From 6714400909a0718fad83f72465dff9835cd4c53b Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Tue, 19 Oct 2021 06:55:30 +0200 Subject: [PATCH] spiFlashdb: introduce tb_register to know tb location register --- src/spiFlashdb.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/spiFlashdb.hpp b/src/spiFlashdb.hpp index 37c6989..933483c 100644 --- a/src/spiFlashdb.hpp +++ b/src/spiFlashdb.hpp @@ -11,6 +11,11 @@ #include #include +typedef enum { + STATR = 0, /* status register */ + FUNCR = 1 /* function register */ +} tb_loc_t; + typedef struct { std::string manufacturer; /**< manufacturer name */ std::string model; /**< chip name */ @@ -21,6 +26,7 @@ typedef struct { bool has_extended; bool tb_otp; /**< TOP/BOTTOM One Time Programming */ uint8_t tb_offset; /**< TOP/BOTTOM bit offset */ + tb_loc_t tb_register; /**< TOP/BOTTOM location (register) */ uint8_t bp_len; /**< BPx length */ uint8_t bp_offset[4]; /**< BP[0:3] bit offset */ } flash_t; @@ -35,6 +41,7 @@ static std::map flash_list = { .has_extended = true, .tb_otp = false, .tb_offset = (1 << 5), + .tb_register = STATR, .bp_len = 4, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 6)}} }, @@ -47,6 +54,7 @@ static std::map flash_list = { .has_extended = true, .tb_otp = false, .tb_offset = (1 << 5), + .tb_register = STATR, .bp_len = 4, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 6)}} }, @@ -59,6 +67,7 @@ static std::map flash_list = { .has_extended = false, .tb_otp = true, .tb_offset = (1 << 5), + .tb_register = FUNCR, .bp_len = 4, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)}} }, @@ -71,6 +80,7 @@ static std::map flash_list = { .has_extended = false, .tb_otp = true, .tb_offset = (1 << 5), + .tb_register = FUNCR, .bp_len = 4, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)}} }, @@ -83,6 +93,7 @@ static std::map flash_list = { .has_extended = false, .tb_otp = true, .tb_offset = (1 << 5), + .tb_register = FUNCR, .bp_len = 4, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)}} }, @@ -95,6 +106,7 @@ static std::map flash_list = { .has_extended = false, .tb_otp = false, .tb_offset = (1 << 5), + .tb_register = STATR, .bp_len = 3, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), 0}} },