Texas Instruments TMS320 User Manual page 195

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

Advertisement

Example 5-10. Using SYS_abort with Optional Data Values
Example 5-11. Using Handlers in SYS_exit
Example 5-12. Using Multiple SYS_NUMHANDLERS
(*(Abort_function)) (format, vargs)
The single vargs parameter is of type va_list and represents the sequence of
arg parameters originally passed to SYS_abort. The function specified for the
Abort function property can pass the format and vargs parameters directly to
SYS_vprintf or SYS_vsprintf prior to terminating program execution. To avoid
the large code overhead of SYS_vprintf or SYS_vsprintf, you can use
LOG_error instead to simply print the format string.
SYS_exit likewise calls whatever function is bound to the Exit function
property, passing on its original status parameter. SYS_exit first executes a
set of handlers registered through the function SYS_atexit as described
Example 5-11.
(*handlerN)(status)
...
(*handler2)(status)
(*handler1)(status)
(*(Exit_function))(status)
The function SYS_atexit provides a mechanism that enables you to stack up
to SYS_NUMHANDLERS (which is set to 8) clean-up routines as shown in
Example 5-12. The handlers are executed before SYS_exit calls the function
bound to the Exit function property. SYS_atexit returns FALSE when its
internal stack is full.
Bool SYS_atexit(handler)
Fxn
handler;
Memory and Low-level Functions
System Services
5-13

Advertisement

Table of Contents
loading

Table of Contents