blob: c313356470be698e673b100608ceb42a61b4a7e2 [file] [log] [blame]
Harald Welte9d3e3822015-11-09 00:50:54 +01001#pragma once
2
3#include <stdint.h>
4
5struct card_handle;
6
7enum card_io {
8 CARD_IO_VCC,
9 CARD_IO_RST,
10 CARD_IO_CLK,
11};
12
13struct 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 */
16void card_emu_process_rx_byte(struct card_handle *ch, uint8_t byte);
17
18/* return a single byte to be transmitted to the reader */
19int 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 */
22void 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 */
25int 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
31int card_emu_uart_update_fidi(uint8_t uart_chan, unsigned int fidi);
32int card_emu_uart_tx(uint8_t uart_chan, uint8_t byte);
33void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx);