Files | |
file | error.h |
[host/MPU] MARS Error Values | |
file | base.h |
[host] MARS Base API | |
Defines | |
#define | mars_alloca_align(boundary, size) |
[host] Allocates memory on the stack | |
Functions | |
void * | mars_malloc (size_t size) |
[host] Allocates memory in host storage. | |
void * | mars_realloc (void *ptr, size_t size) |
[host] Re-allocates memory in host storage. | |
void | mars_free (void *ptr) |
[host] Frees memory allocated in host storage. | |
uint64_t | mars_ea_memalign (size_t boundary, size_t size) |
[host] Allocates memory in shared storage accessible from MPU. | |
void | mars_ea_free (uint64_t ea) |
[host] Frees memory allocated in shared storage. | |
void | mars_ea_get (uint64_t ea, void *ptr, size_t size) |
[host] Copy memory block from shared memory to host memory. | |
uint8_t | mars_ea_get_uint8 (uint64_t ea) |
[host] Get 8-bit integer value from shared memory | |
uint16_t | mars_ea_get_uint16 (uint64_t ea) |
[host] Get 16-bit integer value from shared memory | |
uint32_t | mars_ea_get_uint32 (uint64_t ea) |
[host] Get 32-bit integer value from shared memory atomically | |
uint64_t | mars_ea_get_uint64 (uint64_t ea) |
[host] Get 64-bit integer value from shared memory | |
void | mars_ea_put (uint64_t ea, const void *ptr, size_t size) |
[host] Copy memory block from host memory to shared memory. | |
void | mars_ea_put_uint8 (uint64_t ea, uint8_t value) |
[host] Put 8-bit integer value to shared memory atomically | |
void | mars_ea_put_uint16 (uint64_t ea, uint16_t value) |
[host] Put 16-bit integer value to shared memory atomically | |
void | mars_ea_put_uint32 (uint64_t ea, uint32_t value) |
[host] Put 32-bit integer value to shared memory atomically | |
void | mars_ea_put_uint64 (uint64_t ea, uint64_t value) |
[host] Put 64-bit integer value to shared memory atomically | |
uint64_t | mars_ea_map (void *ptr, size_t size) |
[host] Enable read access to data in specified memory block from MPU | |
void | mars_ea_unmap (uint64_t ea, size_t size) |
[host] Disable data access enabled by mars_ea_map | |
void | mars_ea_sync (void) |
[host] Memory barrier | |
static void * | mars_ea_to_ptr (uint64_t ea) |
[host] Converts a 64-bit address to pointer. | |
static uint64_t | mars_ptr_to_ea (const void *ptr) |
[host] Converts a pointer to 64-bit address. | |
uint32_t | mars_get_ticks (void) |
[host/MPU] Returns tick counter value. |
#define mars_alloca_align | ( | boundary, | |||
size | ) |
Value:
( (void *)( ( (uintptr_t)alloca((size) + (boundary) - 1) + \
(boundary) - 1) & \
~(uintptr_t)((boundary) - 1) ) )
[in] | boundary | - memory address will be a multiple of boundary |
[in] | size | - size of memory block to allocate |
void* mars_malloc | ( | size_t | size | ) |
[host] Allocates memory in host storage.
[in] | size | - size of memory block to allocate |
void* mars_realloc | ( | void * | ptr, | |
size_t | size | |||
) |
[host] Re-allocates memory in host storage.
[in] | ptr | - ptr to memory block to re-allocate |
[in] | size | - size of memory block to resize to |
void mars_free | ( | void * | ptr | ) |
[host] Frees memory allocated in host storage.
[in] | ptr | - ptr to memory block to free |
uint64_t mars_ea_memalign | ( | size_t | boundary, | |
size_t | size | |||
) |
[host] Allocates memory in shared storage accessible from MPU.
[in] | boundary | - memory address will be a multiple of boundary |
[in] | size | - size of memory block to allocate |
void mars_ea_free | ( | uint64_t | ea | ) |
[host] Frees memory allocated in shared storage.
[in] | ea | - 64-bit address of allocated memory block to free |
void mars_ea_get | ( | uint64_t | ea, | |
void * | ptr, | |||
size_t | size | |||
) |
[host] Copy memory block from shared memory to host memory.
[in] | ea | - 64-bit address of source |
[in] | ptr | - pointer to destination |
[in] | size | - size of memory block to copy |
uint8_t mars_ea_get_uint8 | ( | uint64_t | ea | ) |
[host] Get 8-bit integer value from shared memory
[in] | ea | - 64-bit address of source |
uint16_t mars_ea_get_uint16 | ( | uint64_t | ea | ) |
[host] Get 16-bit integer value from shared memory
[in] | ea | - 64-bit address of source |
uint32_t mars_ea_get_uint32 | ( | uint64_t | ea | ) |
[host] Get 32-bit integer value from shared memory atomically
[in] | ea | - 64-bit address of source |
uint64_t mars_ea_get_uint64 | ( | uint64_t | ea | ) |
[host] Get 64-bit integer value from shared memory
[in] | ea | - 64-bit address of source |
void mars_ea_put | ( | uint64_t | ea, | |
const void * | ptr, | |||
size_t | size | |||
) |
[host] Copy memory block from host memory to shared memory.
[in] | ea | - 64-bit address of destination |
[in] | ptr | - pointer to source |
[in] | size | - size of memory block to copy |
void mars_ea_put_uint8 | ( | uint64_t | ea, | |
uint8_t | value | |||
) |
[host] Put 8-bit integer value to shared memory atomically
[in] | ea | - 64-bit address of destination |
[in] | value | - 8-bit value to be stored in shared memory, no guarantee that it is stored atomically |
void mars_ea_put_uint16 | ( | uint64_t | ea, | |
uint16_t | value | |||
) |
[host] Put 16-bit integer value to shared memory atomically
[in] | ea | - 64-bit address of destination |
[in] | value | - 16-bit value to be stored in shared memory, no guarantee that it is stored atomically |
void mars_ea_put_uint32 | ( | uint64_t | ea, | |
uint32_t | value | |||
) |
[host] Put 32-bit integer value to shared memory atomically
[in] | ea | - 64-bit address of destination |
[in] | value | - 32-bit value to be stored in shared memory |
void mars_ea_put_uint64 | ( | uint64_t | ea, | |
uint64_t | value | |||
) |
[host] Put 64-bit integer value to shared memory atomically
[in] | ea | - 64-bit address of destination |
[in] | value | - 64-bit value to be stored in shared memory, no guarantee that it is stored atomically |
uint64_t mars_ea_map | ( | void * | ptr, | |
size_t | size | |||
) |
[host] Enable read access to data in specified memory block from MPU
[in] | ptr | - pointer to source |
[in] | size | - size of memory block |
void mars_ea_unmap | ( | uint64_t | ea, | |
size_t | size | |||
) |
[host] Disable data access enabled by mars_ea_map
[in] | ea | - 64-bit address of memory block |
[in] | size | - size of memory block |
static void* mars_ea_to_ptr | ( | uint64_t | ea | ) | [inline, static] |
[host] Converts a 64-bit address to pointer.
[in] | ea | - 64-bit address |
static uint64_t mars_ptr_to_ea | ( | const void * | ptr | ) | [inline, static] |
[host] Converts a pointer to 64-bit address.
[in] | ptr | - pointer value |
uint32_t mars_get_ticks | ( | void | ) |
[host/MPU] Returns tick counter value.