Christina Quast | c0aa769 | 2015-02-25 14:02:01 +0100 | [diff] [blame] | 1 | #ifndef SIMTRACE_H |
| 2 | #define SIMTRACE_H |
Christina Quast | 32906bb | 2015-02-24 11:35:19 +0100 | [diff] [blame] | 3 | |
Christina Quast | 4db82e0 | 2015-04-11 18:14:41 +0200 | [diff] [blame] | 4 | #include "ringbuffer.h" |
| 5 | |
Christina Quast | 4ba4d22 | 2015-03-02 16:14:09 +0100 | [diff] [blame] | 6 | /* Endpoint numbers */ |
| 7 | #define DATAOUT 1 |
| 8 | #define DATAIN 2 |
| 9 | #define INT 3 |
| 10 | |
Christina Quast | 4db82e0 | 2015-04-11 18:14:41 +0200 | [diff] [blame] | 11 | #define BUFLEN 64 |
Christina Quast | 7123425 | 2015-04-03 11:35:59 +0200 | [diff] [blame] | 12 | |
Christina Quast | b65b881 | 2015-04-04 10:51:37 +0200 | [diff] [blame] | 13 | #define PHONE_DATAOUT 4 |
| 14 | #define PHONE_DATAIN 5 |
| 15 | #define PHONE_INT 6 |
Christina Quast | 7123425 | 2015-04-03 11:35:59 +0200 | [diff] [blame] | 16 | |
Christina Quast | 3eab56e | 2015-04-10 15:38:49 +0200 | [diff] [blame] | 17 | #define CLK_MASTER 1 |
| 18 | #define CLK_SLAVE 0 |
| 19 | |
Christina Quast | 4db82e0 | 2015-04-11 18:14:41 +0200 | [diff] [blame] | 20 | extern volatile ringbuf sim_rcv_buf; |
Christina Quast | 95d6616 | 2015-04-09 22:38:47 +0200 | [diff] [blame] | 21 | |
| 22 | extern volatile bool rcvdChar; |
| 23 | extern volatile uint32_t char_stat; |
| 24 | extern volatile enum confNum simtrace_config; |
Christina Quast | 4ba4d22 | 2015-03-02 16:14:09 +0100 | [diff] [blame] | 25 | |
Christina Quast | 10b2e5a | 2015-02-25 18:40:15 +0100 | [diff] [blame] | 26 | enum confNum { |
Christina Quast | db7b1ab | 2015-03-03 12:34:36 +0100 | [diff] [blame] | 27 | CFG_NUM_SNIFF = 1, CFG_NUM_CCID, CFG_NUM_PHONE, CFG_NUM_MITM, NUM_CONF |
Christina Quast | 10b2e5a | 2015-02-25 18:40:15 +0100 | [diff] [blame] | 28 | }; |
| 29 | |
Christina Quast | db7b1ab | 2015-03-03 12:34:36 +0100 | [diff] [blame] | 30 | /// CCIDDriverConfiguration Descriptors |
| 31 | /// List of descriptors that make up the configuration descriptors of a |
| 32 | /// device using the CCID driver. |
| 33 | typedef struct { |
| 34 | |
| 35 | /// Configuration descriptor |
| 36 | USBConfigurationDescriptor configuration; |
| 37 | /// Interface descriptor |
| 38 | USBInterfaceDescriptor interface; |
| 39 | /// CCID descriptor |
| 40 | CCIDDescriptor ccid; |
| 41 | /// Bulk OUT endpoint descriptor |
| 42 | USBEndpointDescriptor bulkOut; |
| 43 | /// Bulk IN endpoint descriptor |
| 44 | USBEndpointDescriptor bulkIn; |
| 45 | /// Interrupt OUT endpoint descriptor |
| 46 | USBEndpointDescriptor interruptIn; |
| 47 | } __attribute__ ((packed)) CCIDDriverConfigurationDescriptors; |
| 48 | |
Christina Quast | 4b1e98d | 2015-04-06 23:28:02 +0200 | [diff] [blame] | 49 | extern const USBConfigurationDescriptor *configurationDescriptorsArr[]; |
| 50 | |
Christina Quast | 2b8a18b | 2015-04-12 09:31:36 +0200 | [diff] [blame] | 51 | int check_data_from_phone(); |
Christina Quast | db7b1ab | 2015-03-03 12:34:36 +0100 | [diff] [blame] | 52 | |
Christina Quast | 95d6616 | 2015-04-09 22:38:47 +0200 | [diff] [blame] | 53 | /* Configure functions */ |
| 54 | extern void Sniffer_configure( void ); |
| 55 | extern void CCID_configure( void ); |
| 56 | extern void Phone_configure( void ); |
| 57 | extern void MITM_configure( void ); |
| 58 | |
Christina Quast | 1edf350 | 2015-02-27 13:33:52 +0100 | [diff] [blame] | 59 | /* Init functions */ |
Christina Quast | 95d6616 | 2015-04-09 22:38:47 +0200 | [diff] [blame] | 60 | extern void Sniffer_init( void ); |
Christina Quast | db7b1ab | 2015-03-03 12:34:36 +0100 | [diff] [blame] | 61 | extern void CCID_init( void ); |
Christina Quast | 95d6616 | 2015-04-09 22:38:47 +0200 | [diff] [blame] | 62 | extern void Phone_init( void ); |
Christina Quast | 1edf350 | 2015-02-27 13:33:52 +0100 | [diff] [blame] | 63 | extern void MITM_init( void ); |
Christina Quast | 27c643d | 2015-02-24 19:09:08 +0100 | [diff] [blame] | 64 | |
Christina Quast | c0aa769 | 2015-02-25 14:02:01 +0100 | [diff] [blame] | 65 | extern void SIMtrace_USB_Initialize( void ); |
Christina Quast | c0aa769 | 2015-02-25 14:02:01 +0100 | [diff] [blame] | 66 | |
Christina Quast | 95d6616 | 2015-04-09 22:38:47 +0200 | [diff] [blame] | 67 | /* Exit functions */ |
| 68 | extern void Sniffer_exit( void ); |
| 69 | extern void CCID_exit( void ); |
| 70 | extern void Phone_exit( void ); |
| 71 | extern void MITM_exit( void ); |
| 72 | |
Christina Quast | 1edf350 | 2015-02-27 13:33:52 +0100 | [diff] [blame] | 73 | /* Run functions */ |
| 74 | extern void Sniffer_run( void ); |
Christina Quast | db7b1ab | 2015-03-03 12:34:36 +0100 | [diff] [blame] | 75 | extern void CCID_run( void ); |
Christina Quast | 1edf350 | 2015-02-27 13:33:52 +0100 | [diff] [blame] | 76 | extern void Phone_run( void ); |
| 77 | extern void MITM_run( void ); |
| 78 | |
Christina Quast | 531d10b | 2015-03-19 19:27:04 +0100 | [diff] [blame] | 79 | /* Timer helper function */ |
| 80 | void Timer_Init( void ); |
| 81 | void TC0_Counter_Reset( void ); |
| 82 | |
Christina Quast | 1edf350 | 2015-02-27 13:33:52 +0100 | [diff] [blame] | 83 | #endif /* SIMTRACE_H */ |