Subject: Re: PCI-audio & endianness (eso.c/mulaw.c)
To: None <leo@wau.mis.ah.nl>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: tech-kern
Date: 10/27/1999 23:16:52
In <19991027083347.B2826@wau.mis.ah.nl>
leo@wau.mis.ah.nl wrote:
> 1 - dev/sys/pci/eso.c:
>
> This file defines htopci() and pcitoh() macro's that do a bswap32()
> when BIG_ENDIAN. This swapped value is than written using
> bus_space_write_4() - this is wrong! The bus-functions for a PCI-bus
> on a big-endian machine should do the necessary swapping. I'll
> remove this endian stuff from this file later this week.
I think bswap32() should not be needed in bus_space(9) functions, too.
> 2 - dev/mulaw.c
>
> Here also, endianness is taken into account. However, I can not play
> '.au' files when compiling for big-endian. If I compile for the little
> endian case, the samples play fine. Now it isn't obvious to me what
> is the 'correct' case here. I have absolutely no experience with
> audio drivers. From my observation of the eso.c file, it is clear that
> the sound-card uses DMA to fetch the data (== no endian conversion) and
> from the docs on the Hades PCI-bus it looks that there is no magic
> like hardware swaps involved.
I guess most PCI bus-master devices assume the host is little endian,
so bswap*() functions are needed on passing non-bytestream data via DMA.
(i.e. on accessing variables allocated by bus_dmamem_alloc(9) and
bus_dmamem_map(9))
> Can anybody say something authoritative about case 2? Since .wav files
> are not yet working, I expect more problems in the endian field.
pcscp.c and if_vr.c use bswap32() on passing some args,
but I have no idea about data transfers by bus_dmamem_mmap(9) case...
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp