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
5 //-----------------------------------------------------------------------------
8 // (c) 2012 Roel Verdult
9 // (c) 2016 Oguzhan Cicek, Hendrik Schwartke, Ralf Spenneberg
11 //-----------------------------------------------------------------------------
20 #define PACKED __attribute__((packed))
29 RHT2F_AUTHENTICATE
= 22,
32 RHT2F_TEST_AUTH_ATTEMPTS
= 25,
38 } PACKED rht2d_password
;
43 } PACKED rht2d_authenticate
;
48 } PACKED rht2d_crypto
;
52 rht2d_authenticate auth
;
57 //---------------------------------------------------------
59 //---------------------------------------------------------
60 typedef enum PROTO_STATE
{READY
=0,INIT
,AUTHENTICATE
,SELECTED
,QUIET
,TTF
,FAIL
} PSTATE
; //protocol-state
61 typedef enum TAG_STATE
{NO_OP
=0,READING_PAGE
,READING_BLOCK
,WRITING_PAGE_ACK
,WRITING_PAGE_DATA
,WRITING_BLOCK_DATA
} TSATE
; //tag-state
62 typedef enum SOF_TYPE
{STANDARD
=0,ADVANCED
,FAST_ADVANCED
,ONE
,NO_BITS
} stype
; //number of start-of-frame bits
65 PSTATE pstate
; //protocol-state
66 TSATE tstate
; //tag-state
70 uint8_t pwdl0
, pwdl1
, pwdh0
;
75 bool auth
; //0=Plain 1=Auth
76 bool TTFC
; //Transponder Talks first coding. 0=Manchester 1=Biphase
77 int TTFDR
; //data rate in TTF Mode
78 int TTFM
; //the number of pages that are sent to the RWD
79 bool LCON
; //0=con1/2 read write 1=con1 read only and con2 OTP
80 bool LKP
; //0=page2/3 read write 1=page2/3 read only in Plain mode and no access in authenticate mode
82 //0=read write 1=read only
86 bool LCK4
; //page12-15
87 bool LCK3
; //page16-23
88 bool LCK2
; //page24-31
89 bool LCK1
; //page32-47
90 bool LCK0
; //page48-63