diff --git a/sam3s_example/simtrace/simtrace.h b/sam3s_example/simtrace/simtrace.h index 0e024e9f..ff29fe2d 100644 --- a/sam3s_example/simtrace/simtrace.h +++ b/sam3s_example/simtrace/simtrace.h @@ -1,6 +1,10 @@ #ifndef SIMTRACE_H #define SIMTRACE_H +enum confNum { + CFG_NUM_SNIFF = 1, CFG_NUM_PHONE, CFG_NUM_MITM, NUM_CONF +}; + // FIXME: static function definitions extern uint32_t _ISO7816_GetChar( uint8_t *pCharToReceive ); extern uint32_t _ISO7816_SendChar( uint8_t CharToSend ); diff --git a/sam3s_example/simtrace/simtrace_main.c b/sam3s_example/simtrace/simtrace_main.c index 1a170059..dbc74e53 100644 --- a/sam3s_example/simtrace/simtrace_main.c +++ b/sam3s_example/simtrace/simtrace_main.c @@ -5,20 +5,10 @@ #include "board.h" -/*------------------------------------------------------------------------------ - * Internal definitions - *------------------------------------------------------------------------------*/ -#define CONF_NONE 0 -#define CONF_SNIFFER 1 -#define CONF_CCID_READER 2 -#define CONF_SIMCARD_EMUL 3 -#define CONF_MITM 4 - - /*------------------------------------------------------------------------------ * Internal variables *------------------------------------------------------------------------------*/ -uint8_t simtrace_config = CONF_NONE; +uint8_t simtrace_config = 0; uint8_t conf_changed = 1; uint8_t rcvdChar = 0; @@ -69,9 +59,10 @@ extern int main( void ) /* FIXME: Or should we move the while loop into every case, and break out in case the config changes? */ switch(simtrace_config) { - case CONF_SNIFFER: + case CFG_NUM_SNIFF: if (conf_changed) { Sniffer_Init(); + printf("****+ Changed to CFG_NUM_SNIFF\n\r"); conf_changed = 0; } else { if (rcvdChar != 0) { @@ -80,17 +71,18 @@ extern int main( void ) } } break; - case CONF_CCID_READER: +/* case CONF_CCID_READER: if (conf_changed) { // Init conf_changed = 0; } else { // Receive char } - break; - case CONF_SIMCARD_EMUL: + break; */ + case CFG_NUM_PHONE: if (conf_changed) { Phone_Master_Init(); + printf("****+ Changed to CFG_NUM_PHONE\n\r"); conf_changed = 0; /* Configure ISO7816 driver */ // FIXME: PIO_Configure(pPwr, PIO_LISTSIZE( pPwr )); @@ -100,8 +92,9 @@ extern int main( void ) // ISO7816_SendChar(char_to_send); } break; - case CONF_MITM: + case CFG_NUM_MITM: if (conf_changed) { + printf("****+ Changed to CFG_NUM_MITM\n\r"); // Init conf_changed = 0; } else { diff --git a/sam3s_example/simtrace/usb.c b/sam3s_example/simtrace/usb.c index c2cdda2c..8edaf557 100644 --- a/sam3s_example/simtrace/usb.c +++ b/sam3s_example/simtrace/usb.c @@ -171,7 +171,7 @@ const SIMTraceDriverConfigurationDescriptorSniffer configurationDescriptorSniffe USBGenericDescriptor_CONFIGURATION, sizeof(SIMTraceDriverConfigurationDescriptorSniffer), 1, /* There is one interface in this configuration */ - 1, /* This is configuration #1 */ + CFG_NUM_SNIFF, /* configuration number */ SNIFFER_CONF_STR, /* string descriptor for this configuration */ USBD_BMATTRIBUTES, USBConfigurationDescriptor_POWER(100) @@ -243,7 +243,7 @@ const SIMTraceDriverConfigurationDescriptorPhone configurationDescriptorPhone = USBGenericDescriptor_CONFIGURATION, sizeof(SIMTraceDriverConfigurationDescriptorSniffer), 1, /* There is one interface in this configuration */ - 2, /* This is configuration #2 */ + CFG_NUM_PHONE, /* configuration number */ PHONE_CONF_STR, /* string descriptor for this configuration */ USBD_BMATTRIBUTES, USBConfigurationDescriptor_POWER(100) @@ -305,7 +305,7 @@ const SIMTraceDriverConfigurationDescriptorMITM configurationDescriptorMITM = { USBGenericDescriptor_CONFIGURATION, sizeof(SIMTraceDriverConfigurationDescriptorMITM), 2, /* There are two interfaces in this configuration */ - 3, /* This is configuration #3 */ + CFG_NUM_MITM, /* configuration number */ MITM_CONF_STR, /* string descriptor for this configuration */ USBD_BMATTRIBUTES, USBConfigurationDescriptor_POWER(100)