@@ -47,15 +47,15 @@ constexpr int SFDP_ERASE_BITMASK_ALL = 0x0F; ///< Erase type All
47
47
48
48
constexpr int SFDP_MAX_NUM_OF_ERASE_TYPES = 4 ; // /< Maximum number of different erase types (erase granularity)
49
49
50
- /* * SFDP Basic Parameter Table info */
50
+ /* * JEDEC Basic Flash Parameter Table info */
51
51
struct sfdp_bptbl_info {
52
52
uint32_t addr; // /< Address
53
53
size_t size; // /< Size
54
54
bd_size_t device_size_bytes;
55
55
int legacy_erase_instruction; // /< Legacy 4K erase instruction
56
56
};
57
57
58
- /* * SFDP Sector Map Table info */
58
+ /* * JEDEC Sector Map Table info */
59
59
struct sfdp_smptbl_info {
60
60
uint32_t addr; // /< Address
61
61
size_t size; // /< Size
@@ -68,67 +68,72 @@ struct sfdp_smptbl_info {
68
68
unsigned int erase_type_size_arr[SFDP_MAX_NUM_OF_ERASE_TYPES]; // /< Erase sizes for all different erase types
69
69
};
70
70
71
- /* * SFDP Parameter Table addresses and sizes */
71
+ /* * SFDP JEDEC Parameter Table info */
72
72
struct sfdp_hdr_info {
73
73
sfdp_bptbl_info bptbl;
74
74
sfdp_smptbl_info smptbl;
75
75
};
76
76
77
- /* * Parse SFDP Headers
78
- * Retrieves SFDP headers from a device and parses the information contained by the headers
77
+ /* * Parse SFDP Database
78
+ * Retrieves all headers from within a memory device and parses the information contained by the headers
79
79
*
80
- * @param sfdp_reader Callback function used to read headers from a device
81
- * @param hdr_info SFDP information structure
80
+ * Only JEDEC headers are parsed, not vendor specific ones.
82
81
*
83
- * @return 0 on success, negative error code on failure
82
+ * @param sfdp_reader Callback function used to read headers from within a device
83
+ * @param[out] sfdp_info Contains the results of parsing the SFDP Database JEDEC headers
84
+ *
85
+ * @return MBED_SUCCESS on success, negative error code on failure
84
86
*/
85
- int sfdp_parse_headers (Callback<int (bd_addr_t , void *, bd_size_t )> sfdp_reader, sfdp_hdr_info &hdr_info );
87
+ int sfdp_parse_headers (Callback<int (bd_addr_t , void *, bd_size_t )> sfdp_reader, sfdp_hdr_info &sfdp_info );
86
88
87
89
/* * Parse Sector Map Parameter Table
88
90
* Retrieves the table from a device and parses the information contained by the table
89
91
*
90
- * @param sfdp_reader Callback function used to read headers from a device
91
- * @param smtbl Sector Map Table information structure
92
+ * @param sfdp_reader Callback function used to read headers from within a device
93
+ * @param[out] smtbl Contains the results of parsing the JEDEC Sector Map Table
92
94
*
93
- * @return 0 on success, negative error code on failure
95
+ * @return MBED_SUCCESS on success, negative error code on failure
94
96
*/
95
97
int sfdp_parse_sector_map_table (Callback<int (bd_addr_t , void *, bd_size_t )> sfdp_reader, sfdp_smptbl_info &smtbl);
96
98
97
99
/* * Detect page size used for writing on flash
98
100
*
99
- * @param bptbl_ptr Pointer to memory holding a Basic Parameter Table structure
100
- * @param bptbl_size Size of memory holding a Basic Parameter Table
101
+ * @param bptbl_ptr Pointer to memory holding a Basic Parameter Table structure
102
+ * @param bptbl_size Size of memory holding the Basic Parameter Table
101
103
*
102
104
* @return Page size
103
105
*/
104
106
size_t sfdp_detect_page_size (uint8_t *bptbl_ptr, size_t bptbl_size);
105
107
106
108
/* * Detect all supported erase types
107
109
*
108
- * @param bptbl_ptr Pointer to memory holding a Basic Parameter Table structure
109
- * @param smtbl Sector Map Table information structure
110
+ * @param bptbl_ptr Pointer to memory holding a JEDEC Basic Flash Parameter Table
111
+ * @param[in,out] sfdp_info Contains the results of parsing erase type instructions and sizes
110
112
*
111
- * @return 0 on success, negative error code on failure
113
+ * @return MBED_SUCCESS on success, negative error code on failure
112
114
*/
113
115
int sfdp_detect_erase_types_inst_and_size (uint8_t *bptbl_ptr, sfdp_hdr_info &sfdp_info);
114
116
115
117
/* * Find the region to which the given offset belongs to
116
118
*
117
- * @param offset Offset value
118
- * @param smtbl Sector Map Table information structure
119
+ * @param offset Offset value
120
+ * @param sfdp_info Region information
121
+ *
122
+ * @return Region number
119
123
*/
120
124
int sfdp_find_addr_region (bd_size_t offset, const sfdp_hdr_info &sfdp_info);
121
125
122
- /* * Iterate on all supported Erase Types of the Region to which the offset belongs to
126
+ /* * Finds the largest Erase Type of the Region to which the offset belongs to
123
127
*
124
128
* Iterates from highest type to lowest.
125
129
*
126
- * @param bitfield
127
- * @param size
128
- * @param region
129
- * @param smtbl Sector Map Table information structure
130
+ * @param bitfield Erase types bit field
131
+ * @param size Upper limit for region size
132
+ * @param offset Offset value
133
+ * @param region Region number
134
+ * @param smtbl Information about different erase types
130
135
*
131
- * @return
136
+ * @return Largest erase type
132
137
*/
133
138
int sfdp_iterate_next_largest_erase_type (uint8_t &bitfield,
134
139
int size,
0 commit comments