Skip to content

Commit d3b65d5

Browse files
author
Veijo Pesonen
committed
QSPIFBlockDevice: refactoring _sfdp_parse_basic_param_table
1 parent 6a60574 commit d3b65d5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int QSPIFBlockDevice::init()
241241

242242
/**************************** Parse Basic Parameters Table ***********************************/
243243
if (_sfdp_parse_basic_param_table(callback(this, &QSPIFBlockDevice::_qspi_send_read_sfdp_command),
244-
_sfdp_info.bptbl.addr, _sfdp_info.bptbl.size) < 0) {
244+
_sfdp_info) < 0) {
245245
tr_error("Init - Parse Basic Param Table Failed");
246246
status = QSPIF_BD_ERROR_PARSING_FAILED;
247247
goto exit_point;
@@ -616,11 +616,11 @@ int QSPIFBlockDevice::remove_csel_instance(PinName csel)
616616
/********** SFDP Parsing and Detection Functions *********/
617617
/*********************************************************/
618618
int QSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
619-
uint32_t basic_table_addr, size_t basic_table_size)
619+
sfdp_hdr_info &sfdp_info)
620620
{
621621
uint8_t param_table[SFDP_BASIC_PARAMS_TBL_SIZE]; /* Up To 20 DWORDS = 80 Bytes */
622622

623-
int status = sfdp_reader(basic_table_addr, param_table, basic_table_size);
623+
int status = sfdp_reader(sfdp_info.bptbl.addr, param_table, sfdp_info.bptbl.size);
624624
if (status != QSPI_STATUS_OK) {
625625
tr_error("Init - Read SFDP First Table Failed");
626626
return -1;
@@ -640,7 +640,7 @@ int QSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, void
640640
_device_size_bytes = (density_bits + 1) / 8;
641641

642642
// Set Page Size (QSPI write must be done on Page limits)
643-
_page_size_bytes = sfdp_detect_page_size(param_table, basic_table_size);
643+
_page_size_bytes = sfdp_detect_page_size(param_table, sfdp_info.bptbl.size);
644644

645645
if (_sfdp_detect_reset_protocol_and_reset(param_table) != QSPIF_BD_ERROR_OK) {
646646
tr_error("Init - Detecting reset protocol/resetting failed");
@@ -657,7 +657,7 @@ int QSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, void
657657
}
658658

659659
// Detect and Set fastest Bus mode (default 1-1-1)
660-
_sfdp_detect_best_bus_read_mode(param_table, basic_table_size, shouldSetQuadEnable, is_qpi_mode);
660+
_sfdp_detect_best_bus_read_mode(param_table, sfdp_info.bptbl.size, shouldSetQuadEnable, is_qpi_mode);
661661
if (true == shouldSetQuadEnable) {
662662
if (_needs_fast_mode) {
663663
_enable_fast_mode();
@@ -677,7 +677,7 @@ int QSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, void
677677
#ifndef TARGET_NORDIC
678678
// 4 byte addressing is not currently supported with the Nordic QSPI controller
679679
if (_attempt_4_byte_addressing) {
680-
if (_sfdp_detect_and_enable_4byte_addressing(param_table, basic_table_size) != QSPIF_BD_ERROR_OK) {
680+
if (_sfdp_detect_and_enable_4byte_addressing(param_table, sfdp_info.bptbl.size) != QSPIF_BD_ERROR_OK) {
681681
tr_error("Init - Detecting/enabling 4-byte addressing failed");
682682
return -1;
683683
}

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
318318
/****************************************/
319319
// Parse and Detect required Basic Parameters from Table
320320
int _sfdp_parse_basic_param_table(mbed::Callback<int(mbed::bd_addr_t, void *, mbed::bd_size_t)> sfdp_reader,
321-
uint32_t basic_table_addr, size_t basic_table_size);
321+
mbed::sfdp_hdr_info &sfdp_info);
322322

323323
// Detect the soft reset protocol and reset - returns error if soft reset is not supported
324324
int _sfdp_detect_reset_protocol_and_reset(uint8_t *basic_param_table_ptr);

0 commit comments

Comments
 (0)