changeset 1615:5118f42e7e62

* src/flashiodev.c: When checking flash upper bound, allow for end of flash at 0xffffffff.
author jlarmour
date Thu, 29 Apr 2004 06:37:56 +0000
parents 7c0a7354a758
children 126cd98e4832
files packages/io/flash/current/ChangeLog packages/io/flash/current/src/flashiodev.c
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-29  Sebastien Couret  <sebastien.couret@elios-informatique.com>
+2004-04-29  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/flashiodev.c: When checking flash upper bound, allow for end
+	of flash at 0xffffffff.
+
 2003-11-27  David Woodhouse  <dwmw2@infradead.org>
 
 	* src/flashiodev.c: Enable set_config() and implement
--- a/packages/io/flash/current/src/flashiodev.c
+++ b/packages/io/flash/current/src/flashiodev.c
@@ -126,7 +126,7 @@ flashiodev_bread( cyg_io_handle_t handle
 
 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time
     char *endpos = startpos + *len - 1;
-    char *flashend = MIN( (char *)flash_info.end, dev->end);
+    char *flashend = MIN( (char *)flash_info.end - 1, dev->end - 1);
     if ( startpos < dev->start )
         return -EINVAL;
     if ( endpos > flashend )
@@ -154,7 +154,7 @@ flashiodev_bwrite( cyg_io_handle_t handl
 
 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time
     char *endpos = startpos + *len - 1;
-    char *flashend = MIN( (char *)flash_info.end, dev->end);
+    char *flashend = MIN( (char *)flash_info.end - 1, dev->end - 1);
     if ( startpos < dev->start )
         return -EINVAL;
     if ( endpos > flashend )
@@ -188,8 +188,8 @@ flashiodev_get_config( cyg_io_handle_t h
 
 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time
             char *endpos = startpos + e->len - 1;
-		    char *flashend = MIN( (char *)flash_info.end, dev->end);
-			if ( startpos < dev->start )
+            char *flashend = MIN( (char *)flash_info.end - 1, dev->end - 1);
+            if ( startpos < dev->start )
                 return -EINVAL;
             if ( endpos > flashend )
                 return -EINVAL;
@@ -218,7 +218,7 @@ flashiodev_get_config( cyg_io_handle_t h
             (cyg_io_flash_getconfig_blocksize_t *)buf;
 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time
        char *startpos = dev->start + b->offset;
-	    char *flashend = MIN( (char *)flash_info.end, dev->end);
+	    char *flashend = MIN( (char *)flash_info.end - 1, dev->end - 1);
 
         if ( startpos < dev->start )
             return -EINVAL;
@@ -244,8 +244,10 @@ flashiodev_set_config( cyg_io_handle_t h
                        const void* buf,
                        cyg_uint32* len)
 {
+#ifdef CYGNUM_IO_FLASH_BLOCK_CFG_FIS_1
 	struct cyg_devtab_entry *tab = (struct cyg_devtab_entry *)handle;
 	struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)tab->priv;
+#endif
 
     switch (key) {
 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_FIS_1