From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Scatter-Gather buffer allocation before running on HDSP-MADI ? Date: Fri, 10 Oct 2003 13:39:51 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <16254.61960.840856.972245@seneca.iemnet> <1065460748.3f81a40c61063@iem.at> <16258.59662.729091.684464@seneca.iemnet> <1065776616.3f8675e8b202e@iem.at> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <1065776616.3f8675e8b202e@iem.at> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: ritsch@iem.at Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Fri, 10 Oct 2003 11:03:36 +0200 (CEST), ritsch@iem.at wrote: > > Hello, > > > the hdsp-madi card with the hdspm driver seems to work now. > so I want do a clean out of the code: > > I asking how should I do this: > > > > at least I have to allocate one page more = 4194304+4096, to get no > > > Segmentation fault, but that could be the hardware too, since hdsp > > > also needs one page more ? > > > > the SG-buffer allocation size is aligned (round up) to PAGE_SIZE. > > (note that PAGE_SIZE is not always 4K byte on other architectures.) > > > > Ok on my i386 architecture I have 4k pages and > the rme card needs 4k buffers. > > So how to code this that it works on all architectures getting > a SG Buf with 4k buffers. > > Do I have to do something by doing preallocation ? on linux, the least page size is 4K byte (so far, all architectures are so). thus, simply do a loop like offset = 0; /* bytes */ while (offset < total_size) { dma_addr_t addr = snd_sgbuf_get_addr(sgbuf, offset); map_this_addr_to_my_hw_table(addr); offset += 4096; /* 4k */ } Takashi ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php