Stability fix for sc-bigbuf traces
This commit is contained in:
1 parent
ceb77de7fe
commit
57a42e3ce9
6 files changed
+25
-1
No files matched your search
+9
-1
@@ -75,6 +75,7 @@ static dmabuf8_t s_dma_8 = {
|
|||||||
// trace related variables
|
// trace related variables
|
||||||
static uint32_t s_trace_len = 0;
|
static uint32_t s_trace_len = 0;
|
||||||
static bool s_tracing = true;
|
static bool s_tracing = true;
|
||||||
|
static bool s_tracing_blocked = false;
|
||||||
|
|
||||||
static uint32_t s_trace_origin = 0;
|
static uint32_t s_trace_origin = 0;
|
||||||
static bool s_trace_origin_valid = false;
|
static bool s_trace_origin_valid = false;
|
||||||
@@ -231,7 +232,14 @@ void set_tracelen(uint32_t value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void set_tracing(bool enable) {
|
void set_tracing(bool enable) {
|
||||||
s_tracing = enable;
|
s_tracing = enable && !s_tracing_blocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool set_tracing_blocked(bool blocked) {
|
||||||
|
bool previous = s_tracing_blocked;
|
||||||
|
s_tracing_blocked = blocked;
|
||||||
|
if (blocked) s_tracing = false;
|
||||||
|
return previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_tracing(void) {
|
bool get_tracing(void) {
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ void BigBuf_print_status(void);
|
|||||||
uint32_t BigBuf_get_traceLen(void);
|
uint32_t BigBuf_get_traceLen(void);
|
||||||
void clear_trace(void);
|
void clear_trace(void);
|
||||||
void set_tracing(bool enable);
|
void set_tracing(bool enable);
|
||||||
|
bool set_tracing_blocked(bool blocked); // Returns the previous block state.
|
||||||
void set_tracelen(uint32_t value);
|
void set_tracelen(uint32_t value);
|
||||||
bool get_tracing(void);
|
bool get_tracing(void);
|
||||||
|
|
||||||
|
|||||||
@@ -2936,6 +2936,10 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||||||
sam_sc_handler(packet);
|
sam_sc_handler(packet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CMD_HF_SAM_SC_NO_TRACE: {
|
||||||
|
sam_sc_handler_no_trace(packet);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -453,6 +453,15 @@ static int sam_sc_card_api_loop(uint8_t *response, uint16_t *response_len,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sam_sc_handler_no_trace(const PacketCommandNG *c) {
|
||||||
|
const bool tracing = get_tracing();
|
||||||
|
const bool blocked = set_tracing_blocked(true);
|
||||||
|
clear_trace();
|
||||||
|
sam_sc_handler(c);
|
||||||
|
set_tracing_blocked(blocked);
|
||||||
|
set_tracing(tracing);
|
||||||
|
}
|
||||||
|
|
||||||
void sam_sc_handler(const PacketCommandNG *c) {
|
void sam_sc_handler(const PacketCommandNG *c) {
|
||||||
|
|
||||||
if (c == NULL || c->length < SAM_SC_HEADER_LEN) {
|
if (c == NULL || c->length < SAM_SC_HEADER_LEN) {
|
||||||
|
|||||||
@@ -93,6 +93,7 @@
|
|||||||
#define SAM_SC_ADDR_SNMP_LOADER 0xff
|
#define SAM_SC_ADDR_SNMP_LOADER 0xff
|
||||||
|
|
||||||
void sam_sc_handler(const PacketCommandNG *c);
|
void sam_sc_handler(const PacketCommandNG *c);
|
||||||
|
void sam_sc_handler_no_trace(const PacketCommandNG *c);
|
||||||
|
|
||||||
// Forces the next sam_sc_handler() call to perform an I2C reset before sending
|
// Forces the next sam_sc_handler() call to perform an I2C reset before sending
|
||||||
// its payload. Intended to be called by other firmware paths that may have
|
// its payload. Intended to be called by other firmware paths that may have
|
||||||
|
|||||||
@@ -1205,6 +1205,7 @@ typedef struct {
|
|||||||
// session state must persist across calls (no I2C reset, no GetVersion ping,
|
// session state must persist across calls (no I2C reset, no GetVersion ping,
|
||||||
// no iso15 NFC-relay loop) and the routing scFlag byte must be host-supplied.
|
// no iso15 NFC-relay loop) and the routing scFlag byte must be host-supplied.
|
||||||
#define CMD_HF_SAM_SC 0x0904
|
#define CMD_HF_SAM_SC 0x0904
|
||||||
|
#define CMD_HF_SAM_SC_NO_TRACE 0x0905 // Same payload and reply command as CMD_HF_SAM_SC.
|
||||||
|
|
||||||
#define CMD_UNKNOWN 0xFFFF
|
#define CMD_UNKNOWN 0xFFFF
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user