On Fri, 10 Oct 2003, Takashi Iwai wrote:

> At Fri, 10 Oct 2003 13:57:10 +0200 (CEST),
> Jaroslav wrote:
> >
> > On Fri, 10 Oct 2003, Takashi Iwai wrote:
> >
> > > At Fri, 10 Oct 2003 11:03:36 +0200 (CEST),
> > > [EMAIL PROTECTED] 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
> >
> > Nope. Old alpha arch has 8K pages.
>
> well, i wrote "least" size in the above :)
> in fact, ia64 can have up to 64kb pages (configurable).
>
> the page size is equal with or greater than 4k.  and since the size is
> power of two, the kernel page is always aligned (at least) to 4k
> boundary.
>
> > >   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 */
> >
> > I suggest to use PAGE_SIZE define here.
>
> no, it must be 4096 (or better to define other const), which
> corresponds to the page size of the sound card.
>
> the point of the code above is:
>
> - the hardware page size is 4k byte independent from archs.
> - you can use snd_sgbuf_get_addr() macro to retrieve the physical
>   address of each 4k page regardless of the kernel page size.

Yes, sorry for my confusion.

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs


-------------------------------------------------------
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
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to