mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
unit-test-app: freertos_compliance config added
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
This commit is contained in:
@@ -992,6 +992,9 @@ static IRAM_ATTR void spi_transmit_polling_measure(spi_device_handle_t spi, spi_
|
||||
|
||||
TEST_CASE("spi_speed","[spi]")
|
||||
{
|
||||
#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
|
||||
return;
|
||||
#endif
|
||||
uint32_t t_flight;
|
||||
//to get rid of the influence of randomly interrupts, we measured the performance by median value
|
||||
uint32_t t_flight_sorted[TEST_TIMES];
|
||||
|
||||
@@ -430,7 +430,8 @@ menu "FreeRTOS"
|
||||
bool "Tests compliance with Vanilla FreeRTOS port*_CRITICAL calls"
|
||||
default n
|
||||
help
|
||||
If enabled, context of port*_CRITICAL calls (ISR or Non-ISR) would be checked to be in compliance with Vanilla FreeRTOS.
|
||||
If enabled, context of port*_CRITICAL calls (ISR or Non-ISR)
|
||||
would be checked to be in compliance with Vanilla FreeRTOS.
|
||||
e.g Calling port*_CRITICAL from ISR context would cause assert failure
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -220,14 +220,25 @@ void vTaskExitCritical( portMUX_TYPE *mux, const char *function, int line );
|
||||
#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
|
||||
/* Calling port*_CRITICAL from ISR context would cause an assert failure.
|
||||
* If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE
|
||||
**/
|
||||
#define portENTER_CRITICAL(mux) do { \
|
||||
configASSERT(!xPortInIsrContext()); \
|
||||
vTaskEnterCritical(mux, __FUNCTION__, __LINE__); \
|
||||
*/
|
||||
#define portENTER_CRITICAL(mux) do { \
|
||||
if(!xPortInIsrContext()) { \
|
||||
vTaskEnterCritical(mux, __FUNCTION__, __LINE__); \
|
||||
} else { \
|
||||
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
abort(); \
|
||||
} \
|
||||
} while(0)
|
||||
#define portEXIT_CRITICAL(mux) do { \
|
||||
configASSERT(!xPortInIsrContext()); \
|
||||
vTaskExitCritical(mux, __FUNCTION__, __LINE__); \
|
||||
|
||||
#define portEXIT_CRITICAL(mux) do { \
|
||||
if(!xPortInIsrContext()) { \
|
||||
vTaskExitCritical(mux, __FUNCTION__, __LINE__); \
|
||||
} else { \
|
||||
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
abort(); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define portENTER_CRITICAL(mux) vTaskEnterCritical(mux, __FUNCTION__, __LINE__)
|
||||
@@ -254,14 +265,25 @@ void vPortCPUReleaseMutex(portMUX_TYPE *mux);
|
||||
#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
|
||||
/* Calling port*_CRITICAL from ISR context would cause an assert failure.
|
||||
* If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE
|
||||
**/
|
||||
#define portENTER_CRITICAL(mux) do { \
|
||||
configASSERT(!xPortInIsrContext()); \
|
||||
vTaskEnterCritical(mux); \
|
||||
*/
|
||||
#define portENTER_CRITICAL(mux) do { \
|
||||
if(!xPortInIsrContext()) { \
|
||||
vTaskEnterCritical(mux); \
|
||||
} else { \
|
||||
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
abort(); \
|
||||
} \
|
||||
} while(0)
|
||||
#define portEXIT_CRITICAL(mux) do { \
|
||||
configASSERT(!xPortInIsrContext()); \
|
||||
vTaskExitCritical(mux); \
|
||||
|
||||
#define portEXIT_CRITICAL(mux) do { \
|
||||
if(!xPortInIsrContext()) { \
|
||||
vTaskExitCritical(mux); \
|
||||
} else { \
|
||||
ets_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
abort(); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define portENTER_CRITICAL(mux) vTaskEnterCritical(mux)
|
||||
|
||||
@@ -40,8 +40,8 @@ TEST_CASE("portMUX spinlocks (no contention)", "[freertos]")
|
||||
BENCHMARK_START();
|
||||
|
||||
for (int i = 0; i < REPEAT_OPS; i++) {
|
||||
portENTER_CRITICAL(&mux);
|
||||
portEXIT_CRITICAL(&mux);
|
||||
portENTER_CRITICAL_ISR(&mux);
|
||||
portEXIT_CRITICAL_ISR(&mux);
|
||||
}
|
||||
BENCHMARK_END("no contention lock");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user