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]

Re: cs8900a for big endian targets


Jifl,

I thought of that myself also, but, doesn't that introduce the risk
of swapping everything at runtime rather than at compile time ? An
additional problem would be the following

If you define e.g.

#define ISQ_RxEvent     CYG_CPU_TO_LE16(0x0004)

how do you then deal with code like ...

switch(x) {
 ...

 case ISQ_RxEvent:    <<-- you get a compiler error here since it
                           no longer expands to an integer
                           expression
}

Bob

On Mon, 2003-03-03 at 22:10, Jonathan Larmour wrote:
> Bob Koninckx wrote:
> > Oops ... Better send it with the attachment ...
> > 
> > Attached patch makes a number of modifications to the code to support
> > both big endian and little endian targets. Thoroughly tested with big
> > endian target (powerpc), not been tested with a little endian target as
> > I don't have one.
> 
> Just a comment, that to save duplication (and therefore avoid the risk of 
> being out of sync) it might be slightly preferable to use a macro with the 
> existing values.
> 
> Perhaps #include <cyg/hal/hal_endian.h> and "just" use CYG_CPU_TO_LE16 
> when using/defining each value? That might be sufficient.
> 
> Similarly using the CYG_*_TO_* macros from hal_endian.h you don't need to 
> use CYG_SWAP16 etc. but can just use a single macro which will be a no-op 
> on little-endian.
> 
> Jifl
-- 
----------------------------------------------------------------------
ir. Bob Koninckx
Katholieke Universiteit Leuven
Division Production Engineering,                   tel.  +32 16 322535
Machine Design and Automation                      fax.  +32 16 322987
Celestijnenlaan 300B                  bob dot koninckx at mech dot kuleuven dot ac dot be
B-3001 Leuven Belgium               http://www.mech.kuleuven.ac.be/pma
----------------------------------------------------------------------


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