summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-02-12 15:34:41 +0100
committerHarald Welte <laforge@gnumonks.org>2012-02-12 15:34:41 +0100
commit4f7ca20bf40b911c035264d86ef0359d20e7ac88 (patch)
tree9019f7c4f137d964a7076b123c66cdcf21dcd7a9 /firmware
parentf233812722cede1fee0aa521ed81572686d64fad (diff)
simtrace: Inform host of Fi/Di values (and flag change due to PPS)
Diffstat (limited to 'firmware')
-rw-r--r--firmware/include/simtrace_usb.h1
-rw-r--r--firmware/src/simtrace/iso7816_uart.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/firmware/include/simtrace_usb.h b/firmware/include/simtrace_usb.h
index c020093..b8b62d3 100644
--- a/firmware/include/simtrace_usb.h
+++ b/firmware/include/simtrace_usb.h
@@ -20,5 +20,6 @@ enum simtrace_usb_msgt {
/* flags for MSGT_DATA */
#define SIMTRACE_FLAG_ATR 0x01 /* ATR immediately after reset */
#define SIMTRACE_FLAG_WTIME_EXP 0x04 /* work waiting time expired */
+#define SIMTRACE_FLAG_PPS_FIDI 0x08 /* Fi/Di values in res[2] */
#endif /* SIMTRACE_USB_H */
diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c
index 706b5db..09a7aa0 100644
--- a/firmware/src/simtrace/iso7816_uart.c
+++ b/firmware/src/simtrace/iso7816_uart.c
@@ -175,6 +175,10 @@ static void send_rctx(struct iso7816_3_handle *ih)
if (!rctx)
return;
+ /* Put Fi and Di into res[2] array */
+ ih->sh.res[0] = ih->fi;
+ ih->sh.res[1] = ih->di;
+
/* copy the simtrace header */
memcpy(rctx->data, &ih->sh, sizeof(ih->sh));
@@ -443,6 +447,7 @@ process_byte_pts(struct iso7816_3_handle *ih, u_int8_t byte)
ih->fi = byte >> 4;
ih->di = byte & 0xf;
DEBUGPCR("found Fi=%u Di=%u", ih->fi, ih->di);
+ ih->sh.flags |= SIMTRACE_FLAG_PPS_FIDI;
ih->pts_resp[_PTS1] = byte;
break;
case PTS_S_WAIT_RESP_PTS2:
personal git repositories of Harald Welte. Your mileage may vary