16#define LOOPS_PER_MS 1000
40 return calloc(nitems, size);
128 static uint32_t tick = 0;
129 static uint16_t microtick = 0;
131 if (microtick++ == LOOPS_PER_MS)
143void _exit(
int status)
172static uint8_t *__sbrk_heap_end = NULL;
178void *_sbrk(ptrdiff_t incr)
182 extern uint8_t _estack;
183 extern uint32_t _Min_Stack_Size;
184 const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
185 const uint8_t *max_heap = (uint8_t *)stack_limit;
186 uint8_t *prev_heap_end;
189 if (NULL == __sbrk_heap_end)
191 __sbrk_heap_end = &_end;
195 if (__sbrk_heap_end + incr > max_heap)
201 prev_heap_end = __sbrk_heap_end;
202 __sbrk_heap_end += incr;
204 return (
void *)prev_heap_end;
void mmosal_log_failure_info(const struct mmosal_failure_info *info)
Log failure information in a way that it is preserved across reboots so that it can be available for ...
void mmosal_impl_assert(void)
Assertion handler implementation.
int mmosal_main(mmosal_app_init_cb_t app_init_cb)
OS main function.
void(* mmosal_app_init_cb_t)(void)
Application initialization callback (see mmosal_main for details).
void * mmosal_calloc(size_t nitems, size_t size)
Equivalent of standard library calloc().
void * mmosal_malloc_dbg(size_t size, const char *name, unsigned line_number)
Allocate memory of the given size and return a pointer to it (malloc) – debug version.
void mmosal_free(void *p)
Free the given memory allocation.
void * mmosal_malloc_(size_t size)
Allocate memory of the given size and return a pointer to it (malloc).
struct mmosal_mutex * mmosal_mutex_create(const char *name)
Create a new mutex.
bool mmosal_mutex_release(struct mmosal_mutex *mutex)
Release a mutex.
void mmosal_mutex_delete(struct mmosal_mutex *mutex)
Delete a mutex.
bool mmosal_mutex_get(struct mmosal_mutex *mutex, uint32_t timeout_ms)
Acquire a mutex.
bool mmosal_semb_give_from_isr(struct mmosal_semb *semb)
Give a binary semaphore (from ISR context).
bool mmosal_semb_wait(struct mmosal_semb *semb, uint32_t timeout_ms)
Wait for a counting semaphore.
struct mmosal_semb * mmosal_semb_create(const char *name)
Create a new binary semaphore.
bool mmosal_semb_give(struct mmosal_semb *semb)
Give a binary semaphore.
void mmosal_semb_delete(struct mmosal_semb *semb)
Delete the given binary semaphore.
uint32_t mmosal_get_time_ms(void)
Get the system time in milliseconds.
uint32_t mmosal_get_time_ticks(void)
Get the system time in ticks.
#define MM_UNUSED(_x)
Casts the given expression to void to avoid "unused" warnings from the compiler.
Data structure used to store information about a failure that can be preserved across reset.