|
Data Structures | |
| struct | dma_pool |
| DMA memory pool. More... | |
Modules | |
| Generic DMA pool allocator | |
Functions | |
| void | dma_pool_init_coherent_physmem (struct dma_pool *dmapool, struct physmem_pool *phys_pool, unsigned int nr_objects, size_t objsize, unsigned int align_order) |
| Initialize a DMA pool using the physmem allocator. | |
| static void | dma_pool_init_coherent (struct dma_pool *pool, phys_addr_t phys_start, size_t size, size_t objsize, unsigned int align_order) |
| Initialize a DMA-coherent memory pool. | |
| static dma_addr_t | dma_pool_alloc (struct dma_pool *pool) |
| Allocate an object from a DMA pool. | |
| static void | dma_pool_free (struct dma_pool *pool, dma_addr_t addr) |
| Free an object previously allocated from pool. | |
This is a memory pool allocator for DMA memory. DMA memory differs from "regular" memory in that both the physical and virtual addresses are kept track of, and cache coherency issues are easier to deal with.
On cache- and MMU-less processors, DMA memory pools are essentially identical to regular memory pools. Nevertheless, it is highly recommended to utilize DMA memory for any memory which is to be used in data transfers involving hardware, as it will make the code more easily portable to other chips.
| dma_addr_t dma_pool_alloc | ( | struct dma_pool * | pool | ) | [inline, static] |
Allocate an object from a DMA pool.
| pool | The pool from which the object will be allocated |
Definition at line 77 of file dmapool_nommu.h.
References mem_pool_alloc(), dma_pool::mempool, and dma_addr_t::ptr.
| void dma_pool_free | ( | struct dma_pool * | pool, | |
| dma_addr_t | addr | |||
| ) | [inline, static] |
Free an object previously allocated from pool.
| pool | The pool from which the object was allocated | |
| addr | The physical and virtual address of the object |
Definition at line 87 of file dmapool_nommu.h.
References mem_pool_free(), dma_pool::mempool, and dma_addr_t::ptr.
| void dma_pool_init_coherent | ( | struct dma_pool * | pool, | |
| phys_addr_t | phys_start, | |||
| size_t | size, | |||
| size_t | objsize, | |||
| unsigned int | align_order | |||
| ) | [inline, static] |
Initialize a DMA-coherent memory pool.
This function will initialize a pool of fixed-size objects located in DMA-coherent memory. Since the memory is coherent, no cache synchronization is needed before and after DMA data transfers.
| pool | The DMA pool to be initialized | |
| phys_start | The physical address of the underlying memory area | |
| size | The size of the underlying memory area in bytes | |
| objsize | The size of each object in bytes | |
| align_order | log2 of the minimum object alignment in bytes |
Definition at line 69 of file dmapool_nommu.h.
References mem_pool_init(), and dma_pool::mempool.
Referenced by dma_pool_init_coherent_physmem().
| void dma_pool_init_coherent_physmem | ( | struct dma_pool * | dmapool, | |
| struct physmem_pool * | phys_pool, | |||
| unsigned int | nr_objects, | |||
| size_t | objsize, | |||
| unsigned int | align_order | |||
| ) |
Initialize a DMA pool using the physmem allocator.
This function will grab enough physical memory for nr_objects from phys_pool and use this to initialize dmapool.
| dmapool | The DMA pool to be initialized. | |
| phys_pool | The physical memory pool from which to grab memory | |
| nr_objects | The number of objects in the pool | |
| objsize | The size of each object in bytes. | |
| align_order | log2 of the minimum object alignment in bytes. |
Definition at line 67 of file dmapool.c.
References assert, dma_pool_init_coherent(), physmem_alloc(), PHYSMEM_ALLOC_ERR, and round_up.
1.6.3