Skip to content

Commit 5484f58

Browse files
author
Marten Lootsma
committed
Cleaned up SPIF trace log.
- Test most SPIF log to DEBUG level. - Removed DEBUG/ERROR/INFO tags. - Removed not needed line endings.
1 parent 04d0b0d commit 5484f58

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ SPIFBlockDevice::SPIFBlockDevice(
117117
_region_erase_types_bitfield[0] = ERASE_BITMASK_NONE;
118118

119119
if (SPIF_BD_ERROR_OK != _spi_set_frequency(freq)) {
120-
tr_error("ERROR: SPI Set Frequency Failed");
120+
tr_error("SPI Set Frequency Failed");
121121
}
122122

123123
_cs = 1;
@@ -148,7 +148,7 @@ int SPIFBlockDevice::init()
148148

149149
// Soft Reset
150150
if (-1 == _reset_flash_mem()) {
151-
tr_error("ERROR: init - Unable to initialize flash memory, tests failed\n");
151+
tr_error("init - Unable to initialize flash memory, tests failed");
152152
status = SPIF_BD_ERROR_DEVICE_ERROR;
153153
goto exit_point;
154154
}
@@ -157,7 +157,7 @@ int SPIFBlockDevice::init()
157157
spi_status = _spi_send_general_command(SPIF_RDID, SPI_NO_ADDRESS_COMMAND, NULL, 0, (char *)vendor_device_ids,
158158
data_length);
159159
if (spi_status != SPIF_BD_ERROR_OK) {
160-
tr_error("ERROR: init - Read Vendor ID Failed");
160+
tr_error("init - Read Vendor ID Failed");
161161
status = SPIF_BD_ERROR_DEVICE_ERROR;
162162
goto exit_point;
163163
}
@@ -173,22 +173,22 @@ int SPIFBlockDevice::init()
173173

174174
//Synchronize Device
175175
if (false == _is_mem_ready()) {
176-
tr_error("ERROR: init - _is_mem_ready Failed");
176+
tr_error("init - _is_mem_ready Failed");
177177
status = SPIF_BD_ERROR_READY_FAILED;
178178
goto exit_point;
179179
}
180180

181181
/**************************** Parse SFDP Header ***********************************/
182182
if (0 != _sfdp_parse_sfdp_headers(basic_table_addr, basic_table_size, sector_map_table_addr, sector_map_table_size)) {
183-
tr_error("ERROR: init - Parse SFDP Headers Failed");
183+
tr_error("init - Parse SFDP Headers Failed");
184184
status = SPIF_BD_ERROR_PARSING_FAILED;
185185
goto exit_point;
186186
}
187187

188188

189189
/**************************** Parse Basic Parameters Table ***********************************/
190190
if (0 != _sfdp_parse_basic_param_table(basic_table_addr, basic_table_size)) {
191-
tr_error("ERROR: init - Parse Basic Param Table Failed");
191+
tr_error("init - Parse Basic Param Table Failed");
192192
status = SPIF_BD_ERROR_PARSING_FAILED;
193193
goto exit_point;
194194
}
@@ -200,7 +200,7 @@ int SPIFBlockDevice::init()
200200

201201
if ((sector_map_table_addr != 0) && (0 != sector_map_table_size)) {
202202
if (0 != _sfdp_parse_sector_map_table(sector_map_table_addr, sector_map_table_size)) {
203-
tr_error("ERROR: init - Parse Sector Map Table Failed");
203+
tr_error("init - Parse Sector Map Table Failed");
204204
status = SPIF_BD_ERROR_PARSING_FAILED;
205205
goto exit_point;
206206
}
@@ -238,7 +238,7 @@ int SPIFBlockDevice::deinit()
238238
// Disable Device for Writing
239239
status = _spi_send_general_command(SPIF_WRDI, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0);
240240
if (status != SPIF_BD_ERROR_OK) {
241-
tr_error("ERROR: Write Disable failed");
241+
tr_error("Write Disable failed");
242242
}
243243
_is_initialized = false;
244244

@@ -290,7 +290,7 @@ int SPIFBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size)
290290

291291
//Send WREN
292292
if (_set_write_enable() != 0) {
293-
tr_error("ERROR: Write Enabe failed\n");
293+
tr_error("Write Enabe failed");
294294
program_failed = true;
295295
status = SPIF_BD_ERROR_WREN_FAILED;
296296
goto exit_point;
@@ -303,7 +303,7 @@ int SPIFBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size)
303303
size -= chunk;
304304

305305
if (false == _is_mem_ready()) {
306-
tr_error("ERROR: Device not ready after write, failed\n");
306+
tr_error("Device not ready after write, failed");
307307
program_failed = true;
308308
status = SPIF_BD_ERROR_READY_FAILED;
309309
goto exit_point;
@@ -338,12 +338,12 @@ int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
338338
uint8_t bitfield = _region_erase_types_bitfield[region];
339339

340340
if ((addr + in_size) > _device_size_bytes) {
341-
tr_error("ERROR: erase exceeds flash device size");
341+
tr_error("erase exceeds flash device size");
342342
return SPIF_BD_ERROR_INVALID_ERASE_PARAMS;
343343
}
344344

345345
if (((addr % get_erase_size(addr)) != 0) || (((addr + in_size) % get_erase_size(addr + in_size - 1)) != 0)) {
346-
tr_error("ERROR: invalid erase - unaligned address and size");
346+
tr_error("invalid erase - unaligned address and size");
347347
return SPIF_BD_ERROR_INVALID_ERASE_PARAMS;
348348
}
349349

@@ -360,7 +360,7 @@ int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
360360
_mutex->lock();
361361

362362
if (_set_write_enable() != 0) {
363-
tr_error("ERROR: SPI Erase Device not ready - failed");
363+
tr_error("SPI Erase Device not ready - failed");
364364
erase_failed = true;
365365
status = SPIF_BD_ERROR_READY_FAILED;
366366
goto exit_point;
@@ -378,7 +378,7 @@ int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
378378
}
379379

380380
if (false == _is_mem_ready()) {
381-
tr_error("ERROR: SPI After Erase Device not ready - failed\n");
381+
tr_error("SPI After Erase Device not ready - failed");
382382
erase_failed = true;
383383
status = SPIF_BD_ERROR_READY_FAILED;
384384
goto exit_point;
@@ -437,7 +437,7 @@ bd_size_t SPIFBlockDevice::get_erase_size(bd_addr_t addr)
437437
}
438438

439439
if (i_ind == 4) {
440-
tr_error("ERROR: no erase type was found for region addr");
440+
tr_error("no erase type was found for region addr");
441441
}
442442
}
443443

@@ -596,19 +596,19 @@ int SPIFBlockDevice::_sfdp_parse_sector_map_table(uint32_t sector_map_table_addr
596596
spif_bd_error status = _spi_send_read_command(SPIF_SFDP, sector_map_table, sector_map_table_addr /*address*/,
597597
sector_map_table_size);
598598
if (status != SPIF_BD_ERROR_OK) {
599-
tr_error("ERROR: init - Read SFDP First Table Failed");
599+
tr_error("init - Read SFDP First Table Failed");
600600
return -1;
601601
}
602602

603603
// Currently we support only Single Map Descriptor
604604
if (!((sector_map_table[0] & 0x3) == 0x03) && (sector_map_table[1] == 0x0)) {
605-
tr_error("ERROR: Sector Map - Supporting Only Single! Map Descriptor (not map commands)");
605+
tr_error("Sector Map - Supporting Only Single! Map Descriptor (not map commands)");
606606
return -1;
607607
}
608608

609609
_regions_count = sector_map_table[2] + 1;
610610
if (_regions_count > SPIF_MAX_REGIONS) {
611-
tr_error("ERROR: Supporting up to %d regions, current setup to %d regions - fail",
611+
tr_error("Supporting up to %d regions, current setup to %d regions - fail",
612612
SPIF_MAX_REGIONS, _regions_count);
613613
return -1;
614614
}
@@ -650,13 +650,13 @@ int SPIFBlockDevice::_sfdp_parse_basic_param_table(uint32_t basic_table_addr, si
650650
spif_bd_error status = _spi_send_read_command(SPIF_SFDP, param_table, basic_table_addr /*address*/,
651651
basic_table_size);
652652
if (status != SPIF_BD_ERROR_OK) {
653-
tr_error("ERROR: init - Read SFDP First Table Failed");
653+
tr_error("init - Read SFDP First Table Failed");
654654
return -1;
655655
}
656656

657657
// Check address size, currently only supports 3byte addresses
658658
if ((param_table[2] & 0x4) != 0 || (param_table[7] & 0x80) != 0) {
659-
tr_error("ERROR: init - verify 3byte addressing Failed");
659+
tr_error("init - verify 3byte addressing Failed");
660660
return -1;
661661
}
662662

@@ -702,14 +702,14 @@ int SPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_t
702702

703703
spif_bd_error status = _spi_send_read_command(SPIF_SFDP, sfdp_header, addr /*address*/, data_length);
704704
if (status != SPIF_BD_ERROR_OK) {
705-
tr_error("ERROR: init - Read SFDP Failed");
705+
tr_error("init - Read SFDP Failed");
706706
return -1;
707707
}
708708

709709
// Verify SFDP signature for sanity
710710
// Also check that major/minor version is acceptable
711711
if (!(memcmp(&sfdp_header[0], "SFDP", 4) == 0 && sfdp_header[5] == 1)) {
712-
tr_error("ERROR: init - _verify SFDP signature and version Failed");
712+
tr_error("init - _verify SFDP signature and version Failed");
713713
return -1;
714714
}
715715

@@ -724,14 +724,14 @@ int SPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_t
724724

725725
status = _spi_send_read_command(SPIF_SFDP, param_header, addr, data_length);
726726
if (status != SPIF_BD_ERROR_OK) {
727-
tr_error("ERROR: init - Read Param Table %d Failed", i_ind + 1);
727+
tr_error("init - Read Param Table %d Failed", i_ind + 1);
728728
return -1;
729729
}
730730

731731
// The SFDP spec indicates the standard table is always at offset 0
732732
// in the parameter headers, we check just to be safe
733733
if (param_header[2] != 1) {
734-
tr_error("ERROR: Param Table %d - Major Version should be 1!", i_ind + 1);
734+
tr_error("Param Table %d - Major Version should be 1!", i_ind + 1);
735735
return -1;
736736
}
737737

@@ -797,7 +797,7 @@ int SPIFBlockDevice::_sfdp_detect_erase_types_inst_and_size(uint8_t *basic_param
797797
if (erase4k_inst != erase_type_inst_arr[i_ind]) {
798798
//Verify 4KErase Type is identical to Legacy 4K erase type specified in Byte 1 of Param Table
799799
erase4k_inst = erase_type_inst_arr[i_ind];
800-
tr_warning("WARNING: _detectEraseTypesInstAndSize - Default 4K erase Inst is different than erase type Inst for 4K");
800+
tr_warning("_detectEraseTypesInstAndSize - Default 4K erase Inst is different than erase type Inst for 4K");
801801

802802
}
803803
}
@@ -809,7 +809,7 @@ int SPIFBlockDevice::_sfdp_detect_erase_types_inst_and_size(uint8_t *basic_param
809809
}
810810

811811
if (false == found_4Kerase_type) {
812-
tr_warning("WARNING: Couldn't find Erase Type for 4KB size");
812+
tr_warning("Couldn't find Erase Type for 4KB size");
813813
}
814814
return 0;
815815
}
@@ -872,7 +872,7 @@ int SPIFBlockDevice::_reset_flash_mem()
872872
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RSTEN, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0)) {
873873
// store received values in status_value
874874
} else {
875-
tr_error("ERROR: Sending RSTEN failed\n");
875+
tr_error("Sending RSTEN failed");
876876
status = -1;
877877
}
878878

@@ -881,7 +881,7 @@ int SPIFBlockDevice::_reset_flash_mem()
881881
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RST, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0)) {
882882
// store received values in status_value
883883
} else {
884-
tr_error("ERROR: Sending RST failed\n");
884+
tr_error("Sending RST failed");
885885
status = -1;
886886
}
887887
_is_mem_ready();
@@ -904,12 +904,12 @@ bool SPIFBlockDevice::_is_mem_ready()
904904
//Read the Status Register from device
905905
if (SPIF_BD_ERROR_OK != _spi_send_general_command(SPIF_RDSR, SPI_NO_ADDRESS_COMMAND, NULL, 0, status_value,
906906
1)) { // store received values in status_value
907-
tr_error("ERROR: Reading Status Register failed\n");
907+
tr_error("Reading Status Register failed");
908908
}
909909
} while ((status_value[0] & SPIF_STATUS_BIT_WIP) != 0 && retries < IS_MEM_READY_MAX_RETRIES);
910910

