]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - common/iso15693tools.h
2 // Adrian Dabrowski 2010 and others, GPLv2
15 #define ISO15_CRC_PRESET (uint16_t)0xFFFF
16 #define ISO15_CRC_POLY (uint16_t)0x8408
17 #define ISO15_CRC_CHECK ((uint16_t)(~0xF0B8 & 0xFFFF)) // use this for checking of a correct crc
21 #define ISO15_REQ_SUBCARRIER_SINGLE 0x00 // Tag should respond using one subcarrier (ASK)
22 #define ISO15_REQ_SUBCARRIER_TWO 0x01 // Tag should respond using two subcarriers (FSK)
23 #define ISO15_REQ_DATARATE_LOW 0x00 // Tag should respond using low data rate
24 #define ISO15_REQ_DATARATE_HIGH 0x02 // Tag should respond using high data rate
25 #define ISO15_REQ_NONINVENTORY 0x00
26 #define ISO15_REQ_INVENTORY 0x04 // This is an inventory request - see inventory flags
27 #define ISO15_REQ_PROTOCOL_NONEXT 0x00
28 #define ISO15_REQ_PROTOCOL_EXT 0x08 // RFU
30 // REQUEST FLAGS when INVENTORY is not set
32 #define ISO15_REQ_SELECT 0x10 // only selected cards response
33 #define ISO15_REQ_ADDRESS 0x20 // this req contains an address
34 #define ISO15_REQ_OPTION 0x40 // Command specific option selector
36 //REQUEST FLAGS when INVENTORY is set
38 #define ISO15_REQINV_AFI 0x10 // AFI Field is present
39 #define ISO15_REQINV_SLOT1 0x20 // 1 Slot
40 #define ISO15_REQINV_SLOT16 0x00 // 16 Slots
41 #define ISO15_REQINV_OPTION 0x40 // Command specific option selector
44 #define ISO15_RES_ERROR 0x01
45 #define ISO15_RES_EXT 0x08 // Protocol Extention
47 // RESPONSE ERROR CODES
48 #define ISO15_NOERROR 0x00
49 #define ISO15_ERROR_CMD_NOT_SUP 0x01 // Command not supported
50 #define ISO15_ERROR_CMD_NOT_REC 0x02 // Command not recognized (eg. parameter error)
51 #define ISO15_ERROR_CMD_OPTION 0x03 // Command option not supported
52 #define ISO15_ERROR_GENERIC 0x0F // No additional Info about this error
53 #define ISO15_ERROR_BLOCK_UNAVAILABLE 0x10
54 #define ISO15_ERROR_BLOCK_LOCKED_ALREADY 0x11 // cannot lock again
55 #define ISO15_ERROR_BLOCK_LOCKED 0x12 // cannot be changed
56 #define ISO15_ERROR_BLOCK_WRITE 0x13 // Writing was unsuccessful
57 #define ISO15_ERROR_BLOCL_WRITELOCK 0x14 // Locking was unsuccessful
60 #define ISO15_CMD_INVENTORY 0x01
61 #define ISO15_CMD_STAYQUIET 0x02
62 #define ISO15_CMD_READ 0x20
63 #define ISO15_CMD_WRITE 0x21
64 #define ISO15_CMD_LOCK 0x22
65 #define ISO15_CMD_READMULTI 0x23
66 #define ISO15_CMD_WRITEMULTI 0x24
67 #define ISO15_CMD_SELECT 0x25
68 #define ISO15_CMD_RESET 0x26
69 #define ISO15_CMD_WRITEAFI 0x27
70 #define ISO15_CMD_LOCKAFI 0x28
71 #define ISO15_CMD_WRITEDSFID 0x29
72 #define ISO15_CMD_LOCKDSFID 0x2A
73 #define ISO15_CMD_SYSINFO 0x2B
74 #define ISO15_CMD_SECSTATUS 0x2C
77 uint16_t Iso15693Crc(uint8_t *v
, int n
);
78 int Iso15693AddCrc(uint8_t *req
, int n
);
79 char* Iso15693sprintUID(char *target
,uint8_t *uid
);
80 unsigned short iclass_crc16(char *data_p
, unsigned short length
);
82 //-----------------------------------------------------------------------------
83 // Map a sequence of octets (~layer 2 command) into the set of bits to feed
84 // to the FPGA, to transmit that command to the tag.
85 // Mode: highspeed && one subcarrier (ASK)
86 //-----------------------------------------------------------------------------
88 // The sampling rate is 106.353 ksps/s, for T = 18.8 us
91 // 1) Unmodulated time of 56.64us
92 // 2) 24 pulses of 423.75khz
93 // 3) logic '1' (unmodulated for 18.88us followed by 8 pulses of 423.75khz)
95 static const int Iso15693FrameSOF
[] = {
96 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
97 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
98 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
99 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
105 static const int Iso15693Logic0
[] = {
111 static const int Iso15693Logic1
[] = {
119 // 1) logic '0' (8 pulses of 423.75khz followed by unmodulated for 18.88us)
120 // 2) 24 pulses of 423.75khz
121 // 3) Unmodulated time of 56.64us
123 static const int Iso15693FrameEOF
[] = {
128 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
129 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
130 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
131 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1