blob: 32c9fc30319b3c59837e6612d2e9da45bf2e25fb [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 Quast4db82e02015-04-11 18:14:41 +02004#include "ringbuffer.h"
5
Christina Quast4ba4d222015-03-02 16:14:09 +01006/* Endpoint numbers */
7#define DATAOUT 1
8#define DATAIN 2
9#define INT 3
10
Christina Quast4db82e02015-04-11 18:14:41 +020011#define BUFLEN 64
Christina Quast71234252015-04-03 11:35:59 +020012
Christina Quastb65b8812015-04-04 10:51:37 +020013#define PHONE_DATAOUT 4
14#define PHONE_DATAIN 5
15#define PHONE_INT 6
Christina Quast71234252015-04-03 11:35:59 +020016
Christina Quast3eab56e2015-04-10 15:38:49 +020017#define CLK_MASTER 1
18#define CLK_SLAVE 0
19
Christina Quast4db82e02015-04-11 18:14:41 +020020extern volatile ringbuf sim_rcv_buf;
Christina Quast95d66162015-04-09 22:38:47 +020021
22extern volatile bool rcvdChar;
23extern volatile uint32_t char_stat;
24extern volatile enum confNum simtrace_config;
Christina Quast4ba4d222015-03-02 16:14:09 +010025
Christina Quast10b2e5a2015-02-25 18:40:15 +010026enum confNum {
Christina Quastdb7b1ab2015-03-03 12:34:36 +010027 CFG_NUM_SNIFF = 1, CFG_NUM_CCID, CFG_NUM_PHONE, CFG_NUM_MITM, NUM_CONF
Christina Quast10b2e5a2015-02-25 18:40:15 +010028};
29
Christina Quastdb7b1ab2015-03-03 12:34:36 +010030/// CCIDDriverConfiguration Descriptors
31/// List of descriptors that make up the configuration descriptors of a
32/// device using the CCID driver.
33typedef 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 Quast4b1e98d2015-04-06 23:28:02 +020049extern const USBConfigurationDescriptor *configurationDescriptorsArr[];
50
Christina Quast2b8a18b2015-04-12 09:31:36 +020051int check_data_from_phone();
Christina Quastdb7b1ab2015-03-03 12:34:36 +010052
Christina Quast95d66162015-04-09 22:38:47 +020053/* Configure functions */
54extern void Sniffer_configure( void );
55extern void CCID_configure( void );
56extern void Phone_configure( void );
57extern void MITM_configure( void );
58
Christina Quast1edf3502015-02-27 13:33:52 +010059/* Init functions */
Christina Quast95d66162015-04-09 22:38:47 +020060extern void Sniffer_init( void );
Christina Quastdb7b1ab2015-03-03 12:34:36 +010061extern void CCID_init( void );
Christina Quast95d66162015-04-09 22:38:47 +020062extern void Phone_init( void );
Christina Quast1edf3502015-02-27 13:33:52 +010063extern void MITM_init( void );
Christina Quast27c643d2015-02-24 19:09:08 +010064
Christina Quastc0aa7692015-02-25 14:02:01 +010065extern void SIMtrace_USB_Initialize( void );
Christina Quastc0aa7692015-02-25 14:02:01 +010066
Christina Quast95d66162015-04-09 22:38:47 +020067/* Exit functions */
68extern void Sniffer_exit( void );
69extern void CCID_exit( void );
70extern void Phone_exit( void );
71extern void MITM_exit( void );
72
Christina Quast1edf3502015-02-27 13:33:52 +010073/* Run functions */
74extern void Sniffer_run( void );
Christina Quastdb7b1ab2015-03-03 12:34:36 +010075extern void CCID_run( void );
Christina Quast1edf3502015-02-27 13:33:52 +010076extern void Phone_run( void );
77extern void MITM_run( void );
78
Christina Quast531d10b2015-03-19 19:27:04 +010079/* Timer helper function */
80void Timer_Init( void );
81void TC0_Counter_Reset( void );
82
Christina Quast1edf3502015-02-27 13:33:52 +010083#endif /* SIMTRACE_H */