Loading...
Searching...
No Matches
task.h
1/*
2 * Copyright (C) 2019 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 *
8 * FreeRTOS to RIOT-OS adaption module for source code compatibility
9 */
10
11#ifndef FREERTOS_TASK_H
12#define FREERTOS_TASK_H
13
14#ifndef DOXYGEN
15
16#include <limits.h> /* for INT_MAX */
17
18#include "thread.h"
19#include "freertos/FreeRTOS.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define xTaskHandle TaskHandle_t
26#define tskNO_AFFINITY INT_MAX
27
28#define taskDISABLE_INTERRUPTS portDISABLE_INTERRUPTS
29#define taskENABLE_INTERRUPTS portENABLE_INTERRUPTS
30
31#define taskENTER_CRITICAL portENTER_CRITICAL
32#define taskEXIT_CRITICAL portEXIT_CRITICAL
33
34#define taskSCHEDULER_NOT_STARTED 1
35#define taskSCHEDULER_RUNNING 2
36
37typedef enum {
38 eNoAction = 0,
39 eSetBits,
40 eIncrement,
41 eSetValueWithOverwrite,
42 eSetValueWithoutOverwrite,
43} eNotifyAction;
44
45typedef void (*TaskFunction_t)(void *);
46typedef void (*TlsDeleteCallbackFunction_t)( int, void * );
47
48typedef void* TaskHandle_t;
49
50BaseType_t xTaskCreate(TaskFunction_t pvTaskCode,
51 const char * const pcName,
52 const uint32_t usStackDepth,
53 void * const pvParameters,
54 UBaseType_t uxPriority,
55 TaskHandle_t * const pvCreatedTask);
56
57BaseType_t xTaskCreatePinnedToCore(TaskFunction_t pvTaskCode,
58 const char * const pcName,
59 const uint32_t usStackDepth,
60 void * const pvParameters,
61 UBaseType_t uxPriority,
62 TaskHandle_t * const pvCreatedTask,
63 const BaseType_t xCoreID);
64
65void vTaskDelete(TaskHandle_t xTaskToDelete);
66void vTaskSuspend(TaskHandle_t xTaskToSuspend);
67void vTaskResume(TaskHandle_t xTaskToResume);
68void vTaskDelay(const TickType_t xTicksToDelay);
69void vTaskSuspendAll(void);
70
71TaskHandle_t xTaskGetCurrentTaskHandle(void);
72
73const char *pcTaskGetTaskName(TaskHandle_t xTaskToQuery);
74
75UBaseType_t uxTaskGetStackHighWaterMark(TaskHandle_t xTask);
76
77void *pvTaskGetThreadLocalStoragePointer(TaskHandle_t xTaskToQuery,
78 BaseType_t xIndex);
79void vTaskSetThreadLocalStoragePointerAndDelCallback(TaskHandle_t xTaskToSet,
80 BaseType_t xIndex,
81 void *pvValue,
82 TlsDeleteCallbackFunction_t pvDelCallback);
83
84void vTaskEnterCritical(portMUX_TYPE *mux);
85void vTaskExitCritical(portMUX_TYPE *mux);
86
87TickType_t xTaskGetTickCount(void);
88
89BaseType_t xTaskNotify(TaskHandle_t xTaskToNotify, uint32_t ulValue,
90 eNotifyAction eAction);
91BaseType_t xTaskNotifyWait(uint32_t ulBitsToClearOnEntry,
92 uint32_t ulBitsToClearOnExit,
93 uint32_t *pulNotificationValue,
94 TickType_t xTicksToWait);
95
96BaseType_t xTaskNotifyGive(TaskHandle_t xTaskToNotify);
97void vTaskNotifyGiveFromISR(TaskHandle_t xTaskToNotify,
98 BaseType_t *pxHigherPriorityTaskWoken);
99uint32_t ulTaskNotifyTake(BaseType_t xClearCountOnExit,
100 TickType_t xTicksToWait);
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif /* DOXYGEN */
107#endif /* FREERTOS_TASK_H */