diff packages/devs/flash/intel/strata/current/src/strata.c @ 993:46540206b407

Cache fix - from Jani Monoses.
author gthomas
date Fri, 02 May 2003 16:35:23 +0000
parents d2c90368aeef
children b657b20a6ea2
line wrap: on
line diff
--- a/packages/devs/flash/intel/strata/current/src/strata.c
+++ b/packages/devs/flash/intel/strata/current/src/strata.c
@@ -53,7 +53,6 @@
 #include <pkgconf/system.h>
 #include <pkgconf/hal.h>
 #include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_cache.h>
 
 #define  _FLASH_PRIVATE_
 #include <cyg/io/flash.h>
@@ -71,31 +70,9 @@ int
 flash_hwr_init(void)
 {
     struct FLASH_query data, *qp;
-    extern char flash_query[], flash_query_end[];
-    typedef int code_fun(unsigned char *);
-    code_fun *_flash_query;
-    int code_len, stat, num_regions, region_size, buffer_size;
-    int icache_on, dcache_on;
-
-    HAL_DCACHE_IS_ENABLED(dcache_on);
-    HAL_ICACHE_IS_ENABLED(icache_on);
+    int num_regions, region_size, buffer_size;
 
-    // Copy 'program' code to RAM for execution
-    code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
-    _flash_query = (code_fun *)flash_info.work_space;
-    memcpy(_flash_query, &flash_query, code_len);
-    if (dcache_on) {
-        HAL_DCACHE_SYNC();  // Should guarantee this code will run
-    }
-    if (icache_on) {
-        HAL_ICACHE_DISABLE(); // is also required to avoid old contents
-    }
-
-    stat = (*_flash_query)((unsigned char *)&data);
-    if (icache_on) {
-        HAL_ICACHE_ENABLE();
-    }
-
+    flash_dev_query(&data);
     qp = &data;
     if ( (qp->manuf_code == FLASH_Intel_code)
 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
@@ -171,8 +148,8 @@ flash_hwr_init(void)
 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
  flash_type_unknown:
 #endif
-    (*flash_info.pf)("Can't identify FLASH, sorry, man %x, dev %x, id [%4s] stat %x\n",
-           qp->manuf_code, qp->device_code, qp->id, stat );
+    (*flash_info.pf)("Can't identify FLASH, sorry, man %x, dev %x, id [%4s] \n",
+           qp->manuf_code, qp->device_code, qp->id );
     diag_dump_buf(qp, sizeof(data));
     return FLASH_ERR_HWR;
 }