911911
if ((status_value[0] & SPIF_STATUS_BIT_WIP) != 0) {
912-
tr_error("ERROR: _is_mem_ready FALSE\n");
912+
tr_error("_is_mem_ready FALSE");
913913
mem_ready = false;
914914
}
915915
return mem_ready;
@@ -923,24 +923,24 @@ int SPIFBlockDevice::_set_write_enable()
923923

924924
do {
925925
if (SPIF_BD_ERROR_OK != _spi_send_general_command(SPIF_WREN, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0)) {
926-
tr_error("ERROR:Sending WREN command FAILED\n");
926+
tr_error("Sending WREN command FAILED");
927927
break;
928928
}
929929

930930
if (false == _is_mem_ready()) {
931-
tr_error("ERROR: Device not ready, write failed");
931+
tr_error("Device not ready, write failed");
932932
break;
933933
}
934934

935935
memset(status_value, 0, 2);
936936
if (SPIF_BD_ERROR_OK != _spi_send_general_command(SPIF_RDSR, SPI_NO_ADDRESS_COMMAND, NULL, 0, status_value,
937937
1)) { // store received values in status_value
938-
tr_error("ERROR: Reading Status Register failed\n");
938+
tr_error("Reading Status Register failed");
939939
break;
940940
}
941941

942942
if ((status_value[0] & SPIF_STATUS_BIT_WEL) == 0) {
943-
tr_error("ERROR: _set_write_enable failed\n");
943+
tr_error("_set_write_enable failed");
944944
break;
945945
}
946946
status = 0;
@@ -993,7 +993,7 @@ int SPIFBlockDevice::_utils_iterate_next_largest_erase_type(uint8_t &bitfield, i
993993
}
994994

995995
if (i_ind == 4) {
996-
tr_error("ERROR: no erase type was found for current region addr");
996+
tr_error("no erase type was found for current region addr");
997997
}
998998
return largest_erase_type;
999999

0 commit comments

Comments
 (0)