HWI_enter
Application Program Interface
2-165
See c55.h55 for constants defined for working with these masks. If your
HWI is coded in C, it is recommended that you use the
SAVE_BY_CALLER masks provided in c55.h55.
Note:
The C55_saveCcontext, C55_restoreCcontext C55_saveBiosContext
and C55_restoreBiosContext macros preserve processor register
context per C and DSP/BIOS requirements, respectively.
Constraints and
Calling Context
❏
This API should not be used in the NMI HWI function.
❏
This API must not be called if the HWI object that runs this function
uses the HWI dispatcher.
❏
This API cannot be called from the program’s main() function.
❏
This API cannot be called from a SWI, TSK, or IDL function.
❏
This API cannot be called from a CLK function.
❏
Unless the HWI dispatcher is used, this API must be called within any
hardware interrupt function (except NMI’s HWI function) before the
first operation in an HWI that uses any DSP/BIOS API calls that might
post or affect a SWI or semaphore. Such functions must be written in
assembly language. Alternatively, the HWI dispatcher can be used
instead of this API, allowing the function to be written completely in C
and allowing you to reduce code size.
❏
If an interrupt function calls HWI_enter, it must end by calling
HWI_exit.
❏
Do not use the interrupt keyword or the INTERRUPT pragma in C
functions that run in the context of an HWI.
❏
Examples
Example #1:
Calling a C function from within an HWI_enter/HWI_exit block. Specify all
registers in the C convention class, save-by-caller. Use the appropriate
register save masks with the HWI_enter macro. See the c55.h55 file for
definitions of the masks used in this example.
HWI_enter C55_AR_DR_SAVE_BY_CALLER_MASK, \
C55_ACC_SAVE_BY_CALLER_MASK, \
C55_MISC1_SAVE_BY_CALLER_MASK, \
C55_MISC2_SAVE_BY_CALLER_MASK, \
C55_MISC3_SAVE_BY_CALLER_MASK, \
user_ier0_mask, user_ier1_mask
The HWI_enter macro: