Skip to content

Commit b5e52f0

Browse files
authored
fix ambiguous global enum definition for SPI in OSPIFBlockDevice driver (#291)
* fix ambiguous SPI enum definition in OSPIFBlockDevice driver * remove ' ' after * in comment * remove comment link from SPI reference * change to class specific doxygen link for SPI dma hint comment * Fix submodule hash
1 parent 02623ff commit b5e52f0

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@ enum ospif_bd_error {
8585
OSPIF_BD_ERROR_DEVICE_MAX_EXCEED = -4007 /* Max active OSPIF devices exceeded */
8686
};
8787

88-
enum _mode {
89-
SPI,
90-
SOPI,
91-
DOPI
88+
/** Enum ospif opi modes
89+
*
90+
* @enum ospif_opi_mode
91+
*/
92+
enum ospif_opi_mode {
93+
OSPIF_OPI_MODE_SPI = 0, /* SPI mode (OPI modes disabled)*/
94+
OSPIF_OPI_MODE_SOPI, /* STR-OPI mode */
95+
OSPIF_OPI_MODE_DOPI /* DTR-OPI mode */
9296
};
9397

9498
/** Enum ospif polarity mode

storage/blockdevice/COMPONENT_OSPIF/source/OSPIFBlockDevice.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ int OSPIFBlockDevice::deinit()
389389
_wait_flag = NOT_STARTED;
390390
#endif
391391

392-
change_mode(SPI);
392+
change_mode(OSPIF_OPI_MODE_SPI);
393393

394394
// Disable Device for Writing
395395
ospi_status_t status = _ospi_send_general_command(OSPIF_INST_WRDI, OSPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0);
@@ -723,13 +723,13 @@ int OSPIFBlockDevice::change_mode(int mode)
723723
int status = OSPIF_BD_ERROR_OK;
724724
char config_reg2 = 0;
725725

726-
if (((mode == SPI) && (_read_instruction == OSPIF_INST_READ_4B)) ||
727-
((mode == SOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_STR)) ||
728-
((mode == DOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_DTR))) {
726+
if (((mode == OSPIF_OPI_MODE_SPI) && (_read_instruction == OSPIF_INST_READ_4B)) ||
727+
((mode == OSPIF_OPI_MODE_SOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_STR)) ||
728+
((mode == OSPIF_OPI_MODE_DOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_DTR))) {
729729
tr_debug("Flash does not need change mode");
730730
}
731731

732-
if (mode == SOPI) {
732+
if (mode == OSPIF_OPI_MODE_SOPI) {
733733
if ((_read_instruction != OSPIF_INST_READ_4B) && (_read_instruction != OSPIF_INST_READ_DEFAULT)) { //change mode from DOPI to SPI
734734
// Write new Status Register Setup
735735
if (_set_write_enable() != 0) {
@@ -781,7 +781,7 @@ int OSPIFBlockDevice::change_mode(int mode)
781781

782782
_ospi.configure_format(_inst_width, _inst_size, _address_width, _address_size, OSPI_CFG_BUS_SINGLE,
783783
0, _data_width, 0);
784-
} else if (mode == DOPI) {
784+
} else if (mode == OSPIF_OPI_MODE_DOPI) {
785785
if ((_read_instruction != OSPIF_INST_READ_4B) && (_read_instruction != OSPIF_INST_READ_DEFAULT)) {//chang mode from SOPI to SPI
786786
// Write new Status Register Setup
787787
if (_set_write_enable() != 0) {
@@ -833,7 +833,7 @@ int OSPIFBlockDevice::change_mode(int mode)
833833

834834
_ospi.configure_format(_inst_width, _inst_size, _address_width, _address_size, OSPI_CFG_BUS_SINGLE,
835835
0, _data_width, 0);
836-
} else if (mode == SPI) {
836+
} else if (mode == OSPIF_OPI_MODE_SPI) {
837837
// Write new Status Register Setup
838838
if (_set_write_enable() != 0) {
839839
tr_error("Write Enabe failed");
@@ -996,7 +996,7 @@ int OSPIFBlockDevice::_sfdp_parse_basic_param_table(Callback<int(bd_addr_t, mbed
996996
// Detect and Set fastest Bus mode (default 1-1-1)
997997
_sfdp_detect_best_bus_read_mode(param_table, sfdp_info.bptbl.size, shouldSetQuadEnable, is_qpi_mode, is_opi_mode);
998998
if (true == is_opi_mode) {
999-
change_mode(DOPI);
999+
change_mode(OSPIF_OPI_MODE_DOPI);
10001000
tr_debug("Init - Setting DOPI mode");
10011001
}
10021002
if (true == shouldSetQuadEnable) {

storage/blockdevice/COMPONENT_SD/include/SD/SDBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class SDBlockDevice : public mbed::BlockDevice {
112112
* in the background while data is going to and from the card.
113113
*
114114
* @param enabled Whether usage of async %SPI is enabled.
115-
* @param dma_usage_hint DMA usage hint to pass to the underlying #SPI instance.
115+
* @param dma_usage_hint DMA usage hint to pass to the underlying #mbed::SPI instance.
116116
*/
117117
void set_async_spi_mode(bool enabled, DMAUsage dma_usage_hint = DMAUsage::DMA_USAGE_NEVER);
118118
#endif

0 commit comments

Comments
 (0)