some more reader-related debugging
[librfid] / include / rfid / rfid_protocol_tcl.h
1 #ifndef _RFID_PROTOCOL_TCL_H
2 #define _RFID_PROTOCOL_TCL_H
3
4 enum tcl_transport_rate {
5         TCL_RATE_106    = 0x01,
6         TCL_RATE_212    = 0x02,
7         TCL_RATE_424    = 0x04,
8         TCL_RATE_848    = 0x08,
9 };
10
11 enum tcl_transport_transcieve_flags {
12         TCL_TRANSP_F_TX_CRC     = 0x01, /* transport adds TX CRC */
13         TCL_TRANSP_F_RX_CRC     = 0x02, 
14 };
15
16
17 struct tcl_handle {
18         /* derived from ats */
19         unsigned char *historical_bytes; /* points into ats */
20         unsigned int historical_len;
21
22         unsigned int fsc;       /* max frame size accepted by card */
23         unsigned int fsd;       /* max frame size accepted by reader */
24         unsigned int fwt;       /* frame waiting time */
25         unsigned char ta;       /* divisor information */
26         unsigned char sfgt;     /* start-up frame guard time */
27
28         /* otherwise determined */
29         unsigned int cid;       /* Card ID */
30         unsigned int nad;       /* Node Address */
31
32         unsigned int flags;
33         unsigned int state;     /* protocol state */
34
35         unsigned int ats_len;
36         unsigned char ats[0];
37 };
38
39 enum tcl_handle_flags {
40         TCL_HANDLE_F_NAD_SUPPORTED      = 0x0001,
41         TCL_HANDLE_F_CID_SUPPORTED      = 0x0002,
42         TCL_HANDLE_F_NAD_USED           = 0x0010,
43         TCL_HANDLE_F_CID_USED           = 0x0020,
44 };
45
46
47 enum tcl_pcb_bits {
48         TCL_PCB_CID_FOLLOWING           = 0x08,
49         TCL_PCB_NAD_FOLLOWING           = 0x04,
50 };
51
52 enum tcl_pcd_state {
53         TCL_STATE_NONE = 0x00,
54         TCL_STATE_INITIAL,
55         TCL_STATE_RATS_SENT,            /* waiting for ATS */
56         TCL_STATE_ATS_RCVD,             /* ATS received */
57         TCL_STATE_PPS_SENT,             /* waiting for PPS response */
58         TCL_STATE_ESTABLISHED,          /* xchg transparent data */
59         TCL_STATE_DESELECT_SENT,        /* waiting for DESELECT response */
60         TCL_STATE_DESELECTED,           /* card deselected or HLTA'd */
61 };
62
63 struct rfid_protocol rfid_protocol_tcl;
64
65 #endif