lib/physmem.c File Reference

Physical memory allocator implementation. More...

#include <physmem.h>
#include <types.h>
#include <util.h>

Include dependency graph for physmem.c:

Go to the source code of this file.

Functions

phys_addr_t physmem_alloc (struct physmem_pool *pool, phys_size_t size, unsigned int align_order)
 Allocate a region of physical memory.
phys_addr_t physmem_alloc_low (struct physmem_pool *pool, phys_size_t size, unsigned int align_order)
 Allocate a low region of physical memory.


Detailed Description

Physical memory allocator implementation.

This physical memory allocator implemention only supports allocating physical memory, not freeing it. This makes the allocator very lightweight, while still useful for initializing other allocation pools, and for expanding the malloc() pool.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file physmem.c.


Function Documentation

phys_addr_t physmem_alloc ( struct physmem_pool pool,
phys_size_t  size,
unsigned int  align_order 
)

Allocate a region of physical memory.

This function tries to allocate a block of physical memory from the given pool, at the highest possible address.

The following pools must be available on any CPU with internal SRAM (though they may refer to the same pool):

Parameters:
pool The physical memory pool to allocate from.
size The number of bytes to allocate.
align_order log2 of required alignment.
Returns:
A valid physical address, or PHYSMEM_ALLOC_ERR if there isn't sufficient physical memory available.
Precondition:
Not in interrupt context.

Definition at line 70 of file physmem.c.

References physmem_pool::end, PHYSMEM_ALLOC_ERR, round_down(), and physmem_pool::start.

Referenced by dma_pool_init_coherent_physmem(), and mem_pool_init_physmem().

Here is the call graph for this function:

phys_addr_t physmem_alloc_low ( struct physmem_pool pool,
phys_size_t  size,
unsigned int  align_order 
)

Allocate a low region of physical memory.

This function tries to allocate a block of physical memory from the given pool, at the highest possible address.

Note:
This function is only intended for use by malloc(). All other users should call physmem_alloc() instead.
Parameters:
pool The physical memory pool to allocate from.
size The number of bytes to allocate.
align_order log2 of required alignment.
Returns:
A valid physical address, or PHYSMEM_ALLOC_ERR if there isn't sufficient physical memory available.
Precondition:
Not in interrupt context.

Definition at line 102 of file physmem.c.

References physmem_pool::end, PHYSMEM_ALLOC_ERR, round_up(), and physmem_pool::start.

Here is the call graph for this function:


Generated on Tue Sep 15 10:18:49 2009 for libavr32 by  doxygen 1.5.8