@@ -70,8 +70,6 @@ enum qspif_polarity_mode {
70
70
QSPIF_POLARITY_MODE_1 /* CPOL=1, CPHA=1 */
71
71
};
72
72
73
- #define QSPIF_MAX_REGIONS 10
74
- #define MAX_NUM_OF_ERASE_TYPES 4
75
73
#define QSPIF_MAX_ACTIVE_FLASH_DEVICES 10
76
74
77
75
/* * BlockDevice for SFDP based flash devices over QSPI bus
@@ -318,15 +316,9 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
318
316
/* ***************************************/
319
317
/* SFDP Detection and Parsing Functions */
320
318
/* ***************************************/
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
-
324
319
// Parse and Detect required Basic Parameters from Table
325
320
int _sfdp_parse_basic_param_table (uint32_t basic_table_addr, size_t basic_table_size);
326
321
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
-
330
322
// Detect the soft reset protocol and reset - returns error if soft reset is not supported
331
323
int _sfdp_detect_reset_protocol_and_reset (uint8_t *basic_param_table_ptr);
332
324
@@ -344,7 +336,9 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
344
336
int _sfdp_detect_page_size (uint8_t *basic_param_table_ptr, int basic_param_table_size);
345
337
346
338
// 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);
348
342
349
343
// Detect 4-byte addressing mode and enable it if supported
350
344
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 {
356
350
/* Utilities Functions */
357
351
/* **********************/
358
352
// 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 );
360
354
361
355
// Iterate on all supported Erase Types of the Region to which the offset belong to.
362
356
// 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);
364
362
365
363
private:
366
364
enum qspif_clear_protection_method_t {
@@ -399,10 +397,6 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
399
397
// 4-byte addressing extension register write instruction
400
398
mbed::qspi_inst_t _4byte_msb_reg_write_inst;
401
399
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
-
406
400
// Quad mode enable status register and bit
407
401
int _quad_enable_register_idx;
408
402
int _quad_enable_bit;
@@ -412,13 +406,8 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
412
406
// Clear block protection
413
407
qspif_clear_protection_method_t _clear_protection_method;
414
408
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;
422
411
423
412
unsigned int _page_size_bytes; // Page size - 256 Bytes default
424
413
int _freq;
0 commit comments