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,
39 } PACKED rht2d_password
;
44 } PACKED rht2d_authenticate
;
49 } PACKED rht2d_crypto
;
53 rht2d_authenticate auth
;
58 //---------------------------------------------------------
60 //---------------------------------------------------------
61 typedef enum PROTO_STATE
{READY
=0,INIT
,AUTHENTICATE
,SELECTED
,QUIET
,TTF
,FAIL
} PSTATE
; //protocol-state
62 typedef enum TAG_STATE
{NO_OP
=0,READING_PAGE
,READING_BLOCK
,WRITING_PAGE_ACK
,WRITING_PAGE_DATA
,WRITING_BLOCK_DATA
} TSATE
; //tag-state
63 typedef enum SOF_TYPE
{STANDARD
=0,ADVANCED
,FAST_ADVANCED
,ONE
,NO_BITS
} stype
; //number of start-of-frame bits
66 PSTATE pstate
; //protocol-state
67 TSATE tstate
; //tag-state
71 uint8_t pwdl0
, pwdl1
, pwdh0
;
76 bool auth
; //0=Plain 1=Auth
77 bool TTFC
; //Transponder Talks first coding. 0=Manchester 1=Biphase
78 int TTFDR
; //data rate in TTF Mode
79 int TTFM
; //the number of pages that are sent to the RWD
80 bool LCON
; //0=con1/2 read write 1=con1 read only and con2 OTP
81 bool LKP
; //0=page2/3 read write 1=page2/3 read only in Plain mode and no access in authenticate mode
83 //0=read write 1=read only
87 bool LCK4
; //page12-15
88 bool LCK3
; //page16-23
89 bool LCK2
; //page24-31
90 bool LCK1
; //page32-47
91 bool LCK0
; //page48-63