Definitions for general use. More...
Data Structures | |
struct | ltrx_power_level_application |
Represents a power level application for registration. More... | |
Macros | |
#define | ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
Size of array. More... | |
#define | ASSIGN_CONST_STRUCT_POINTER_FROM_MEMBER_POINTER(sp, st, m, mp) |
Const structure pointer from member pointer. More... | |
#define | ASSIGN_STRUCT_POINTER_FROM_MEMBER_POINTER(sp, st, m, mp) |
Structure pointer from member pointer. More... | |
#define | INTEGERIFY(v) INTEGERIFY_DO_NOT_CALL_DIRECTLY(v) |
Unsigned long from defined number. More... | |
#define | KILOBYTE 0x400 |
Kilobyte. More... | |
#define | ltrx_free(addr) |
Free previously allocated memory. More... | |
#define | LTRX_MUTEX_WAIT(mutex, timeout_in_milliseconds) |
Wait for a mutex. More... | |
#define | ltrx_preemption_block() ltrx_preemption_block_do_not_call_directly(__FILE__, __LINE__) |
Block preemption. More... | |
#define | ltrx_thread_sleep(timeMsec) ltrx_thread_sleep_do_not_call_directly(__FILE__, __LINE__, timeMsec) |
Pause this thread. More... | |
#define | ltrx_thread_yield() ltrx_thread_yield_do_not_call_directly(__FILE__, __LINE__) |
Yield control to other threads. More... | |
#define | LTRX_TRIGGER_WAIT(trigger, timeout_in_milliseconds) |
Wait for a trigger. More... | |
#define | MALLOC(size) |
Allocate memory. More... | |
#define | MALLOC_ZEROED(size) |
Allocate memory and clear it to zeroes. More... | |
#define | MAXIMUM(a, b) ((a) < (b) ? (b) : (a)) |
Larger of two numbers. More... | |
#define | MEGABYTE 0x100000 |
Megabyte. More... | |
#define | MEMALIGN(align_size, requested_size) |
Allocate memory with alignment. More... | |
#define | MEMBER_OFFSET(st, m) ((size_t)(&(((st *)0)->m))) |
Offset of member in struct. More... | |
#define | MINIMUM(a, b) ((a) < (b) ? (a) : (b)) |
Smaller of two numbers. More... | |
#define | REALLOC(addr, newSize) |
Re-allocate memory and copy original into it. More... | |
#define | STACK_SIZE_GREEN_FROM_MAX_OBSERVED_STACK_USED(used) ((used + 3) * 100 / 80) |
Compute stack size based on observation. More... | |
#define | STRDUP(string) |
Allocate memory and copy a string into it. More... | |
#define | STRINGIFY(v) STRINGIFY_DO_NOT_CALL_DIRECTLY(v) |
String from defined number. More... | |
#define | STRNDUP(string, n) |
Allocate memory and copy a string into it, up to a limit. More... | |
#define | TIME_WAIT_FOREVER 0xffffffff |
Wait forever. More... | |
Functions | |
uint32_t | ltrx_elapsed_time_current_ms (uint32_t time_mark) |
Measure time since time mark. More... | |
uint32_t | ltrx_get_uptime_ms (void) |
Get device uptime. More... | |
void | ltrx_interrupt_disable (void) |
Disable interrupts. More... | |
void | ltrx_interrupt_enable (void) |
Enable interrupts. More... | |
bool | ltrx_malloc_has_ever_failed (void) |
Determine if any memory allocation has yet failed. More... | |
bool | ltrx_mutex_create (struct ltrx_mutex *mutex, const char *name) |
Create a mutex. More... | |
bool | ltrx_mutex_destroy (struct ltrx_mutex *mutex) |
Destroy a mutex. More... | |
struct ltrx_thread * | ltrx_mutex_held_by (const struct ltrx_mutex *mutex) |
Get ID of thread holding mutex. More... | |
void | ltrx_mutex_signal (struct ltrx_mutex *mutex) |
Relinquish a mutex. More... | |
const char * | ltrx_platform_get_product_type (void) |
Get the product type name. | |
void | ltrx_power_level_application_permit_shutdown (const char *applicationName, uint32_t durationSeconds) |
Application permits shutdown for specified time duration. More... | |
void | ltrx_power_level_application_register (const struct ltrx_power_level_application *application) |
Register an application to have a voice in power control. More... | |
void | ltrx_power_level_application_request_full_power (const char *applicationName) |
Application requests full power till further notice. More... | |
void | ltrx_preemption_unblock (void) |
Unblock preemption. More... | |
struct ltrx_thread * | ltrx_thread_create (const char *name, void(*entry_function)(void *opaque), void *entry_opaque, uint32_t stack_size) |
Create a thread. More... | |
struct ltrx_thread * | ltrx_thread_id (void) |
Get current thread ID. More... | |
void | ltrx_thread_resume (struct ltrx_thread *thread) |
Resumes a thread. More... | |
void | ltrx_thread_suspend (void) |
Suspend a thread. More... | |
void | ltrx_thread_wake (struct ltrx_thread *thread) |
Wake a thread. More... | |
uint32_t | ltrx_timemark (void) |
Get time mark. More... | |
void | ltrx_trigger_clear (struct ltrx_trigger *trigger) |
Clear a trigger. More... | |
bool | ltrx_trigger_create (struct ltrx_trigger *trigger, const char *name) |
Create a trigger. More... | |
bool | ltrx_trigger_destroy (struct ltrx_trigger *trigger) |
Destroy a trigger. More... | |
void | ltrx_trigger_signal (struct ltrx_trigger *trigger) |
Signal a trigger. More... | |
Definitions for general use.
#define KILOBYTE 0x400 |
Kilobyte.
Typically a multiplier.
#define MEGABYTE 0x100000 |
Megabyte.
Typically a multiplier.
#define TIME_WAIT_FOREVER 0xffffffff |
Wait forever.
Many macros or functions with a timeout parameter will accept this value to represent an indefinite period of time.