Subject: mulaw.c & endianness
To: None <tech-kern@netbsd.org>
From: Leo Weppelman <leo@wau.mis.ah.nl>
List: tech-kern
Date: 11/01/1999 14:49:17
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...

Leo.