diff options
author | Christina Quast <chrysh.ng+git@gmail.com> | 2015-04-11 20:03:14 +0200 |
---|---|---|
committer | Christina Quast <chrysh.ng+git@gmail.com> | 2015-04-11 20:03:14 +0200 |
commit | 5c6a299c713471248f70632c682ed9ecee984223 (patch) | |
tree | 3a9edd1c8edabb76b2f93ee86412177617125d69 | |
parent | 3a47a4f10e24896afe8f0b3789fee6f286fd3442 (diff) |
phone.c: Sniffer bus config make switch
-rw-r--r-- | firmware/Makefile | 4 | ||||
-rw-r--r-- | firmware/include_board/board.h | 2 | ||||
-rw-r--r-- | firmware/src_simtrace/phone.c | 13 |
3 files changed, 13 insertions, 6 deletions
diff --git a/firmware/Makefile b/firmware/Makefile index 8770df0..c9be267 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -52,6 +52,8 @@ TRACE_LEVEL = 1 #FIXME: Remove this variable NOAUTOCALLBACK=no +DEBUG_PHONE_SNIFF=0 + #CFLAGS+=-DUSB_NO_DEBUG=1 # Optimization level, put in comment for debugging @@ -117,7 +119,7 @@ CFLAGS += -Dprintf=iprintf #CFLAGS += -save-temps -fverbose-asm #CFLAGS += -Wa,-a,-ad CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb # -mfix-cortex-m3-ldrd -CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) +CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DDEBUG_PHONE_SNIFF=$(DEBUG_PHONE_SNIFF) ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__ LDFLAGS = -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=ResetException -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols $(LIB) #LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats diff --git a/firmware/include_board/board.h b/firmware/include_board/board.h index f6c97af..0e3e88a 100644 --- a/firmware/include_board/board.h +++ b/firmware/include_board/board.h @@ -138,7 +138,7 @@ #define PINS_TC PIN_SIM_IO_INPUT, PIN_SIM_CLK_INPUT #define VCC_PHONE {PIO_PA25, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} -#define PIN_ISO7816_RST_PHONE {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_IT_RISE_EDGE } +#define PIN_ISO7816_RST_PHONE {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_IT_RISE_EDGE | PIO_DEGLITCH } #define PIN_PHONE_IO_INPUT {PIO_PA21, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} #define PIN_PHONE_IO {PIO_PA22, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} #define PIN_PHONE_CLK {PIO_PA23A_SCK1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} // External Clock Input on PA28 diff --git a/firmware/src_simtrace/phone.c b/firmware/src_simtrace/phone.c index 2be088f..11ff868 100644 --- a/firmware/src_simtrace/phone.c +++ b/firmware/src_simtrace/phone.c @@ -84,9 +84,14 @@ unsigned char USBState = STATE_IDLE; /** ISO7816 pins */ static const Pin pinsISO7816_PHONE[] = {PINS_ISO7816_PHONE}; /** Bus switch pins */ + +#if DEBUG_PHONE_SNIFF +# warning "Debug phone sniff via logic analyzer is enabled" +// Logic analyzer probes are easier to attach to the SIM card slot +static const Pin pins_bus[] = {PINS_BUS_SNIFF}; +#else static const Pin pins_bus[] = {PINS_BUS_DEFAULT}; -// FIXME: temporary enable bus switch -//static const Pin pins_bus[] = {PINS_BUS_SNIFF}; +#endif /** ISO7816 RST pin */ static const Pin pinIso7816RstMC = PIN_ISO7816_RST_PHONE; @@ -245,7 +250,7 @@ void sendResponse_to_phone( uint8_t *pArg, uint8_t status, uint32_t transferred, return; } PR("sendResp, stat: %X, trnsf: %x, rem: %x\n\r", status, transferred, remaining); - PR("Resp: %x %x %x .. %x", host_to_sim_buf[0], host_to_sim_buf[1], host_to_sim_buf[2], host_to_sim_buf[transferred-1]); + PR("Resp: %x %x %x .. %x\n", host_to_sim_buf[0], host_to_sim_buf[1], host_to_sim_buf[2], host_to_sim_buf[transferred-1]); for (uint32_t i = 0; i < transferred; i++ ) { _ISO7816_SendChar(host_to_sim_buf[i]); @@ -260,7 +265,7 @@ void receive_from_host() if ((ret = USBD_Read(PHONE_DATAOUT, &host_to_sim_buf, sizeof(host_to_sim_buf), (TransferCallback)&sendResponse_to_phone, 0)) == USBD_STATUS_SUCCESS) { } else { - TRACE_ERROR("USB Err: %X", ret); + TRACE_ERROR("USB Err: %X\n", ret); } } void Phone_configure( void ) { |