mirror of https://github.com/ARMmbed/mbed-os.git
SFDP: reorganizes internal info structure
parent
6a6904043c
commit
4e1fb07633
|
@ -256,7 +256,7 @@ int QSPIFBlockDevice::init()
|
|||
}
|
||||
|
||||
/**************************** Parse Basic Parameters Table ***********************************/
|
||||
if (0 != _sfdp_parse_basic_param_table(hdr_info.basic_table_addr, hdr_info.basic_table_size)) {
|
||||
if (0 != _sfdp_parse_basic_param_table(hdr_info.bptbl.addr, hdr_info.bptbl.size)) {
|
||||
tr_error("Init - Parse Basic Param Table Failed");
|
||||
status = QSPIF_BD_ERROR_PARSING_FAILED;
|
||||
goto exit_point;
|
||||
|
@ -267,10 +267,10 @@ int QSPIFBlockDevice::init()
|
|||
_device_size_bytes; // If there's no region map, we have a single region sized the entire device size
|
||||
_region_high_boundary[0] = _device_size_bytes - 1;
|
||||
|
||||
if ((hdr_info.sector_map_table_addr != 0) && (0 != hdr_info.sector_map_table_size)) {
|
||||
tr_debug("Init - Parsing Sector Map Table - addr: 0x%lxh, Size: %d", hdr_info.sector_map_table_addr,
|
||||
hdr_info.sector_map_table_size);
|
||||
if (0 != _sfdp_parse_sector_map_table(hdr_info.sector_map_table_addr, hdr_info.sector_map_table_size)) {
|
||||
if ((hdr_info.smtbl.addr != 0) && (0 != hdr_info.smtbl.size)) {
|
||||
tr_debug("Init - Parsing Sector Map Table - addr: 0x%lxh, Size: %d", hdr_info.smtbl.addr,
|
||||
hdr_info.smtbl.size);
|
||||
if (0 != _sfdp_parse_sector_map_table(hdr_info.smtbl.addr, hdr_info.smtbl.size)) {
|
||||
tr_error("Init - Parse Sector Map Table Failed");
|
||||
status = QSPIF_BD_ERROR_PARSING_FAILED;
|
||||
goto exit_point;
|
||||
|
|
|
@ -189,7 +189,7 @@ int SPIFBlockDevice::init()
|
|||
|
||||
|
||||
/**************************** Parse Basic Parameters Table ***********************************/
|
||||
if (0 != _sfdp_parse_basic_param_table(hdr_info.basic_table_addr, hdr_info.basic_table_size)) {
|
||||
if (0 != _sfdp_parse_basic_param_table(hdr_info.bptbl.addr, hdr_info.bptbl.size)) {
|
||||
tr_error("init - Parse Basic Param Table Failed");
|
||||
status = SPIF_BD_ERROR_PARSING_FAILED;
|
||||
goto exit_point;
|
||||
|
@ -200,10 +200,10 @@ int SPIFBlockDevice::init()
|
|||
_device_size_bytes; // If there's no region map, we have a single region sized the entire device size
|
||||
_region_high_boundary[0] = _device_size_bytes - 1;
|
||||
|
||||
if ((hdr_info.sector_map_table_addr != 0) && (0 != hdr_info.sector_map_table_size)) {
|
||||
tr_debug("init - Parsing Sector Map Table - addr: 0x%" PRIx32 "h, Size: %d", hdr_info.sector_map_table_addr,
|
||||
hdr_info.sector_map_table_size);
|
||||
if (0 != _sfdp_parse_sector_map_table(hdr_info.sector_map_table_addr, hdr_info.sector_map_table_size)) {
|
||||
if ((hdr_info.smtbl.addr != 0) && (0 != hdr_info.smtbl.size)) {
|
||||
tr_debug("init - Parsing Sector Map Table - addr: 0x%" PRIx32 "h, Size: %d", hdr_info.smtbl.addr,
|
||||
hdr_info.smtbl.size);
|
||||
if (0 != _sfdp_parse_sector_map_table(hdr_info.smtbl.addr, hdr_info.smtbl.size)) {
|
||||
tr_error("init - Parse Sector Map Table Failed");
|
||||
status = SPIF_BD_ERROR_PARSING_FAILED;
|
||||
goto exit_point;
|
||||
|
|
|
@ -28,12 +28,22 @@ namespace mbed {
|
|||
static const int SFDP_HEADER_SIZE = 8; ///< Size of an SFDP header */
|
||||
static const int SFDP_BASIC_PARAMS_TBL_SIZE = 80; ///< Basic Parameter Table size in Bytes, 20 DWORDS */
|
||||
|
||||
/** SFDP Basic Parameter Table info */
|
||||
struct sfdp_bptbl_info {
|
||||
uint32_t addr;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
/** SFDP Sector Map Table info */
|
||||
struct sfdp_smtbl_info {
|
||||
uint32_t addr;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
/** SFDP Parameter Table addresses and sizes */
|
||||
struct sfdp_hdr_info {
|
||||
uint32_t basic_table_addr; // Basic Parameter Table address
|
||||
size_t basic_table_size; // Basic Parameter Table size
|
||||
uint32_t sector_map_table_addr; // Sector Map Parameter Table address
|
||||
size_t sector_map_table_size; // Sector Map Parameter Table size
|
||||
sfdp_bptbl_info bptbl;
|
||||
sfdp_smtbl_info smtbl;
|
||||
};
|
||||
|
||||
/** SFDP Header */
|
||||
|
|
|
@ -67,13 +67,13 @@ int sfdp_parse_single_param_header(sfdp_prm_hdr *phdr, sfdp_hdr_info &hdr_info)
|
|||
|
||||
if ((phdr->PID_LSB == 0) && (sfdp_get_param_id_msb(phdr->DWORD2) == 0xFF)) {
|
||||
tr_debug("Parameter Header: Basic Parameter Header");
|
||||
hdr_info.basic_table_addr = sfdp_get_param_tbl_ptr(phdr->DWORD2);
|
||||
hdr_info.basic_table_size = std::min((phdr->P_LEN * 4), SFDP_BASIC_PARAMS_TBL_SIZE);
|
||||
hdr_info.bptbl.addr = sfdp_get_param_tbl_ptr(phdr->DWORD2);
|
||||
hdr_info.bptbl.size = std::min((phdr->P_LEN * 4), SFDP_BASIC_PARAMS_TBL_SIZE);
|
||||
|
||||
} else if ((phdr->PID_LSB == 0x81) && (sfdp_get_param_id_msb(phdr->DWORD2) == 0xFF)) {
|
||||
tr_debug("Parameter Header: Sector Map Parameter Header");
|
||||
hdr_info.sector_map_table_addr = sfdp_get_param_tbl_ptr(phdr->DWORD2);
|
||||
hdr_info.sector_map_table_size = phdr->P_LEN * 4;
|
||||
hdr_info.smtbl.addr = sfdp_get_param_tbl_ptr(phdr->DWORD2);
|
||||
hdr_info.smtbl.size = phdr->P_LEN * 4;
|
||||
|
||||
} else {
|
||||
tr_debug("Parameter Header vendor specific or unknown. Parameter ID LSB: 0x%" PRIX8 "; MSB: 0x%" PRIX8 "",
|
||||
|
|
Loading…
Reference in New Issue