aboutsummaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-02 01:45:56 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-02 01:45:56 +0000
commit757383d8193d4a37cd380b7ba6232552a531fc9c (patch)
tree9acbfbd6a6c514a4041325607c990da1a0219187 /nuttx
parent6913926a9621d7aa92c89a44d7946290d299dcde (diff)
downloadpx4-firmware-757383d8193d4a37cd380b7ba6232552a531fc9c.tar.gz
px4-firmware-757383d8193d4a37cd380b7ba6232552a531fc9c.tar.bz2
px4-firmware-757383d8193d4a37cd380b7ba6232552a531fc9c.zip
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')
-rw-r--r--nuttx/arch/arm/src/lpc43xx/lpc43_spifi.c14
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 8e633e5d1..e26d705b1 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 */