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