public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Big endian ARM HAL_WRITE_UINT8 problem (ecos 1.3.1)
@ 2002-07-10 14:43 Dirk Sigurdson
  2002-07-10 14:50 ` Gary Thomas
  0 siblings, 1 reply; 11+ messages in thread
From: Dirk Sigurdson @ 2002-07-10 14:43 UTC (permalink / raw)
  To: ecos-discuss

I'm working with a big endian arm chip and am having problems with the
HAL_WRITE_UINT8 macro.

If I do something like:

#define HW_REG_ADDRESS \
    ((volatile cyg_uint8*) (0x0400c71f))


HAL_WRITE_UINT8(HW_REG_ADDRESS, 0xff);


It ends up writing to address 0x0400c71c and not 0x0400c71f.  I could just
take the ^3 out of the macro, but am concerned that it might cause problems.
Does anyone have any suggestions?

Thanks,

Dirk


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [ECOS] Big endian ARM HAL_WRITE_UINT8 problem (ecos 1.3.1)
@ 2002-07-11  7:19 Mark Salter
  2002-07-11  8:01 ` Grant Edwards
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Salter @ 2002-07-11  7:19 UTC (permalink / raw)
  To: jskov; +Cc: ecos-discuss

> You are using register definitions that are munged for big-endian
> hardware and clearly expected to be used by non-portable (big/little
> endian) software.

> If you want to use them with eCos macros, it will clearly fail since the
> eCos macros are endian safe.

> How's that? Well, the device you are writing to is activated (chip
> select) by matching of address lines A31-A2. I.e. addresses 0x71c,
> 0x71d, 0x71e and 0x71f all match and enable your device for access. It
> doesn't care about anything else.

> So when the chip select is right, you need to get the data bits right.
> Depending on the endianess of the CPU, you need to put the data in
> either D0-7 or D24-D31 for 8bit access. You do that by changing A1-A0.

> So A1-A0 should be depending on the CPU endian mode, and *nothing else*.

> If you don't care about portability, and want to use definitions that
> are not suitable for porting, by all means don't use the eCos macros.

> But don't blame the macros for bothing it when fed bad definitions. The
> macros do exactly what they were designed to; making the software
> portable. Changing one endian definition flag is easier than changing
> umpteen register definitions.

Maybe its me, but it seems you are describing broken hardware. The
bus subsystem (external to the CPU) should be responsible for 
handling the byte lanes correctly. On bi-endian boards, this usually
means adding a jumper/switch so that the bus controller knows what
endianness to use. If a bi-endian board requires different addresses
for byte registers depending on endianess, then it is broken IMO. Some
XScale boards that I am familiar with do not require address gymnastics
based on endianess. A byte address is the same with both endianesses.

--Mark

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [ECOS] Big endian ARM HAL_WRITE_UINT8 problem (ecos 1.3.1)
@ 2002-07-11  8:34 Mark Salter
  2002-07-11  8:35 ` Grant Edwards
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Salter @ 2002-07-11  8:34 UTC (permalink / raw)
  To: grante; +Cc: ecos-discuss


> On Thu, Jul 11, 2002 at 10:17:31AM -0400, Mark Salter wrote:

>> > You are using register definitions that are munged for
>> > big-endian hardware and clearly expected to be used by
>> > non-portable (big/little endian) software.

Careful with attributions. I didn't write that.

--Mark

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

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

end of thread, other threads:[~2002-07-12  3:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-10 14:43 [ECOS] Big endian ARM HAL_WRITE_UINT8 problem (ecos 1.3.1) Dirk Sigurdson
2002-07-10 14:50 ` Gary Thomas
2002-07-10 15:15   ` Grant Edwards
2002-07-10 16:00     ` Dirk Sigurdson
2002-07-10 23:52     ` Jesper Skov
2002-07-11  7:19 Mark Salter
2002-07-11  8:01 ` Grant Edwards
2002-07-11 18:28   ` Dirk Sigurdson
2002-07-11 20:22     ` Grant Edwards
2002-07-11  8:34 Mark Salter
2002-07-11  8:35 ` Grant Edwards

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).