Generic tracing pt.3 : reworking how iso14443b-traces are stored in ARM-memory

This commit is contained in:
Martin Holst Swende
2015-01-21 23:53:40 +01:00
parent 355c8b4a7d
commit 9e8255d4e9
5 changed files with 32 additions and 24 deletions

View File

@@ -986,7 +986,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
void __attribute__((noreturn)) AppMain(void)
{
SpinDelay(100);
clear_trace();
if(common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
/* Initialize common area */
memset(&common_area, 0, sizeof(common_area));

View File

@@ -628,30 +628,26 @@ static void GetSamplesFor14443Demod(int weTx, int n, int quiet)
int max = 0;
int gotFrame = FALSE;
//# define DMA_BUFFER_SIZE 8
int8_t *dmaBuf;
int lastRxCounter;
int8_t *upTo;
int ci, cq;
int samples = 0;
// Clear out the state of the "UART" that receives from the tag.
memset(BigBuf, 0x00, 400);
Demod.output = (uint8_t *)BigBuf;
memset(Demod.output, 0x00, MAX_FRAME_SIZE);
Demod.output = ((uint8_t *)BigBuf) + RECV_RESP_OFFSET;
Demod.len = 0;
Demod.state = DEMOD_UNSYNCD;
// And the UART that receives from the reader
Uart.output = (((uint8_t *)BigBuf) + 1024);
Uart.byteCntMax = 100;
Uart.output = ((uint8_t *)BigBuf) + RECV_CMD_OFFSET;
Uart.byteCntMax = MAX_FRAME_SIZE;
Uart.state = STATE_UNSYNCD;
// Setup for the DMA.
dmaBuf = (int8_t *)(BigBuf + 32);
upTo = dmaBuf;
// The DMA buffer, used to stream samples from the FPGA
int8_t *dmaBuf = ((int8_t *)BigBuf) + DMA_BUFFER_OFFSET;
int8_t *upTo= dmaBuf;
lastRxCounter = DEMOD_DMA_BUFFER_SIZE;
FpgaSetupSscDma((uint8_t *)dmaBuf, DEMOD_DMA_BUFFER_SIZE);

View File

@@ -22,10 +22,7 @@
#include "mifareutil.h"
static uint32_t iso14a_timeout;
uint8_t *trace = (uint8_t *) BigBuf+TRACE_OFFSET;
int rsamples = 0;
int traceLen = 0;
int tracing = TRUE;
uint8_t trigger = 0;
// the block number for the ISO14443-4 PCB
static uint8_t iso14_pcb_blocknum = 0;

View File

@@ -13,6 +13,9 @@
#include "string.h"
#include "apps.h"
uint8_t *trace = (uint8_t *) BigBuf+TRACE_OFFSET;
int traceLen = 0;
int tracing = TRUE;
void print_result(char *name, uint8_t *buf, size_t len) {
@@ -463,7 +466,6 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
tracing = FALSE; // don't trace any more
return FALSE;
}
// Traceformat:
// 32 bits timestamp (little endian)
// 16 bits duration (little endian)
@@ -502,6 +504,11 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
}
traceLen += num_paritybytes;
if(traceLen +4 < TRACE_SIZE)
{ //If it hadn't been cleared, for whatever reason..
memset(trace+traceLen,0x44, 4);
}
return TRUE;
}