Archive for May, 2010

5/24: Safe Interrupt Enable / Disable

Axiom, HC12ShawnNo Comments

Having trouble switching from cooperative tasking? One of the easiest oversights is your “sei” and “cli” sections.

The diagram below shows how you can run into problems within the critical sections of code. In this example when the memory allocation ends the interrupts are enabled with “cli” removing the critical section around the linked list manager. Once this happens RTI ISR fires and switches in thread 2. This example shows thread 2 popping an item from this list breaking the flow inside of thread 1.

Read the rest of this entry »