summaryrefslogtreecommitdiff
path: root/include/rfid/rfid_protocol_tcl.h
blob: f0dbcdc45fc723de85143a6b276b6e02123f40bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef _RFID_PROTOCOL_TCL_H
#define _RFID_PROTOCOL_TCL_H

enum tcl_transport_rate {
	TCL_RATE_106	= 0x01,
	TCL_RATE_212	= 0x02,
	TCL_RATE_424	= 0x04,
	TCL_RATE_848	= 0x08,
};

enum tcl_transport_transcieve_flags {
	TCL_TRANSP_F_TX_CRC	= 0x01,	/* transport adds TX CRC */
	TCL_TRANSP_F_RX_CRC	= 0x02, 
};


struct tcl_handle {
	/* derived from ats */
	unsigned char *historical_bytes; /* points into ats */
	unsigned int historical_len;

	unsigned int fsc;	/* max frame size accepted by card */
	unsigned int fsd;	/* max frame size accepted by reader */
	unsigned int fwt;	/* frame waiting time (in usec)*/
	unsigned char ta;	/* divisor information */
	unsigned char sfgt;	/* start-up frame guard time (in usec) */

	/* otherwise determined */
	unsigned int cid;	/* Card ID */
	unsigned int nad;	/* Node Address */

	unsigned int flags;
	unsigned int state;	/* protocol state */

	unsigned int toggle;	/* send toggle with next frame */

	unsigned int ats_len;
	unsigned char ats[0];
};

enum tcl_handle_flags {
	TCL_HANDLE_F_NAD_SUPPORTED 	= 0x0001,
	TCL_HANDLE_F_CID_SUPPORTED 	= 0x0002,
	TCL_HANDLE_F_NAD_USED		= 0x0010,
	TCL_HANDLE_F_CID_USED		= 0x0020,
};


enum tcl_pcb_bits {
	TCL_PCB_CID_FOLLOWING		= 0x08,
	TCL_PCB_NAD_FOLLOWING		= 0x04,
};

enum tcl_pcd_state {
	TCL_STATE_NONE = 0x00,
	TCL_STATE_INITIAL,
	TCL_STATE_RATS_SENT,		/* waiting for ATS */
	TCL_STATE_ATS_RCVD,		/* ATS received */
	TCL_STATE_PPS_SENT,		/* waiting for PPS response */
	TCL_STATE_ESTABLISHED,		/* xchg transparent data */
	TCL_STATE_DESELECT_SENT,	/* waiting for DESELECT response */
	TCL_STATE_DESELECTED,		/* card deselected or HLTA'd */
};

struct rfid_protocol rfid_protocol_tcl;

#endif
personal git repositories of Harald Welte. Your mileage may vary