@@ -53,7 +53,6 @@ using namespace mbed;
53
53
54
54
/* Basic Parameters Table Parsing */
55
55
/* *********************************/
56
- #define SFDP_DEFAULT_BASIC_PARAMS_TABLE_SIZE_BYTES 64 /* 16 DWORDS */
57
56
// READ Instruction support according to BUS Configuration
58
57
#define QSPIF_BASIC_PARAM_TABLE_FAST_READ_SUPPORT_BYTE 2
59
58
#define QSPIF_BASIC_PARAM_TABLE_QPI_READ_SUPPORT_BYTE 16
@@ -270,7 +269,8 @@ int QSPIFBlockDevice::init()
270
269
if ((hdr_info.smtbl .addr != 0 ) && (0 != hdr_info.smtbl .size )) {
271
270
tr_debug (" Init - Parsing Sector Map Table - addr: 0x%lxh, Size: %d" , hdr_info.smtbl .addr ,
272
271
hdr_info.smtbl .size );
273
- if (0 != _sfdp_parse_sector_map_table (hdr_info.smtbl .addr , hdr_info.smtbl .size )) {
272
+ if (_sfdp_parse_sector_map_table (callback (this , &QSPIFBlockDevice::_qspi_send_read_sfdp_command),
273
+ hdr_info.smtbl ) < 0 ) {
274
274
tr_error (" Init - Parse Sector Map Table Failed" );
275
275
status = QSPIF_BD_ERROR_PARSING_FAILED;
276
276
goto exit_point;
@@ -629,7 +629,7 @@ int QSPIFBlockDevice::remove_csel_instance(PinName csel)
629
629
/* ********************************************************/
630
630
int QSPIFBlockDevice::_sfdp_parse_basic_param_table (uint32_t basic_table_addr, size_t basic_table_size)
631
631
{
632
- uint8_t param_table[SFDP_DEFAULT_BASIC_PARAMS_TABLE_SIZE_BYTES ]; /* Up To 16 DWORDS = 64 Bytes */
632
+ uint8_t param_table[SFDP_BASIC_PARAMS_TBL_SIZE ]; /* Up To 16 DWORDS = 64 Bytes */
633
633
634
634
int status = _qspi_send_read_sfdp_command (basic_table_addr, (char *)param_table, basic_table_size);
635
635
if (status != QSPI_STATUS_OK) {
@@ -1103,17 +1103,18 @@ int QSPIFBlockDevice::_sfdp_detect_reset_protocol_and_reset(uint8_t *basic_param
1103
1103
return status;
1104
1104
}
1105
1105
1106
- int QSPIFBlockDevice::_sfdp_parse_sector_map_table (uint32_t sector_map_table_addr, size_t sector_map_table_size)
1106
+ int QSPIFBlockDevice::_sfdp_parse_sector_map_table (Callback<int (bd_addr_t , void *, bd_size_t )> sfdp_reader,
1107
+ sfdp_smtbl_info &smtbl)
1107
1108
{
1108
- uint8_t sector_map_table[SFDP_DEFAULT_BASIC_PARAMS_TABLE_SIZE_BYTES ]; /* Up To 16 DWORDS = 64 Bytes */
1109
+ uint8_t sector_map_table[SFDP_BASIC_PARAMS_TBL_SIZE ]; /* Up To 16 DWORDS = 64 Bytes */
1109
1110
uint32_t tmp_region_size = 0 ;
1110
1111
int i_ind = 0 ;
1111
1112
int prev_boundary = 0 ;
1112
1113
// Default set to all type bits 1-4 are common
1113
1114
int min_common_erase_type_bits = ERASE_BITMASK_ALL;
1114
1115
1115
- int status = _qspi_send_read_sfdp_command (sector_map_table_addr, ( char *) sector_map_table, sector_map_table_size );
1116
- if (status != QSPI_STATUS_OK ) {
1116
+ int status = sfdp_reader (smtbl. addr , sector_map_table, smtbl. size );
1117
+ if (status < 0 ) {
1117
1118
tr_error (" Init - Read SFDP First Table Failed" );
1118
1119
return -1 ;
1119
1120
}
0 commit comments