2008-01-02 04:54 AM
critical section example
2011-05-17 03:20 AM
Hi,
I have implemented buffered uarts using interupts on the STM32. Can anyone provide a ''critical section'' example to disable interupts when getting data in or out of my circular buffers. I've used the code below in the past with other processors but I'm not sure how to implement the macros DISABLE_INTERRUPTS and ENABLE_INTERRUPTS on the STM32.Code:
void EnterCriticalSection( void ) { DISABLE_INTERRUPTS(); CriticalSectionNesting++; } void ExitCriticalSection( void ) { if ((--CriticalSectionNesting) == 0) ENABLE_INTERRUPTS(); } Thanks Trevor2011-05-17 03:20 AM
Your code looks like it was ripped from Freertos, why not just have a look at the cortexm3 port.
Cheers sjo