diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-08-02 01:45:56 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-08-02 01:45:56 +0000 |
commit | 2028c3e34d74ec850375b776f1d9c9beaa0f9f6d (patch) | |
tree | 9acbfbd6a6c514a4041325607c990da1a0219187 /nuttx/arch/arm | |
parent | edeb4ed92a8e841ad62e8b5a06823a3037ce4301 (diff) |
Correct an addressing error in the LPC32 SPIFI MTD driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4997 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r-- | nuttx/arch/arm/src/lpc43xx/lpc43_spifi.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_spifi.c b/nuttx/arch/arm/src/lpc43xx/lpc43_spifi.c index 8e633e5d18..e26d705b14 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_spifi.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_spifi.c @@ -515,7 +515,7 @@ static void lpc43_cacheflush(struct lpc43_dev_s *priv) { /* Get the SPIFI address corresponding to the cached erase block */ - dest = SPIFI_BASE + (priv->blkno << SPIFI_BLKSHIFT); + dest = SPIFI_BASE + ((off_t)priv->blkno << SPIFI_BLKSHIFT); /* Write entire erase block to FLASH */ @@ -554,24 +554,24 @@ static FAR uint8_t *lpc43_cacheread(struct lpc43_dev_s *priv, off_t sector) /* Check if the requested erase block is already in the cache */ - if (!IS_VALID(priv) || blkno != priv->blkno) + if (!IS_VALID(priv) || blkno != (off_t)priv->blkno) { /* No.. Flush any dirty erase block currently in the cache */ lpc43_cacheflush(priv); - /* Read the erase block into the cache */ - /* Get the SPIFI address corresponding to the cached erase block */ + /* Read the new erase block into the cache */ + /* Get the SPIFI address corresponding to the new erase block */ - src = SPIFI_BASE + (priv->blkno << SPIFI_BLKSHIFT); + src = SPIFI_BASE + ((off_t)blkno << SPIFI_BLKSHIFT); - /* Write entire erase block to FLASH */ + /* Read the entire erase block from FLASH */ lpc43_pageread(priv, priv->cache, src, SPIFI_BLKSIZE); /* Mark the sector as cached */ - priv->blkno = blkno; + priv->blkno = (uint16_t)blkno; SET_VALID(priv); /* The data in the cache is valid */ CLR_DIRTY(priv); /* It should match the FLASH contents */ |