Re: dvd kernelmodule: memory address problem

[email protected] (Arthur Othieno)
Newsgroups gmane.linux.ports.game-cube.devel
Message-ID <20040416202808.GA32370@mars>
On Wed, Apr 14, 2004 at 06:44:55PM +0200, JockyW wrote:
> Thanks for your assistance Arthur,
> 
> My simple dvd characterdevice works quite well. I rewrote the linux IRQ2
> handler to handle all dvd irqs (not just the cover int).

Block device, you mean ;)

> But now I stumbled on a memory problem. My devicedriver uses a read buffer
> which is a 2048 bytes static char array. When I print the address, it sits
> on 0xC200EB24. That address doesn't work when I pass it to the DMA Memory
> Address Register. It is a strange address, because in "yagcd"
> http://www.gc-linux.org/docs/yagcd/chap4.html#sec4 it is written that
> uncached logical ram addresses run from 0xc0000000-0xc17fffff
> 
> What kind of address translation should I apply to get the dma to work?

You want to use memory allocated from a dma pool for that instead.

Create one with:

struct dma_pool *dma_pool_create(const char *name, struct device *dev,
			size_t size, size_t align, size_t alloc);

Allocate memory from it with:

void *dma_pool_alloc(struct dma_pool *pool, int gfp_flags,
			dma_addr_t *dma_handle);

Free alloc'd memory with dma_pool_free(), destroy the pool with
dma_pool_destroy().

See drivers/base/dmapool.c and Documentation/DMA-API.txt for
the gory details.

	Arthur


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.