mirror of https://gerrit.osmocom.org/simtrace2
Sniffer functionality and sniffer bus board config
This commit is contained in:
parent
a90eefa865
commit
27c643d297
|
@ -14,6 +14,9 @@
|
||||||
#include "cciddriver.h"
|
#include "cciddriver.h"
|
||||||
#include "USBD.h"
|
#include "USBD.h"
|
||||||
|
|
||||||
|
#include "USBD_Config.h"
|
||||||
|
#include "USBDDriver.h"
|
||||||
|
|
||||||
/** Highlevel */
|
/** Highlevel */
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
@ -21,6 +24,8 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "inttypes.h"
|
#include "inttypes.h"
|
||||||
|
|
||||||
|
#define MIN(a, b) ((a < b) ? a : b)
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#undef __GNUC__
|
#undef __GNUC__
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,15 +52,24 @@
|
||||||
#define LED_NUM_RED 0
|
#define LED_NUM_RED 0
|
||||||
#define LED_NUM_GREEN 1
|
#define LED_NUM_GREEN 1
|
||||||
|
|
||||||
/** Phone */
|
/** Phone (SIM card emulator)/CCID Reader/MITM configuration **/
|
||||||
|
/* Normally the communication lines between phone and SIM card are disconnected */
|
||||||
|
// Disconnect SIM card I/O, VPP line from the phone lines
|
||||||
|
// FIXME: Per default pins are input, therefore high-impedance, therefore they don not activate the bus switch, right?
|
||||||
|
#define PIN_SC_SW_DEFAULT {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
||||||
|
// Disconnect SIM card RST, CLK line from the phone lines
|
||||||
|
#define PIN_IO_SW_DEFAULT {PIO_PA19, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
||||||
|
#define PINS_BUS
|
||||||
|
|
||||||
|
/** Sniffer configuration **/
|
||||||
// Connect VPP, CLK and RST lines from smartcard to the phone
|
// Connect VPP, CLK and RST lines from smartcard to the phone
|
||||||
//#define PIN_SC_SW {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
#define PIN_SC_SW_SNIFF {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
||||||
// Temporary fix: do not connect
|
#define PIN_IO_SW_SNIFF {PIO_PA19, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
||||||
#define PIN_SC_SW {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
#define PINS_BUS_SNIFF PIN_SC_SW_SNIFF, PIN_IO_SW_SNIFF
|
||||||
// Connect SIM card I/O lines to the phone
|
|
||||||
//#define PIN_IO_SW {PIO_PA19, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
#define PINS_SIM_SNIFF_SIM PIN_PHONE_IO, PIN_PHONE_CLK
|
||||||
// FIXME: Temporary fix: do not connect
|
|
||||||
#define PIN_IO_SW {PIO_PA19, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
|
||||||
|
|
||||||
/** USART0 pin RX */
|
/** USART0 pin RX */
|
||||||
#define PIN_USART0_RXD {PIO_PA9A_URXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
|
#define PIN_USART0_RXD {PIO_PA9A_URXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
|
||||||
|
@ -134,7 +148,8 @@
|
||||||
#define PIN_SPI_NPCS0 {1 << 11, PIOA, PIOA, PIO_PERIPH_A, PIO_DEFAULT}
|
#define PIN_SPI_NPCS0 {1 << 11, PIOA, PIOA, PIO_PERIPH_A, PIO_DEFAULT}
|
||||||
|
|
||||||
//** USB **/
|
//** USB **/
|
||||||
/// USB pull-up control pin definition (PA16).
|
// USB pull-up control pin definition (PA16).
|
||||||
|
// Default: 1 (USB Pullup deactivated)
|
||||||
#define PIN_USB_PULLUP {1 << 16, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
#define PIN_USB_PULLUP {1 << 16, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
||||||
|
|
||||||
// Board has UDP controller
|
// Board has UDP controller
|
||||||
|
|
|
@ -3,3 +3,7 @@
|
||||||
extern uint32_t _ISO7816_GetChar( uint8_t *pCharToReceive );
|
extern uint32_t _ISO7816_GetChar( uint8_t *pCharToReceive );
|
||||||
extern uint32_t _ISO7816_SendChar( uint8_t CharToSend );
|
extern uint32_t _ISO7816_SendChar( uint8_t CharToSend );
|
||||||
extern void Phone_Master_Init( void );
|
extern void Phone_Master_Init( void );
|
||||||
|
|
||||||
|
extern void Sniffer_Init( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,33 +44,17 @@
|
||||||
|
|
||||||
/** Maximum ATR ucSize in bytes.*/
|
/** Maximum ATR ucSize in bytes.*/
|
||||||
#define MAX_ATR_SIZE 55
|
#define MAX_ATR_SIZE 55
|
||||||
|
|
||||||
/* Sniffer configuration */
|
|
||||||
#ifdef PIN_SC_SW
|
|
||||||
#undef PIN_SC_SW
|
|
||||||
#endif
|
|
||||||
#define PIN_SC_SW {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
|
||||||
|
|
||||||
#ifdef PIN_IO_SW
|
|
||||||
#undef PIN_IO_SW
|
|
||||||
#endif
|
|
||||||
#define PIN_IO_SW {PIO_PA19, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
|
||||||
|
|
||||||
#define PINS_BUS PIN_SC_SW, PIN_IO_SW
|
|
||||||
|
|
||||||
#define PINS_SIM_SNIFF_SIM PIN_PHONE_IO, PIN_PHONE_CLK
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Internal variables
|
* Internal variables
|
||||||
*------------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------------*/
|
||||||
/** ISO7816 pins */
|
/** ISO7816 pins */
|
||||||
static const Pin pinsISO7816_sniff[] = {PINS_SIM_SNIFF_SIM};
|
static const Pin pinsISO7816_sniff[] = {PINS_SIM_SNIFF_SIM};
|
||||||
static const Pin pins_bus[] = {PINS_BUS};
|
static const Pin pins_bus[] = {PINS_BUS_SNIFF};
|
||||||
static const Pin pPwr[] = {
|
static const Pin pPwr[] = {
|
||||||
/* Enable power converter 4.5-6V to 3.3V; low: off */
|
/* Enable power converter 4.5-6V to 3.3V; low: off */
|
||||||
{SIM_PWEN, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT},
|
{SIM_PWEN, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT},
|
||||||
|
|
||||||
/* Enable second power converter: VCC_PHONE to VCC_SIM; high: off */
|
/* Enable second power converter: VCC_PHONE to VCC_SIM; high: on */
|
||||||
{VCC_FWD, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
{VCC_FWD, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue