2015-02-25 13:02:01 +00:00
|
|
|
#ifndef SIMTRACE_H
|
|
|
|
#define SIMTRACE_H
|
2015-02-24 10:35:19 +00:00
|
|
|
|
2015-03-02 15:14:09 +00:00
|
|
|
/* Endpoint numbers */
|
|
|
|
#define DATAOUT 1
|
|
|
|
#define DATAIN 2
|
|
|
|
#define INT 3
|
|
|
|
|
2015-04-03 09:35:59 +00:00
|
|
|
#define BUFLEN 5
|
|
|
|
|
2015-04-04 08:51:37 +00:00
|
|
|
#define PHONE_DATAOUT 4
|
|
|
|
#define PHONE_DATAIN 5
|
|
|
|
#define PHONE_INT 6
|
2015-04-03 09:35:59 +00:00
|
|
|
|
2015-03-02 15:14:09 +00:00
|
|
|
typedef struct ring_buffer
|
|
|
|
{
|
|
|
|
uint8_t buf[BUFLEN*2]; // data buffer
|
|
|
|
uint8_t idx; // number of items in the buffer
|
|
|
|
} ring_buffer;
|
|
|
|
|
|
|
|
|
2015-02-25 17:40:15 +00:00
|
|
|
enum confNum {
|
2015-03-03 11:34:36 +00:00
|
|
|
CFG_NUM_SNIFF = 1, CFG_NUM_CCID, CFG_NUM_PHONE, CFG_NUM_MITM, NUM_CONF
|
2015-02-25 17:40:15 +00:00
|
|
|
};
|
|
|
|
|
2015-03-03 11:34:36 +00:00
|
|
|
/// CCIDDriverConfiguration Descriptors
|
|
|
|
/// List of descriptors that make up the configuration descriptors of a
|
|
|
|
/// device using the CCID driver.
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
/// Configuration descriptor
|
|
|
|
USBConfigurationDescriptor configuration;
|
|
|
|
/// Interface descriptor
|
|
|
|
USBInterfaceDescriptor interface;
|
|
|
|
/// CCID descriptor
|
|
|
|
CCIDDescriptor ccid;
|
|
|
|
/// Bulk OUT endpoint descriptor
|
|
|
|
USBEndpointDescriptor bulkOut;
|
|
|
|
/// Bulk IN endpoint descriptor
|
|
|
|
USBEndpointDescriptor bulkIn;
|
|
|
|
/// Interrupt OUT endpoint descriptor
|
|
|
|
USBEndpointDescriptor interruptIn;
|
|
|
|
} __attribute__ ((packed)) CCIDDriverConfigurationDescriptors;
|
|
|
|
|
2015-04-06 21:28:02 +00:00
|
|
|
extern const USBConfigurationDescriptor *configurationDescriptorsArr[];
|
|
|
|
|
2015-03-03 11:34:36 +00:00
|
|
|
/* Helper functions */
|
|
|
|
|
2015-02-24 10:35:19 +00:00
|
|
|
// FIXME: static function definitions
|
2015-02-24 16:38:57 +00:00
|
|
|
extern uint32_t _ISO7816_GetChar( uint8_t *pCharToReceive );
|
|
|
|
extern uint32_t _ISO7816_SendChar( uint8_t CharToSend );
|
2015-02-24 18:09:08 +00:00
|
|
|
|
2015-02-27 12:33:52 +00:00
|
|
|
/* Init functions */
|
|
|
|
extern void Phone_Master_Init( void );
|
2015-03-03 11:34:36 +00:00
|
|
|
extern void CCID_init( void );
|
2015-02-24 18:09:08 +00:00
|
|
|
extern void Sniffer_Init( void );
|
2015-02-27 12:33:52 +00:00
|
|
|
extern void MITM_init( void );
|
2015-02-24 18:09:08 +00:00
|
|
|
|
2015-02-25 13:02:01 +00:00
|
|
|
extern void SIMtrace_USB_Initialize( void );
|
|
|
|
extern void _ISO7816_Init( void );
|
|
|
|
|
2015-02-27 12:33:52 +00:00
|
|
|
/* Run functions */
|
|
|
|
extern void Sniffer_run( void );
|
2015-03-03 11:34:36 +00:00
|
|
|
extern void CCID_run( void );
|
2015-02-27 12:33:52 +00:00
|
|
|
extern void Phone_run( void );
|
|
|
|
extern void MITM_run( void );
|
|
|
|
|
2015-03-19 18:27:04 +00:00
|
|
|
/* Timer helper function */
|
|
|
|
void Timer_Init( void );
|
|
|
|
void TC0_Counter_Reset( void );
|
|
|
|
|
2015-02-27 12:33:52 +00:00
|
|
|
#endif /* SIMTRACE_H */
|