Skip to content

Commit f73544e

Browse files
author
David Saada
committed
Remove excessive info and debug prints in SPIF driver.
1 parent f28b82b commit f73544e

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,8 @@ int SPIFBlockDevice::init()
151151
tr_error("ERROR: init - Unable to initialize flash memory, tests failed\n");
152152
status = SPIF_BD_ERROR_DEVICE_ERROR;
153153
goto exit_point;
154-
} else {
155-
tr_info("INFO: Initialize flash memory OK\n");
156154
}
157155

158-
159156
/* Read Manufacturer ID (1byte), and Device ID (2bytes)*/
160157
spi_status = _spi_send_general_command(SPIF_RDID, SPI_NO_ADDRESS_COMMAND, NULL, 0, (char *)vendor_device_ids,
161158
data_length);
@@ -202,8 +199,6 @@ int SPIFBlockDevice::init()
202199
_region_high_boundary[0] = _device_size_bytes - 1;
203200

204201
if ((sector_map_table_addr != 0) && (0 != sector_map_table_size)) {
205-
tr_info("INFO: init - Parsing Sector Map Table - addr: 0x%lxh, Size: %d", sector_map_table_addr,
206-
sector_map_table_size);
207202
if (0 != _sfdp_parse_sector_map_table(sector_map_table_addr, sector_map_table_size)) {
208203
tr_error("ERROR: init - Parse Sector Map Table Failed");
209204
status = SPIF_BD_ERROR_PARSING_FAILED;
@@ -260,7 +255,6 @@ int SPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
260255
}
261256

262257
int status = SPIF_BD_ERROR_OK;
263-
tr_info("INFO Read - Inst: 0x%xh", _read_instruction);
264258
_mutex->lock();
265259

266260
// Set Dummy Cycles for Specific Read Command Mode
@@ -286,8 +280,6 @@ int SPIFBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size)
286280
uint32_t offset = 0;
287281
uint32_t chunk = 0;
288282

