blob: f6c8dfc205cb02e8a756d2fc98d3b0e9cdb1b4e2 [file] [log] [blame]
Christina Quastc0aa7692015-02-25 14:02:01 +01001#ifndef SIMTRACE_H
2#define SIMTRACE_H
Christina Quast32906bb2015-02-24 11:35:19 +01003
Christina Quast4ba4d222015-03-02 16:14:09 +01004/* Endpoint numbers */
5#define DATAOUT 1
6#define DATAIN 2
7#define INT 3
8
Christina Quast71234252015-04-03 11:35:59 +02009#define BUFLEN 5
10
Christina Quastb65b8812015-04-04 10:51:37 +020011#define PHONE_DATAOUT 4
12#define PHONE_DATAIN 5
13#define PHONE_INT 6
Christina Quast71234252015-04-03 11:35:59 +020014
Christina Quast4ba4d222015-03-02 16:14:09 +010015typedef struct ring_buffer
16{
17 uint8_t buf[BUFLEN*2]; // data buffer
18 uint8_t idx; // number of items in the buffer
19} ring_buffer;
20
21
Christina Quast10b2e5a2015-02-25 18:40:15 +010022enum confNum {
Christina Quastdb7b1ab2015-03-03 12:34:36 +010023 CFG_NUM_SNIFF = 1, CFG_NUM_CCID, CFG_NUM_PHONE, CFG_NUM_MITM, NUM_CONF
Christina Quast10b2e5a2015-02-25 18:40:15 +010024};
25
Christina Quastdb7b1ab2015-03-03 12:34:36 +010026/// CCIDDriverConfiguration Descriptors
27/// List of descriptors that make up the configuration descriptors of a
28/// device using the CCID driver.
29typedef struct {
30
31 /// Configuration descriptor
32 USBConfigurationDescriptor configuration;
33 /// Interface descriptor
34 USBInterfaceDescriptor interface;
35 /// CCID descriptor
36 CCIDDescriptor ccid;
37 /// Bulk OUT endpoint descriptor
38 USBEndpointDescriptor bulkOut;
39 /// Bulk IN endpoint descriptor
40 USBEndpointDescriptor bulkIn;
41 /// Interrupt OUT endpoint descriptor
42 USBEndpointDescriptor interruptIn;
43} __attribute__ ((packed)) CCIDDriverConfigurationDescriptors;
44
Christina Quast4b1e98d2015-04-06 23:28:02 +020045extern const USBConfigurationDescriptor *configurationDescriptorsArr[];
46
Christina Quastdb7b1ab2015-03-03 12:34:36 +010047/* Helper functions */
Christina Quastdb7b1ab2015-03-03 12:34:36 +010048
Christina Quast32906bb2015-02-24 11:35:19 +010049// FIXME: static function definitions
Christina Quast566d3f92015-02-24 17:38:57 +010050extern uint32_t _ISO7816_GetChar( uint8_t *pCharToReceive );
51extern uint32_t _ISO7816_SendChar( uint8_t CharToSend );
Christina Quast27c643d2015-02-24 19:09:08 +010052
Christina Quast1edf3502015-02-27 13:33:52 +010053/* Init functions */
54extern void Phone_Master_Init( void );
Christina Quastdb7b1ab2015-03-03 12:34:36 +010055extern void CCID_init( void );
Christina Quast27c643d2015-02-24 19:09:08 +010056extern void Sniffer_Init( void );
Christina Quast1edf3502015-02-27 13:33:52 +010057extern void MITM_init( void );
Christina Quast27c643d2015-02-24 19:09:08 +010058
Christina Quastc0aa7692015-02-25 14:02:01 +010059extern void SIMtrace_USB_Initialize( void );
Christina Quastc0aa7692015-02-25 14:02:01 +010060extern void _ISO7816_Init( void );
61
Christina Quast1edf3502015-02-27 13:33:52 +010062/* Run functions */
63extern void Sniffer_run( void );
Christina Quastdb7b1ab2015-03-03 12:34:36 +010064extern void CCID_run( void );
Christina Quast1edf3502015-02-27 13:33:52 +010065extern void Phone_run( void );
66extern void MITM_run( void );
67
Christina Quast531d10b2015-03-19 19:27:04 +010068/* Timer helper function */
69void Timer_Init( void );
70void TC0_Counter_Reset( void );
71
Christina Quast1edf3502015-02-27 13:33:52 +010072#endif /* SIMTRACE_H */