mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 04:52:59 +01:00
drivers/mtd: fix doc of mtd_read_page(), mtd_write_page_raw()
The function allows for offsets greater than the page size.
This commit is contained in:
parent
934c65fb2e
commit
bede0615ad
@ -318,8 +318,6 @@ int mtd_read(mtd_dev_t *mtd, void *dest, uint32_t addr, uint32_t count);
|
||||
* The MTD layer will take care of splitting up the transaction into multiple
|
||||
* reads if it is required by the underlying storage media.
|
||||
*
|
||||
* @p offset must be smaller than the page size
|
||||
*
|
||||
* @param mtd the device to read from
|
||||
* @param[out] dest the buffer to fill in
|
||||
* @param[in] page Page number to start reading from
|
||||
@ -369,8 +367,6 @@ int mtd_write(mtd_dev_t *mtd, const void *src, uint32_t addr, uint32_t count);
|
||||
*
|
||||
* Both @p offset and @p size must be multiples of the device's write size.
|
||||
*
|
||||
* @p offset must be smaller than the page size
|
||||
*
|
||||
* @param mtd the device to write to
|
||||
* @param[in] src the buffer to write
|
||||
* @param[in] page Page number to start writing to
|
||||
|
@ -106,6 +106,7 @@ int mtd_read_page(mtd_dev_t *mtd, void *dest, uint32_t page, uint32_t offset,
|
||||
const uint32_t page_shift = bitarithm_msb(mtd->page_size);
|
||||
const uint32_t page_mask = mtd->page_size - 1;
|
||||
|
||||
/* ensure offset is within a page */
|
||||
page += offset >> page_shift;
|
||||
offset = offset & page_mask;
|
||||
|
||||
@ -264,6 +265,7 @@ int mtd_write_page_raw(mtd_dev_t *mtd, const void *src, uint32_t page, uint32_t
|
||||
const uint32_t page_shift = bitarithm_msb(mtd->page_size);
|
||||
const uint32_t page_mask = mtd->page_size - 1;
|
||||
|
||||
/* ensure offset is within a page */
|
||||
page += offset >> page_shift;
|
||||
offset = offset & page_mask;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user