-
Notifications
You must be signed in to change notification settings - Fork 917
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cgo: add more FreeRTOS compatibility
This commit implements: * xTaskCreate * vTaskDelay * xSemaphoreCreateCounting (partially) * xSemaphoreTake * xSemaphoreGive * xQueueCreate * vQueueDelete * xQueueReceive * xQueueSend * uxQueueMessagesWaiting
- Loading branch information
Showing
6 changed files
with
127 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
#pragma once | ||
|
||
typedef struct QueueDefinition * QueueHandle_t; | ||
typedef void * QueueHandle_t; | ||
|
||
QueueHandle_t xQueueCreate(UBaseType_t uxQueueLength, UBaseType_t uxItemSize); | ||
void vQueueDelete(QueueHandle_t xQueue); | ||
|
||
BaseType_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait); | ||
BaseType_t xQueueSend(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait); | ||
UBaseType_t uxQueueMessagesWaiting(QueueHandle_t xQueue); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#pragma once | ||
|
||
// Note: in FreeRTOS, SemaphoreHandle_t is an alias for QueueHandle_t. | ||
typedef struct SemaphoreDefinition * SemaphoreHandle_t; | ||
typedef void * SemaphoreHandle_t; | ||
|
||
SemaphoreHandle_t xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount); | ||
SemaphoreHandle_t xSemaphoreCreateRecursiveMutex(void); | ||
|
||
void vSemaphoreDelete(SemaphoreHandle_t xSemaphore); | ||
|
||
// Note: these two functions are macros in FreeRTOS. | ||
BaseType_t xSemaphoreTakeRecursive(SemaphoreHandle_t xMutex, TickType_t xTicksToWait); | ||
BaseType_t xSemaphoreGiveRecursive(SemaphoreHandle_t xMutex); | ||
|
||
// Note: these functions are macros in FreeRTOS. | ||
BaseType_t xSemaphoreTake(QueueHandle_t xSemaphore, TickType_t xTicksToWait); | ||
BaseType_t xSemaphoreGive(QueueHandle_t xSemaphore); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
#pragma once | ||
|
||
typedef void * TaskHandle_t; | ||
typedef void (*TaskFunction_t)(void *); | ||
|
||
TaskHandle_t xTaskGetCurrentTaskHandle(void); | ||
|
||
BaseType_t xTaskCreate(TaskFunction_t pvTaskCode, const char * const pcName, uintptr_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask); | ||
|
||
void vTaskDelay(const TickType_t xTicksToDelay); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters