Skip to content

Commit b5e7dd9

Browse files
committed
SFDP: Add more parameters to the reader callback
The SFDP functions parse SFDP data which is fetched by a callback called `sfdp_reader` provided by {SPIF,QSPIF,OSPIF}BlockDevice. Currently, this callback interface only takes a read address and an RX buffer to store output data. This has been enough, because other SPI parameters are always the same when fetching the SFDP table only - they are just hardcoded in each reader. But in the future we will add support for flash devices with multiple configurations (in a subsequent commit), and to detect which configuration is enabled, we will need to send detection commands which require device-dependent SPI parameters: * address size * instruction * dummy cycles This commit * turns the above SPI parameters from predefined/hardcoded values into parameters of the callback * lets the SFDP functions pass the above parameters to the callback (Note: To read the SFDP table itself, those values are constants defined by the standard, not tied to any particular device, so they can be known to the SFDP functions) * updates the callbacks implemented by {SPIF,QSPIF,OSPIF}BlockDevice * updates the mock callback for unit tests and expectations
1 parent 2581254 commit b5e7dd9

File tree

9 files changed

+227
-55
lines changed

9 files changed

+227
-55
lines changed

storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ class OSPIFBlockDevice : public mbed::BlockDevice {
327327
mbed::bd_size_t tx_length, const char *rx_buffer, mbed::bd_size_t rx_length);
328328

329329
// Send command to read from the SFDP table
330-
int _ospi_send_read_sfdp_command(mbed::bd_addr_t addr, void *rx_buffer, mbed::bd_size_t rx_length);
330+
int _ospi_send_read_sfdp_command(mbed::bd_addr_t addr, mbed::sfdp_cmd_addr_size_t addr_size,
331+
uint8_t inst, uint8_t dummy_cycles,
332+
void *rx_buffer, mbed::bd_size_t rx_length);
331333

332334
// Read the contents of status registers 1 and 2 into a buffer (buffer must have a length of 2)
333335
ospi_status_t _ospi_read_status_registers(uint8_t *reg_buffer);
@@ -366,11 +368,11 @@ class OSPIFBlockDevice : public mbed::BlockDevice {
366368
/* SFDP Detection and Parsing Functions */
367369
/****************************************/
368370
// Parse and Detect required Basic Parameters from Table
369-
int _sfdp_parse_basic_param_table(mbed::Callback<int(mbed::bd_addr_t, void *, mbed::bd_size_t)> sfdp_reader,
371+
int _sfdp_parse_basic_param_table(mbed::Callback<int(mbed::bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, mbed::bd_size_t)> sfdp_reader,
370372
mbed::sfdp_hdr_info &sfdp_info);
371373

372374
// Parse and Detect 4-Byte Address Instruction Parameters from Table
373-
int _sfdp_parse_4_byte_inst_table(mbed::Callback<int(mbed::bd_addr_t, void *, mbed::bd_size_t)> sfdp_reader,
375+
int _sfdp_parse_4_byte_inst_table(mbed::Callback<int(mbed::bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, mbed::bd_size_t)> sfdp_reader,
374376
mbed::sfdp_hdr_info &sfdp_info);
375377

376378
// Detect the soft reset protocol and reset - returns error if soft reset is not supported

storage/blockdevice/COMPONENT_OSPIF/source/OSPIFBlockDevice.cpp

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -921,12 +921,19 @@ int OSPIFBlockDevice::remove_csel_instance(PinName csel)
921921
/*********************************************************/
922922
/********** SFDP Parsing and Detection Functions *********/
923923
/*********************************************************/
924-
int OSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
924+
int OSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader,
925925
sfdp_hdr_info &sfdp_info)
926926
{
927927
uint8_t param_table[SFDP_BASIC_PARAMS_TBL_SIZE]; /* Up To 20 DWORDS = 80 Bytes */
928928

929-
int status = sfdp_reader(sfdp_info.bptbl.addr, param_table, sfdp_info.bptbl.size);
929+
int status = sfdp_reader(
930+
sfdp_info.bptbl.addr,
931+
SFDP_READ_CMD_ADDR_TYPE,
932+
SFDP_READ_CMD_INST,
933+
SFDP_READ_CMD_DUMMY_CYCLES,
934+
param_table,
935+
sfdp_info.bptbl.size
936+
);
930937
if (status != OSPI_STATUS_OK) {
931938
tr_error("Init - Read SFDP First Table Failed");
932939
return -1;
@@ -1383,12 +1390,19 @@ int OSPIFBlockDevice::_sfdp_detect_reset_protocol_and_reset(uint8_t *basic_param
13831390
return status;
13841391
}
13851392

1386-
int OSPIFBlockDevice::_sfdp_parse_4_byte_inst_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
1393+
int OSPIFBlockDevice::_sfdp_parse_4_byte_inst_table(Callback<int(mbed::bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, mbed::bd_size_t)> sfdp_reader,
13871394
sfdp_hdr_info &sfdp_info)
13881395
{
13891396
uint8_t four_byte_inst_table[SFDP_DEFAULT_4_BYTE_INST_TABLE_SIZE_BYTES]; /* Up To 2 DWORDS = 8 Bytes */
13901397

1391-
int status = sfdp_reader(sfdp_info.fbatbl.addr, four_byte_inst_table, sfdp_info.fbatbl.size);
1398+
int status = sfdp_reader(
1399+
sfdp_info.fbatbl.addr,
1400+
SFDP_READ_CMD_ADDR_TYPE,
1401+
SFDP_READ_CMD_INST,
1402+
SFDP_READ_CMD_DUMMY_CYCLES,
1403+
four_byte_inst_table,
1404+
sfdp_info.fbatbl.size
1405+
);
13921406
if (status != OSPI_STATUS_OK) {
13931407
tr_error("Init - Read SFDP Four Byte Inst Table Failed");
13941408
return -1;
@@ -1823,21 +1837,48 @@ ospi_status_t OSPIFBlockDevice::_ospi_send_general_command(ospi_inst_t instructi
18231837
return OSPI_STATUS_OK;
18241838
}
18251839

1826-
int OSPIFBlockDevice::_ospi_send_read_sfdp_command(bd_addr_t addr, void *rx_buffer, bd_size_t rx_length)
1840+
int OSPIFBlockDevice::_ospi_send_read_sfdp_command(mbed::bd_addr_t addr, mbed::sfdp_cmd_addr_size_t addr_size,
1841+
uint8_t inst, uint8_t dummy_cycles,
1842+
void *rx_buffer, mbed::bd_size_t rx_length)
18271843
{
1828-
size_t rx_len = rx_length;
18291844
uint8_t *rx_buffer_tmp = (uint8_t *)rx_buffer;
18301845

1846+
// Set default here to avoid uninitialized variable warning
1847+
ospi_address_size_t address_size = _address_size;
1848+
int address = addr;
1849+
switch (addr_size) {
1850+
case SFDP_CMD_ADDR_3_BYTE:
1851+
address_size = OSPI_CFG_ADDR_SIZE_24;
1852+
break;
1853+
case SFDP_CMD_ADDR_4_BYTE:
1854+
address_size = OSPI_CFG_ADDR_SIZE_32;
1855+
break;
1856+
case SFDP_CMD_ADDR_SIZE_VARIABLE: // use current setting
1857+
break;
1858+
case SFDP_CMD_ADDR_NONE: // no address in command
1859+
address = static_cast<int>(OSPI_NO_ADDRESS_COMMAND);
1860+
break;
1861+
default:
1862+
tr_error("Invalid SFDP command address size: 0x%02X", addr_size);
1863+
return -1;
1864+
}
1865+
1866+
if (dummy_cycles == SFDP_CMD_DUMMY_CYCLES_VARIABLE) {
1867+
// use current setting
1868+
dummy_cycles = _dummy_cycles;
1869+
}
1870+
18311871
// SFDP read instruction requires 1-1-1 bus mode with 8 dummy cycles and a 3-byte address
1832-
ospi_status_t status = _ospi.configure_format(OSPI_CFG_BUS_SINGLE, OSPI_CFG_INST_SIZE_8, OSPI_CFG_BUS_SINGLE, OSPI_CFG_ADDR_SIZE_24, OSPI_CFG_BUS_SINGLE, 0, OSPI_CFG_BUS_SINGLE, OSPIF_RSFDP_DUMMY_CYCLES);
1872+
ospi_status_t status = _ospi.configure_format(OSPI_CFG_BUS_SINGLE, OSPI_CFG_INST_SIZE_8, OSPI_CFG_BUS_SINGLE, address_size, OSPI_CFG_BUS_SINGLE, 0, OSPI_CFG_BUS_SINGLE, dummy_cycles);
18331873
if (OSPI_STATUS_OK != status) {
18341874
tr_error("_ospi_configure_format failed");
18351875
return status;
18361876
}
18371877

18381878
// Don't check the read status until after we've configured the format back to 1-1-1, to avoid leaving the interface in an
18391879
// incorrect state if the read fails.
1840-
status = _ospi.read(OSPIF_INST_RSFDP, -1, (unsigned int) addr, (char *) rx_buffer, &rx_len);
1880+
size_t rx_len = rx_length;
1881+
status = _ospi.read(inst, -1, address, static_cast<char *>(rx_buffer), &rx_len);
18411882

18421883
ospi_status_t format_status = _ospi.configure_format(OSPI_CFG_BUS_SINGLE, OSPI_CFG_INST_SIZE_8, OSPI_CFG_BUS_SINGLE, _address_size, OSPI_CFG_BUS_SINGLE, 0, OSPI_CFG_BUS_SINGLE, 0);
18431884
// All commands other than Read and RSFDP use default 1-1-1 bus mode (Program/Erase are constrained by flash memory performance more than bus performance)

storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
277277
mbed::bd_size_t tx_length, const char *rx_buffer, mbed::bd_size_t rx_length);
278278

279279
// Send command to read from the SFDP table
280-
int _qspi_send_read_sfdp_command(mbed::bd_addr_t addr, void *rx_buffer, mbed::bd_size_t rx_length);
280+
int _qspi_send_read_sfdp_command(mbed::bd_addr_t addr, mbed::sfdp_cmd_addr_size_t addr_size,
281+
uint8_t inst, uint8_t dummy_cycles,
282+
void *rx_buffer, mbed::bd_size_t rx_length);
281283

282284
// Read the contents of status registers 1 and 2 into a buffer (buffer must have a length of 2)
283285
qspi_status_t _qspi_read_status_registers(uint8_t *reg_buffer);
@@ -313,7 +315,7 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
313315
/* SFDP Detection and Parsing Functions */
314316
/****************************************/
315317
// Parse and Detect required Basic Parameters from Table
316-
int _sfdp_parse_basic_param_table(mbed::Callback<int(mbed::bd_addr_t, void *, mbed::bd_size_t)> sfdp_reader,
318+
int _sfdp_parse_basic_param_table(mbed::Callback<int(bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader,
317319
mbed::sfdp_hdr_info &sfdp_info);
318320

319321
// Detect the soft reset protocol and reset - returns error if soft reset is not supported

storage/blockdevice/COMPONENT_QSPIF/source/QSPIFBlockDevice.cpp

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -614,12 +614,19 @@ int QSPIFBlockDevice::remove_csel_instance(PinName csel)
614614
/*********************************************************/
615615
/********** SFDP Parsing and Detection Functions *********/
616616
/*********************************************************/
617-
int QSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
617+
int QSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader,
618618
sfdp_hdr_info &sfdp_info)
619619
{
620620
uint8_t param_table[SFDP_BASIC_PARAMS_TBL_SIZE]; /* Up To 20 DWORDS = 80 Bytes */
621621

622-
int status = sfdp_reader(sfdp_info.bptbl.addr, param_table, sfdp_info.bptbl.size);
622+
int status = sfdp_reader(
623+
sfdp_info.bptbl.addr,
624+
SFDP_READ_CMD_ADDR_TYPE,
625+
SFDP_READ_CMD_INST,
626+
SFDP_READ_CMD_DUMMY_CYCLES,
627+
param_table,
628+
sfdp_info.bptbl.size
629+
);
623630
if (status != QSPI_STATUS_OK) {
624631
tr_error("Init - Read SFDP First Table Failed");
625632
return -1;
@@ -1405,23 +1412,53 @@ qspi_status_t QSPIFBlockDevice::_qspi_send_general_command(qspi_inst_t instructi
14051412
return QSPI_STATUS_OK;
14061413
}
14071414

1408-
int QSPIFBlockDevice::_qspi_send_read_sfdp_command(bd_addr_t addr, void *rx_buffer, bd_size_t rx_length)
1415+
int QSPIFBlockDevice::_qspi_send_read_sfdp_command(mbed::bd_addr_t addr, mbed::sfdp_cmd_addr_size_t addr_size,
1416+
uint8_t inst, uint8_t dummy_cycles,
1417+
void *rx_buffer, mbed::bd_size_t rx_length)
14091418
{
1410-
size_t rx_len = rx_length;
1419+
// Set default here to avoid uninitialized variable warning
1420+
qspi_address_size_t address_size = _address_size;
1421+
int address = addr;
1422+
switch (addr_size) {
1423+
case SFDP_CMD_ADDR_3_BYTE:
1424+
address_size = QSPI_CFG_ADDR_SIZE_24;
1425+
break;
1426+
case SFDP_CMD_ADDR_4_BYTE:
1427+
address_size = QSPI_CFG_ADDR_SIZE_32;
1428+
break;
1429+
case SFDP_CMD_ADDR_SIZE_VARIABLE: // use current setting
1430+
break;
1431+
case SFDP_CMD_ADDR_NONE: // no address in command
1432+
address = static_cast<int>(QSPI_NO_ADDRESS_COMMAND);
1433+
break;
1434+
default:
1435+
tr_error("Invalid SFDP command address size: 0x%02X", addr_size);
1436+
return -1;
1437+
}
14111438

1412-
// SFDP read instruction requires 1-1-1 bus mode with 8 dummy cycles and a 3-byte address
1413-
qspi_status_t status = _qspi.configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE, 0, QSPI_CFG_BUS_SINGLE, QSPIF_RSFDP_DUMMY_CYCLES);
1439+
if (dummy_cycles == SFDP_CMD_DUMMY_CYCLES_VARIABLE) {
1440+
// use current setting
1441+
dummy_cycles = _dummy_cycles;
1442+
}
1443+
1444+
qspi_status_t status = _qspi.configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE,
1445+
address_size, QSPI_CFG_BUS_SINGLE,
1446+
0, QSPI_CFG_BUS_SINGLE, dummy_cycles);
14141447
if (QSPI_STATUS_OK != status) {
14151448
tr_error("_qspi_configure_format failed");
14161449
return status;
14171450
}
14181451

1419-
// Don't check the read status until after we've configured the format back to 1-1-1, to avoid leaving the interface in an
1420-
// incorrect state if the read fails.
1421-
status = _qspi.read(QSPIF_INST_RSFDP, -1, (unsigned int) addr, (char *) rx_buffer, &rx_len);
1452+
// Don't check the read status until after we've configured the format back to 1-1-1,
1453+
// to avoid leaving the interface in an incorrect state if the read fails.
1454+
size_t rx_len = rx_length;
1455+
status = _qspi.read(inst, -1, address, static_cast<char *>(rx_buffer), &rx_len);
14221456

1423-
qspi_status_t format_status = _qspi.configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, _address_size, QSPI_CFG_BUS_SINGLE, 0, QSPI_CFG_BUS_SINGLE, 0);
1424-
// All commands other than Read and RSFDP use default 1-1-1 bus mode (Program/Erase are constrained by flash memory performance more than bus performance)
1457+
qspi_status_t format_status = _qspi.configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE,
1458+
address_size, QSPI_CFG_BUS_SINGLE,
1459+
0, QSPI_CFG_BUS_SINGLE, 0);
1460+
// All commands other than Read and RSFDP use default 1-1-1 bus mode
1461+
// (Program/Erase are constrained by flash memory performance more than bus performance)
14251462
if (QSPI_STATUS_OK != format_status) {
14261463
tr_error("_qspi_configure_format failed");
14271464
return format_status;

storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,12 @@ class SPIFBlockDevice : public mbed::BlockDevice {
221221
/* SFDP Detection and Parsing Functions */
222222
/****************************************/
223223
// Send SFDP Read command to Driver
224-
int _spi_send_read_sfdp_command(mbed::bd_addr_t addr, void *rx_buffer, mbed::bd_size_t rx_length);
224+
int _spi_send_read_sfdp_command(mbed::bd_addr_t addr, mbed::sfdp_cmd_addr_size_t addr_size,
225+
uint8_t inst, uint8_t dummy_cycles,
226+
void *rx_buffer, mbed::bd_size_t rx_length);
225227

226228
// Parse and Detect required Basic Parameters from Table
227-
int _sfdp_parse_basic_param_table(mbed::Callback<int(mbed::bd_addr_t, void *, mbed::bd_size_t)> sfdp_reader,
229+
int _sfdp_parse_basic_param_table(mbed::Callback<int(bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader,
228230
mbed::sfdp_hdr_info &hdr_info);
229231

230232
// Detect fastest read Bus mode supported by device

storage/blockdevice/COMPONENT_SPIF/source/SPIFBlockDevice.cpp

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,32 @@ spif_bd_error SPIFBlockDevice::_spi_send_read_command(int read_inst, uint8_t *bu
497497
return SPIF_BD_ERROR_OK;
498498
}
499499

500-
int SPIFBlockDevice::_spi_send_read_sfdp_command(bd_addr_t addr, void *rx_buffer, bd_size_t rx_length)
500+
int SPIFBlockDevice::_spi_send_read_sfdp_command(mbed::bd_addr_t addr, mbed::sfdp_cmd_addr_size_t addr_size,
501+
uint8_t inst, uint8_t dummy_cycles,
502+
void *rx_buffer, mbed::bd_size_t rx_length)
501503
{
502-
// Set 1-1-1 bus mode for SFDP header parsing
503-
// Initial SFDP read tables are read with 8 dummy cycles
504-
_dummy_and_mode_cycles = 8;
504+
switch (addr_size) {
505+
case SFDP_CMD_ADDR_3_BYTE:
506+
_address_size = SPIF_ADDR_SIZE_3_BYTES;
507+
break;
508+
case SFDP_CMD_ADDR_4_BYTE:
509+
_address_size = SPIF_ADDR_SIZE_4_BYTES;
510+
break;
511+
case SFDP_CMD_ADDR_SIZE_VARIABLE: // use current setting
512+
break;
513+
case SFDP_CMD_ADDR_NONE: // no address in command
514+
addr = static_cast<int>(SPI_NO_ADDRESS_COMMAND);
515+
break;
516+
default:
517+
tr_error("Invalid SFDP command address size: 0x%02X", addr_size);
518+
return -1;
519+
}
520+
521+
if (dummy_cycles != SFDP_CMD_DUMMY_CYCLES_VARIABLE) {
522+
_dummy_and_mode_cycles = dummy_cycles;
523+
}
505524

506-
int status = _spi_send_read_command(SPIF_SFDP, (uint8_t *)rx_buffer, addr, rx_length);
525+
int status = _spi_send_read_command(inst, static_cast<uint8_t *>(rx_buffer), addr, rx_length);
507526
if (status < 0) {
508527
tr_error("_spi_send_read_sfdp_command failed");
509528
}
@@ -588,12 +607,19 @@ spif_bd_error SPIFBlockDevice::_spi_send_general_command(int instruction, bd_add
588607
/*********************************************************/
589608
/********** SFDP Parsing and Detection Functions *********/
590609
/*********************************************************/
591-
int SPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
592-
mbed::sfdp_hdr_info &sfdp_info)
610+
int SPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, mbed::sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader,
611+
sfdp_hdr_info &sfdp_info)
593612
{
594613
uint8_t param_table[SFDP_BASIC_PARAMS_TBL_SIZE]; /* Up To 20 DWORDS = 80 Bytes */
595614

596-
int status = sfdp_reader(sfdp_info.bptbl.addr, param_table, sfdp_info.bptbl.size);
615+
int status = sfdp_reader(
616+
sfdp_info.bptbl.addr,
617+
SFDP_READ_CMD_ADDR_TYPE,
618+
SFDP_READ_CMD_INST,
619+
SFDP_READ_CMD_DUMMY_CYCLES,
620+
param_table,
621+
sfdp_info.bptbl.size
622+
);
597623
if (status != SPIF_BD_ERROR_OK) {
598624
tr_error("init - Read SFDP First Table Failed");
599625
return -1;

storage/blockdevice/include/blockdevice/internal/SFDP.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ constexpr int SFDP_ERASE_BITMASK_ALL = 0x0F; ///< Erase type All
4747

4848
constexpr int SFDP_MAX_NUM_OF_ERASE_TYPES = 4; ///< Maximum number of different erase types (erase granularity)
4949

50+
// Size of a command specified by SFDP
51+
enum sfdp_cmd_addr_size_t {
52+
SFDP_CMD_ADDR_NONE = 0x00, // No address in command
53+
SFDP_CMD_ADDR_3_BYTE = 0x01, // 3-byte address
54+
SFDP_CMD_ADDR_4_BYTE = 0x02, // 4-byte address
55+
SFDP_CMD_ADDR_SIZE_VARIABLE = 0x03 // Address size from current setting
56+
};
57+
58+
// Parameters for SFDP Read command
59+
constexpr sfdp_cmd_addr_size_t SFDP_READ_CMD_ADDR_TYPE = SFDP_CMD_ADDR_3_BYTE; // Read SFDP has 3-byte address
60+
constexpr uint8_t SFDP_READ_CMD_INST = 0x5A; // Read SFDP instruction
61+
constexpr uint8_t SFDP_READ_CMD_DUMMY_CYCLES = 8; // READ SFDP dummy cycles
62+
63+
// Special value from SFDP for using dummy cycles from current setting
64+
constexpr uint8_t SFDP_CMD_DUMMY_CYCLES_VARIABLE = 0xF;
65+
5066
/** JEDEC Basic Flash Parameter Table info */
5167
struct sfdp_bptbl_info {
5268
uint32_t addr; ///< Address
@@ -92,7 +108,7 @@ struct sfdp_hdr_info {
92108
*
93109
* @return MBED_SUCCESS on success, negative error code on failure
94110
*/
95-
int sfdp_parse_headers(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &sfdp_info);
111+
int sfdp_parse_headers(Callback<int(bd_addr_t, sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &sfdp_info);
96112

97113
/** Parse Sector Map Parameter Table
98114
* Retrieves the table from a device and parses the information contained by the table
@@ -102,7 +118,7 @@ int sfdp_parse_headers(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
102118
*
103119
* @return MBED_SUCCESS on success, negative error code on failure
104120
*/
105-
int sfdp_parse_sector_map_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &sfdp_info);
121+
int sfdp_parse_sector_map_table(Callback<int(bd_addr_t, sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &sfdp_info);
106122

107123
/** Detect page size used for writing on flash
108124
*

0 commit comments

Comments
 (0)