]>
Commit | Line | Data |
---|---|---|
0db11b71 | 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 | // HitagS emulation (preliminary test version) | |
7 | // | |
8 | // (c) 2016 Oguzhan Cicek, Hendrik Schwartke, Ralf Spenneberg | |
9 | // <info@os-s.de> | |
10 | //----------------------------------------------------------------------------- | |
11 | ||
0db11b71 | 12 | #include <stdlib.h> |
13 | #include <string.h> | |
14 | #include <hitag2.h> | |
15 | ||
16 | #ifndef _HITAGS_H_ | |
17 | #define _HITAGS_H_ | |
18 | ||
19 | //protocol-state | |
20 | typedef enum PROTO_STATE { | |
21 | HT_READY=0, | |
22 | HT_INIT, | |
23 | HT_AUTHENTICATE, | |
24 | HT_SELECTED, | |
25 | HT_QUIET, | |
26 | HT_TTF, | |
27 | HT_FAIL} PSTATE; | |
28 | ||
29 | //tag-state | |
30 | typedef enum TAG_STATE { | |
31 | HT_NO_OP=0, | |
32 | HT_READING_PAGE, | |
33 | HT_WRITING_PAGE_ACK, | |
34 | HT_WRITING_PAGE_DATA, | |
35 | HT_WRITING_BLOCK_DATA} TSATE; | |
36 | ||
37 | //number of start-of-frame bits | |
38 | typedef enum SOF_TYPE { | |
39 | HT_STANDARD=0, | |
40 | HT_ADVANCED, | |
41 | HT_FAST_ADVANCED, | |
42 | HT_ONE, | |
43 | HT_NO_BITS} stype; | |
44 | ||
45 | struct hitagS_tag { | |
46 | PSTATE pstate; //protocol-state | |
47 | TSATE tstate; //tag-state | |
48 | uint32_t uid; | |
49 | uint32_t pages[16][4]; | |
50 | uint64_t key; | |
51 | byte_t pwdl0, pwdl1, pwdh0; | |
52 | //con0 | |
53 | int max_page; | |
54 | stype mode; | |
55 | //con1 | |
56 | bool auth; //0=Plain 1=Auth | |
57 | bool TTFC; //Transponder Talks first coding. 0=Manchester 1=Biphase | |
58 | int TTFDR; //data rate in TTF Mode | |
59 | int TTFM; //the number of pages that are sent to the RWD | |
60 | bool LCON; //0=con1/2 read write 1=con1 read only and con2 OTP | |
61 | bool LKP; //0=page2/3 read write 1=page2/3 read only in Plain mode and no access in authenticate mode | |
62 | //con2 | |
63 | //0=read write 1=read only | |
64 | bool LCK7; //page4/5 | |
65 | bool LCK6; //page6/7 | |
66 | bool LCK5; //page8-11 | |
67 | bool LCK4; //page12-15 | |
68 | bool LCK3; //page16-23 | |
69 | bool LCK2; //page24-31 | |
70 | bool LCK1; //page32-47 | |
71 | bool LCK0; //page48-63 | |
72 | } ; | |
73 | ||
74 | #endif |