changeset 1400:707a873489c8

* src/flash.c: gcc 3.x vs gcc 2.x problems.
author asl
date Tue, 25 Nov 2003 09:05:31 +0000
parents 1bc2e99ec44b
children 08e1358c3718
files packages/io/flash/current/ChangeLog packages/io/flash/current/src/flash.c
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,7 @@
+2003-11-25  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/flash.c: gcc 3.x vs gcc 2.x problems. 
+
 2003-11-24  Jani Monoses  <jani@iv.ro>
 
 	* cdl/io_flash.cdl:
--- a/packages/io/flash/current/src/flash.c
+++ b/packages/io/flash/current/src/flash.c
@@ -72,6 +72,16 @@
 
 struct flash_info flash_info;
 
+// These are the functions in the HW specific driver we need to call.
+typedef void code_fun(void*);
+
+externC code_fun flash_query;
+externC code_fun flash_erase_block;
+externC code_fun flash_program_buf;
+externC code_fun flash_read_buf;
+externC code_fun flash_lock_block;
+externC code_fun flash_unlock_block;
+
 int
 flash_init(_printf *pf)
 {
@@ -105,7 +115,6 @@ flash_dev_query(void* data)
     code_fun *_flash_query;
     int d_cache, i_cache;
 
-    externC code_fun flash_query;
     _flash_query = (code_fun*) __anonymizer(&flash_query);
 
     HAL_FLASH_CACHES_OFF(d_cache, i_cache);
@@ -167,7 +176,6 @@ flash_erase(void *addr, int len, void **
         return FLASH_ERR_PROTECT;
 #endif
 
-     externC code_fun flash_erase_block;
      _flash_erase_block = (code_fun*) __anonymizer(&flash_erase_block);
 
     block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask);
@@ -254,7 +262,6 @@ flash_program(void *_addr, void *_data, 
         return FLASH_ERR_PROTECT;
 #endif
 
-    externC code_fun flash_program_buf;
     _flash_program_buf = (code_fun*) __anonymizer(&flash_program_buf);
 
 #ifdef CYGSEM_IO_FLASH_CHATTER
@@ -328,7 +335,6 @@ flash_read(void *_addr, void *_data, int
         return FLASH_ERR_PROTECT;
 #endif
 
-    externC code_fun flash_read_buf;
     _flash_read_buf = (code_fun*) __anonymizer(&flash_read_buf);
 
 #ifdef CYGSEM_IO_FLASH_CHATTER
@@ -408,7 +414,6 @@ flash_lock(void *addr, int len, void **e
         return FLASH_ERR_PROTECT;
 #endif
 
-    externC code_fun flash_lock_block;
     _flash_lock_block = (code_fun*) __anonymizer(&flash_lock_block);
 
     block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask);
@@ -473,7 +478,6 @@ flash_unlock(void *addr, int len, void *
         return FLASH_ERR_PROTECT;
 #endif
 
-    externC code_fun flash_unlock_block;
     _flash_unlock_block = (code_fun*) __anonymizer(&flash_unlock_block);
 
     block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask);