Slide 1 Slide 2 Slide 3 Slide 4 Slide 5 Slide 6 Slide 7 Slide 8 Slide 9 Slide 10 Slide 11 Slide 12 Product List
RTOS and Software Interrupts Slide 9

So far, only software interrupts being posted via the Swi_post() cal have been discussed; however, there are actually additional ways to conditionally or unconditionally post a Swi. With each Swi that is created, its data structure will have a variable called the trigger that is used for conditional posting. This trigger is the size of a C integer, which means it will be either 16 or 32 bits, depending on what TI architecture it is being run on. The API call Swi_inc() will unconditionally post the Swi, but will also increment the value stored in the trigger. Swis are only run once to completion, no matter how many times they are first posted. Therefore, Swi_inc might be useful in systems where the software interrupt function needs to know how many times it was posted before running. Swi_dec() is similar, but it decrements the trigger value before posting the Swi. This can be used to defer running a Swi function until it gets posted a certain number of times. Swi_or() allows the application to bit-OR the trigger with a mask value before posting. Swi_andn() will only post the software interrupt when a mask value that is not-ANDED with the trigger equals zero. This could be useful if there are multiple posts that all need to occur before the Swi runs. To make this more useful, the API call Swi_getTrigger() returns the latched value of the trigger when the Swi function was called. The reason the value is latched is because the actual trigger value will be reset to its initial value every time it is posted.

PTM Published on: 2012-07-17