vram.h File Reference

VRAM allocator. More...

Go to the source code of this file.

## Enumerations

enum | vramAllocPos { VRAM_ALLOC_A = BIT(0) , VRAM_ALLOC_B = BIT(1) , VRAM_ALLOC_ANY = VRAM_ALLOC_A | VRAM_ALLOC_B }

## Functions

void * | vramAlloc (size_t size)
| Allocates a 0x80-byte aligned buffer. More...
void * | vramAllocAt (size_t size, vramAllocPos pos)
| Allocates a 0x80-byte aligned buffer in the given VRAM bank. More...
void * | vramMemAlign (size_t size, size_t alignment)
| Allocates a buffer aligned to the given size. More...
void * | vramMemAlignAt (size_t size, size_t alignment, vramAllocPos pos)
| Allocates a buffer aligned to the given size in the given VRAM bank. More...
void * | vramRealloc (void *mem, size_t size)
| Reallocates a buffer. More...
size_t | vramGetSize (void *mem)
| Retrieves the allocated size of a buffer. More...
void | vramFree (void *mem)
| Frees a buffer. More...
u32 | vramSpaceFree (void)
| Gets the current VRAM free space. More...

## Detailed Description

VRAM allocator.

## Function Documentation

## vramAlloc()

void* vramAlloc | ( | size_t | size | ) |

Allocates a 0x80-byte aligned buffer.

Parameters

  size | Size of the buffer to allocate.

Returns
  The allocated buffer.

## vramAllocAt()

void* vramAllocAt | ( | size_t | size,
|  | vramAllocPos | pos
| ) |  |

Allocates a 0x80-byte aligned buffer in the given VRAM bank.

Parameters

  size | Size of the buffer to allocate.
  pos | VRAM bank to use (see vramAllocPos).

Returns
  The allocated buffer.

## vramFree()

void vramFree | ( | void * | mem | ) |

Frees a buffer.

Parameters

  mem | Buffer to free.

## vramGetSize()

size_t vramGetSize | ( | void * | mem | ) |

Retrieves the allocated size of a buffer.

Returns
  The size of the buffer.

## vramMemAlign()

void* vramMemAlign | ( | size_t | size,
|  | size_t | alignment
| ) |  |

Allocates a buffer aligned to the given size.

Parameters

  size | Size of the buffer to allocate.
  alignment | Alignment to use.

Returns
  The allocated buffer.

## vramMemAlignAt()

void* vramMemAlignAt | ( | size_t | size,
|  | size_t | alignment,
|  | vramAllocPos | pos
| ) |  |

Allocates a buffer aligned to the given size in the given VRAM bank.

Parameters

  size | Size of the buffer to allocate.
  alignment | Alignment to use.
  pos | VRAM bank to use (see vramAllocPos).

Returns
  The allocated buffer.

## vramRealloc()

void* vramRealloc | ( | void * | mem,
|  | size_t | size
| ) |  |

Reallocates a buffer.

Note: Not implemented yet.

Parameters

  mem | Buffer to reallocate.
  size | Size of the buffer to allocate.

Returns
  The reallocated buffer.

## vramSpaceFree()

u32 vramSpaceFree | ( | void |  | ) |

Gets the current VRAM free space.

Returns
  The current VRAM free space.