Subject: Re: mulaw.c & endianness
To: Leo Weppelman <leo@wau.mis.ah.nl>
From: Eduardo E. Horvath <eeh@one-o.com>
List: tech-kern
Date: 11/01/1999 09:07:06
>
> Ok, here I am again... I need this issue to be resolved.
>
> Facts as I see them (from the previous discussion):
>
> - The PCI-bus is a little-endian bus by definition.
> - When cards on the PCI bus do DMA to/from main memory, they use a
> little endian data-format.
> - A driver knows the bus it is connected to (from it's attaching frontend).
>
> The functions in question:
> mulaw_to_[us]linear16() and alaw_to_[us]linear16().
I presume you mean that these functions do conversions to little
endian format if needed?
>
> The drivers I could find that were using these functions:
> isa/ess.c, isa/sbdsp.c, pci/eap.c, pci/eso.c, pci/sv.c
>
> I can see 2 ways of solving the problem:
> 1) Make the functions little-endian only (ie. remove '#if *ENDIAN').
>
> 2) Provide big- and little endian versions of the functions and use
> the right one in the driver. For the drivers currently in the tree,
> this boils down to:
>
> #define mulaw_to_ulinear16 mulaw_to_ulinear16_le
> #define alaw_to_ulinear16 alaw_to_ulinear16_le
>
> It depends on how much chance there is on drivers wanting big-endian versions
> of these functions. This is something that I really don't know...
That depends on whether these chipsets are available on cards that
attach to big endian buses. I am aware of several chips that are,
most notably the ISPs are available on SBus and PCI.
The other thing to keep in mind is that one machine may have several
buses. It is quite possible today to have a machine with a Qlogic ISP
on both an SBus card and PCI bus. In fact I think I may have one
lying around somewhere at work. This means that the endianness and
byte flipping would need to be set differently for each device
instance.
=========================================================================
Eduardo Horvath eeh@one-o.com
"I need to find a pithy new quote." -- me