Loading...
Searching...
No Matches
portmacro.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 "stdbool.h"
15#include "stdint.h"
16
17#ifndef CPU_ESP8266
18#include "esp_heap_caps.h"
19#include "esp_timer.h"
20#include "soc/soc.h"
21#endif
22
23#include "mutex.h"
24#include "irq.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#define portBASE_TYPE int
31#define portUBASE_TYPE unsigned portBASE_TYPE
32#define portTICK_TYPE uint32_t
33#define portSTACK_TYPE uint8_t
34
35#define portMAX_DELAY 0xFFFFFFFFUL
36
37#define portMUX_TYPE mutex_t
38#define portMUX_INITIALIZE mutex_init
39#define portMUX_INITIALIZER_UNLOCKED MUTEX_INIT
40
41#define portYIELD thread_yield_higher
42#define portYIELD_FROM_ISR thread_yield_higher
43
44#define portENTER_CRITICAL vTaskEnterCritical
45#define portEXIT_CRITICAL vTaskExitCritical
46#define portENTER_CRITICAL_SAFE vTaskEnterCritical
47#define portEXIT_CRITICAL_SAFE vTaskExitCritical
48#define portENTER_CRITICAL_ISR vTaskEnterCritical
49#define portEXIT_CRITICAL_ISR vTaskExitCritical
50#define portENTER_CRITICAL_NESTED irq_disable
51#define portEXIT_CRITICAL_NESTED irq_restore
52
53#define portSET_INTERRUPT_MASK_FROM_ISR xPortSetInterruptMaskFromISR
54#define portCLEAR_INTERRUPT_MASK_FROM_ISR vPortClearInterruptMaskFromISR
55
56#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
57
58#if defined(CPU_FAM_ESP32) || defined(CPU_FAM_ESP32S3)
59
60#define portNUM_PROCESSORS 2
61#define xPortGetCoreID() PRO_CPU_NUM
62#define vPortYield portYIELD
63
64#else /* defined(CPU_FAM_ESP32) || defined(CPU_FAM_ESP32S3) */
65
66#define portNUM_PROCESSORS 1
67#define xPortGetCoreID() PRO_CPU_NUM
68#define vPortYield portYIELD
69
70#endif /* defined(CPU_FAM_ESP32) || defined(CPU_FAM_ESP32S3) */
71
72extern void vTaskEnterCritical(portMUX_TYPE *mux);
73extern void vTaskExitCritical(portMUX_TYPE *mux);
74
75bool xPortCanYield(void);
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif /* DOXYGEN */
IRQ driver interface.
Mutex for thread synchronization.