@@ -70,8 +70,6 @@ enum qspif_polarity_mode {
7070 QSPIF_POLARITY_MODE_1 /* CPOL=1, CPHA=1 */
7171};
7272
73- #define QSPIF_MAX_REGIONS 10
74- #define MAX_NUM_OF_ERASE_TYPES 4
7573#define QSPIF_MAX_ACTIVE_FLASH_DEVICES 10
7674
7775/* * BlockDevice for SFDP based flash devices over QSPI bus
@@ -318,15 +316,9 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
318316 /* ***************************************/
319317 /* SFDP Detection and Parsing Functions */
320318 /* ***************************************/
321- // Parse SFDP Headers and retrieve Basic Param and Sector Map Tables (if exist)
322- int _sfdp_parse_sfdp_headers (mbed::sfdp_hdr_info &hdr_info);
323-
324319 // Parse and Detect required Basic Parameters from Table
325320 int _sfdp_parse_basic_param_table (uint32_t basic_table_addr, size_t basic_table_size);
326321
327- // Parse and read information required by Regions Sector Map
328- int _sfdp_parse_sector_map_table (uint32_t sector_map_table_addr, size_t sector_map_table_size);
329-
330322 // Detect the soft reset protocol and reset - returns error if soft reset is not supported
331323 int _sfdp_detect_reset_protocol_and_reset (uint8_t *basic_param_table_ptr);
332324
@@ -344,7 +336,9 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
344336 int _sfdp_detect_page_size (uint8_t *basic_param_table_ptr, int basic_param_table_size);
345337
346338 // Detect all supported erase types
347- int _sfdp_detect_erase_types_inst_and_size (uint8_t *basic_param_table_ptr, int basic_param_table_size);
339+ int _sfdp_detect_erase_types_inst_and_size (uint8_t *basic_param_table_ptr,
340+ int basic_param_table_size,
341+ mbed::sfdp_smptbl_info &smptbl);
348342
349343 // Detect 4-byte addressing mode and enable it if supported
350344 int _sfdp_detect_and_enable_4byte_addressing (uint8_t *basic_param_table_ptr, int basic_param_table_size);
@@ -356,11 +350,15 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
356350 /* Utilities Functions */
357351 /* **********************/
358352 // Find the region to which the given offset belong to
359- int _utils_find_addr_region (mbed::bd_size_t offset);
353+ int _utils_find_addr_region (mbed::bd_size_t offset, mbed::sfdp_smptbl_info &smptbl );
360354
361355 // Iterate on all supported Erase Types of the Region to which the offset belong to.
362356 // Iterates from highest type to lowest
363- int _utils_iterate_next_largest_erase_type (uint8_t &bitfield, int size, int offset, int boundry);
357+ int _utils_iterate_next_largest_erase_type (uint8_t &bitfield,
358+ int size,
359+ int offset,
360+ int region,
361+ mbed::sfdp_smptbl_info &smptbl);
364362
365363private:
366364 enum qspif_clear_protection_method_t {
@@ -399,10 +397,6 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
399397 // 4-byte addressing extension register write instruction
400398 mbed::qspi_inst_t _4byte_msb_reg_write_inst;
401399
402- // Up To 4 Erase Types are supported by SFDP (each with its own command Instruction and Size)
403- mbed::qspi_inst_t _erase_type_inst_arr[MAX_NUM_OF_ERASE_TYPES];
404- unsigned int _erase_type_size_arr[MAX_NUM_OF_ERASE_TYPES];
405-
406400 // Quad mode enable status register and bit
407401 int _quad_enable_register_idx;
408402 int _quad_enable_bit;
@@ -412,13 +406,8 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
412406 // Clear block protection
413407 qspif_clear_protection_method_t _clear_protection_method;
414408
415- // Sector Regions Map
416- int _regions_count; // number of regions
417- int _region_size_bytes[QSPIF_MAX_REGIONS]; // regions size in bytes
418- bd_size_t _region_high_boundary[QSPIF_MAX_REGIONS]; // region high address offset boundary
419- // Each Region can support a bit combination of any of the 4 Erase Types
420- uint8_t _region_erase_types_bitfield[QSPIF_MAX_REGIONS];
421- unsigned int _min_common_erase_size; // minimal common erase size for all regions (0 if none exists)
409+ // Data extracted from the devices SFDP structure
410+ mbed::sfdp_hdr_info _sfdp_info;
422411
423412 unsigned int _page_size_bytes; // Page size - 256 Bytes default
424413 int _freq;
0 commit comments