System Services
5-14
5.2.2 Handling Errors
SYS_error is used to handle DSP/BIOS error conditions as shown in
Example 5-13. Application programs as well as internal functions use
SYS_error to handle program errors.
Example 5-13. DSP/BIOS Error Handling
SYS_error uses whatever function is bound to the Error function property to
handle error conditions. The default error function in the configuration
template is _UTL_doError, which logs an error message. In Example 5-14,
Error function can be configured to use doError which uses LOG_error to
print the error number and associated error string.
Example 5-14. Using doError to Print Error Information
The errno parameter to SYS_error can be a DSP/BIOS error (for example,
SYS_EALLOC) or a user error (errno >= 256). See TMS320 DSP/BIOS API
Reference Guide for your platform for a table of error codes and strings.
Note:
Error checking that would increase memory and CPU requirements has
been kept to a minimum in the DSP/BIOS APIs. Instead, the API reference
documentation specifies constraints for calling DSP/BIOS API functions. It
is the responsibility of the application developer to meet these constraints.
Void SYS_error(s, errno, ...)
String s;
Uns errno;
Void doError(String s, Int errno, va_list ap)
{
LOG_error("SYS_error called: error id = 0x%x", errno);
LOG_error("SYS_error called: string = '%s'", s);
}