1 //-----------------------------------------------------------------------------
2 // (c) RFID Research Group - 2019
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
8 //-----------------------------------------------------------------------------
9 // RDV4 flash constants
10 //-----------------------------------------------------------------------------
18 // 256kb divided into 4k sectors.
20 // 0x3F000 - 1 4kb sector = signature
21 // 0x3E000 - 1 4kb sector = settings
22 // 0x3D000 - 1 4kb sector = default T55XX keys dictionary
23 // 0x3B000 - 1 4kb sector = default ICLASS keys dictionary
24 // 0x39000 - 2 4kb sectors = default MFC keys dictionary
26 #ifndef FLASH_MEM_BLOCK_SIZE
27 # define FLASH_MEM_BLOCK_SIZE 256
30 #ifndef FLASH_MEM_MAX_SIZE
31 # define FLASH_MEM_MAX_SIZE 0x40000 // (262144)
34 #ifndef FLASH_MEM_MAX_4K_SECTOR
35 # define FLASH_MEM_MAX_4K_SECTOR 0x3F000
38 #ifndef FLASH_MEM_ID_LEN
39 # define FLASH_MEM_ID_LEN 8
42 #ifndef FLASH_MEM_SIGNATURE_LEN
43 # define FLASH_MEM_SIGNATURE_LEN 128
46 #ifndef FLASH_MEM_SIGNATURE_OFFSET
47 // -1 for historical compatibility with already released Proxmark3 RDV4.0 devices
48 # define FLASH_MEM_SIGNATURE_OFFSET (FLASH_MEM_MAX_SIZE - FLASH_MEM_SIGNATURE_LEN - 1)
51 #ifndef T55XX_CONFIG_LEN
52 # define T55XX_CONFIG_LEN sizeof( t55xx_configurations_t )
55 #ifndef T55XX_CONFIG_OFFSET
56 # define T55XX_CONFIG_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x2000)
59 // Reserved space for T55XX PWD = 4 kb
60 #ifndef DEFAULT_T55XX_KEYS_OFFSET
61 # define DEFAULT_T55XX_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x3000)
64 // Reserved space for iClass keys = 4 kb
65 #ifndef DEFAULT_ICLASS_KEYS_OFFSET
66 # define DEFAULT_ICLASS_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x4000)
69 // Reserved space for MIFARE Keys = 8 kb
70 #ifndef DEFAULT_MF_KEYS_OFFSET
71 # define DEFAULT_MF_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x6000)
74 // RDV40, validation structure to help identifying that client/firmware is talking with RDV40
77 uint8_t flashid
[FLASH_MEM_ID_LEN
];
78 uint8_t signature
[FLASH_MEM_SIGNATURE_LEN
];
79 } PACKED rdv40_validation_t
;
81 // SPIFFS current allocates 128kb of the 256kb available.
82 #ifndef FLASH_SPIFFS_ALLOCATED_SIZE
83 # define FLASH_SPIFFS_ALLOCATED_SIZE (1024 * 128)