Usb Lowlevel Format 501 Upgrade Code
#define BLOCKS_TOTAL (1024*1024) // example #define CHECKPOINT_INTERVAL 128 #define CHK_AREA_ADDR 0x10000 #define METADATA_ADDR 0x20000
if (resume) if (!load_checkpoint(&checkpoint) else memset(&checkpoint,0,sizeof(checkpoint)); checkpoint.magic = 0x4C4C464D; // 'LLFM' checkpoint.version = 0x5001; checkpoint.cur_block = 0; checkpoint.phase = PH_ERASE; persist_checkpoint(&checkpoint); usb lowlevel format 501 upgrade code
typedef enum PH_INIT, PH_ERASE, PH_MAP, PH_META, PH_COMMIT, PH_CLEAN phase_t; checkpoint.magic = 0x4C4C464D
typedef struct uint32_t magic; uint32_t version; uint32_t cur_block; uint32_t phase; uint32_t crc32; uint32_t reserved[3]; checkpoint_t; // 'LLFM' checkpoint.version = 0x5001