On Sat, 4 Oct 2003, Winfried Ritsch wrote: > > Hello ! > > (A question from an newbie-developer to make it perfect ;-) > > I am writing an ALSA-lowleveldriver for the RME HDSP-MADI card. > (which have 64Audion in and out and an 128in64(= 8192Fader) Mixer > see http://www.rme-audio.de/hdsp/hdspmadi.htm ) Coding is quite > complete but I have trouble with the memory management. > > The Card uses ScatterGather Buffer, each channel 64kB and this > has to be asigned (to be safe) before activation, so I want > to allocate SGbuffer (64+64)*64*1024=8388608 in 4k-blocks. > > I do a > > snd_pcm_lib_preallocate_pci_pages_for_all(hdspm->pci, pcm,8388608l,8388608l) > > after making the pcm_device. > > Here the questions: > > 1) How can I get the sgbuf pointer ? > > ... since in the streams runtime is not set and therefore (besides the > Documentation says is (snd_pcm_sgbuf_t*)substream->dma_private which I > couldnt find) > > sgbuf = (snd_pcm_sgbuf_t*)substream->runtime->dma_private; > > is not assigned. > > but when I activate the card (for MIDI for example) there must be > memory asigned und I think doing it in hw_params is to late.
Note that ALSA has SG routines only for PCM streams and it's lifetime is limited only for stream lifetime. If hardware needs to allocate a big buffer at the initialization phase, you have to do it yourself. > 2) If it is bound to substream is always the same substream the > capture or playback or are the assigned dynamically on calling ? It depends on hardware parameters and on application. If your hardware supports multiple equal streams using same i/o connector (hardware mixing), then the substream might be allocated dynamically, but application might still request the exact substream number. If your hardware uses only a few totaly independent streams, create PCM devices with one substream. Jaroslav ----- Jaroslav Kysela <[EMAIL PROTECTED]> Linux Kernel Sound Maintainer ALSA Project, SuSE Labs ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel