portmacro.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_PORTMACRO_H
12 #define FREERTOS_PORTMACRO_H
13 
14 #ifndef DOXYGEN
15 
16 #include "stdint.h"
17 
18 #include "mutex.h"
19 #include "irq.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #define portBASE_TYPE int
26 #define portUBASE_TYPE unsigned portBASE_TYPE
27 
28 #define portMAX_DELAY 0xFFFFFFFF
29 
30 #define portMUX_TYPE mutex_t
31 #define portMUX_INITIALIZER_UNLOCKED MUTEX_INIT
32 
33 #define portYIELD_FROM_ISR thread_yield_higher
34 
35 #define portENTER_CRITICAL vTaskEnterCritical
36 #define portEXIT_CRITICAL vTaskExitCritical
37 #define portENTER_CRITICAL_ISR vTaskEnterCritical
38 #define portEXIT_CRITICAL_ISR vTaskExitCritical
39 #define portENTER_CRITICAL_NESTED irq_disable
40 #define portEXIT_CRITICAL_NESTED irq_restore
41 
42 #ifdef MCU_ESP32
43 
44 #define portNUM_PROCESSORS 2
45 #define xPortGetCoreID() PRO_CPU_NUM
46 
47 #else /* MCU_ESP32 */
48 
49 #define portNUM_PROCESSORS 1
50 #define xPortGetCoreID() PRO_CPU_NUM
51 
52 #endif /* MCU_ESP32 */
53 
54 extern void vTaskEnterCritical(portMUX_TYPE *mux);
55 extern void vTaskExitCritical(portMUX_TYPE *mux);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* DOXYGEN */
62 #endif /* FREERTOS_PORTMACRO_H */
irq.h
IRQ driver interface.
mutex.h
Mutex for thread synchronization.