forked from espressif/arduino-esp32
IDF master c69f0ec32 (#5449)
esp-dsp: master f4d7d6e esp-face: master 420fc7e esp-rainmaker: f1b82c7 esp32-camera: master 6a9497b esp_littlefs: master b58f00c
This commit is contained in:
@ -308,11 +308,22 @@ static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t comp
|
||||
void vPortYield( void );
|
||||
void vPortEvaluateYieldFromISR(int argc, ...);
|
||||
void _frxt_setup_switch( void );
|
||||
|
||||
/**
|
||||
* Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with,
|
||||
* or without arguments.
|
||||
* or without arguments. The macro counts only 0 or 1 arguments.
|
||||
*
|
||||
* In the future, we want to switch to C++20. We also want to become compatible with clang.
|
||||
* Hence, we provide two versions of the following macros which are using variadic arguments.
|
||||
* The first one is using the GNU extension ##__VA_ARGS__. The second one is using the C++20 feature __VA_OPT__(,).
|
||||
* This allows users to compile their code with standard C++20 enabled instead of the GNU extension.
|
||||
* Below C++20, we haven't found any good alternative to using ##__VA_ARGS__.
|
||||
*/
|
||||
#if defined(__cplusplus) && (__cplusplus > 201703L)
|
||||
#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0 __VA_OPT__(,) __VA_ARGS__,1,0)
|
||||
#else
|
||||
#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0, ##__VA_ARGS__,1,0)
|
||||
#endif
|
||||
#define portGET_ARGUMENT_COUNT_INNER(zero, one, count, ...) count
|
||||
|
||||
_Static_assert(portGET_ARGUMENT_COUNT() == 0, "portGET_ARGUMENT_COUNT() result does not match for 0 arguments");
|
||||
@ -325,7 +336,11 @@ _Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result
|
||||
* it was developed to support both usages of portYIELD inside of an ISR. Any other usage form
|
||||
* might result in undesired behaviour
|
||||
*/
|
||||
#if defined(__cplusplus) && (__cplusplus > 201703L)
|
||||
#define portYIELD_FROM_ISR(...) vPortEvaluateYieldFromISR(portGET_ARGUMENT_COUNT(__VA_ARGS__) __VA_OPT__(,) __VA_ARGS__)
|
||||
#else
|
||||
#define portYIELD_FROM_ISR(...) vPortEvaluateYieldFromISR(portGET_ARGUMENT_COUNT(__VA_ARGS__), ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/* Yielding within an API call (when interrupts are off), means the yield should be delayed
|
||||
until interrupts are re-enabled.
|
||||
|
Reference in New Issue
Block a user