clear remaining 32 reserved bytes
This commit is contained in:
parent
07db20ecb6
commit
383dcc4ea9
|
@ -53,7 +53,7 @@ class StorageInfo(NamedTuple):
|
||||||
|
|
||||||
mag = b[:16]
|
mag = b[:16]
|
||||||
ver, cm, nm = struct.unpack('<HBB', b[16:20])
|
ver, cm, nm = struct.unpack('<HBB', b[16:20])
|
||||||
res = b[20:28]
|
res = b[20:28] + b[245-32:]
|
||||||
d2tab = struct.unpack('<I', b[28:32])
|
d2tab = struct.unpack('<I', b[28:32])
|
||||||
|
|
||||||
mdat = StorageInfoMode.list_from_bytes(b[32:256-32])
|
mdat = StorageInfoMode.list_from_bytes(b[32:256-32])
|
||||||
|
|
|
@ -48,13 +48,18 @@ __attribute__((__packed__)) struct mode_data {
|
||||||
#define MAX_MDT_ELEMENTS ((256 - 64) / sizeof(struct mode_data)) /* should be 16 */
|
#define MAX_MDT_ELEMENTS ((256 - 64) / sizeof(struct mode_data)) /* should be 16 */
|
||||||
|
|
||||||
__attribute__((__packed__)) struct storage_header {
|
__attribute__((__packed__)) struct storage_header {
|
||||||
|
// +0
|
||||||
uint8_t magic[STORAGE_MAGIC_LEN];
|
uint8_t magic[STORAGE_MAGIC_LEN];
|
||||||
|
// +16
|
||||||
uint16_t fwversion;
|
uint16_t fwversion;
|
||||||
uint8_t curmode;
|
uint8_t curmode;
|
||||||
uint8_t nmodes; // *stored* modes, not modes it knows of
|
uint8_t nmodes; // *stored* modes, not modes it knows of
|
||||||
uint8_t reserved[8];
|
uint8_t reserved[8];
|
||||||
uint32_t table_djb2;
|
uint32_t table_djb2;
|
||||||
struct mode_data mode_data_table[MAX_MDT_ELEMENTS];
|
// +32
|
||||||
|
struct mode_data mode_data_table[MAX_MDT_ELEMENTS]; // 192 bytes in size
|
||||||
|
// +224
|
||||||
|
uint8_t reserved2[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: static assert sizeof(struct storage_header) == 256
|
// TODO: static assert sizeof(struct storage_header) == 256
|
||||||
|
|
|
@ -28,6 +28,7 @@ static size_t storage_allocate_new(void) {
|
||||||
|
|
||||||
memcpy(header_tmp.magic, STORAGE_MAGIC, STORAGE_MAGIC_LEN);
|
memcpy(header_tmp.magic, STORAGE_MAGIC, STORAGE_MAGIC_LEN);
|
||||||
memset(header_tmp.reserved, 0xff, sizeof(header_tmp.reserved));
|
memset(header_tmp.reserved, 0xff, sizeof(header_tmp.reserved));
|
||||||
|
memset(header_tmp.reserved2, 0xff, sizeof(header_tmp.reserved2));
|
||||||
memset(header_tmp.mode_data_table, 0xff, sizeof(header_tmp.mode_data_table));
|
memset(header_tmp.mode_data_table, 0xff, sizeof(header_tmp.mode_data_table));
|
||||||
|
|
||||||
header_tmp.fwversion = STORAGE_VER;
|
header_tmp.fwversion = STORAGE_VER;
|
||||||
|
|
Loading…
Reference in New Issue