mirror of
https://github.com/apache/nuttx.git
synced 2025-12-09 03:33:51 +08:00
MTD progmem: Fix an address calculation
This commit is contained in:
2
arch
2
arch
Submodule arch updated: 24f87df3fa...1c26392beb
@@ -329,7 +329,7 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
|
||||
buffer += dev->geo.erasesize;
|
||||
}
|
||||
|
||||
/* Finally, handler any partial blocks after the last full erase block */
|
||||
/* Finally, handle any partial blocks after the last full erase block */
|
||||
|
||||
if (remaining > 0)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -199,15 +200,13 @@ static ssize_t progmem_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
{
|
||||
FAR struct progmem_dev_s *priv = (FAR struct progmem_dev_s *)dev;
|
||||
FAR const uint8_t *src;
|
||||
size_t offset;
|
||||
|
||||
/* Read the specified blocks into the provided user buffer and return
|
||||
* status (The positive, number of blocks actually read or a negated
|
||||
* errno).
|
||||
*/
|
||||
|
||||
offset = startblock << priv->blkshift;
|
||||
src = (FAR const uint8_t *)up_progmem_getaddress(offset);
|
||||
src = (FAR const uint8_t *)up_progmem_getaddress(startblock);
|
||||
memcpy(buffer, src, nblocks << priv->blkshift);
|
||||
return nblocks;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user