mirror of https://gerrit.osmocom.org/simtrace2
owhw: fix GPIO definitions (output low level by default)
This commit is contained in:
parent
8c49636127
commit
2fb5996d30
|
@ -26,11 +26,13 @@
|
|||
#define PIN_USIM1_CLK_TC {PIO_PA29, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
|
||||
#define PINS_TC_USIM1 PIN_USIM1_IO_TC, PIN_USIM1_CLK_TC
|
||||
|
||||
#define PIN_SET_USIM1_PRES {PIO_PA12, PIOA, ID_PIOA, PIO_OUTPUT, PIO_DEFAULT}
|
||||
#define PIN_SET_USIM1_PRES {PIO_PA12, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
||||
#define PIN_USIM1_nRST {PIO_PA23, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
|
||||
#define PIN_USIM1_VCC {PIO_PB3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
|
||||
|
||||
#define PIN_SET_USIM2_PRES {PIO_PA14, PIOA, ID_PIOA, PIO_OUTPUT, PIO_DEFAULT}
|
||||
#define PIN_SET_USIM2_PRES {PIO_PA14, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
||||
#define PIN_USIM2_nRST {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
|
||||
#define PIN_USIM2_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
|
||||
|
||||
#define PINS_USIM1 PINS_TC_USIM1, PINS_ISO7816_USIM1, PIN_USIM1_nRST, PIN_SET_USIM1_PRES
|
||||
#define PINS_USIM2 PINS_TC_USIM2, PINS_ISO7816_USIM2, PIN_USIM2_nRST, PIN_SET_USIM2_PRES
|
||||
|
@ -41,3 +43,5 @@
|
|||
#define SIMTRACE_PRODUCT_ID 0x60e3 /* FIXME */
|
||||
#define USB_VENDOR_ID SIMTRACE_VENDOR_ID
|
||||
#define USB_PRODUCT_ID SIMTRACE_PRODUCT_ID
|
||||
|
||||
#define HAVE_CARDEM
|
||||
|
|
|
@ -76,3 +76,8 @@
|
|||
#define SIMTRACE_PRODUCT_ID 0x60e3
|
||||
#define USB_VENDOR_ID SIMTRACE_VENDOR_ID
|
||||
#define USB_PRODUCT_ID SIMTRACE_PRODUCT_ID
|
||||
|
||||
#define HAVE_SNIFFER
|
||||
#define HAVE_CCID
|
||||
#define HAVE_CARDEM
|
||||
#define HAVE_MITM
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "card_emu.h"
|
||||
|
||||
#if 0
|
||||
void card_emu_process_rx_byte(struct card_handle *ch, uint8_t byte);
|
||||
int card_emu_tx_byte(struct card_handle *ch);
|
||||
void card_emu_io_statechg(struct card_handle *ch, enum card_io io, int active);
|
||||
#endif
|
||||
|
||||
static struct Usart_info usart_info[2] = {
|
||||
{
|
||||
.base = USART_PHONE,
|
||||
.id = ID_USART_PHONE,
|
||||
.state = USART_RCV
|
||||
}, {}
|
||||
};
|
||||
|
||||
static Usart *get_usart_by_chan(uint8_t uart_chan)
|
||||
{
|
||||
switch (uart_chan) {
|
||||
case 0:
|
||||
return USART_PHONE;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx)
|
||||
{
|
||||
Usart *usart = get_usart_by_chan(uart_chan);
|
||||
USART_SetTransmitterEnabled(usart, 0);
|
||||
USART_SetReceiverEnabled(usart, 1);
|
||||
}
|
||||
|
||||
int card_emu_uart_tx(uint8_t uart_chan, uint8_t byte)
|
||||
{
|
||||
Usart_info *ui = &usart_info[uart_chan];
|
||||
ISO7816_SendChar(byte, ui);
|
||||
return 1;
|
||||
}
|
|
@ -27,6 +27,8 @@
|
|||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CCID
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Headers
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
@ -178,3 +180,4 @@ void CCID_run( void )
|
|||
|
||||
CCID_SmartCardRequest();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -21,37 +21,52 @@ typedef struct {
|
|||
|
||||
static const conf_func config_func_ptrs[] = {
|
||||
/* array slot 0 is empty, usb configs start at 1 */
|
||||
#ifdef HAVE_SNIFFER
|
||||
[CFG_NUM_SNIFF] = {
|
||||
.configure = Sniffer_configure,
|
||||
.init = Sniffer_init,
|
||||
.exit = Sniffer_exit,
|
||||
.run = Sniffer_run,
|
||||
},
|
||||
#endif
|
||||
#ifdef HAVE_CCID
|
||||
[CFG_NUM_CCID] = {
|
||||
.configure = CCID_configure,
|
||||
.init = CCID_init,
|
||||
.exit = CCID_exit,
|
||||
.run = CCID_run,
|
||||
},
|
||||
#endif
|
||||
#ifdef HAVE_CARDEM
|
||||
[CFG_NUM_PHONE] = {
|
||||
.configure = Phone_configure,
|
||||
.init = Phone_init,
|
||||
.exit = Phone_exit,
|
||||
.run = Phone_run,
|
||||
},
|
||||
#endif
|
||||
#ifdef HAVE_MITM
|
||||
[CFG_NUM_MITM] = {
|
||||
.configure = MITM_configure,
|
||||
.init = MITM_init,
|
||||
.exit = MITM_exit,
|
||||
.run = MITM_run
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Internal variables
|
||||
*------------------------------------------------------------------------------*/
|
||||
#if defined(HAVE_SNIFFER)
|
||||
static volatile enum confNum simtrace_config = CFG_NUM_SNIFF;
|
||||
#elif defined(HAVE_CARDEM)
|
||||
static volatile enum confNum simtrace_config = CFG_NUM_PHONE;
|
||||
#elif defined(HAVE_CCID)
|
||||
static volatile enum confNum simtrace_config = CFG_NUM_CCID;
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Callbacks
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_MITM
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Headers
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
@ -63,3 +65,4 @@ void MITM_run( void )
|
|||
Phone_run();
|
||||
CCID_run();
|
||||
}
|
||||
#endif /* HAVE_MITM */
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SNIFFER
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Headers
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
@ -94,3 +96,4 @@ void Sniffer_run( void )
|
|||
{
|
||||
check_data_from_phone();
|
||||
}
|
||||
#endif /* HAVE_SNIFFER */
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "board.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <cciddriverdescriptors.h>
|
||||
|
||||
|
@ -193,6 +194,7 @@ static const unsigned char *stringDescriptors[] = {
|
|||
* USB Device descriptors
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef HAVE_SNIFFER
|
||||
typedef struct _SIMTraceDriverConfigurationDescriptorSniffer {
|
||||
|
||||
/** Standard configuration descriptor. */
|
||||
|
@ -261,7 +263,10 @@ static const SIMTraceDriverConfigurationDescriptorSniffer configurationDescripto
|
|||
0x10
|
||||
}
|
||||
};
|
||||
#endif /* HAVE_SNIFFER */
|
||||
|
||||
|
||||
#ifdef HAVE_CCID
|
||||
/*
|
||||
/// CCIDDriverConfiguration Descriptors
|
||||
/// List of descriptors that make up the configuration descriptors of a
|
||||
|
@ -367,8 +372,10 @@ static const CCIDDriverConfigurationDescriptors configurationDescriptorCCID = {
|
|||
0x10
|
||||
},
|
||||
};
|
||||
#endif /* HAVE_CCID */
|
||||
|
||||
|
||||
#ifdef HAVE_CARDEM
|
||||
/* SIM card emulator */
|
||||
typedef struct _SIMTraceDriverConfigurationDescriptorPhone {
|
||||
|
||||
|
@ -437,8 +444,9 @@ static const SIMTraceDriverConfigurationDescriptorPhone configurationDescriptorP
|
|||
0x10
|
||||
}
|
||||
};
|
||||
#endif /* HAVE_CARDEM */
|
||||
|
||||
|
||||
#ifdef HAVE_MITM
|
||||
typedef struct _SIMTraceDriverConfigurationDescriptorMITM {
|
||||
|
||||
/** Standard configuration descriptor. */
|
||||
|
@ -587,6 +595,22 @@ static const SIMTraceDriverConfigurationDescriptorMITM configurationDescriptorMI
|
|||
0x10
|
||||
}
|
||||
};
|
||||
#endif /* HAVE_CARDEM */
|
||||
|
||||
const USBConfigurationDescriptor *configurationDescriptorsArr[] = {
|
||||
#ifdef HAVE_SNIFFER
|
||||
&configurationDescriptorSniffer.configuration,
|
||||
#endif
|
||||
#ifdef HAVE_CCID
|
||||
&configurationDescriptorCCID.configuration,
|
||||
#endif
|
||||
#ifdef HAVE_CARDEM
|
||||
&configurationDescriptorPhone.configuration,
|
||||
#endif
|
||||
#ifdef HAVE_MITM
|
||||
&configurationDescriptorMITM.configuration,
|
||||
#endif
|
||||
};
|
||||
|
||||
/** Standard USB device descriptor for the CDC serial driver */
|
||||
const USBDeviceDescriptor deviceDescriptor = {
|
||||
|
@ -607,14 +631,7 @@ const USBDeviceDescriptor deviceDescriptor = {
|
|||
MANUF_STR, /* Indesx of manufacturer string descriptor */
|
||||
PRODUCT_STRING, /* Index of product string descriptor */
|
||||
0, /* No string descriptor for serial number */
|
||||
4 /* Device has 4 possible configurations */
|
||||
};
|
||||
|
||||
const USBConfigurationDescriptor *configurationDescriptorsArr[] = {
|
||||
&configurationDescriptorSniffer.configuration,
|
||||
&configurationDescriptorCCID.configuration,
|
||||
&configurationDescriptorPhone.configuration,
|
||||
&configurationDescriptorMITM.configuration,
|
||||
ARRAY_SIZE(configurationDescriptorsArr) /* Device has N possible configs */
|
||||
};
|
||||
|
||||
/* AT91SAM3S only supports full speed, but not high speed USB */
|
||||
|
|
Loading…
Reference in New Issue