This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reworking eCos flash interfaces...


David Vrabel wrote:
Hi,

> flash2_redboot_2003_07_15.patch

Ian missed a few bits out which break the fis free command.  Find patch
attached.

Find non-reversed patch attached... Oops.


/me crawls back into hole.

David Vrabel
--
David Vrabel, Design Engineer

Arcom                         Tel: +44 (0)1223 411200 ext. 3233
Clifton Road                  Fax: +44 (0)1223 403400
Cambridge CB1 7EA             E-mail: dvrabel@arcom.com
UK                            Web: http://www.arcom.com/


________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________
Index: packages/redboot/current/src/flash.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.4
retrieving revision 1.6
diff -u -B -p -r1.4 -r1.6
--- packages/redboot/current/src/flash.c	19 Jun 2003 15:17:28 -0000	1.4
+++ packages/redboot/current/src/flash.c	15 Jul 2003 15:24:53 -0000	1.6
@@ -504,8 +504,8 @@ fis_list(int argc, char *argv[])
 static void
 fis_free(int argc, char *argv[])
 {
-    unsigned long fis_ptr, fis_end;
-    unsigned long area_start;
+    cyg_flash_offset_t fis_ptr, fis_end;
+    cyg_flash_offset_t area_start;
     unsigned long temp;
 
     // Do not search the area reserved for pre-RedBoot systems:
@@ -527,11 +527,11 @@ fis_free(int argc, char *argv[])
                 if (temp == (unsigned long)0xFFFFFFFF) {
                     break;
                 }
-                area_start += flash_block_size / sizeof(CYG_ADDRESS);
+                area_start += flash_block_size;
             }
             fis_ptr = area_start;
         } else {
-            fis_ptr += flash_block_size / sizeof(CYG_ADDRESS);
+            fis_ptr += flash_block_size;
         }
     }
     if (area_start != fis_ptr) {
@@ -544,15 +544,17 @@ fis_free(int argc, char *argv[])
 static bool
 fis_find_free(CYG_ADDRESS *addr, unsigned long length)
 {
-    unsigned long *fis_ptr, *fis_end;
-    unsigned long *area_start;
+    cyg_flash_offset_t fis_ptr, fis_end;
+    cyg_flash_offset_t area_start;
+    unsigned long temp;
 
     // Do not search the area reserved for pre-RedBoot systems:
-    fis_ptr = (unsigned long *)(CYGNUM_REDBOOT_FLASH_RESERVED_BASE);
-    fis_end = (unsigned long *)(CYG_ADDRESS)flash_size;
+    fis_ptr = CYGNUM_REDBOOT_FLASH_RESERVED_BASE;
+    fis_end = flash_size;
     area_start = fis_ptr;
     while (fis_ptr < fis_end) {
-        if (*fis_ptr != (unsigned long)0xFFFFFFFF) {
+        cyg_flash_read(flash_info, (CYG_ADDRESS)&temp, fis_ptr, sizeof(unsigned long), NULL);
+        if (temp != (unsigned long)0xFFFFFFFF) {
             if (area_start != fis_ptr) {
                 // Assume that this is something
                 if ((fis_ptr-area_start) >= (length/sizeof(unsigned))) {
@@ -563,14 +565,15 @@ fis_find_free(CYG_ADDRESS *addr, unsigne
             // Find next blank block
             area_start = fis_ptr;
             while (area_start < fis_end) {
-                if (*area_start == (unsigned long)0xFFFFFFFF) {
+                cyg_flash_read(flash_info, (CYG_ADDRESS)&temp, area_start, sizeof(unsigned long), NULL);
+                if (temp == (unsigned long)0xFFFFFFFF) {
                     break;
                 }
-                area_start += flash_block_size / sizeof(CYG_ADDRESS);
+                area_start += flash_block_size;
             }
             fis_ptr = area_start;
         } else {
-            fis_ptr += flash_block_size / sizeof(CYG_ADDRESS);
+            fis_ptr += flash_block_size;
         }
     }
     if (area_start != fis_ptr) {

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]