Error Handling

Cascade Driver for Hilscher Fieldbus CIF Cards: Version 4.1
Prev | Chapter 2. Overview | Next

# 2.4. Error Handling

The Cascade Driver implements a mechanism for error reporting that provides as much information as possible from the different product components and layers. Errors can originate from any of the following:

- The API calls made by the user's application, as a result of parameter checks performed within the API functions.

- The device driver.

- Other products connected to the driver, such as the Cascade DataHub

- The QNX or C-library function calls made by the driver or user's application.

To accomplish this, errors from each of these sources are encoded in groups, to ensure that there can be no ambiguity as to the error source. A base error group number in the thousands (`1000-9999`) is added to the specific error. For example, all errors generated by the driver are in the range `5001-5999`. The following list describes the error categories (see Summary of Reported Errors in the appendices, and the API header file `dr_api.h` for a complete list of errors):

- `DR_API_ERRORS` group: errors generated by the API functions.

- `DR_API_ADMIN_ERRORS` group: errors generated by the driver.

- `DR_API_STATUS_ERRORS` group: errors generated by the driver or API that are non-subsystem specific statuses. The specific error can be interpreted with reference to the `ST_STATUS` group of errors.

- `DR_API_IPC_ERRORS` group: errors generated by the interprocess communication subsystem within the driver or API. The specific error can be interpreted with reference to the `ST_STATUS` group of errors..

- All other errors (below `1000`): QNX and C-library errors are left unmodified.

Most error sources have an associated table of error descriptions for their group of errors. This is referenced by the API functions to return the appropriate error-string (where available as a parameter).

Errors originating in the driver in many cases provide even more detail, specifying the particular parameter values that caused the error. Driver errors are transferred using the error command format:

        (error error_string)

where `error_string` is as follows:

        "error_source error_number (error_time) error_description"

and where:

`error_source`

  The module/function generating the error.

`error_number`

  The `error_code` described above.

(`error_time`)

  The time of the error, formatted as `yymmdd@hh:mm:ss`.

`error_description`

  The remainder of the string, providing a detailed explanation of the error.

API functions decode this command to extract the error_string and return it as a parameter. Users of the direct interface may want to perform a similar parsing of the response data on an error condition.

Prev | Home | Next
Driver Startup | Up | API Specifications

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.