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 | |
Harald Welte | 855ba9e | 2016-02-24 21:00:46 +0100 | [diff] [blame] | 18 | /* transmit a single byte to the reader */ |
| 19 | int card_emu_tx_byte(struct card_handle *ch); |
Harald Welte | 9d3e382 | 2015-11-09 00:50:54 +0100 | [diff] [blame] | 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 | |
Harald Welte | 54cb3d0 | 2016-02-29 14:12:40 +0100 | [diff] [blame] | 27 | struct llist_head *card_emu_get_uart_tx_queue(struct card_handle *ch); |
| 28 | struct llist_head *card_emu_get_usb_tx_queue(struct card_handle *ch); |
Harald Welte | acae412 | 2016-03-02 10:27:58 +0100 | [diff] [blame^] | 29 | void card_emu_have_new_uart_tx(struct card_handle *ch); |
Harald Welte | 9d3e382 | 2015-11-09 00:50:54 +0100 | [diff] [blame] | 30 | |
| 31 | #define ENABLE_TX 0x01 |
| 32 | #define ENABLE_RX 0x02 |
| 33 | |
| 34 | int card_emu_uart_update_fidi(uint8_t uart_chan, unsigned int fidi); |
| 35 | int card_emu_uart_tx(uint8_t uart_chan, uint8_t byte); |
| 36 | void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx); |