diff packages/io/flash/current/src/flash.c @ 160:0d0f03f76f6a

Merge from eCos master repository on 2001-06-01-18:52:13-BST
author jlarmour
date Fri, 01 Jun 2001 22:16:29 +0000
parents b65ec671dd4c
children 2395031e7a66
line wrap: on
line diff
--- a/packages/io/flash/current/src/flash.c
+++ b/packages/io/flash/current/src/flash.c
@@ -58,8 +58,7 @@
 #undef RAM_FLASH_DEV_DEBUG
 #if !defined(CYG_HAL_STARTUP_RAM) && defined(RAM_FLASH_DEV_DEBUG)
 # warning "Can only enable the flash debugging when configured for RAM startup"
-# undef  CYGHWR_IO_FLASH_DEVICE_IN_RAM
-# define CYGHWR_IO_FLASH_DEVICE_IN_RAM 1
+# undef  CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
 #endif
 
 struct flash_info flash_info;
@@ -80,7 +79,7 @@ flash_init(void *work_space, int work_sp
     return FLASH_ERR_OK;
 }
 
-#ifdef CYGHWR_IO_FLASH_DEVICE_IN_RAM
+#ifndef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
 // Use this function to make function pointers anonymous - forcing the
 // compiler to use jumps instead of branches when calling driver
 // services.
@@ -100,12 +99,7 @@ flash_dev_query(void* data)
     code_fun *_flash_query;
     int d_cache, i_cache;
 
-#ifdef CYGHWR_IO_FLASH_DEVICE_IN_RAM
-    {
-        externC code_fun flash_query;
-        _flash_query = (code_fun*) __anonymizer(&flash_query);
-    }
-#else
+#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
     {
         extern char flash_query[], flash_query_end[];
         int code_len;
@@ -115,6 +109,11 @@ flash_dev_query(void* data)
         _flash_query = (code_fun *)flash_info.work_space;
         memcpy(_flash_query, &flash_query, code_len);
     }
+#else
+    {
+        externC code_fun flash_query;
+        _flash_query = (code_fun*) __anonymizer(&flash_query);
+    }
 #endif
 
     HAL_FLASH_CACHES_OFF(d_cache, i_cache);
@@ -171,12 +170,7 @@ flash_erase(void *addr, int len, void **
         return FLASH_ERR_NOT_INIT;
     }
 
-#ifdef CYGHWR_IO_FLASH_DEVICE_IN_RAM
-    {
-        externC code_fun flash_erase_block;
-        _flash_erase_block = (code_fun*) __anonymizer(&flash_erase_block);
-    }
-#else
+#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
     {
         extern char flash_erase_block[], flash_erase_block_end[];
         int code_len;
@@ -186,6 +180,11 @@ flash_erase(void *addr, int len, void **
         _flash_erase_block = (code_fun *)flash_info.work_space;
         memcpy(_flash_erase_block, &flash_erase_block, code_len);
     }
+#else
+    {
+        externC code_fun flash_erase_block;
+        _flash_erase_block = (code_fun*) __anonymizer(&flash_erase_block);
+    }
 #endif
 
     block = (unsigned short *)((unsigned long)addr & flash_info.block_mask);
@@ -227,12 +226,7 @@ flash_program(void *_addr, void *_data, 
         return FLASH_ERR_NOT_INIT;
     }
 
-#ifdef CYGHWR_IO_FLASH_DEVICE_IN_RAM
-    {
-        externC code_fun flash_program_buf;
-        _flash_program_buf = (code_fun*) __anonymizer(&flash_program_buf);
-    }
-#else
+#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
     {
         int code_len;
         extern char flash_program_buf[], flash_program_buf_end[];
@@ -241,6 +235,11 @@ flash_program(void *_addr, void *_data, 
         _flash_program_buf = (code_fun *)flash_info.work_space;
         memcpy(_flash_program_buf, &flash_program_buf, code_len);
     }
+#else
+    {
+        externC code_fun flash_program_buf;
+        _flash_program_buf = (code_fun*) __anonymizer(&flash_program_buf);
+    }
 #endif
 
     printf("... Program from %p-%p at %p: ", (void*)data, 
@@ -291,12 +290,7 @@ flash_lock(void *addr, int len, void **e
         return FLASH_ERR_NOT_INIT;
     }
 
-#ifdef CYGHWR_IO_FLASH_DEVICE_IN_RAM
-    {
-        externC code_fun flash_lock_block;
-        _flash_lock_block = (code_fun*) __anonymizer(&flash_lock_block);
-    }
-#else
+#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
     {
         extern char flash_lock_block[], flash_lock_block_end[];
         int code_len;
@@ -305,6 +299,11 @@ flash_lock(void *addr, int len, void **e
         _flash_lock_block = (code_fun *)flash_info.work_space;
         memcpy(_flash_lock_block, &flash_lock_block, code_len);
     }
+#else
+    {
+        externC code_fun flash_lock_block;
+        _flash_lock_block = (code_fun*) __anonymizer(&flash_lock_block);
+    }
 #endif
 
     block = (unsigned short *)((unsigned long)addr & flash_info.block_mask);
@@ -343,12 +342,7 @@ flash_unlock(void *addr, int len, void *
         return FLASH_ERR_NOT_INIT;
     }
 
-#ifdef CYGHWR_IO_FLASH_DEVICE_IN_RAM
-    {
-        externC code_fun flash_unlock_block;
-        _flash_unlock_block = (code_fun*) __anonymizer(&flash_unlock_block);
-    }
-#else
+#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
     {
         extern char flash_unlock_block[], flash_unlock_block_end[];
         int code_len;
@@ -357,6 +351,11 @@ flash_unlock(void *addr, int len, void *
         _flash_unlock_block = (code_fun *)flash_info.work_space;
         memcpy(_flash_unlock_block, &flash_unlock_block, code_len);
     }
+#else
+    {
+        externC code_fun flash_unlock_block;
+        _flash_unlock_block = (code_fun*) __anonymizer(&flash_unlock_block);
+    }
 #endif
 
     block = (unsigned short *)((unsigned long)addr & flash_info.block_mask);