Subject: Re: ncr.4 & byte ordering
To: Justin T. Gibbs <gibbs@freefall.freebsd.org>
From: Bill Studenmund <skippy@macro.stanford.edu>
List: current-users
Date: 01/16/1997 12:01:47
On Thu, 16 Jan 1997, Justin T. Gibbs wrote:
> >On Wed, 15 Jan 1997 18:59:33 +0100
> > ws@kurt.tools.de (Wolfgang Solfrank) wrote:
> >
> > > Which reminds me that this NCR driver isn't really machine independent.
> > > It assumes a little endian machine (at least it did last I looked).
> >
> >Well, that's... special. Hmm, I guess this is in status blocks returned
> >by the card? The script, maybe? A platform's bus_space_*() stuff should
> >do byte swapping where appropriate...
> >
[snip went Jason's sig]
>
> Some PCI cards, like the aic7880 have built in byte swapping capabilities,
> so having the bus_space stuff byte swap may not always be apropriate.
>
[snip went Justin's sig]
Would it make sense to define byte-swapping routines that define
conditional byteswapping routines for little-endian words, similar to
"network" byte order stuff. Maybe "dos" byte order, though there might be
a better name. Maybe "isa" byte order?
Such things would be useful in the above PCI drivers, msdosfs stuff, and
isa drivers in general. By standardizing the names, each code segment
wouldn't have to define its own names & routines. I'd hope all the *BSD's
(and Linux?) could agree on the names?
So we'd have something like htois(), htoil(), itohs(), itohl(), or
htods(), htodl(), dtohs(), and dtohl(). Or some other letter, depending on
the name chosen. Oh, "litle-endian" order would probably be bad as then
we'd have names like htoll() which look like someone want's money before
continuing. :-)
Thoughts?
Take care,
Bill