be203d4972d880df80acca56d9dca60724929ca5
[rfid/librfid.git] / gemtag / gemtag.h
1 /*
2  * (C) 2006 by Frank Zirkelbach <hackbard@hackdaworld.org>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License version 2 
6  *  as published by the Free Software Foundation
7  *
8  *  This program is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *  GNU General Public License for more details.
12  *
13  *  You should have received a copy of the GNU General Public License
14  *  along with this program; if not, write to the Free Software
15  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16  */
17
18 #ifndef _GEMTAG_H
19 #define _GEMTAG_H
20
21 #define USB_VENDOR_GEMTAG       0x1394
22 #define USB_DEVICE_X501         0x0501
23
24 struct gemtag_handle {
25         struct usb_dev_handle *handle;
26         unsigned char seq;
27         unsigned char caps;
28         unsigned char snr[4];
29 };
30
31 #define GEMTAG_CAP_CRC                  0x01
32 #define GEMTAG_CAP_VERB_TRANSMIT        0x02
33
34 struct gemtag_cmd_hdr {
35         unsigned char start;
36         unsigned char seq;
37         unsigned char cmd;
38         u_int16_t len;
39 } __attribute__ ((packed));
40
41 #define BAD_CRC                         0x01
42 #define SEQ_MISMATCH                    0x02
43 #define SHORT_ANSWER                    0x03
44
45 /* gemtag commands */
46
47 #define GEMTAG_CMD_GET_FW_VERSION       0x63
48 #define GEMTAG_CMD_GET_RIC_VERSION      0x64
49
50 #define GEMTAG_CMD_SET_CPU_TIMEOUT      0x88
51
52
53 #define GEMTAG_CMD_PICC_EXCHANGE_BLOCK  0x48
54
55
56
57 #define GEMTAG_CMD_PICC_ACTIVATE_IDLE   0x43
58 #define GEMTAG_CMD_PICC_ACTIVATE_WAKEUP 0x44
59
60 #define GEMTAG_CMD_PICC_REQUEST         0x40
61 #define GEMTAG_PICC_REQALL              0x52
62 #define GEMTAG_PICC_REQIDL              0x26
63
64 #define GEMTAG_CMD_PICC_CASC_ANTICOLL   0x41
65 #define GEMTAG_CMD_PICC_CASC_SELECT     0x42
66 #define GEMTAG_PICC_STD_SELECT_CODE     0x93
67 #define GEMTAG_PICC_CASC_LEVEL1         0x95
68 #define GEMTAG_PICC_CASC_LEVEL2         0x97
69
70 #define GEMTAG_CMD_PCD_CONFIG           0x10
71 #define GEMTAG_CMD_PICC_ANTICOLL        0x12
72 #define GEMTAG_CMD_PICC_SELECT          0x13
73
74 #define GEMTAG_CMD_PICC_AUTH            0x14
75 #define GEMTAG_CMD_PICC_AUTH_E2         0x15
76 #define GEMTAG_CMD_HOST_CODE_KEY        0x16
77 #define GEMTAG_CMD_PCD_LOAD_KEY_E2      0x17
78 #define GEMTAG_CMD_PICC_AUTH_KEY        0x18
79 #define GEMTAG_PICC_AUTHENT1A
80 #define GEMTAG_PICC_AUTHENT1B
81
82 #define GEMTAG_CMD_PICC_READ            0x19
83 #define GEMTAG_CMD_PICC_WRITE           0x1a
84 #define GEMTAG_CMD_PICC_VALUE           0x1b
85 #define GEMTAG_CMD_PICC_VALUE_DEBIT     0x1c
86 #define GEMTAG_PICC_INCREMENT           
87 #define GEMTAG_PICC_DECREMENT           
88 #define GEMTAG_PICC_RESTORE
89 #define GEMTAG_CMD_PICC_HALT            0x1d
90 #define GEMTAG_CMD_PICC_WRITE4          0x1e
91 #define GEMTAG_CMD_COMMON_WRITE         0x1f
92 #define GEMTAG_PICC_WRITE16
93 #define GEMTAG_PICC_WRITE4
94
95 #define GEMTAG_CMD_PCD_RF_RESET         0x20
96
97 #define GEMTAG_CMD_GET_SERIAL_NUMBER    0x22
98
99 #define GEMTAG_CMD_PCD_READ_E2          0x23
100 #define GEMTAG_CMD_PCD_WRITE_E2         0x24
101
102 #define GEMTAG_CMD_PCD_SET_TMO          0x27
103
104 #define GEMTAG_CMD_PICC_COMMON_READ     0x28
105 #define GEMTAG_PICC_READ16
106
107 #define GEMTAG_CMD_SET_ATTRIBUTES       0x46
108 #define GEMTAG_CMD_SET_DFLT_ATTRIBUTES  0x45
109
110 #define GEMTAG_CMD_PPS_REQUEST          0xa0
111 #define GEMTAG_CMD_DESELECT             0xa1
112
113 #define GEMTAG_CMD_SET_DEFAULT_BAUDRATE 0x81
114 #define GEMTAG_CMD_SET_ONLINE_BAUDRATE  0x82
115
116 #define GEMTAG_CMD_SWITCH_LED           0x60
117 #define GEMTAG_LED_OFF                  0x00
118 #define GEMTAG_LED_ON                   0x01
119
120 #define GEMTAG_CMD_DETECT_CARD          0x92
121 #define GEMTAG_CMD_DETECT_ISO15693_CARD 0x93
122
123
124 #endif