Software Interrupts
Thread Scheduling
4-31
SWI_andn and SWI_dec post the SWI object only if the value of its mailbox
becomes 0:
❏
SWI_andn clears the bits in the mailbox determined by a mask passed
as a parameter.
❏
SWI_dec decreases the value of the mailbox by one.
Table 4-3 summarizes the differences between these functions.
Table 4-3.
SWI Object Function Differences
The SWI mailbox allows you to have tighter control over the conditions that
should cause an SWI function to be posted, or the number of times the SWI
function should be executed once the software interrupt is posted and
scheduled for execution.
To access the value of its mailbox, an SWI function can call SWI_getmbox.
SWI_getmbox can be called only from the SWI's object function. The value
returned by SWI_getmbox is the value of the mailbox before the SWI object
was removed from the posted SWI queue and the SWI function was
scheduled for execution.
When the SWI Manager removes a pending SWI object from the posted
object’s queue, its mailbox is reset to its initial value. The initial value of the
mailbox should be set in the .tcf configuration file. If while the SWI function is
executing it is posted again, its mailbox is updated accordingly. However, this
does not affect the value returned by SWI_getmbox while the SWI functions
execute. That is, the mailbox value that SWI_getmbox returns is the latched
mailbox value when the software interrupt was removed from the list of
pending SWIs. The SWI's mailbox however, is immediately reset after the
SWI is removed from the list of pending SWIs and scheduled for execution.
This gives the application the ability to keep updating the value of the SWI
mailbox if a new posting occurs, even if the SWI function has not finished its
execution.
For example, if an SWI object is posted multiple times before it is removed
from the queue of posted SWIs, the SWI Manager schedules its function to
execute only once. However, if an SWI function must always run multiple
times when the SWI object is posted multiple times, SWI_inc should be used
to post the SWI as shown in Figure 4-7.
Action
Treats
Mailbox as
Bitmask
Treats
Mailbox as
Counter
Does not
Modify
Mailbox
Always post
SWI_or
SWI_inc
SWI_post
Post if it becomes zero
SWI_andn
SWI_dec
—
Содержание TMS320 Series
Страница 1: ...TMS320 DSP BIOS v5 40 User s Guide Literature Number SPRU423G April 2009 ...
Страница 16: ...xvi ...
Страница 152: ...Tasks 4 48 Figure 4 12 Trace from Example 4 7 ...
Страница 168: ...Semaphores 4 64 Figure 4 14 Trace Results from Example 4 11 ...
Страница 202: ...5 20 ...
Страница 287: ...Index 9 Index Void 1 11 W words data memory 3 15 of code 1 5 wrapper function 2 29 ...
Страница 288: ...Index 10 Index ...