Subject: Re: bus.h style question
To: Jonathan Stone <>
From: Jason Thorpe <>
List: tech-kern
Date: 08/21/1997 06:59:18
On Wed, 20 Aug 1997 03:33:11 -0700 
 Jonathan Stone <jonathan@DSG.Stanford.EDU> wrote:

 > Err,  actually I thought I was proposing semantics more like
 > 	#define bus_space_read_swapped_2 (t, h, o) \
 > 		NTOHS(bus_space_read_2(t, h, (o))
 > 	#define bus_space_read_swapped_4 (t, h, o) \
 > 		NTOHL(bus_space_read_2(t, h, (o))

UGH!  NO!  The methods should have much more abstracted names than that,
and this doesn't even do the right thing!

Here is what the semantics, IMO, should be:

	bus_space_{read,write}* - value is read from/written to bus space.
	If the bus's "native" byte order is different from the CPU's, any
	appropriate byte swapping _will_ occur.

	(new entry points)
	bus_space_stream_{read,write}* - value is read from/written to bus
	space.  The values are treated as octet streams, thus bypassing
	any byte swapping mechanisms.  Useful for e.g. 16-bit PIO access
	to NE-2000 ethernet cards, manipulating VGA frame buffer data, etc.

Jason R. Thorpe                             
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-6                                       Work: +1 415 604 0935
Moffett Field, CA 94035                             Pager: +1 415 428 6939