1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2020 tharexde
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // Low frequency EM4x50 structs
9 //-----------------------------------------------------------------------------
16 #define EM4X50_NO_WORDS 34
19 #define EM4X50_DEVICE_PASSWORD 0
20 #define EM4X50_PROTECTION 1
21 #define EM4X50_CONTROL 2
22 #define EM4X50_DEVICE_SERIAL 32
23 #define EM4X50_DEVICE_ID 33
25 // control word (word = 4 bytes)
26 #define FIRST_WORD_READ 0 // first byte
27 #define LAST_WORD_READ 1 // second byte
28 #define CONFIG_BLOCK 2 // third byte
29 #define PASSWORD_CHECK 0x80 // first bit in third byte
30 #define READ_AFTER_WRITE 0x40 // second bit in third byte
33 #define FIRST_WORD_READ_PROTECTED 0 // first byte
34 #define LAST_WORD_READ_PROTECTED 1 // second byte
35 #define FIRST_WORD_WRITE_INHIBITED 2 // third byte
36 #define LAST_WORD_WRITE_INHIBITED 3 // fourth byte
39 #define EM4X50_COMMAND_LOGIN 0x01
40 #define EM4X50_COMMAND_RESET 0x80
41 #define EM4X50_COMMAND_WRITE 0x12
42 #define EM4X50_COMMAND_WRITE_PASSWORD 0x11
43 #define EM4X50_COMMAND_SELECTIVE_READ 0x0A
44 #define EM4X50_COMMAND_STANDARD_READ 0x02 // virtual command
47 #define TIMEOUT_CMD 3000
48 #define DUMP_FILESIZE 136
57 } PACKED em4x50_data_t
;
61 } PACKED em4x50_word_t
;
64 extern bool gWritePasswordProcess
;
65 extern uint32_t gPassword
;
67 #endif /* EM4X50_H__ */