Is use of macro portEND_SWITCHING_ISR() dependent on position within ISR

I usually use this macro just before exiting the ISR. I have a situation where portENDSWITCHINGISR() needs to be called within a fuction call within the ISR making its position NOT just prior to ISR return but deeper within the ISR stack. Is using portENDSWITCHINGISR() deep within the ISR call stack permissable or do I need to bubble the request up so it used just prior to exiting the ISR? Thanks

Is use of macro portEND_SWITCHING_ISR() dependent on position within ISR

It depends on the processor and the port. Some ports the portENDSWITCHINGISR() macro sets a pending interrupt which doesn’t actually happen until the ISR ends. In this case it doesn’t actually matter where the call is. Other ports, (which don’t support nesting interrupts, like the Pic24 port) the portENDSWITCHINGISR actually does the yield at that point and the following code in the ISR doesn’t get executed until the task that was interrupted gets run again. In this case it is very important that it be at the end of the ISR.

Is use of macro portEND_SWITCHING_ISR() dependent on position within ISR

Thanks. I’m using an ARM and saw the IRQ being Set. Just wanted to make sure something I didn’t know/understand might bite me in the ass.

Is use of macro portEND_SWITCHING_ISR() dependent on position within ISR

Different ARM processors do this in different ways too. If this is an ARM Cortex-M then it is fine for the call to portYIELDFROMISR() to appear anywhere in the ISR (if it were an ARM9, for example, it would not be ok).