From cc181c3f91d26a85341827db5a9c65363679ac5a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 20 Apr 2018 15:26:34 +0200 Subject: [PATCH] chg: downloading of flashmemory to client. --- client/cmdmain.c | 1 + client/data.c | 17 +++++++++++++---- client/data.h | 5 +++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/client/cmdmain.c b/client/cmdmain.c index fcf7e0e6b..fa114146c 100644 --- a/client/cmdmain.c +++ b/client/cmdmain.c @@ -217,6 +217,7 @@ void UsbCommandReceived(UsbCommand *c) { PrintAndLogEx(NORMAL, "#db# %08x, %08x, %08x", c->arg[0], c->arg[1], c->arg[2]); break; } + case CMD_DOWNLOADED_FLASHMEM: case CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K: case CMD_DOWNLOADED_EML_BIGBUF: { // sample_buf is a array pointer, located in data.c diff --git a/client/data.c b/client/data.c index ba0ea47af..56887daa8 100644 --- a/client/data.c +++ b/client/data.c @@ -17,17 +17,19 @@ uint8_t* sample_buf; -void GetFromBigBuf(uint8_t *dest, int bytes, int start_index) { +// this triggers a download sequence from device, its received inside cmdmain.c UsbCommandReceived() +void GetFromBigBuf(uint8_t *dest, uint32_t len, uint32_t start_index) { + // global sample_buf = dest; - UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {start_index, bytes, 0}}; + UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {start_index, len, 0}}; clearCommandBuffer(); SendCommand(&c); } // this will download the EMULATOR memory part from device, // inside the BigBuf EML zon. -bool GetEMLFromBigBuf(uint8_t *dest, uint32_t bytes, uint32_t start_index) { +bool GetEMLFromBigBuf(uint8_t *dest, uint32_t len, uint32_t start_index) { sample_buf = dest; - UsbCommand c = {CMD_DOWNLOAD_EML_BIGBUF, {start_index, bytes, 0}}; + UsbCommand c = {CMD_DOWNLOAD_EML_BIGBUF, {start_index, len, 0}}; clearCommandBuffer(); SendCommand(&c); @@ -40,3 +42,10 @@ bool GetEMLFromBigBuf(uint8_t *dest, uint32_t bytes, uint32_t start_index) { return true; } +// Download data from flashmem, rdv40 +void GetFromFlashMen(uint8_t *dest, uint32_t len, uint32_t start_index) { + sample_buf = dest; + UsbCommand c = {CMD_DOWNLOAND_FLASH_MEM, {start_index, len, 0}}; + clearCommandBuffer(); + SendCommand(&c); +} diff --git a/client/data.h b/client/data.h index b8bbaa207..885880796 100644 --- a/client/data.h +++ b/client/data.h @@ -17,6 +17,7 @@ #define FILE_PATH_SIZE 1000 extern uint8_t* sample_buf; -extern void GetFromBigBuf(uint8_t *dest, int bytes, int start_index); -extern bool GetEMLFromBigBuf(uint8_t *dest, uint32_t bytes, uint32_t start_index); +extern void GetFromBigBuf(uint8_t *dest, uint32_t len, uint32_t start_index); +extern bool GetEMLFromBigBuf(uint8_t *dest, uint32_t len, uint32_t start_index); +extern void GetFromFlashMen(uint8_t *dest, uint32_t len, uint32_t start_index); #endif