Harald Welte | 9d3e382 | 2015-11-09 00:50:54 +0100 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | |
| 5 | struct card_handle; |
| 6 | |
| 7 | enum card_io { |
| 8 | CARD_IO_VCC, |
| 9 | CARD_IO_RST, |
| 10 | CARD_IO_CLK, |
| 11 | }; |
| 12 | |
| 13 | struct card_handle *card_emu_init(uint8_t slot_num, uint8_t tc_chan, uint8_t uart_chan); |
| 14 | |
| 15 | /* process a single byte received from the reader */ |
| 16 | void card_emu_process_rx_byte(struct card_handle *ch, uint8_t byte); |
| 17 | |
| 18 | /* return a single byte to be transmitted to the reader */ |
| 19 | int card_emu_get_tx_byte(struct card_handle *ch, uint8_t *byte); |
| 20 | |
| 21 | /* hardware driver informs us that a card I/O signal has changed */ |
| 22 | void card_emu_io_statechg(struct card_handle *ch, enum card_io io, int active); |
| 23 | |
| 24 | /* User sets a new ATR to be returned during next card reset */ |
| 25 | int card_emu_set_atr(struct card_handle *ch, const uint8_t *atr, uint8_t len); |
| 26 | |
| 27 | |
| 28 | #define ENABLE_TX 0x01 |
| 29 | #define ENABLE_RX 0x02 |
| 30 | |
| 31 | int card_emu_uart_update_fidi(uint8_t uart_chan, unsigned int fidi); |
| 32 | int card_emu_uart_tx(uint8_t uart_chan, uint8_t byte); |
| 33 | void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx); |