Subject: Re: Driver for hardware sensors in G4 iBooks and probably other
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: Michael <macallan18@earthlink.net>
List: port-macppc
Date: 12/13/2004 21:36:58
Hello,

> Structures will be allocated with natural alignment rules, as per
> C. My recollection is that this means that a structure will be aligned
> to the largest alignment required by any of its members, and each
> member will be aligned according to its natural data type. But if you
> have, say, a structure that only gets 4-byte alingment but needs
> 16-byte alignment, then you can invoke that by tacking on
> __attribute__ ((__aligned__(16))).

I replaced two arrays of  struct dbdma_command[20] with pointers and allocated the memory using malloc(40*sizeof(struct dbdma_command), M_DMAMAP, M_WAITOK|M_ZERO) and had the 2nd pointer point at [20]. So far nothing special, the alignment seems to be ok. Is M_DMAMAP the right type to use? There are still some weirdnesses, audio skips sometimes without apparent reason and sometimes there's a high-pitched noise which disappears when closing and re-opening the audio device - do you have any idea how mature the snapper driver is? It seems to contain a few rather dodgy things.

have fun
Michael