mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
CHG: Added calling clear bigbuff to zero out it also, instead of just "free" it.
ADD: downloading the EML part from BigBuffer specially.
This commit is contained in:
parent
6063655a3c
commit
aaa1a9a2dc
16 changed files with 91 additions and 48 deletions
|
@ -16,10 +16,17 @@
|
||||||
|
|
||||||
// BigBuf is the large multi-purpose buffer, typically used to hold A/D samples or traces.
|
// BigBuf is the large multi-purpose buffer, typically used to hold A/D samples or traces.
|
||||||
// Also used to hold various smaller buffers and the Mifare Emulator Memory.
|
// Also used to hold various smaller buffers and the Mifare Emulator Memory.
|
||||||
|
|
||||||
// declare it as uint32_t to achieve alignment to 4 Byte boundary
|
// declare it as uint32_t to achieve alignment to 4 Byte boundary
|
||||||
static uint32_t BigBuf[BIGBUF_SIZE/sizeof(uint32_t)];
|
static uint32_t BigBuf[BIGBUF_SIZE/sizeof(uint32_t)];
|
||||||
|
|
||||||
|
/* BigBuf memory layout:
|
||||||
|
Pointer to highest available memory: BigBuf_hi
|
||||||
|
|
||||||
|
high BIGBUF_SIZE
|
||||||
|
reserved = BigBuf_malloc() subtracts amount from BigBuf_hi,
|
||||||
|
low 0x00
|
||||||
|
*/
|
||||||
|
|
||||||
// High memory mark
|
// High memory mark
|
||||||
static uint16_t BigBuf_hi = BIGBUF_SIZE;
|
static uint16_t BigBuf_hi = BIGBUF_SIZE;
|
||||||
|
|
||||||
|
@ -40,9 +47,9 @@ uint8_t *BigBuf_get_addr(void)
|
||||||
// get the address of the emulator memory. Allocate part of Bigbuf for it, if not yet done
|
// get the address of the emulator memory. Allocate part of Bigbuf for it, if not yet done
|
||||||
uint8_t *BigBuf_get_EM_addr(void)
|
uint8_t *BigBuf_get_EM_addr(void)
|
||||||
{
|
{
|
||||||
if (emulator_memory == NULL) { // not yet allocated
|
// not yet allocated
|
||||||
|
if (emulator_memory == NULL)
|
||||||
emulator_memory = BigBuf_malloc(CARD_MEMORY_SIZE);
|
emulator_memory = BigBuf_malloc(CARD_MEMORY_SIZE);
|
||||||
}
|
|
||||||
|
|
||||||
return emulator_memory;
|
return emulator_memory;
|
||||||
}
|
}
|
||||||
|
@ -85,30 +92,32 @@ void BigBuf_free(void)
|
||||||
{
|
{
|
||||||
BigBuf_hi = BIGBUF_SIZE;
|
BigBuf_hi = BIGBUF_SIZE;
|
||||||
emulator_memory = NULL;
|
emulator_memory = NULL;
|
||||||
|
|
||||||
|
// shouldn't this empty BigBuf also?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// free allocated chunks EXCEPT the emulator memory
|
// free allocated chunks EXCEPT the emulator memory
|
||||||
void BigBuf_free_keep_EM(void)
|
void BigBuf_free_keep_EM(void)
|
||||||
{
|
{
|
||||||
if (emulator_memory != NULL) {
|
if (emulator_memory != NULL)
|
||||||
BigBuf_hi = emulator_memory - (uint8_t *)BigBuf;
|
BigBuf_hi = emulator_memory - (uint8_t *)BigBuf;
|
||||||
} else {
|
else
|
||||||
BigBuf_hi = BIGBUF_SIZE;
|
BigBuf_hi = BIGBUF_SIZE;
|
||||||
}
|
|
||||||
|
// shouldn't this empty BigBuf also?
|
||||||
}
|
}
|
||||||
|
|
||||||
void BigBuf_print_status(void)
|
void BigBuf_print_status(void)
|
||||||
{
|
{
|
||||||
Dbprintf("Memory");
|
Dbprintf("Memory");
|
||||||
Dbprintf(" BIGBUF_SIZE.............%d", BIGBUF_SIZE);
|
Dbprintf(" BIGBUF_SIZE.............%d", BIGBUF_SIZE);
|
||||||
Dbprintf(" BigBuf_hi .............%d", BigBuf_hi);
|
Dbprintf(" Available memory........%d", BigBuf_hi);
|
||||||
Dbprintf("Tracing");
|
Dbprintf("Tracing");
|
||||||
Dbprintf(" tracing ................%d", tracing);
|
Dbprintf(" tracing ................%d", tracing);
|
||||||
Dbprintf(" traceLen ...............%d", traceLen);
|
Dbprintf(" traceLen ...............%d", traceLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// return the maximum trace length (i.e. the unallocated size of BigBuf)
|
// return the maximum trace length (i.e. the unallocated size of BigBuf)
|
||||||
uint16_t BigBuf_max_traceLen(void)
|
uint16_t BigBuf_max_traceLen(void)
|
||||||
{
|
{
|
||||||
|
@ -149,9 +158,7 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
|
||||||
uint16_t duration = timestamp_end - timestamp_start;
|
uint16_t duration = timestamp_end - timestamp_start;
|
||||||
|
|
||||||
// Return when trace is full
|
// Return when trace is full
|
||||||
uint16_t max_traceLen = BigBuf_max_traceLen();
|
if (traceLen + sizeof(iLen) + sizeof(timestamp_start) + sizeof(duration) + num_paritybytes + iLen >= BigBuf_max_traceLen()) {
|
||||||
|
|
||||||
if (traceLen + sizeof(iLen) + sizeof(timestamp_start) + sizeof(duration) + num_paritybytes + iLen >= max_traceLen) {
|
|
||||||
tracing = FALSE; // don't trace any more
|
tracing = FALSE; // don't trace any more
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1274,8 +1274,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
||||||
LED_D_OFF(); // LED D indicates field ON or OFF
|
LED_D_OFF(); // LED D indicates field ON or OFF
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K:
|
case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K: {
|
||||||
|
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
uint8_t *BigBuf = BigBuf_get_addr();
|
uint8_t *BigBuf = BigBuf_get_addr();
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
@ -1287,13 +1286,26 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
||||||
cmd_send(CMD_ACK,1,0,BigBuf_get_traceLen(),getSamplingConfig(),sizeof(sample_config));
|
cmd_send(CMD_ACK,1,0,BigBuf_get_traceLen(),getSamplingConfig(),sizeof(sample_config));
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case CMD_DOWNLOADED_SIM_SAMPLES_125K: {
|
case CMD_DOWNLOADED_SIM_SAMPLES_125K: {
|
||||||
uint8_t *b = BigBuf_get_addr();
|
uint8_t *b = BigBuf_get_addr();
|
||||||
memcpy( b + c->arg[0], c->d.asBytes, USB_CMD_DATA_SIZE);
|
memcpy( b + c->arg[0], c->d.asBytes, USB_CMD_DATA_SIZE);
|
||||||
cmd_send(CMD_ACK,0,0,0,0,0);
|
cmd_send(CMD_ACK,0,0,0,0,0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CMD_DOWNLOAD_EML_BIGBUF: {
|
||||||
|
LED_B_ON();
|
||||||
|
uint8_t *cardmem = BigBuf_get_EM_addr();
|
||||||
|
size_t len = 0;
|
||||||
|
for(size_t i=0; i < c->arg[1]; i += USB_CMD_DATA_SIZE) {
|
||||||
|
len = MIN((c->arg[1] - i), USB_CMD_DATA_SIZE);
|
||||||
|
cmd_send(CMD_DOWNLOADED_EML_BIGBUF, i, len, CARD_MEMORY_SIZE, cardmem + c->arg[0] + i, len);
|
||||||
|
}
|
||||||
|
// Trigger a finish downloading signal with an ACK frame
|
||||||
|
cmd_send(CMD_ACK, 1, 0, CARD_MEMORY_SIZE, 0, 0);
|
||||||
|
LED_B_OFF();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CMD_READ_MEM:
|
case CMD_READ_MEM:
|
||||||
ReadMem(c->arg[0]);
|
ReadMem(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -220,7 +220,8 @@ static voidpf fpga_inflate_malloc(voidpf opaque, uInt items, uInt size)
|
||||||
|
|
||||||
static void fpga_inflate_free(voidpf opaque, voidpf address)
|
static void fpga_inflate_free(voidpf opaque, voidpf address)
|
||||||
{
|
{
|
||||||
BigBuf_free();
|
// free eventually allocated BigBuf memory
|
||||||
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,7 +417,7 @@ void FpgaDownloadAndGo(int bitstream_version)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// make sure that we have enough memory to decompress
|
// make sure that we have enough memory to decompress
|
||||||
BigBuf_free();
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
if (!reset_fpga_stream(bitstream_version, &compressed_fpga_stream, output_buffer)) {
|
if (!reset_fpga_stream(bitstream_version, &compressed_fpga_stream, output_buffer)) {
|
||||||
return;
|
return;
|
||||||
|
@ -430,7 +431,8 @@ void FpgaDownloadAndGo(int bitstream_version)
|
||||||
|
|
||||||
inflateEnd(&compressed_fpga_stream);
|
inflateEnd(&compressed_fpga_stream);
|
||||||
|
|
||||||
BigBuf_free();
|
// free eventually allocated BigBuf memory
|
||||||
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -450,7 +452,7 @@ void FpgaGatherVersion(int bitstream_version, char *dst, int len)
|
||||||
dst[0] = '\0';
|
dst[0] = '\0';
|
||||||
|
|
||||||
// ensure that we can allocate enough memory for decompression:
|
// ensure that we can allocate enough memory for decompression:
|
||||||
BigBuf_free();
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
if (!reset_fpga_stream(bitstream_version, &compressed_fpga_stream, output_buffer))
|
if (!reset_fpga_stream(bitstream_version, &compressed_fpga_stream, output_buffer))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -28,8 +28,11 @@ static void RAMFUNC optimizedSnoop(void)
|
||||||
|
|
||||||
void HfSnoop(int samplesToSkip, int triggersToSkip)
|
void HfSnoop(int samplesToSkip, int triggersToSkip)
|
||||||
{
|
{
|
||||||
|
BigBuf_free(); BigBuf_Clear();
|
||||||
|
|
||||||
Dbprintf("Skipping first %d sample pairs, Skipping %d triggers.\n", samplesToSkip, triggersToSkip);
|
Dbprintf("Skipping first %d sample pairs, Skipping %d triggers.\n", samplesToSkip, triggersToSkip);
|
||||||
bool trigger_cnt;
|
bool trigger_cnt;
|
||||||
|
|
||||||
LED_D_ON();
|
LED_D_ON();
|
||||||
// Select correct configs
|
// Select correct configs
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
|
@ -40,9 +43,6 @@ void HfSnoop(int samplesToSkip, int triggersToSkip)
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SNOOP);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SNOOP);
|
||||||
SpinDelay(100);
|
SpinDelay(100);
|
||||||
|
|
||||||
BigBuf_free();
|
|
||||||
BigBuf_Clear();
|
|
||||||
|
|
||||||
AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(16); // Setting Frame Mode For better performance on high speed data transfer.
|
AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(16); // Setting Frame Mode For better performance on high speed data transfer.
|
||||||
|
|
||||||
trigger_cnt = 0;
|
trigger_cnt = 0;
|
||||||
|
|
|
@ -713,6 +713,9 @@ void SnoopHitag(uint32_t type) {
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
|
|
||||||
|
// free eventually allocated BigBuf memory
|
||||||
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
// Clean up trace and prepare it for storing frames
|
// Clean up trace and prepare it for storing frames
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(TRUE);
|
set_tracing(TRUE);
|
||||||
|
@ -720,7 +723,6 @@ void SnoopHitag(uint32_t type) {
|
||||||
auth_table_len = 0;
|
auth_table_len = 0;
|
||||||
auth_table_pos = 0;
|
auth_table_pos = 0;
|
||||||
|
|
||||||
BigBuf_free();
|
|
||||||
auth_table = (byte_t *)BigBuf_malloc(AUTH_TABLE_LENGTH);
|
auth_table = (byte_t *)BigBuf_malloc(AUTH_TABLE_LENGTH);
|
||||||
memset(auth_table, 0x00, AUTH_TABLE_LENGTH);
|
memset(auth_table, 0x00, AUTH_TABLE_LENGTH);
|
||||||
|
|
||||||
|
@ -927,6 +929,9 @@ void SimulateHitagTag(bool tag_mem_supplied, byte_t* data) {
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
|
|
||||||
|
// free eventually allocated BigBuf memory
|
||||||
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
// Clean up trace and prepare it for storing frames
|
// Clean up trace and prepare it for storing frames
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(TRUE);
|
set_tracing(TRUE);
|
||||||
|
@ -934,7 +939,7 @@ void SimulateHitagTag(bool tag_mem_supplied, byte_t* data) {
|
||||||
auth_table_len = 0;
|
auth_table_len = 0;
|
||||||
auth_table_pos = 0;
|
auth_table_pos = 0;
|
||||||
byte_t* auth_table;
|
byte_t* auth_table;
|
||||||
BigBuf_free();
|
|
||||||
auth_table = (byte_t *)BigBuf_malloc(AUTH_TABLE_LENGTH);
|
auth_table = (byte_t *)BigBuf_malloc(AUTH_TABLE_LENGTH);
|
||||||
memset(auth_table, 0x00, AUTH_TABLE_LENGTH);
|
memset(auth_table, 0x00, AUTH_TABLE_LENGTH);
|
||||||
|
|
||||||
|
|
|
@ -954,7 +954,8 @@ void SimulateHitagSTag(bool tag_mem_supplied, byte_t* data) {
|
||||||
byte_t txbuf[HITAG_FRAME_LEN];
|
byte_t txbuf[HITAG_FRAME_LEN];
|
||||||
byte_t* tx = txbuf;
|
byte_t* tx = txbuf;
|
||||||
size_t txlen = 0;
|
size_t txlen = 0;
|
||||||
BigBuf_free();
|
// free eventually allocated BigBuf memory
|
||||||
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
// Clean up trace and prepare it for storing frames
|
// Clean up trace and prepare it for storing frames
|
||||||
set_tracing(TRUE);
|
set_tracing(TRUE);
|
||||||
|
|
|
@ -546,7 +546,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
|
||||||
|
|
||||||
// Allocate memory from BigBuf for some buffers
|
// Allocate memory from BigBuf for some buffers
|
||||||
// free all previous allocations first
|
// free all previous allocations first
|
||||||
BigBuf_free();
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
// init trace buffer
|
// init trace buffer
|
||||||
clear_trace();
|
clear_trace();
|
||||||
|
@ -2303,6 +2303,9 @@ void ReaderMifare(bool first_try, uint8_t block )
|
||||||
#define MAX_SYNC_TRIES 32
|
#define MAX_SYNC_TRIES 32
|
||||||
#define MAX_STRATEGY 3
|
#define MAX_STRATEGY 3
|
||||||
|
|
||||||
|
// free eventually allocated BigBuf memory
|
||||||
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(TRUE);
|
set_tracing(TRUE);
|
||||||
|
|
||||||
|
@ -2311,9 +2314,6 @@ void ReaderMifare(bool first_try, uint8_t block )
|
||||||
if (first_try)
|
if (first_try)
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD);
|
||||||
|
|
||||||
// free eventually allocated BigBuf memory. We want all for tracing.
|
|
||||||
BigBuf_free();
|
|
||||||
|
|
||||||
if (first_try) {
|
if (first_try) {
|
||||||
sync_time = GetCountSspClk() & 0xfffffff8;
|
sync_time = GetCountSspClk() & 0xfffffff8;
|
||||||
sync_cycles = PRNG_SEQUENCE_LENGTH + 1100; //65536; //0x10000 // theory: Mifare Classic's random generator repeats every 2^16 cycles (and so do the nonces).
|
sync_cycles = PRNG_SEQUENCE_LENGTH + 1100; //65536; //0x10000 // theory: Mifare Classic's random generator repeats every 2^16 cycles (and so do the nonces).
|
||||||
|
@ -3068,6 +3068,9 @@ void RAMFUNC SniffMifare(uint8_t param) {
|
||||||
// bit 1 - trigger from first reader 7-bit request
|
// bit 1 - trigger from first reader 7-bit request
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
|
|
||||||
|
// free eventually allocated BigBuf memory
|
||||||
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
// init trace buffer
|
// init trace buffer
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(TRUE);
|
set_tracing(TRUE);
|
||||||
|
@ -3084,9 +3087,6 @@ void RAMFUNC SniffMifare(uint8_t param) {
|
||||||
|
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_SNIFFER);
|
iso14443a_setup(FPGA_HF_ISO14443A_SNIFFER);
|
||||||
|
|
||||||
// free eventually allocated BigBuf memory
|
|
||||||
BigBuf_free();
|
|
||||||
|
|
||||||
// allocate the DMA buffer, used to stream samples from the FPGA
|
// allocate the DMA buffer, used to stream samples from the FPGA
|
||||||
uint8_t *dmaBuf = BigBuf_malloc(DMA_BUFFER_SIZE);
|
uint8_t *dmaBuf = BigBuf_malloc(DMA_BUFFER_SIZE);
|
||||||
uint8_t *data = dmaBuf;
|
uint8_t *data = dmaBuf;
|
||||||
|
|
|
@ -260,7 +260,7 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
|
|
||||||
// free eventually allocated BigBuf memory
|
// free eventually allocated BigBuf memory
|
||||||
BigBuf_free();
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(true);
|
set_tracing(true);
|
||||||
|
|
||||||
|
@ -778,7 +778,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
|
|
||||||
// free eventually allocated BigBuf memory
|
// free eventually allocated BigBuf memory
|
||||||
BigBuf_free();
|
BigBuf_free(); BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
if (calibrate) clear_trace();
|
if (calibrate) clear_trace();
|
||||||
set_tracing(true);
|
set_tracing(true);
|
||||||
|
|
|
@ -541,7 +541,6 @@ uint8_t FirstBlockOfSector(uint8_t sectorNo)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// work with emulator memory
|
// work with emulator memory
|
||||||
void emlSetMem(uint8_t *data, int blockNum, int blocksCount) {
|
void emlSetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||||
emlSetMem_xt(data, blockNum, blocksCount, 16);
|
emlSetMem_xt(data, blockNum, blocksCount, 16);
|
||||||
|
|
|
@ -197,14 +197,15 @@ void UsbCommandReceived(UsbCommand *UC)
|
||||||
return;
|
return;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case CMD_DEBUG_PRINT_INTEGERS:
|
case CMD_DEBUG_PRINT_INTEGERS: {
|
||||||
PrintAndLog("#db# %08x, %08x, %08x", UC->arg[0], UC->arg[1], UC->arg[2]);
|
PrintAndLog("#db# %08x, %08x, %08x", UC->arg[0], UC->arg[1], UC->arg[2]);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K:
|
case CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K:
|
||||||
|
case CMD_DOWNLOADED_EML_BIGBUF: {
|
||||||
memcpy( sample_buf + (UC->arg[0]), UC->d.asBytes, UC->arg[1]);
|
memcpy( sample_buf + (UC->arg[0]), UC->d.asBytes, UC->arg[1]);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
storeCommand(UC);
|
storeCommand(UC);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,3 +23,10 @@ void GetFromBigBuf(uint8_t *dest, int bytes, int start_index) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
}
|
}
|
||||||
|
void GetEMLFromBigBuf(uint8_t *dest, int bytes, int start_index) {
|
||||||
|
sample_buf = dest;
|
||||||
|
UsbCommand c = {CMD_DOWNLOAD_EML_BIGBUF, {start_index, bytes, 0}};
|
||||||
|
clearCommandBuffer();
|
||||||
|
SendCommand(&c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,5 +19,5 @@ extern uint8_t* sample_buf;
|
||||||
#define arraylen(x) (sizeof(x)/sizeof((x)[0]))
|
#define arraylen(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
|
|
||||||
void GetFromBigBuf(uint8_t *dest, int bytes, int start_index);
|
void GetFromBigBuf(uint8_t *dest, int bytes, int start_index);
|
||||||
|
void GetEMLFromBigBuf(uint8_t *dest, int bytes, int start_index);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,6 +53,9 @@ typedef struct {
|
||||||
#define CMD_STATUS 0x0108
|
#define CMD_STATUS 0x0108
|
||||||
#define CMD_PING 0x0109
|
#define CMD_PING 0x0109
|
||||||
|
|
||||||
|
#define CMD_DOWNLOAD_EML_BIGBUF 0x0110
|
||||||
|
#define CMD_DOWNLOADED_EML_BIGBUF 0x0111
|
||||||
|
|
||||||
// For low-frequency tags
|
// For low-frequency tags
|
||||||
#define CMD_READ_TI_TYPE 0x0202
|
#define CMD_READ_TI_TYPE 0x0202
|
||||||
#define CMD_WRITE_TI_TYPE 0x0203
|
#define CMD_WRITE_TI_TYPE 0x0203
|
||||||
|
|
|
@ -22,6 +22,9 @@ local _commands = {
|
||||||
CMD_VERSION = 0x0107,
|
CMD_VERSION = 0x0107,
|
||||||
CMD_STATUS = 0x0108,
|
CMD_STATUS = 0x0108,
|
||||||
CMD_PING = 0x0109,
|
CMD_PING = 0x0109,
|
||||||
|
CMD_DOWNLOAD_EML_BIGBUF = 0x0110,
|
||||||
|
CMD_DOWNLOADED_EML_BIGBUF = 0x0111,
|
||||||
|
|
||||||
--// For low-frequency tags
|
--// For low-frequency tags
|
||||||
CMD_READ_TI_TYPE = 0x0202,
|
CMD_READ_TI_TYPE = 0x0202,
|
||||||
CMD_WRITE_TI_TYPE = 0x0203,
|
CMD_WRITE_TI_TYPE = 0x0203,
|
||||||
|
|
|
@ -63,6 +63,9 @@ typedef struct{
|
||||||
#define CMD_STATUS 0x0108
|
#define CMD_STATUS 0x0108
|
||||||
#define CMD_PING 0x0109
|
#define CMD_PING 0x0109
|
||||||
|
|
||||||
|
#define CMD_DOWNLOAD_EML_BIGBUF 0x0110
|
||||||
|
#define CMD_DOWNLOADED_EML_BIGBUF 0x0111
|
||||||
|
|
||||||
// For low-frequency tags
|
// For low-frequency tags
|
||||||
#define CMD_READ_TI_TYPE 0x0202
|
#define CMD_READ_TI_TYPE 0x0202
|
||||||
#define CMD_WRITE_TI_TYPE 0x0203
|
#define CMD_WRITE_TI_TYPE 0x0203
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue