Texas Instruments TMS320 User Manual page 123

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

Advertisement

4.2.4
Context and Interrupt Management Within Interrupts
When a hardware interrupt preempts the function that is currently executing,
the HWI function must save and restore any registers it uses or modifies.
DSP/BIOS provides the HWI_enter assembly macro to save registers and the
HWI_exit assembly macro to restore registers. Using these macros gives the
function that was preempted the same context when it resumes running. In
addition
to
the
register
HWI_enter/HWI_exit macros perform the following system level operations:
❏ ensure the SWI and TSK schedulers are called at the appropriate times
❏ disable/restore individual interrupts while the ISR executes
The HWI_enter assembly macro must be called prior to any DSP/BIOS API
calls that could post or affect a software interrupt or semaphore. The
HWI_exit assembly macro must be called at the very end of the function's
code.
In order to support interrupt routines written completely in C, DSP/BIOS
provides an HWI dispatcher that performs these enter and exit macros for an
interrupt routine. An HWI can handle context saving and interrupt disabling
using this HWI dispatcher or by explicitly calling HWI_enter and HWI_exit.
The HWI configuration properties allow you to choose whether the HWI
dispatcher is used for individual HWI objects. The HWI dispatcher is the
preferred method for handling interrupts.
The HWI dispatcher, in effect, calls the configured HWI function from within
an HWI_enter/HWI_exit macro pair. This allows the HWI function to be written
completely in C. It would, in fact, cause a system crash were the dispatcher
to call a function that contains the HWI_enter/HWI_exit macro pair. Using the
dispatcher therefore allows for only one instance of the HWI_enter and
HWI_exit code.
Note:
The interrupt keyword or INTERRUPT pragma must not be used when
HWI
objects
are
HWI_enter/HWI_exit macros and the HWI dispatcher contain this
functionality, and the use of the C modifier can cause program failure.
context
saving/restoring
used
in
conjunction
Thread Scheduling
Hardware Interrupts
functionality,
with
C
functions.The
4-19
the

Advertisement

Table of Contents
loading

Table of Contents