Subject: Re: bus_space_read/write in Big/Little Endian
To: Dante Profeta <dante@mclink.it>
From: Leo Weppelman <leo@wau.mis.ah.nl>
List: tech-kern
Date: 06/18/1998 22:44:56
On Thu 18 Jun 1998, Dante Profeta wrote:
> This is a trivial question, but I always programmed in Motorola 68K asm.

No.... it's not trivial ;-)

> If I issue a bus_space_read_2() what I get?
> In Big Endian HiB-LowB, while in Little Endian I think LowB-HiB ...isn't
> it?
> 
> If I issue a bus_space_write_2() with a value of 0xFF00 what I actually
> write in a Little Endian environment?

What you get is dependent on the bus. The consensus was that a bus
has endianess. PCI/ISA are little endian, VME is big endian. The bus_space
functions (except for their 'stream' members) should do bus to host endian
conversion automatically. This means that bus_space_read_2() on an 68k cpu 
when acting on an isa/pci bus does an implied byte-swap.

Hope this helps,

Leo.