Subject: Re: mulaw.c & endianness
To: Leo Weppelman <leo@wau.mis.ah.nl>
From: Lennart Augustsson <lennart@augustsson.net>
List: tech-kern
Date: 11/01/1999 17:53:14
Leo Weppelman wrote:

> 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().
>
> 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...

I will try and change the audio drivers ASAP so that the drivers themselves determine
when to do the byte swapping.


--

        -- Lennart