fix for client crash in lf hitag eload. Hitag simulation still now working (wip)
[RRG-proxmark3.git] / common / iso15693tools.h
blobbce7eb68dc477ef5d9e32cc450c5a2ab3e78e871
1 //-----------------------------------------------------------------------------
2 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
3 // at your option, any later version. See the LICENSE.txt file for the text of
4 // the license.
5 //-----------------------------------------------------------------------------
6 // ISO15693 other commons
7 //-----------------------------------------------------------------------------
8 // Adrian Dabrowski 2010 and otherss
9 // Christian Herrmann 2018
11 #ifndef ISO15693_H__
12 #define ISO15693_H__
14 #include "common.h"
16 // REQUEST FLAGS
17 #define ISO15_REQ_SUBCARRIER_SINGLE 0x00 // Tag should respond using one subcarrier (ASK)
18 #define ISO15_REQ_SUBCARRIER_TWO 0x01 // Tag should respond using two subcarriers (FSK)
19 #define ISO15_REQ_DATARATE_LOW 0x00 // Tag should respond using low data rate
20 #define ISO15_REQ_DATARATE_HIGH 0x02 // Tag should respond using high data rate
21 #define ISO15_REQ_NONINVENTORY 0x00
22 #define ISO15_REQ_INVENTORY 0x04 // This is an inventory request - see inventory flags
23 #define ISO15_REQ_PROTOCOL_NONEXT 0x00
24 #define ISO15_REQ_PROTOCOL_EXT 0x08 // RFU
26 // REQUEST FLAGS when INVENTORY is not set
27 #define ISO15_REQ_SELECT 0x10 // only selected cards response
28 #define ISO15_REQ_ADDRESS 0x20 // this req contains an address
29 #define ISO15_REQ_OPTION 0x40 // Command specific option selector
31 //REQUEST FLAGS when INVENTORY is set
32 #define ISO15_REQINV_AFI 0x10 // AFI Field is present
33 #define ISO15_REQINV_SLOT1 0x20 // 1 Slot
34 #define ISO15_REQINV_SLOT16 0x00 // 16 Slots
35 #define ISO15_REQINV_OPTION 0x40 // Command specific option selector
37 //RESPONSE FLAGS
38 #define ISO15_RES_ERROR 0x01
39 #define ISO15_RES_EXT 0x08 // Protocol Extention
41 // RESPONSE ERROR CODES
42 #define ISO15_NOERROR 0x00
43 #define ISO15_ERROR_CMD_NOT_SUP 0x01 // Command not supported
44 #define ISO15_ERROR_CMD_NOT_REC 0x02 // Command not recognized (eg. parameter error)
45 #define ISO15_ERROR_CMD_OPTION 0x03 // Command option not supported
46 #define ISO15_ERROR_GENERIC 0x0F // No additional Info about this error
47 #define ISO15_ERROR_BLOCK_UNAVAILABLE 0x10
48 #define ISO15_ERROR_BLOCK_LOCKED_ALREADY 0x11 // cannot lock again
49 #define ISO15_ERROR_BLOCK_LOCKED 0x12 // cannot be changed
50 #define ISO15_ERROR_BLOCK_WRITE 0x13 // Writing was unsuccessful
51 #define ISO15_ERROR_BLOCL_WRITELOCK 0x14 // Locking was unsuccessful
53 //-----------------------------------------------------------------------------
54 // Map a sequence of octets (~layer 2 command) into the set of bits to feed
55 // to the FPGA, to transmit that command to the tag.
56 // Mode: highspeed && one subcarrier (ASK)
57 //-----------------------------------------------------------------------------
59 // The sampling rate is 106.353 ksps/s, for T = 18.8 us
61 // SOF defined as
62 // 1) Unmodulated time of 56.64us
63 // 2) 24 pulses of 423.75kHz
64 // 3) logic '1' (unmodulated for 18.88us followed by 8 pulses of 423.75kHz)
66 static const int Iso15693FrameSOF[] = {
67 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
68 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
69 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
70 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
71 -1, -1, -1, -1,
72 -1, -1, -1, -1,
73 1, 1, 1, 1,
74 1, 1, 1, 1
76 static const int Iso15693Logic0[] = {
77 1, 1, 1, 1,
78 1, 1, 1, 1,
79 -1, -1, -1, -1,
80 -1, -1, -1, -1
82 static const int Iso15693Logic1[] = {
83 -1, -1, -1, -1,
84 -1, -1, -1, -1,
85 1, 1, 1, 1,
86 1, 1, 1, 1
89 // EOF defined as
90 // 1) logic '0' (8 pulses of 423.75kHz followed by unmodulated for 18.88us)
91 // 2) 24 pulses of 423.75kHz
92 // 3) Unmodulated time of 56.64us
93 static const int Iso15693FrameEOF[] = {
94 1, 1, 1, 1,
95 1, 1, 1, 1,
96 -1, -1, -1, -1,
97 -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,
100 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
101 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
104 char *iso15693_sprintUID(char *dest, uint8_t *uid);
106 #endif