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
22 extern "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 typedef void (*TaskFunction_t)(void *);
35 
36 typedef void* TaskHandle_t;
37 
38 BaseType_t xTaskCreate(TaskFunction_t pvTaskCode,
39  const char * const pcName,
40  const uint32_t usStackDepth,
41  void * const pvParameters,
42  UBaseType_t uxPriority,
43  TaskHandle_t * const pvCreatedTask);
44 
45 BaseType_t xTaskCreatePinnedToCore(TaskFunction_t pvTaskCode,
46  const char * const pcName,
47  const uint32_t usStackDepth,
48  void * const pvParameters,
49  UBaseType_t uxPriority,
50  TaskHandle_t * const pvCreatedTask,
51  const BaseType_t xCoreID);
52 
53 void vTaskDelete(TaskHandle_t xTaskToDelete);
54 void vTaskDelay(const TickType_t xTicksToDelay);
55 
56 TaskHandle_t xTaskGetCurrentTaskHandle(void);
57 
58 void vTaskEnterCritical(portMUX_TYPE *mux);
59 void vTaskExitCritical(portMUX_TYPE *mux);
60 
61 TickType_t xTaskGetTickCount(void);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif /* DOXYGEN */
68 #endif /* FREERTOS_TASK_H */