util/physmem.c File Reference

Physical memory allocator implementation. More...

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

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 allocators, and for expanding the malloc() pool.

Copyright (C) 2009 Atmel Corporation. All rights reserved.

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):

  • cpu_sram_pool - Memory suitable for fast CPU access.
  • dma_sram_pool - Memory suitable for fast DMA access.
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 66 of file physmem.c.

References physmem_pool::addr, PHYSMEM_ALLOC_ERR, and round_down.

Referenced by hugemem_alloc(), membag_pool_init_physmem(), and tsfs_init().

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 98 of file physmem.c.

References physmem_pool::addr, PHYSMEM_ALLOC_ERR, and round_up.

Referenced by malloc().

Generated on Thu Apr 29 15:18:22 2010 for display-training by  doxygen 1.6.3