Skip to content

Commit 5f56a5e

Browse files
committed
modify astyle
1 parent 7885a27 commit 5f56a5e

File tree

3 files changed

+42
-43
lines changed

3 files changed

+42
-43
lines changed

storage/blockdevice/COMPONENT_SPINAND/source/SPINANDBlockDevice.cpp

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ using namespace mbed;
4949
#define SPINAND_STATUS_BIT_ERASE_FAIL 0x4 // Erase failed
5050
#define SPINAND_STATUS_BIT_PROGRAM_FAIL 0x8 // Program failed
5151
#define SPINAND_STATUS_BIT_ECC_STATUS_MASK 0x30 // ECC status
52-
#define SPINAND_STATUS_ECC_STATUS_NO_ERR 0x00
53-
#define SPINAND_STATUS_ECC_STATUS_ERR_COR 0x00
54-
#define SPINAND_STATUS_ECC_STATUS_ERR_NO_COR 0x00
52+
#define SPINAND_STATUS_ECC_STATUS_NO_ERR 0x00
53+
#define SPINAND_STATUS_ECC_STATUS_ERR_COR 0x00
54+
#define SPINAND_STATUS_ECC_STATUS_ERR_NO_COR 0x00
5555

5656
// Secure OTP Register Bits
5757
#define SPINAND_SECURE_BIT_QE 0x01 // Quad enable
@@ -61,12 +61,12 @@ using namespace mbed;
6161

6262
// Block Protection Register Bits
6363
#define SPINAND_BLOCK_PROT_BIT_SP 0x01
64-
#define SPINAND_BLOCK_PROT_BIT_COMPLE 0x02
64+
#define SPINAND_BLOCK_PROT_BIT_COMPLE 0x02
6565
#define SPINAND_BLOCK_PROT_BIT_INVERT 0x04
66-
#define SPINAND_BLOCK_PROT_BIT_BP0 0x08
67-
#define SPINAND_BLOCK_PROT_BIT_BP1 0x10
68-
#define SPINAND_BLOCK_PROT_BIT_BP2 0x20
69-
#define SPINAND_BLOCK_PROT_BIT_BPRWD 0x80
66+
#define SPINAND_BLOCK_PROT_BIT_BP0 0x08
67+
#define SPINAND_BLOCK_PROT_BIT_BP1 0x10
68+
#define SPINAND_BLOCK_PROT_BIT_BP2 0x20
69+
#define SPINAND_BLOCK_PROT_BIT_BPRWD 0x80
7070
#define SPINAND_BLOCK_PROT_BIT_BP_MASK 0x38
7171

7272
#define SPINAND_BLOCK_PROT_BP_OFFSET 3
@@ -209,7 +209,7 @@ int SPINANDBlockDevice::init()
209209
}
210210

211211
if (_read_instruction == SPINAND_INST_READ_CACHE4) {
212-
if (QSPI_STATUS_OK !=_set_quad_enable()) {
212+
if (QSPI_STATUS_OK != _set_quad_enable()) {
213213
tr_error("SPI NAND Set Quad enable Failed");
214214
status = SPINAND_BD_ERROR_DEVICE_ERROR;
215215
goto exit_point;
@@ -269,7 +269,7 @@ int SPINANDBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
269269
bd_size_t read_bytes = 0;
270270

271271
tr_debug("Read Inst: 0x%xh", _read_instruction);
272-
272+
273273
while (size > 0) {
274274
// Read on _page_size_bytes boundaries (Default 2048 bytes a page)
275275
offset = addr % MBED_CONF_SPINAND_SPINAND_PAGE_SIZE;
@@ -385,7 +385,7 @@ int SPINANDBlockDevice::erase(bd_addr_t addr, bd_size_t size)
385385
}
386386

387387
addr += SPINAND_BLOCK_OFFSET;
388-
if(size > MBED_CONF_SPINAND_SPINAND_BLOCK_SIZE) {
388+
if (size > MBED_CONF_SPINAND_SPINAND_BLOCK_SIZE) {
389389
size -= MBED_CONF_SPINAND_SPINAND_BLOCK_SIZE;
390390
} else {
391391
size = 0;
@@ -519,19 +519,19 @@ int SPINANDBlockDevice::_set_quad_enable()
519519

520520
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_SECURE_OTP,
521521
NULL, 0, (char *) &secur_reg, 1)) {
522-
tr_error("Reading Security Register failed");
523-
}
522+
tr_error("Reading Security Register failed");
523+
}
524524

525525
secur_reg |= SPINAND_SECURE_BIT_QE;
526526

527527
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_SET_FEATURE, FEATURES_ADDR_SECURE_OTP,
528528
(char *) &secur_reg, 1, NULL, 0)) {
529-
tr_error("Writing Security Register failed");
530-
}
529+
tr_error("Writing Security Register failed");
530+
}
531531
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_SECURE_OTP,
532532
NULL, 0, (char *) &secur_reg, 1)) {
533-
tr_error("Reading Security Register failed");
534-
}
533+
tr_error("Reading Security Register failed");
534+
}
535535
if (false == _is_mem_ready()) {
536536
tr_error("Device not ready, set quad enable failed");
537537
return -1;
@@ -551,19 +551,19 @@ int SPINANDBlockDevice::_clear_block_protection()
551551

552552
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_BLOCK_PROTECTION,
553553
NULL, 0, (char *) &block_protection_reg, 1)) {
554-
tr_error("Reading Block Protection Register failed");
555-
}
554+
tr_error("Reading Block Protection Register failed");
555+
}
556556

