@@ -38,7 +38,7 @@ using namespace mbed;
38
38
#define QSPI_NO_ADDRESS_COMMAND UINT64_MAX
39
39
#define QSPI_ALT_DEFAULT_VALUE 0
40
40
// Status Register Bits
41
- #define QSPIF_STATUS_BIT_WIP 0x1 // Write In Progress
41
+ #define QSPIF_STATUS_BIT_WIP 0x1 // Write In Progress
42
42
#define QSPIF_STATUS_BIT_WEL 0x2 // Write Enable Latch
43
43
44
44
/* SFDP Header Parsing */
@@ -64,14 +64,14 @@ using namespace mbed;
64
64
#define QSPIF_BASIC_PARAM_TABLE_QER_BYTE 58
65
65
#define QSPIF_BASIC_PARAM_TABLE_444_MODE_EN_SEQ_BYTE 56
66
66
// Erase Types Params
67
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_1_BYTE 29
68
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_2_BYTE 31
69
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_3_BYTE 33
70
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_4_BYTE 35
71
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_1_SIZE_BYTE 28
72
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_2_SIZE_BYTE 30
73
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_3_SIZE_BYTE 32
74
- #define QSPIF_BASIC_PARAM_ERASE_TYPE_4_SIZE_BYTE 34
67
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_1_BYTE 29
68
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_2_BYTE 31
69
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_3_BYTE 33
70
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_4_BYTE 35
71
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_1_SIZE_BYTE 28
72
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_2_SIZE_BYTE 30
73
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_3_SIZE_BYTE 32
74
+ #define QSPIF_BASIC_PARAM_TABLE_ERASE_TYPE_4_SIZE_BYTE 34
75
75
#define QSPIF_BASIC_PARAM_4K_ERASE_TYPE_BYTE 1
76
76
77
77
#define QSPIF_BASIC_PARAM_TABLE_SOFT_RESET_BYTE 61
@@ -183,7 +183,7 @@ int QSPIFBlockDevice::init()
183
183
tr_debug (" QSPIFBlockDevice csel: %d" , (int )_csel);
184
184
} else if (_unique_device_status == -1 ) {
185
185
tr_error (" QSPIFBlockDevice with the same csel(%d) already exists" , (int )_csel);
186
- return QSPIF_BD_ERROR_DEVICE_NOT_UNIQE ;
186
+ return QSPIF_BD_ERROR_DEVICE_NOT_UNIQUE ;
187
187
} else {
188
188
tr_error (" Too many different QSPIFBlockDevice devices - max allowed: %d" , QSPIF_MAX_ACTIVE_FLASH_DEVICES);
189
189
return QSPIF_BD_ERROR_DEVICE_MAX_EXCEED;
@@ -223,7 +223,7 @@ int QSPIFBlockDevice::init()
223
223
goto exit_point;
224
224
}
225
225
226
- // Synchronize Device
226
+ // Synchronize Device
227
227
if (false == _is_mem_ready ()) {
228
228
tr_error (" Init - _is_mem_ready Failed" );
229
229
status = QSPIF_BD_ERROR_READY_FAILED;
@@ -513,7 +513,6 @@ bd_size_t QSPIFBlockDevice::get_erase_size(bd_addr_t addr)
513
513
int8_t type_mask = ERASE_BITMASK_TYPE1;
514
514
int i_ind = 0 ;
515
515
516
-
517
516
if (region != -1 ) {
518
517
type_mask = 0x01 ;
519
518
@@ -627,10 +626,10 @@ int QSPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_
627
626
// Verify SFDP signature for sanity
628
627
// Also check that major/minor version is acceptable
629
628
if (!(memcmp (&sfdp_header[0 ], " SFDP" , 4 ) == 0 && sfdp_header[5 ] == 1 )) {
630
- tr_error (" Init - _verify SFDP signature and version Failed " );
629
+ tr_error (" Init - Verification of SFDP signature and version failed " );
631
630
return -1 ;
632
631
} else {
633
- tr_debug (" Init - verified SFDP Signature and version Successfully " );
632
+ tr_debug (" Init - Verification of SFDP signature and version succeeded " );
634
633
}
635
634
636
635
// Discover Number of Parameter Headers
@@ -641,7 +640,7 @@ int QSPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_
641
640
addr += QSPIF_SFDP_HEADER_SIZE;
642
641
data_length = QSPIF_PARAM_HEADER_SIZE;
643
642
644
- // Loop over Param Headers and parse them (currently supported Basic Param Table and Sector Region Map Table)
643
+ // Loop over Param Headers and parse them (currently supports Basic Param Table and Sector Region Map Table)
645
644
for (int i_ind = 0 ; i_ind < number_of_param_headers; i_ind++) {
646
645
status = _qspi_send_read_sfdp_command (addr, (char *) param_header, data_length);
647
646
if (status != QSPI_STATUS_OK) {
@@ -662,21 +661,18 @@ int QSPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_
662
661
basic_table_addr = ((param_header[6 ] << 16 ) | (param_header[5 ] << 8 ) | (param_header[4 ]));
663
662
// Supporting up to 64 Bytes Table (16 DWORDS)
664
663
basic_table_size = ((param_header[3 ] * 4 ) < SFDP_DEFAULT_BASIC_PARAMS_TABLE_SIZE_BYTES) ? (param_header[3 ] * 4 ) : 64 ;
665
-
666
664
} else if ((param_header[0 ] == 81 ) && (param_header[7 ] == 0xFF )) {
667
665
// Found Sector Map Table: LSB=0x81, MSB=0xFF
668
666
tr_debug (" Found Sector Map Table at Table: %d" , i_ind + 1 );
669
667
sector_map_table_addr = ((param_header[6 ] << 16 ) | (param_header[5 ] << 8 ) | (param_header[4 ]));
670
668
sector_map_table_size = param_header[3 ] * 4 ;
671
-
672
669
}
673
670
addr += QSPIF_PARAM_HEADER_SIZE;
674
-
675
671
}
672
+
676
673
return 0 ;
677
674
}
678
675
679
-
680
676
int QSPIFBlockDevice::_sfdp_parse_basic_param_table (uint32_t basic_table_addr, size_t basic_table_size)
681
677
{
682
678
uint8_t param_table[SFDP_DEFAULT_BASIC_PARAMS_TABLE_SIZE_BYTES]; /* Up To 16 DWORDS = 64 Bytes */
@@ -694,11 +690,10 @@ int QSPIFBlockDevice::_sfdp_parse_basic_param_table(uint32_t basic_table_addr, s
694
690
}
695
691
696
692
// Get device density (stored in bits - 1)
697
- uint32_t density_bits = (
698
- (param_table[7 ] << 24 ) |
699
- (param_table[6 ] << 16 ) |
700
- (param_table[5 ] << 8 ) |
701
- param_table[4 ]);
693
+ uint32_t density_bits = ((param_table[7 ] << 24 ) |
694
+ (param_table[6 ] << 16 ) |
695
+ (param_table[5 ] << 8 ) |
696
+ param_table[4 ]);
702
697
_device_size_bytes = (density_bits + 1 ) / 8 ;
703
698
704
699
// Set Page Size (QSPI write must be done on Page limits)
@@ -778,7 +773,7 @@ int QSPIFBlockDevice::_sfdp_set_quad_enabled(uint8_t *basic_param_table_ptr)
778
773
tr_debug (" Setting QE Bit, Bit 1 of Status Reg 2" );
779
774
break ;
780
775
default :
781
- tr_warning (" Unsuported QER configuration" );
776
+ tr_warning (" Unsupported QER configuration" );
782
777
return 0 ;
783
778
}
784
779
@@ -856,7 +851,7 @@ int QSPIFBlockDevice::_sfdp_set_qpi_enabled(uint8_t *basic_param_table_ptr)
856
851
break ;
857
852
858
853
default :
859
- tr_warning (" _sfdp_set_qpi_enabled - Unsuported En Seq 444 configuration" );
854
+ tr_warning (" _sfdp_set_qpi_enabled - Unsupported En Seq 444 configuration" );
860
855
break ;
861
856
}
862
857
return 0 ;
@@ -1380,8 +1375,8 @@ qspi_status_t QSPIFBlockDevice::_qspi_update_4byte_ext_addr_reg(bd_addr_t addr)
1380
1375
return status;
1381
1376
}
1382
1377
1383
- qspi_status_t QSPIFBlockDevice::_qspi_send_read_command (qspi_inst_t read_inst, void *buffer, bd_addr_t addr,
1384
- bd_size_t size)
1378
+ qspi_status_t QSPIFBlockDevice::_qspi_send_read_command (qspi_inst_t read_inst, void *buffer,
1379
+ bd_addr_t addr, bd_size_t size)
1385
1380
{
1386
1381
tr_debug (" Inst: 0x%xh, addr: %llu, size: %llu" , read_inst, addr, size);
1387
1382
@@ -1421,8 +1416,8 @@ qspi_status_t QSPIFBlockDevice::_qspi_send_read_command(qspi_inst_t read_inst, v
1421
1416
return QSPI_STATUS_OK;
1422
1417
}
1423
1418
1424
- qspi_status_t QSPIFBlockDevice::_qspi_send_program_command (qspi_inst_t progInst , const void *buffer, bd_addr_t addr ,
1425
- bd_size_t *size)
1419
+ qspi_status_t QSPIFBlockDevice::_qspi_send_program_command (qspi_inst_t prog_inst , const void *buffer,
1420
+ bd_addr_t addr, bd_size_t *size)
1426
1421
{
1427
1422
tr_debug (" Inst: 0x%xh, addr: %llu, size: %llu" , prog_inst, addr, *size);
1428
1423
@@ -1466,8 +1461,8 @@ qspi_status_t QSPIFBlockDevice::_qspi_send_erase_command(qspi_inst_t erase_inst,
1466
1461
}
1467
1462
1468
1463
qspi_status_t QSPIFBlockDevice::_qspi_send_general_command (qspi_inst_t instruction, bd_addr_t addr,
1469
- const char *tx_buffer,
1470
- mbed:: bd_size_t tx_length, const char *rx_buffer, mbed:: bd_size_t rx_length)
1464
+ const char *tx_buffer, bd_size_t tx_length,
1465
+ const char *rx_buffer, bd_size_t rx_length)
1471
1466
{
1472
1467
tr_debug (" Inst: 0x%xh, addr: %llu, tx length: %llu, rx length: %llu" , instruction, addr, tx_length, rx_length);
1473
1468
0 commit comments