AVR32: portEnterCritical vs DisableInterrupts

jhenshaw wrote on Friday, June 19, 2009:

vportEnterCritical() disables all interrupts and then increments ulCriticalNesting.

My question is when should I use one versus the other? I’m not sure what ulCriticalNesting is for, there’s a number of things in the AVR32 port that don’t match the documentation. Probably because the AVR32 is kinda weird. :slight_smile:

Also, any issues using vportEnterCritical() before the scheduler is running?

Thanks !

rtel wrote on Friday, June 19, 2009:

The only method of disabling and enabling interrupts that should be used are calls to taskENTER_CRITICAL() and taskEXIT_CRITICAL() as these maintain a nesting count.  You should not manipulate ulCriticalNesting directly, it is purely for use of the kernel.

It is fine to use the macros before the scheduler has started, but interrupts will remain disabled until the scheduler has been started.

Also note that some ports don’t disable all interrupts, but only those up to the priority used by the kernel.