This is the mail archive of the ecos-patches@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]

strata.h fix


Hi
the strata header defines FLASHWORD for different values of flash width and number of
devices.This smae code is already found in io/flash/flash_dev.h
So include that instead.It's simpler and besides fixes the case of width=16 bit and nodevs =4
which was not checked for but devs==2 was checked twice.Besides the strata version uses plain C types
instead of cyg_XXX names.I defined INTERLEAVE to be DEVICES and flash_t to flash_data_t to not have to
modify the rest of the strata code for now.I can do that to and have the same names is all drivers to
keep confusion level lower.
Oh and for some reason I though we were in 2002 but a quick googling reveals that this is no longer the case.
So I modified the previous changelog entry's date.All the flash patches I sent yesterday and today have this
....inaccuracy.

Jani.

Index: devs/flash/intel/strata//current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/strata/current/ChangeLog,v
retrieving revision 1.13
diff -u -r1.13 ChangeLog
--- devs/flash/intel/strata//current/ChangeLog	4 Apr 2003 04:23:53 -0000	1.13
+++ devs/flash/intel/strata//current/ChangeLog	4 Apr 2003 09:27:56 -0000
@@ -1,4 +1,12 @@
-2002-04-03  Jani Monoses <jani at iv dot ro>
+2003-04-04  Jani Monoses <jani at iv dot ro>
+	
+	* src/starta.h:
+	Use generic flash_dev.h for providing the FLASHWORD macro for
+	different widths and device numbers.No reason to duplicate that
+	here.This implicitely fixes the case when CYGNUM_FLASH_WIDTH is 16
+	and CYGNUM_FLASH_DEVICES is 4.
+
+2003-04-03  Jani Monoses <jani at iv dot ro>
 
 	* src/flash_lock_block.c (flash_lock_block): 
 	* src/flash_unlock_block.c (flash_unlock_block): 
Index: devs/flash/intel/strata//current/src/strata.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/strata/current/src/strata.h,v
retrieving revision 1.4
diff -u -r1.4 strata.h
--- devs/flash/intel/strata//current/src/strata.h	12 Aug 2002 12:20:50 -0000	1.4
+++ devs/flash/intel/strata//current/src/strata.h	4 Apr 2003 09:27:57 -0000
@@ -92,21 +92,11 @@
 // In that case, CYGNUM_FLASH_DEVICES = 1 and CYGNUM_FLASH_WIDTH = 16, and
 // the device is managed using only 16bit bus operations.
 
+#define CYGNUM_FLASH_INTERLEAVE CYGNUM_FLASH_DEVICES
+#define _FLASH_PRIVATE_
+#include <cyg/io/flash_dev.h>
 
-// ------------------------------------------------------------------------
-//
-// No mapping on this target - but these casts would be needed if some
-// manipulation did occur.  An example of this might be:
-// // First 4K page of flash at physical address zero is
-// // virtually mapped at address 0xa0000000.
-// #define FLASH_P2V(x) ((volatile flash_t *)(((unsigned)(x) < 0x1000) ?
-//                            ((unsigned)(x) | 0xa0000000) :
-//                            (unsigned)(x)))
-
-#ifndef FLASH_P2V
-#define FLASH_P2V( _a_ ) ((volatile flash_t *)((unsigned int)(_a_)))
-#endif
-
+#define flash_t flash_data_t
 // ------------------------------------------------------------------------
 //
 // This generic code is intended to deal with all shapes and orientations
@@ -124,74 +114,6 @@
 // An exception is the test for succesfully erased data.
 //
 // ------------------------------------------------------------------------
-
-#if 8 == CYGNUM_FLASH_WIDTH
-
-# if 1 == CYGNUM_FLASH_DEVICES
-#  define FLASHWORD( k ) ((flash_t)(k)) // To narrow a 16-bit constant
-typedef unsigned char flash_t;
-# elif 2 == CYGNUM_FLASH_DEVICES
-// 2 devices to make 16-bit
-#  define FLASHWORD( k ) ((k)+((k)<<8))
-typedef unsigned short flash_t;
-# elif 4 == CYGNUM_FLASH_DEVICES
-// 4 devices to make 32-bit
-#  define FLASHWORD( k ) ((k)+((k)<<8)+((k)<<16)+((k)<<24))
-typedef unsigned long flash_t;
-# elif 8 == CYGNUM_FLASH_DEVICES
-// 8 devices to make 64-bit - intermediate requires explicit widening
-#  define FLASHWORD32( k ) ((flash_t)((k)+((k)<<8)+((k)<<16)+((k)<<24)))
-#  define FLASHWORD( k ) (FLASHWORD32( k ) + (FLASHWORD32( k ) << 32));
-typedef unsigned long long flash_t;
-# else
-#  error How many 8-bit flash devices?
-# endif
-
-#elif 16 == CYGNUM_FLASH_WIDTH
-
-# if 1 == CYGNUM_FLASH_DEVICES
-#  define FLASHWORD( k ) (k)
-typedef unsigned short flash_t;
-# elif 2 == CYGNUM_FLASH_DEVICES
-// 2 devices to make 32-bit
-#  define FLASHWORD( k ) ((k)+((k)<<16))
-typedef unsigned long flash_t;
-# elif 2 == CYGNUM_FLASH_DEVICES
-// 4 devices to make 64-bit - intermediate requires explicit widening
-#  define FLASHWORD32( k ) ((flash_t)((k)+((k)<<16)))
-#  define FLASHWORD( k ) (FLASHWORD32( k ) + (FLASHWORD32( k ) << 32));
-typedef unsigned long long flash_t;
-# else
-#  error How many 16-bit flash devices?
-# endif
-
-#elif 32 == CYGNUM_FLASH_WIDTH
-
-# if 1 == CYGNUM_FLASH_DEVICES
-#  define FLASHWORD( k ) (k)
-typedef unsigned long flash_t;
-# elif 2 == CYGNUM_FLASH_DEVICES
-// 2 devices to make 64-bit - intermediate requires explicit widening
-#  define FLASHWORD32( k ) ((flash_t)(k))
-#  define FLASHWORD( k ) (FLASHWORD32( k ) + (FLASHWORD32( k ) << 32));
-typedef unsigned long long flash_t;
-# else
-#  error How many 32-bit flash devices?
-# endif
-
-#else
-# error What flash width?
-#endif
-
-// Data (not) that we read back:
-#if 0 == CYGNUM_FLASH_BLANK
-# define FLASH_BlankValue ((flash_t)0)
-#elif 1 == CYGNUM_FLASH_BLANK
-# define FLASH_BlankValue ((flash_t)(-1ll))
-#else
-# error What blank value?
-#endif
-
 // ------------------------------------------------------------------------
 
 #define FLASH_Read_ID      		FLASHWORD( 0x90 )


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