Software Interrupts
4-36
The second advantage is that an SWI handler can call some functions that
cannot be called from an HWI, because an SWI handler is guaranteed not to
run while DSP/BIOS is updating internal data structures. This is an important
feature of DSP/BIOS and you should become familiar with the table,
Functions Callable by Tasks, SWI Handlers, or Hardware ISRs in the
TMS320 DSP/BIOS API Reference Guide for your platform that lists
DSP/BIOS functions and the threads from which each function can be called.
Note:
SWI handlers can call any DSP/BIOS function that does not block. For
example, SEM_pend can make a task block, so SWI handlers cannot call
SEM_pend or any function that calls SEM_pend (for example, MEM_alloc,
TSK_sleep).
On the other hand, an SWI handler must complete before any blocked task is
allowed to run. There might be situations where the use of a task might fit
better with the overall system design, in spite of any additional overhead
involved.
4.3.7 Saving Registers During Software Interrupt Preemption
When a software interrupt preempts another thread, DSP/BIOS preserves
the context of the preempted thread by automatically saving all of the CPU
registers shown in Table 4-4 onto the system stack.
Table 4-4. CPU Registers Saved During Software Interrupt
C55x Platform
C6000 Platform
C28x Platform
ac0
ac1
ac2
ac3
brc1
brs1
csr
rea0
rea1
rptc
rsa0
rsa1
st0
st1
st2
st3
t0
t1
trn1
xar1
xar2
xar3
xar4
a0–a9
a16- a31
(C64x
only)
b0–99
b16-
b31
(C64x
only)
CSR
AMR
al
ah
xar0
xar4
xar5
xar6
xar7
xt
ph
pl
dp