Texas Instruments TMS320 User Manual page 141

Dsp/bios v5.40
Hide thumbs Also See for TMS320:
Table of Contents

Advertisement

Software Interrupts
All registers listed in Table 4-4 are saved when a software interrupt preempts
another thread. It is not necessary for a SWI handler written in either C or
assembly to save any registers. However, if the SWI handler is written in
assembly, it is safest to follow the register conventions and save the "save on
entry" registers, since future DSP/BIOS implementations may not save these
registers. These "save on entry" registers are a10 through a15 and b10
through b15 for C6000. (See the optimizing compiler user's guide for your
platform for more details on C register conventions.)
An SWI function that modifies the IER register should save it and then restore
it before it returns. If the SWI function fails to do this, the change becomes
permanent and any other thread that starts to run or that the program returns
to afterwards can inherit the modification to the IER.
The context is not saved automatically within an HWI function. You must use
the HWI_enter and HWI_exit macros or the HWI dispatcher to preserve the
interrupted context when an HWI function is triggered.
4.3.8
Synchronizing SWI Handlers
Within an idle loop function, task, or software interrupt function, you can
temporarily prevent preemption by a higher-priority software interrupt by
calling SWI_disable, which disables all SWI preemption. To reenable SWI
preemption, call SWI_enable.
Software interrupts are enabled or disabled as a group. An individual
software interrupt cannot be enabled or disabled on its own.
When DSP/BIOS finishes initialization and before the first task is called,
software interrupts have been enabled. If an application wishes to disable
software interrupts, it calls SWI_disable as follows:
key = SWI_disable();
The corresponding enable function is SWI_enable.
SWI_enable(key);
key is a value used by the SWI module to determine if SWI_disable has been
called more than once. This allows nesting of SWI_disable / SWI_enable
calls, since only the outermost SWI_enable call actually enables software
interrupts. In other words, a task can disable and enable software interrupts
without having to determine if SWI_disable has already been called
elsewhere.
When software interrupts are disabled, a posted software interrupt does not
run at that time. The interrupt is "latched" in software and runs when software
interrupts are enabled and it is the highest-priority thread that is read to run.
Thread Scheduling
4-37

Advertisement

Table of Contents
loading

Table of Contents