RTEMS 6.1-rc4
|
RTEMS Run-Time Link Editor Bit Allocator. More...
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <rtems/rtl/rtl-allocator.h>
#include "rtl-bit-alloc.h"
#include "rtl-error.h"
#include <rtems/rtl/rtl-trace.h>
Macros | |
#define | BITS_PER_WORD (sizeof (uint32_t) * 8) |
Functions | |
rtems_rtl_bit_alloc * | rtems_rtl_bit_alloc_open (void *base, size_t size, size_t block_size, size_t used) |
void | rtems_rtl_bit_alloc_close (rtems_rtl_bit_alloc *balloc) |
void * | rtems_rtl_bit_alloc_balloc (rtems_rtl_bit_alloc *balloc, size_t size) |
void | rtems_rtl_bit_alloc_bfree (rtems_rtl_bit_alloc *balloc, void *addr, size_t size) |
RTEMS Run-Time Link Editor Bit Allocator.
A configurable allocator for small peices of memory where embedding control blocks into the memory are not viable. The amount of memory should be small and the minimum allocator a 32bit work or higher.
void * rtems_rtl_bit_alloc_balloc | ( | rtems_rtl_bit_alloc * | balloc, |
size_t | size | ||
) |
Allocate a piece of memory being managed. The size is in bytes are is rounded up the next block size.
balloc | The allocator. |
size | Number of bytes to allocate. |
void rtems_rtl_bit_alloc_bfree | ( | rtems_rtl_bit_alloc * | balloc, |
void * | addr, | ||
size_t | size | ||
) |
Free an allocated memory block. The size is required because the allocator does not contain any state information.
void rtems_rtl_bit_alloc_close | ( | rtems_rtl_bit_alloc * | balloc | ) |
Close the bit allocator.
balloc | The allocator to close. |
rtems_rtl_bit_alloc * rtems_rtl_bit_alloc_open | ( | void * | base, |
size_t | size, | ||
size_t | block_size, | ||
size_t | used | ||
) |
Open a bit allocator. The allocator allocates block_size pieces of the memory being managed.
base | The memory to managem NULL to allocate a piece of memory. |
size | The size of the memory being managed in bytes. |
block_size | The minimum allocation unit in bytes. |
used | The amount of memory already in use in bytes. |
rtems_rtl_bit_alloc | The bit allocator structure. |