Skip to content

Commit 298f6d8

Browse files
dleach02kartben
authored andcommitted
drivers: flash: Add documentation on read API
Add some clarity on expected parameter validation order to have consistency between implementations. Signed-off-by: David Leach <david.leach@nxp.com>
1 parent 73faf5c commit 298f6d8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/zephyr/drivers/flash.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ int flash_params_get_erase_cap(const struct flash_parameters *p)
125125
* @{
126126
*/
127127

128+
/**
129+
* @brief Flash read implementation handler type
130+
*
131+
* @return 0 on success or len is zero, -EINVAL if page offset doesn't exist or data
132+
* destination is NULL
133+
*
134+
* @note Any necessary read protection management must be performed by
135+
* the driver.
136+
*
137+
* For consistency across implementations, value check len parameter equal zero and
138+
* return result 0 before validating the data destination parameter.
139+
*/
128140
typedef int (*flash_api_read)(const struct device *dev, off_t offset,
129141
void *data,
130142
size_t len);

0 commit comments

Comments
 (0)