OK, I've been stuck for a month now writing this driver. I am hoping I can make some progress over the holiday break, but I think I need someone to hold my hand to get started. I am not even sure what to ask.
I am writing a driver for the Gadget Labs Wave/4. This ISA card has no DMA. To use PCM DAC, I want to simply write interleaved PCM values to a port. There is also a port to set the level of data at which an interrupt is generated. I thought I would be able to just define my own pcm_ops->copy routine, which does copy_from_user for each frame and two outw() to put the value in the card: (questions follow) /* Maximum naivete follows */ snd_scache_playback_copy(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count) { u16 reg; int i; int device = substream->pcm->device; u16 *data = src; u16 outdata[2]; scache_t *scache = _snd_pcm_substream_chip(substream); snd_pcm_runtime_t *runtime = scache->playback_substream[device]->runtime; if (device) { reg=SC_DAC0_DATA; } else { reg=SC_DAC1_DATA; } for (i = 0; i < count ; i++ ) { copy_from_user(outdata, data+i+i, 4); /* Four byte frame */ outw(outdata[0],scache->iobase+reg); /* left */ outw(outdata[1],scache->iobase+reg); /* right */ } return 0; } Q1. Is this the right way to do this? I'm hoping someone with experience with drivers will say, "no, no, you should be doing ____________" and then explain a little the concept involved. Q2. Can I sidestep defining the pcm_ops->pointer operation? There is a register I can read to find the current depth of the soundcard's FIFO. I discovered last night that it doesn't stop at 0 when the buffer empties but wraps around. I don't want to deal with this until my basic driver works. Q3. Can someone give me a typical sequence of how the pcm_ops operations are called when an application wants to write some data to the soundcard? Paul Davis described what they do ( I put the message at http://mlug.missouri.edu/~markrages/wiki/index.php?snd_pcm_ops ). I still don't see the big picture though. When I asked before Jaroslav gave me this response: > Sure, everything what you need is emulation of DMA transfer. Transfer > the required count of samples (period_size) and then notify the high > layer that trasfer has been finished (period_done). You can do this > trasfer via cards interrupts (interrupt when FIFO is filled) or use a > timer source. I think my answer lies in what he said, I just can't figure out what I'm supposed to do. Can someone please expand on his answer (use small words :) ) Regards, Mark [EMAIL PROTECTED] _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel