Skip to content

Commit c953b65

Browse files
author
Veijo Pesonen
committed
SFDP: provides doxygen documentation improvements
1 parent ca704a4 commit c953b65

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

drivers/internal/SFDP.h

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ constexpr int SFDP_ERASE_BITMASK_ALL = 0x0F; ///< Erase type All
4747

4848
constexpr int SFDP_MAX_NUM_OF_ERASE_TYPES = 4; ///< Maximum number of different erase types (erase granularity)
4949

50-
/** SFDP Basic Parameter Table info */
50+
/** JEDEC Basic Flash Parameter Table info */
5151
struct sfdp_bptbl_info {
5252
uint32_t addr; ///< Address
5353
size_t size; ///< Size
5454
bd_size_t device_size_bytes;
5555
int legacy_erase_instruction; ///< Legacy 4K erase instruction
5656
};
5757

58-
/** SFDP Sector Map Table info */
58+
/** JEDEC Sector Map Table info */
5959
struct sfdp_smptbl_info {
6060
uint32_t addr; ///< Address
6161
size_t size; ///< Size
@@ -68,67 +68,72 @@ struct sfdp_smptbl_info {
6868
unsigned int erase_type_size_arr[SFDP_MAX_NUM_OF_ERASE_TYPES]; ///< Erase sizes for all different erase types
6969
};
7070

71-
/** SFDP Parameter Table addresses and sizes */
71+
/** SFDP JEDEC Parameter Table info */
7272
struct sfdp_hdr_info {
7373
sfdp_bptbl_info bptbl;
7474
sfdp_smptbl_info smptbl;
7575
};
7676

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
7979
*
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.
8281
*
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
8486
*/
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);
8688

8789
/** Parse Sector Map Parameter Table
8890
* Retrieves the table from a device and parses the information contained by the table
8991
*
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
9294
*
93-
* @return 0 on success, negative error code on failure
95+
* @return MBED_SUCCESS on success, negative error code on failure
9496
*/
9597
int sfdp_parse_sector_map_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader, sfdp_smptbl_info &smtbl);
9698

9799
/** Detect page size used for writing on flash
98100
*
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
101103
*
102104
* @return Page size
103105
*/
104106
size_t sfdp_detect_page_size(uint8_t *bptbl_ptr, size_t bptbl_size);
105107

106108
/** Detect all supported erase types
107109
*
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
110112
*
111-
* @return 0 on success, negative error code on failure
113+
* @return MBED_SUCCESS on success, negative error code on failure
112114
*/
113115
int sfdp_detect_erase_types_inst_and_size(uint8_t *bptbl_ptr, sfdp_hdr_info &sfdp_info);
114116

115117
/** Find the region to which the given offset belongs to
116118
*
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
119123
*/
120124
int sfdp_find_addr_region(bd_size_t offset, const sfdp_hdr_info &sfdp_info);
121125

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
123127
*
124128
* Iterates from highest type to lowest.
125129
*
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
130135
*
131-
* @return
136+
* @return Largest erase type
132137
*/
133138
int sfdp_iterate_next_largest_erase_type(uint8_t &bitfield,
134139
int size,

drivers/source/SFDP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int sfdp_parse_single_param_header(sfdp_prm_hdr *phdr_ptr, sfdp_hdr_info &hdr_in
126126
return 0;
127127
}
128128

129-
int sfdp_parse_headers(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &hdr_info)
129+
int sfdp_parse_headers(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &sfdp_info)
130130
{
131131
bd_addr_t addr = 0x0;
132132
int number_of_param_headers = 0;
@@ -164,7 +164,7 @@ int sfdp_parse_headers(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
164164
return -1;
165165
}
166166

167-
hdr_status = sfdp_parse_single_param_header((sfdp_prm_hdr *)param_header, hdr_info);
167+
hdr_status = sfdp_parse_single_param_header((sfdp_prm_hdr *)param_header, sfdp_info);
168168
if (hdr_status < 0) {
169169
return hdr_status;
170170
}

0 commit comments

Comments
 (0)