mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
Add card_emu_target.c to bind card_emu.c code into target firmware
This commit is contained in:
@@ -140,7 +140,7 @@ C_CMSIS = core_cm3.o
|
||||
C_LOWLEVEL = board_cstartup_gnu.o board_lowlevel.o syscalls.o exceptions.o
|
||||
C_LIBLEVEL = spi.o pio.o pmc.o usart.o pio_it.o pio_capture.o uart_console.o iso7816_4.o wdt.o led.o tc.o
|
||||
C_CCID = cciddriver.o USBD.o USBDDriver.o USBD_HAL.o USBRequests.o USBDCallbacks.o USBDescriptors.o USBDDriverCallbacks.o
|
||||
C_SIMTRACE = simtrace_iso7816.o usb.o ccid.o sniffer.o phone.o mitm.o ringbuffer.o host_communication.o iso7816_fidi.o tc_etu.o req_ctx.o #iso7816_uart.o
|
||||
C_SIMTRACE = simtrace_iso7816.o usb.o ccid.o sniffer.o phone.o mitm.o ringbuffer.o host_communication.o iso7816_fidi.o tc_etu.o req_ctx.o card_emu.o card_emu_target.o
|
||||
C_APPLEVEL = main.o
|
||||
C_OBJECTS = $(C_CMSIS) $(C_LOWLEVEL) $(C_LIBLEVEL) $(C_APPLEVEL) $(C_CCID) $(C_SIMTRACE)
|
||||
|
||||
|
||||
41
firmware/src_simtrace/card_emu_target.c
Normal file
41
firmware/src_simtrace/card_emu_target.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user