You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/02/10 09:05:58 UTC

[incubator-nuttx] branch master updated: drivers/mtd/sst39vf.c: patch adress bug

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f6626f  drivers/mtd/sst39vf.c: patch adress bug
3f6626f is described below

commit 3f6626f765643f68887f54ce03a92b773825b61a
Author: zouboan <ff...@feedforward.com.cn>
AuthorDate: Wed Feb 9 23:56:40 2022 +0800

    drivers/mtd/sst39vf.c: patch adress bug
---
 drivers/mtd/sst39vf.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/sst39vf.c b/drivers/mtd/sst39vf.c
index 49f166c..27ff74e 100644
--- a/drivers/mtd/sst39vf.c
+++ b/drivers/mtd/sst39vf.c
@@ -581,7 +581,7 @@ static int sst39vf_erase(FAR struct mtd_dev_s *dev, off_t startblock,
     {
       /* Clear the sector */
 
-      ret = sst39vf_sectorerase(priv, address);
+      ret = sst39vf_sectorerase(priv, address >> 1);
       if (ret < 0)
         {
           return ret;
@@ -611,7 +611,7 @@ static ssize_t sst39vf_bread(FAR struct mtd_dev_s *dev, off_t startblock,
   /* Get the source address and the size of the transfer */
 
   source = (FAR const uint8_t *)
-           SST39VF_ADDR(startblock * priv->chip->sectorsize);
+           SST39VF_ADDR(startblock * priv->chip->sectorsize >> 1);
   nbytes = nblocks * priv->chip->sectorsize;
 
   /* Copy the data to the user buffer */
@@ -642,8 +642,7 @@ static ssize_t sst39vf_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
 
   /* Get the destination address and the size of the transfer */
 
-  wrinfo.address =
-    (uintptr_t)SST39VF_ADDR((startblock * priv->chip->sectorsize));
+  wrinfo.address = (uintptr_t)(startblock * priv->chip->sectorsize >> 1);
   nwords = nblocks * (priv->chip->sectorsize >> 1);
 
   /* Copy the data to the user buffer */
@@ -657,7 +656,7 @@ static ssize_t sst39vf_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
           return ret;
         }
 
-      wrinfo.address += sizeof(uint16_t);
+      wrinfo.address += sizeof(uint8_t);
     }
 
   return nblocks;
@@ -684,7 +683,7 @@ static ssize_t sst39vf_read(FAR struct mtd_dev_s *dev, off_t offset,
 
   /* Get the source address and the size of the transfer */
 
-  source = (FAR const uint8_t *)SST39VF_ADDR(offset);
+  source = (FAR const uint8_t *)SST39VF_ADDR(offset >> 1);
 
   /* Copy the data to the user buffer */