7#ifndef _PICO_ASYNC_CONTEXT_FREERTOS_H
8#define _PICO_ASYNC_CONTEXT_FREERTOS_H
28#ifndef ASYNC_CONTEXT_DEFAULT_FREERTOS_TASK_PRIORITY
29#define ASYNC_CONTEXT_DEFAULT_FREERTOS_TASK_PRIORITY ( tskIDLE_PRIORITY + 4)
32#ifndef ASYNC_CONTEXT_DEFAULT_FREERTOS_TASK_STACK_SIZE
33#define ASYNC_CONTEXT_DEFAULT_FREERTOS_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
38#if !defined(configNUMBER_OF_CORES) && defined(configNUM_CORES)
40#error configNUMBER_OF_CORES is the new name for configNUM_CORES
43#error configNUMBER_OF_CORES is the new name for configNUM_CORES, however it looks like you may need to define both as you are using an old SMP branch of FreeRTOS
62#if configSUPPORT_STATIC_ALLOCATION
63 StackType_t *task_stack;
69#if configUSE_CORE_AFFINITY && configNUMBER_OF_CORES > 1
70 UBaseType_t task_core_id;
72} async_context_freertos_config_t;
88#if configSUPPORT_STATIC_ALLOCATION
89 StaticSemaphore_t lock_mutex_buf;
90 StaticSemaphore_t work_needed_sem_buf;
91 StaticSemaphore_t task_complete_sem_buf;
92 StaticTimer_t timer_buf;
93 StaticTask_t task_buf;
120 async_context_freertos_config_t config = {
121 .task_priority = ASYNC_CONTEXT_DEFAULT_FREERTOS_TASK_PRIORITY,
122 .task_stack_size = ASYNC_CONTEXT_DEFAULT_FREERTOS_TASK_STACK_SIZE,
123#if configUSE_CORE_AFFINITY && configNUMBER_OF_CORES > 1
124 .task_core_id = (UBaseType_t)-1,
bool async_context_freertos_init(async_context_freertos_t *self, async_context_freertos_config_t *config)
Initialize an async_context_freertos instance using the specified configuration.
Definition async_context_freertos.c:108
static bool async_context_freertos_init_with_defaults(async_context_freertos_t *self)
Initialize an async_context_freertos instance with default values.
Definition async_context_freertos.h:141
static async_context_freertos_config_t async_context_freertos_default_config(void)
Return a copy of the default configuration object used by async_context_freertos_init_with_defaults()...
Definition async_context_freertos.h:119
Configuration object for async_context_freertos instances.
Definition async_context_freertos.h:50
UBaseType_t task_priority
Task priority for the async_context task.
Definition async_context_freertos.h:54
configSTACK_DEPTH_TYPE task_stack_size
Stack size for the async_context task.
Definition async_context_freertos.h:58
Internal state for an async_context_freertos instance.
Definition async_context_freertos.h:81
TaskHandle_t task_handle
Handle of the worker task.
Definition async_context_freertos.h:87
TimerHandle_t timer_handle
FreeRTOS timer used to schedule time-based work.
Definition async_context_freertos.h:86
SemaphoreHandle_t work_needed_sem
Semaphore signalled when work is pending.
Definition async_context_freertos.h:84
volatile bool task_should_exit
Set to true to request the worker task to exit.
Definition async_context_freertos.h:96
SemaphoreHandle_t lock_mutex
Mutex used to serialise access to the context.
Definition async_context_freertos.h:83
SemaphoreHandle_t task_complete_sem
Semaphore signalled when the task has exited.
Definition async_context_freertos.h:85
async_context_t core
Base async_context structure (must be first).
Definition async_context_freertos.h:82
uint8_t nesting
Lock nesting depth.
Definition async_context_freertos.h:95