DCL Error Handling Structures and Macros

Module: Digital Control Library (DCL)

More…

Types

Name

enum

DCL_error_codes { dcl_none = 0U, dcl_param_range_err = (1U << 0), dcl_param_invalid_err = (1U << 1), dcl_param_warn_err = (1U << 2), dcl_input_range_err = (1U << 3), dcl_overflow_err = (1U << 4), dcl_underflow_err = (1U << 5), dcl_controller_err = (1U << 6), dcl_timing_err = (1U << 7), dcl_comp_err = (1U << 8)}
Defines the library enumerated error codes. These will be applied as bit masks in the error handler.

Defines

Name

DCL_clearError(ptr)
Macro to clear stored error code in CSS.

DCL_setError(ptr, code)
Macro to set error code in CSS.

DCL_getErrorLine(ptr)
Macro to store line location of error in CSS.

DCL_getErrorFunc(ptr)
Macro to store function location of error in CSS.

DCL_getErrorInfo(ptr)
Macro to store error info in CSS.

DCL_runErrorHandler(ptr)
Prototype for basic error handler.

Detailed Description

Defines all error handling strctures and macro

Types Documentation

enum DCL_error_codes

Enumerator

Value

Description

dcl_none

0U

No error.

dcl_param_range_err

(1U << 0)

Parameter range exceeded.

dcl_param_invalid_err

(1U << 1)

Parameter not valid.

dcl_param_warn_err

(1U << 2)

Parameter warning.

dcl_input_range_err

(1U << 3)

Input range exceeded.

dcl_overflow_err

(1U << 4)

Numerical overflow.

dcl_underflow_err

(1U << 5)

Numerical underflow.

dcl_controller_err

(1U << 6)

Controller operation not completed.

dcl_timing_err

(1U << 7)

Timing error.

dcl_comp_err

(1U << 8)

Computation error.

Defines the library enumerated error codes. These will be applied as bit masks in the error handler.

Macros Documentation

define DCL_clearError

#define DCL_clearError(
    ptr
)
((ptr)->css->err = dcl_none)

Macro to clear stored error code in CSS.

Parameters:

  • ptr DCL controller object that contains css

define DCL_setError

#define DCL_setError(
    ptr,
    code
)
((ptr)->css->err |= code)

Macro to set error code in CSS.

Parameters:

  • ptr DCL controller object that contains css

  • code enum dcl_error_codes

define DCL_getErrorLine

#define DCL_getErrorLine(
    ptr
)
((ptr)->css->err_line = ((ptr)->css->err) ? __LINE__ : 0)

Macro to store line location of error in CSS.

Parameters:

  • ptr DCL controller object that contains css

define DCL_getErrorFunc

#define DCL_getErrorFunc(
    ptr
)
((ptr)->css->err_func = ((ptr)->css->err) ? __FUNCTION__ : NULL)

Macro to store function location of error in CSS.

Parameters:

  • ptr DCL controller object that contains css

define DCL_getErrorInfo

#define DCL_getErrorInfo(
    ptr
)
    {                          \
        DCL_getErrorLine(ptr); \
        DCL_getErrorFunc(ptr); \
    }

Macro to store error info in CSS.

Parameters:

  • ptr DCL controller object that contains css

define DCL_runErrorHandler

#define DCL_runErrorHandler(
    ptr
)
    {                                  \
        if (ptr->css->err != dcl_none) \
        {                              \
            DCL_setBreakPoint();       \
            DCL_clearError(ptr);       \
        }                              \
    }

Prototype for basic error handler.

Parameters:

  • ptr DCL controller object that contains css