This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can you nest Hwi_disable and Hwi_restore?

Hello,

What will the following piece of code do?

...

key = Hwi_disable();

CriticalFunction();

Hwi_restore(key);  // outer restore

...

void CriticalFunction()

{

    newKey = Hwi_disable();

    EvenMoreCritical();

    Hwi_restore(newKey);   // inner restore

}

If nesting is allowed - Interrupts will not be active until 'outer enable' will be called. If not, however, interrupts will be enabled right after 'inner enable' is called.

Which one is it? Can you nest Hwi_disable and Hwi_restore calls?

Thanks

Nitay