public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [ECOS] How do I get __ARMEB__ defined ?
       [not found] <NDBBIJMAFMCKGDEBEFICCEOCFAAA.yanchi@oak.com.tw>
@ 2000-12-13  9:07 ` Jonathan Larmour
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Larmour @ 2000-12-13  9:07 UTC (permalink / raw)
  To: Edward, Yan-Chi, Lin; +Cc: Ecos-Discuss

"Edward,Yan-Chi,Lin" wrote:
> 
> Thanks Jifl
> 
> But why the option "Use big endian mode" didn't add the "-EB" to the Global compiler flags ?

That would be a problem. Which platform is this?
 
> Now from my understanding. If I want to access a byte at, for examples, 0x7FF9003,
> I can't use HAL_READ_UINT8(0x7FF9003). Is that right ?

Yes, you always have to *assume* it is little-endian, and let the system
handle the translation if it's actually big-endian. Believe me, this is
better for generic code than the alternative which is always to provide two
values.

Jifl
-- 
Red Hat UK, Rustat House, 62 Clifton Road, Cambridge, UK. CB1 7EG 
Tel: +44 (1223) 271062              ||  These opinions are all my own fault

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] How do I get __ARMEB__ defined ?
  2000-12-10 19:23 Edward, Yan-Chi, Lin
@ 2000-12-11 13:36 ` Jonathan Larmour
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Larmour @ 2000-12-11 13:36 UTC (permalink / raw)
  To: Edward, Yan-Chi, Lin; +Cc: Ecos-Discuss

"Edward,Yan-Chi,Lin" wrote:
> 
> Hi
> 
> I have a bigendian ARM cpu now, but I don't know how do I get __ARMEB__ defined ?

It's defined by the compiler when it is invoked with -EB (for big-endian).

> Also could someone explain what does the macro in hal_io.h for big endian means ?
> Why ^3 ?

Because the change of endian-ness means that for the code to read the same
byte when given the same address irrespective of endianness, then the last
two bits of the address need fiddling to compensate for the endianness
change.

e.g. if asking for the lowest significant byte, the address supplied would
end in 00, but for this macro to return the correct byte in big-endian
mode, it has to read 11. Similarly 01->10 and 11->00, so the operation is a
bitwise XOR.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] How do I get __ARMEB__ defined ?
@ 2000-12-10 19:23 Edward, Yan-Chi, Lin
  2000-12-11 13:36 ` Jonathan Larmour
  0 siblings, 1 reply; 3+ messages in thread
From: Edward, Yan-Chi, Lin @ 2000-12-10 19:23 UTC (permalink / raw)
  To: Ecos-Discuss


Hi

I have a bigendian ARM cpu now, but I don't know how do I get __ARMEB__ defined ?
Also could someone explain what does the macro in hal_io.h for big endian means ?
Why ^3 ?

Thanks a lot
Edward Lin
----------------------------------------------------------------------------------------------------
#else // Big-endian version

#define HAL_READ_UINT8( _register_, _value_ ) \
        ((_value_) = *((volatile CYG_BYTE *)((CYG_ADDRWORD)(_register_)^3)))

#define HAL_WRITE_UINT8( _register_, _value_ ) \
        (*((volatile CYG_BYTE *)((CYG_ADDRWORD)(_register_)^3)) = (_value_))


  	

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-12-13  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <NDBBIJMAFMCKGDEBEFICCEOCFAAA.yanchi@oak.com.tw>
2000-12-13  9:07 ` [ECOS] How do I get __ARMEB__ defined ? Jonathan Larmour
2000-12-10 19:23 Edward, Yan-Chi, Lin
2000-12-11 13:36 ` Jonathan Larmour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).