SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
smalloc.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0+ */
2
3#ifndef __SMALLOC_H__
4#define __SMALLOC_H__
5
6#include <stdint.h>
7#include <types.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif// __cplusplus
12
19
20#define BYTE_ALIGN(x) (((x + 15) / 16) * 16)
21
29int32_t smalloc_init(uint32_t p_heap_head, uint32_t n_heap_size);
30
37void *smalloc(uint32_t num_bytes);
38
46void *srealloc(void *p, uint32_t num_bytes);
47
53void sfree(void *p);
54
55#ifdef __cplusplus
56}
57#endif// __cplusplus
58
59#endif// __SMALLOC_H__
u32_t uint32_t
Definition stdint.h:13
s32_t int32_t
Definition stdint.h:12
unsigned long phys_addr_t
Definition types.h:58
void * srealloc(void *p, uint32_t num_bytes)
Reallocate a block of memory with the specified new size.
Definition smalloc.c:58
void sfree(void *p)
Free the memory block pointed to by the specified pointer.
Definition smalloc.c:105
int32_t smalloc_init(uint32_t p_heap_head, uint32_t n_heap_size)
Initialize the simple malloc library with the specified heap parameters.
Definition smalloc.c:13
void * smalloc(uint32_t num_bytes)
Allocate a block of memory from the heap with the specified size.
Definition smalloc.c:22
Definition smalloc.h:13
uint32_t size
Definition smalloc.h:15
uint32_t o_size
Definition smalloc.h:16
struct alloc_struct_t * next
Definition smalloc.h:17
phys_addr_t address
Definition smalloc.h:14