Re: Endian-specific types

Martin Husemann <[email protected]> Tue, 12 Apr 2016 10:00:31 +0200
Newsgroups gmane.os.netbsd.devel.general
Message-ID <[email protected]>
On Mon, Apr 11, 2016 at 10:04:27PM +0000, [email protected] wrote:
> (As Paul said) this is for setting registers and such for the hardware.

For registers we normally don't see this at all (so just use uint16_t),
as we access registers via bus_space_read/bus_space_write and the bus
handling defines all needed endianess conversions.

However, we do see this in data that is DMA'd from or to the device,
and proper use of le16toh and friends is important there.

So for DMA'd structs it may make sense to typedef it to uint16_t
and use it in the struct definition - but on the other hand we don't
do that anywhere else.

Martin