changeset 1391:c1f61c891552

* src/flashiodev.c (flashiodev_bwrite): Use flash_read rather than directly doing a memcpy.
author asl
date Mon, 24 Nov 2003 11:38:59 +0000
parents 5503490aa292
children 47e26737c662
files packages/io/flash/current/ChangeLog packages/io/flash/current/src/flashiodev.c
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-11-24  Roland Caßebohm <roland.cassebohm@visionsystems.de>
+
+	* src/flashiodev.c (flashiodev_bwrite): Use flash_read rather than
+	directly doing a memcpy. 
+
 2003-11-20  Jani Monoses  <jani@iv.ro>
 
 	* src/flash.c: 
--- a/packages/io/flash/current/src/flashiodev.c
+++ b/packages/io/flash/current/src/flashiodev.c
@@ -120,6 +120,9 @@ flashiodev_bread( cyg_io_handle_t handle
 	struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)tab->priv;
 
 	char *startpos = dev->start + pos;
+        void *erraddr;
+        Cyg_ErrNo err = ENOERR;
+        
 
 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time
     char *endpos = startpos + *len - 1;
@@ -129,9 +132,13 @@ flashiodev_bread( cyg_io_handle_t handle
     if ( endpos > flashend )
         return -EINVAL;
 #endif
+    
+    err = flash_read( startpos,
+                      (void *)buf, *len, &erraddr );
 
-    memcpy( buf, startpos, *len );
-    return ENOERR;
+    if ( err )
+        err = -EIO; // just something sane
+    return err;
 } // flashiodev_bread()
 
 static Cyg_ErrNo