557557
block_protection_reg &= ~SPINAND_BLOCK_PROT_BIT_BP_MASK;
558558

559559
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_SET_FEATURE, FEATURES_ADDR_BLOCK_PROTECTION,
560560
(char *) &block_protection_reg, 1, NULL, 0)) {
561-
tr_error("Writing Block Protection Register failed");
562-
}
561+
tr_error("Writing Block Protection Register failed");
562+
}
563563
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_BLOCK_PROTECTION,
564564
NULL, 0, (char *) &block_protection_reg, 1)) {
565-
tr_error("Reading Block Protection Register failed");
566-
}
565+
tr_error("Reading Block Protection Register failed");
566+
}
567567
if (false == _is_mem_ready()) {
568568
tr_error("Device not ready, clearing block protection failed");
569569
return -1;
@@ -588,7 +588,7 @@ int SPINANDBlockDevice::_set_write_enable()
588588
tr_error("Device not ready, write failed");
589589
break;
590590
}
591-
591+
592592
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_STATUS,
593593
NULL, 0,
594594
(char *) &status_value, 1)) { // store received value in status_value
@@ -612,7 +612,7 @@ bool SPINANDBlockDevice::_is_mem_ready()
612612
uint8_t status_value = 0;
613613
int retries = 0;
614614
bool mem_ready = true;
615-
615+
616616
do {
617617
rtos::ThisThread::sleep_for(1ms);
618618
retries++;
@@ -649,7 +649,7 @@ qspi_status_t SPINANDBlockDevice::_qspi_send_read_command(qspi_inst_t read_inst,
649649
// Send read command to device driver
650650
// Read commands use the best bus mode supported by the part
651651
qspi_status_t status = _qspi.configure_format(_inst_width, _address_width, SPI_NAND_COLUMN_ADDR_SIZE, // Alt width should be the same as address width
652-
_address_width,_alt_size, _data_width, 0);
652+
_address_width, _alt_size, _data_width, 0);
653653
if (QSPI_STATUS_OK != status) {
654654
tr_error("_qspi_configure_format failed");
655655
return status;
@@ -668,7 +668,7 @@ qspi_status_t SPINANDBlockDevice::_qspi_send_read_command(qspi_inst_t read_inst,
668668

669669
if (false == _is_mem_ready()) {
670670
tr_error("Device not ready, clearing block protection failed");
671-
// return -1;
671+
return -1;
672672
}
673673

674674
status = _qspi.configure_format(_inst_width, _address_width, SPI_NAND_ROW_ADDR_SIZE, _address_width, // Alt width should be the same as address width
@@ -701,7 +701,7 @@ qspi_status_t SPINANDBlockDevice::_qspi_send_program_command(qspi_inst_t prog_in
701701
bd_addr_t addr, bd_size_t *size)
702702
{
703703
tr_debug("Inst: 0x%xh, addr: %llu, size: %llu", prog_inst, addr, *size);
704-
704+
705705
// Program load commands need 16 bit row address
706706
qspi_status_t status = _qspi.configure_format(_inst_width, _address_width, SPI_NAND_ROW_ADDR_SIZE, // Alt width should be the same as address width
707707
_address_width, _alt_size, QSPI_CFG_BUS_QUAD, 0);
@@ -725,7 +725,7 @@ qspi_status_t SPINANDBlockDevice::_qspi_send_program_command(qspi_inst_t prog_in
725725
return format_status;
726726
}
727727

728-
// Program execute command
728+
// Program execute command
729729
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_PROGRAM_EXEC, addr >> 12, NULL, 0, NULL, 0)) {
730730
tr_error("Read page from array failed");
731731
}
@@ -737,18 +737,18 @@ qspi_status_t SPINANDBlockDevice::_qspi_send_program_command(qspi_inst_t prog_in
737737
return status;
738738
}
739739
uint8_t status_value = 0;
740-
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_STATUS,
741-
NULL, 0,
742-
(char *) &status_value, 1)) { // store received value in status_value
743-
tr_error("Reading Status Register failed");
744-
}
740+
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_STATUS,
741+
NULL, 0,
742+
(char *) &status_value, 1)) { // store received value in status_value
743+
tr_error("Reading Status Register failed");
744+
}
745745
return QSPI_STATUS_OK;
746746
}
747747