289-
tr_debug("DEBUG: program - Buff: 0x%lxh, addr: %llu, size: %llu", (uint32_t)buffer, addr, size);
290-
291283
while (size > 0) {
292284

293285
// Write on _page_size_bytes boundaries (Default 256 bytes a page)
@@ -345,8 +337,6 @@ int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
345337
// Erase Types of selected region
346338
uint8_t bitfield = _region_erase_types_bitfield[region];
347339

348-
tr_info("DEBUG: erase - addr: %llu, in_size: %llu", addr, in_size);
349-
350340
if ((addr + in_size) > _device_size_bytes) {
351341
tr_error("ERROR: erase exceeds flash device size");
352342
return SPIF_BD_ERROR_INVALID_ERASE_PARAMS;
@@ -367,11 +357,6 @@ int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
367357
offset = addr % _erase_type_size_arr[type];
368358
chunk = ((offset + size) < _erase_type_size_arr[type]) ? size : (_erase_type_size_arr[type] - offset);
369359

370-
tr_debug("DEBUG: erase - addr: %llu, size:%d, Inst: 0x%xh, chunk: %lu , ",
371-
addr, size, cur_erase_inst, chunk);
372-
tr_debug("DEBUG: erase - Region: %d, Type:%d",
373-
region, type);
374-
375360
_mutex->lock();
376361

377362
if (_set_write_enable() != 0) {
@@ -555,7 +540,6 @@ spif_bd_error SPIFBlockDevice::_spi_send_program_command(int prog_inst, const vo
555540

556541
spif_bd_error SPIFBlockDevice::_spi_send_erase_command(int erase_inst, bd_addr_t addr, bd_size_t size)
557542
{
558-
tr_info("INFO: Erase Inst: 0x%xh, addr: %llu, size: %llu", erase_inst, addr, size);
559543
addr = (((int)addr) & 0x00FFF000);
560544
_spi_send_general_command(erase_inst, addr, NULL, 0, NULL, 0);
561545
return SPIF_BD_ERROR_OK;
@@ -727,14 +711,10 @@ int SPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_t
727711
if (!(memcmp(&sfdp_header[0], "SFDP", 4) == 0 && sfdp_header[5] == 1)) {
728712
tr_error("ERROR: init - _verify SFDP signature and version Failed");
729713
return -1;
730-
} else {
731-
tr_info("INFO: init - verified SFDP Signature and version Successfully");
732714
}
733715

734716
// Discover Number of Parameter Headers
735717
int number_of_param_headers = (int)(sfdp_header[6]) + 1;
736-
tr_debug("DEBUG: number of Param Headers: %d", number_of_param_headers);
737-
738718

739719
addr += SPIF_SFDP_HEADER_SIZE;
740720
data_length = SPIF_PARAM_HEADER_SIZE;
@@ -757,14 +737,12 @@ int SPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_t
757737

758738
if ((param_header[0] == 0) && (param_header[7] == 0xFF)) {
759739
// Found Basic Params Table: LSB=0x00, MSB=0xFF
760-
tr_debug("DEBUG: Found Basic Param Table at Table: %d", i_ind + 1);
761740
basic_table_addr = ((param_header[6] << 16) | (param_header[5] << 8) | (param_header[4]));
762741
// Supporting up to 64 Bytes Table (16 DWORDS)
763742
basic_table_size = ((param_header[3] * 4) < SFDP_DEFAULT_BASIC_PARAMS_TABLE_SIZE_BYTES) ? (param_header[3] * 4) : 64;
764743

765744
} else if ((param_header[0] == 81) && (param_header[7] == 0xFF)) {
766745
// Found Sector Map Table: LSB=0x81, MSB=0xFF
767-
tr_debug("DEBUG: Found Sector Map Table at Table: %d", i_ind + 1);
768746
sector_map_table_addr = ((param_header[6] << 16) | (param_header[5] << 8) | (param_header[4]));
769747
sector_map_table_size = param_header[3] * 4;
770748

@@ -783,9 +761,6 @@ unsigned int SPIFBlockDevice::_sfdp_detect_page_size(uint8_t *basic_param_table_
783761
// Page Size is specified by 4 Bits (N), calculated by 2^N
784762
int page_to_power_size = ((int)basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_PAGE_SIZE_BYTE]) >> 4;
785763
page_size = local_math_power(2, page_to_power_size);
786-
tr_debug("DEBUG: Detected Page Size: %d", page_size);
787-
} else {
788-
tr_debug("DEBUG: Using Default Page Size: %d", page_size);
789764
}
790765
return page_size;
791766
}
@@ -807,8 +782,6 @@ int SPIFBlockDevice::_sfdp_detect_erase_types_inst_and_size(uint8_t *basic_param
807782
erase_type_inst_arr[i_ind] = 0xff; //0xFF default for unsupported type
808783
erase_type_size_arr[i_ind] = local_math_power(2,
809784
basic_param_table_ptr[SPIF_BASIC_PARAM_ERASE_TYPE_1_SIZE_BYTE + 2 * i_ind]); // Size given as 2^N
810-
tr_info("DEBUG: Erase Type(A) %d - Inst: 0x%xh, Size: %d", (i_ind + 1), erase_type_inst_arr[i_ind],
811-
erase_type_size_arr[i_ind]);
812785
if (erase_type_size_arr[i_ind] > 1) {
813786
// if size==1 type is not supported
814787
erase_type_inst_arr[i_ind] = basic_param_table_ptr[SPIF_BASIC_PARAM_ERASE_TYPE_1_BYTE + 2 * i_ind];
@@ -831,8 +804,6 @@ int SPIFBlockDevice::_sfdp_detect_erase_types_inst_and_size(uint8_t *basic_param
831804
_region_erase_types_bitfield[0] |= bitfield; // If there's no region map, set region "0" types bitfield as defualt;
832805
}
833806

834-
tr_info("INFO: Erase Type %d - Inst: 0x%xh, Size: %d", (i_ind + 1), erase_type_inst_arr[i_ind],
835-
erase_type_size_arr[i_ind]);
836807
bitfield = bitfield << 1;
837808
}
838809
}
@@ -859,7 +830,6 @@ int SPIFBlockDevice::_sfdp_detect_best_bus_read_mode(uint8_t *basic_param_table_
859830
read_inst = basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_222_READ_INST_BYTE];
860831
_read_dummy_and_mode_cycles = (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_222_READ_INST_BYTE - 1] >> 5)
861832
+ (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_222_READ_INST_BYTE - 1] & 0x1F);
862-
tr_info("\nDEBUG: Read Bus Mode set to 2-2-2, Instruction: 0x%xh", read_inst);
863833
break;
864834
}
865835
}
@@ -869,20 +839,17 @@ int SPIFBlockDevice::_sfdp_detect_best_bus_read_mode(uint8_t *basic_param_table_
869839
read_inst = basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_122_READ_INST_BYTE];
870840
_read_dummy_and_mode_cycles = (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_122_READ_INST_BYTE - 1] >> 5)
871841
+ (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_122_READ_INST_BYTE - 1] & 0x1F);
872-
tr_debug("\nDEBUG: Read Bus Mode set to 1-2-2, Instruction: 0x%xh", read_inst);
873842
break;
874843
}
875844
if (examined_byte & 0x01) {
876845
// Fast Read 1-1-2 Supported
877846
read_inst = basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_112_READ_INST_BYTE];
878847
_read_dummy_and_mode_cycles = (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_112_READ_INST_BYTE - 1] >> 5)
879848
+ (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_112_READ_INST_BYTE - 1] & 0x1F);
880-
tr_debug("\nDEBUG: Read Bus Mode set to 1-1-2, Instruction: 0x%xh", _read_instruction);
881849
break;
882850
}
883851
*/
884852
_read_dummy_and_mode_cycles = 0;
885-
tr_debug("\nDEBUG: Read Bus Mode set to 1-1-1, Instruction: 0x%xh", read_inst);
886853
} while (false);
887854

888855
return 0;
@@ -893,21 +860,17 @@ int SPIFBlockDevice::_reset_flash_mem()
893860
// Perform Soft Reset of the Device prior to initialization
894861
int status = 0;
895862
char status_value[2] = {0};
896-
tr_info("INFO: _reset_flash_mem:\n");
897863
//Read the Status Register from device
898864
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RDSR, SPI_NO_ADDRESS_COMMAND, NULL, 0, status_value, 1)) {
899865
// store received values in status_value
900-
tr_debug("DEBUG: Reading Status Register Success: value = 0x%x\n", (int)status_value[0]);
901866
} else {
902-
tr_debug("ERROR: Reading Status Register failed\n");
903867
status = -1;
904868
}
905869

906870
if (0 == status) {
907871
//Send Reset Enable
908872
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RSTEN, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0)) {
909873
// store received values in status_value
910-
tr_debug("DEBUG: Sending RSTEN Success\n");
911874
} else {
912875
tr_error("ERROR: Sending RSTEN failed\n");
913876
status = -1;
@@ -917,7 +880,6 @@ int SPIFBlockDevice::_reset_flash_mem()
917880
//Send Reset
918881
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RST, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0)) {
919882
// store received values in status_value
920-
tr_debug("DEBUG: Sending RST Success\n");
921883
} else {
922884
tr_error("ERROR: Sending RST failed\n");
923885
status = -1;

0 commit comments

Comments
 (0)