mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
phone.c: Sniffer bus config make switch
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user