Skip to content
Snippets Groups Projects
Verified Commit d2986026 authored by rahix's avatar rahix
Browse files

fix(dispatcher): Initialize mutex before RTOS startup


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent 3dd88fbb
Branches freertos-btle
No related tags found
No related merge requests found
...@@ -13,14 +13,17 @@ TaskHandle_t dispatcher_task_id; ...@@ -13,14 +13,17 @@ TaskHandle_t dispatcher_task_id;
static StaticSemaphore_t api_mutex_data; static StaticSemaphore_t api_mutex_data;
SemaphoreHandle_t api_mutex = NULL; SemaphoreHandle_t api_mutex = NULL;
void dispatcher_mutex_init(void)
{
api_mutex = xSemaphoreCreateMutexStatic(&api_mutex_data);
}
/* /*
* API dispatcher task. This task will sleep until an API call is issued and * API dispatcher task. This task will sleep until an API call is issued and
* then wake up to dispatch it. * then wake up to dispatch it.
*/ */
void vApiDispatcher(void *pvParameters) void vApiDispatcher(void *pvParameters)
{ {
api_mutex = xSemaphoreCreateMutexStatic(&api_mutex_data);
LOG_DEBUG("dispatcher", "Ready."); LOG_DEBUG("dispatcher", "Ready.");
while (1) { while (1) {
if (api_dispatcher_poll()) { if (api_dispatcher_poll()) {
......
...@@ -177,6 +177,11 @@ int hardware_early_init(void) ...@@ -177,6 +177,11 @@ int hardware_early_init(void)
*/ */
hwlock_init(); hwlock_init();
/*
* API Dispatcher Mutex
*/
dispatcher_mutex_init();
return 0; return 0;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
/* ---------- Dispatcher --------------------------------------------------- */ /* ---------- Dispatcher --------------------------------------------------- */
void vApiDispatcher(void *pvParameters); void vApiDispatcher(void *pvParameters);
void dispatcher_mutex_init(void);
extern SemaphoreHandle_t api_mutex; extern SemaphoreHandle_t api_mutex;
extern TaskHandle_t dispatcher_task_id; extern TaskHandle_t dispatcher_task_id;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment