How to know if inside interrupt ?

solution-ice
Posts: 4
Joined: Tue May 08, 2018 1:18 am

How to know if inside interrupt ?

Postby solution-ice » Tue May 08, 2018 1:27 am

Hi, I have a library for inter task communication that uses FreeRTOS queues, but I need to know if it was called from inside interrupt to call the right function. Under STM32 I can use this:
if ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0)

Is there something similar under ESP32 ?

Thanks
Frank

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: How to know if inside interrupt ?

Postby ESP_Angus » Tue May 08, 2018 3:08 am

Yes, there's a FreeRTOS function called xPortInIsrContext() which returns true if the calling CPU is inside an ISR.

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], ESP_Sprite and 226 guests