mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-18 22:38:32 +03:00
Moved ISR_PhoneRST into iso code file and simtrace header
This commit is contained in:
@@ -94,7 +94,6 @@ static const Pin pins_bus[] = {PINS_BUS_DEFAULT};
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** ISO7816 RST pin */
|
/** ISO7816 RST pin */
|
||||||
static const Pin pinIso7816RstMC = PIN_ISO7816_RST_PHONE;
|
|
||||||
static uint8_t sim_inserted = 0;
|
static uint8_t sim_inserted = 0;
|
||||||
|
|
||||||
static const Pin pPwr[] = {
|
static const Pin pPwr[] = {
|
||||||
@@ -105,8 +104,7 @@ static const Pin pPwr[] = {
|
|||||||
{VCC_FWD, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
{VCC_FWD, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const Pin pinPhoneRST = PIN_ISO7816_RST_PHONE;
|
||||||
static const Pin pinPhoneRST = PIN_ISO7816_RST_PHONE;
|
|
||||||
|
|
||||||
static struct Usart_info usart_info = {.base = USART_PHONE, .id = ID_USART_PHONE, .state = USART_RCV};
|
static struct Usart_info usart_info = {.base = USART_PHONE, .id = ID_USART_PHONE, .state = USART_RCV};
|
||||||
|
|
||||||
@@ -125,37 +123,6 @@ static struct Usart_info usart_info = {.base = USART_PHONE, .id = ID_USART_PHONE
|
|||||||
*-----------------------------------------------------------------------------*/
|
*-----------------------------------------------------------------------------*/
|
||||||
static uint8_t host_to_sim_buf[BUFLEN];
|
static uint8_t host_to_sim_buf[BUFLEN];
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
* Interrupt routines
|
|
||||||
*-----------------------------------------------------------------------------*/
|
|
||||||
void Callback_PhoneRST_ISR( uint8_t *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
|
|
||||||
{
|
|
||||||
printf("rstCB\n\r");
|
|
||||||
PIO_EnableIt( &pinPhoneRST ) ;
|
|
||||||
}
|
|
||||||
static void ISR_PhoneRST( const Pin *pPin)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
// FIXME: no printfs in ISRs?
|
|
||||||
printf("+++ Int!! %x\n\r", pinPhoneRST.pio->PIO_ISR);
|
|
||||||
if ( ((pinPhoneRST.pio->PIO_ISR & pinPhoneRST.mask) != 0) )
|
|
||||||
{
|
|
||||||
if(PIO_Get( &pinPhoneRST ) == 0) {
|
|
||||||
printf(" 0 ");
|
|
||||||
} else {
|
|
||||||
printf(" 1 ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ret = USBD_Write( PHONE_INT, "R", 1, (TransferCallback)&Callback_PhoneRST_ISR, 0 )) != USBD_STATUS_SUCCESS) {
|
|
||||||
TRACE_ERROR("USB err status: %d (%s)\n", ret, __FUNCTION__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Interrupt enabled after ATR is sent to phone */
|
|
||||||
PIO_DisableIt( &pinPhoneRST ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void receive_from_host( void );
|
void receive_from_host( void );
|
||||||
void sendResponse_to_phone( uint8_t *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
|
void sendResponse_to_phone( uint8_t *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ extern volatile bool rcvdChar;
|
|||||||
extern volatile uint32_t char_stat;
|
extern volatile uint32_t char_stat;
|
||||||
extern volatile enum confNum simtrace_config;
|
extern volatile enum confNum simtrace_config;
|
||||||
|
|
||||||
|
extern const Pin pinPhoneRST;
|
||||||
|
|
||||||
enum confNum {
|
enum confNum {
|
||||||
CFG_NUM_SNIFF = 1, CFG_NUM_CCID, CFG_NUM_PHONE, CFG_NUM_MITM, NUM_CONF
|
CFG_NUM_SNIFF = 1, CFG_NUM_CCID, CFG_NUM_PHONE, CFG_NUM_MITM, NUM_CONF
|
||||||
};
|
};
|
||||||
@@ -57,6 +59,7 @@ typedef struct {
|
|||||||
extern const USBConfigurationDescriptor *configurationDescriptorsArr[];
|
extern const USBConfigurationDescriptor *configurationDescriptorsArr[];
|
||||||
|
|
||||||
int check_data_from_phone();
|
int check_data_from_phone();
|
||||||
|
void ISR_PhoneRST( const Pin *pPin);
|
||||||
|
|
||||||
/* Configure functions */
|
/* Configure functions */
|
||||||
extern void Sniffer_configure( void );
|
extern void Sniffer_configure( void );
|
||||||
|
|||||||
@@ -43,6 +43,37 @@ volatile uint32_t char_stat;
|
|||||||
|
|
||||||
volatile ringbuf sim_rcv_buf = { {0}, 0, 0 };
|
volatile ringbuf sim_rcv_buf = { {0}, 0, 0 };
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------
|
||||||
|
* Interrupt routines
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
void Callback_PhoneRST_ISR( uint8_t *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
|
||||||
|
{
|
||||||
|
printf("rstCB\n\r");
|
||||||
|
PIO_EnableIt( &pinPhoneRST ) ;
|
||||||
|
}
|
||||||
|
void ISR_PhoneRST( const Pin *pPin)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
// FIXME: no printfs in ISRs?
|
||||||
|
printf("+++ Int!! %x\n\r", pinPhoneRST.pio->PIO_ISR);
|
||||||
|
if ( ((pinPhoneRST.pio->PIO_ISR & pinPhoneRST.mask) != 0) )
|
||||||
|
{
|
||||||
|
if(PIO_Get( &pinPhoneRST ) == 0) {
|
||||||
|
printf(" 0 ");
|
||||||
|
} else {
|
||||||
|
printf(" 1 ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ret = USBD_Write( PHONE_INT, "R", 1, (TransferCallback)&Callback_PhoneRST_ISR, 0 )) != USBD_STATUS_SUCCESS) {
|
||||||
|
TRACE_ERROR("USB err status: %d (%s)\n", ret, __FUNCTION__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Interrupt enabled after ATR is sent to phone */
|
||||||
|
PIO_DisableIt( &pinPhoneRST ) ;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* char_stat is zero if no error occured.
|
* char_stat is zero if no error occured.
|
||||||
* Otherwise it is filled with the content of the status register.
|
* Otherwise it is filled with the content of the status register.
|
||||||
|
|||||||
Reference in New Issue
Block a user