748748
qspi_status_t SPINANDBlockDevice::_qspi_send_erase_command(qspi_inst_t erase_inst, bd_addr_t addr, bd_size_t size)
749749
{
750750
tr_debug("Inst: 0x%xh, addr: %llu, size: %llu", erase_inst, addr, size);
751-
751+
752752
qspi_status_t status = _qspi.configure_format(_inst_width, _address_width, SPI_NAND_COLUMN_ADDR_SIZE,// Alt width should be the same as address width
753753
_address_width, _alt_size, _data_width, 0);
754754
if (QSPI_STATUS_OK != status) {
@@ -757,7 +757,7 @@ qspi_status_t SPINANDBlockDevice::_qspi_send_erase_command(qspi_inst_t erase_ins
757757
}
758758

759759
// Send erase command to driver
760-
status = _qspi.command_transfer(erase_inst, (int) (addr >> 12), NULL, 0, NULL, 0);
760+
status = _qspi.command_transfer(erase_inst, (int)(addr >> 12), NULL, 0, NULL, 0);
761761

762762
if (QSPI_STATUS_OK != status) {
763763
tr_error("QSPI Erase failed");
@@ -771,11 +771,11 @@ qspi_status_t SPINANDBlockDevice::_qspi_send_erase_command(qspi_inst_t erase_ins
771771
return status;
772772
}
773773
uint8_t status_value = 0;
774-
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_STATUS,
775-
NULL, 0,
776-
(char *) &status_value, 1)) { // store received value in status_value
777-
tr_error("Reading Status Register failed");
778-
}
774+
if (QSPI_STATUS_OK != _qspi_send_general_command(SPINAND_INST_GET_FEATURE, FEATURES_ADDR_STATUS,
775+
NULL, 0,
776+
(char *) &status_value, 1)) { // store received value in status_value
777+
tr_error("Reading Status Register failed");
778+
}
779779
return QSPI_STATUS_OK;
780780
}
781781

storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ int get_bd_count()
898898
return count;
899899
}
900900

901-
static const char *prefix[] = {"SPIF ", "QSPIF ", "DATAFLASH ", "SD ", "FLASHIAP ", "OSPIF ","SPINAND ", "DEFAULT "};
901+
static const char *prefix[] = {"SPIF ", "QSPIF ", "DATAFLASH ", "SD ", "FLASHIAP ", "OSPIF ", "SPINAND ", "DEFAULT "};
902902

903903
int main()
904904
{

targets/targets.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3812,7 +3812,6 @@
38123812
"STM32L4R9xI"
38133813
],
38143814
"components_add": [
3815-
"FLASHIAP"
38163815
],
38173816
"macros_add": [
38183817
"STM32L4R9xx"

0 commit comments

Comments
 (0)