AM263x Digital Power SDK  09.01.00
dcl_error.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef _DCL_ERROR_H_
34 #define _DCL_ERROR_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
48 #include "../dcl_common.h"
49 
50 //--- Error handling ---------------------------------------------------------
51 
55 typedef enum
56 {
57  dcl_none = 0U,
58  dcl_param_range_err = (1U << 0),
59  dcl_param_invalid_err = (1U << 1),
60  dcl_param_warn_err = (1U << 2),
61  dcl_input_range_err = (1U << 3),
62  dcl_overflow_err = (1U << 4),
63  dcl_underflow_err = (1U << 5),
64  dcl_controller_err = (1U << 6),
65  dcl_timing_err = (1U << 7)
67 
72 #define DCL_clearError(ptr) ((ptr)->css->err = dcl_none)
73 
79 #define DCL_setError(ptr,code) ((ptr)->css->err |= code)
80 
85 #define DCL_getErrorLine(ptr) ((ptr)->css->err_line = ((ptr)->css->err) ? __LINE__ : 0)
86 
91 #define DCL_getErrorFunc(ptr) ((ptr)->css->err_func = ((ptr)->css->err) ? __FUNCTION__ : NULL)
92 
97 #define DCL_getErrorInfo(ptr) \
98 { \
99  DCL_getErrorLine(ptr); \
100  DCL_getErrorFunc(ptr); \
101 }
102 
107 #define DCL_runErrorHandler(ptr) \
108 { \
109  if(dcl_none != ptr->css->err)\
110  { \
111  DCL_setBreakPoint(); \
112  DCL_clearError(ptr); \
113  } \
114 }
115 
118 #ifdef __cplusplus
119 }
120 #endif // extern "C"
121 
122 #endif // _DCL_ERROR_H_
dcl_param_warn_err
@ dcl_param_warn_err
Parameter warning.
Definition: dcl_error.h:60
dcl_param_range_err
@ dcl_param_range_err
Parameter range exceeded.
Definition: dcl_error.h:58
dcl_error_codes
dcl_error_codes
Defines the library enumerated error codes. These will be applied as bit masks in the error handler.
Definition: dcl_error.h:56
dcl_none
@ dcl_none
No error.
Definition: dcl_error.h:57
dcl_overflow_err
@ dcl_overflow_err
Numerical overflow.
Definition: dcl_error.h:62
dcl_timing_err
@ dcl_timing_err
Timing error.
Definition: dcl_error.h:65
dcl_param_invalid_err
@ dcl_param_invalid_err
Parameter not valid.
Definition: dcl_error.h:59
dcl_underflow_err
@ dcl_underflow_err
Numerical underflow
Definition: dcl_error.h:63
dcl_controller_err
@ dcl_controller_err
Controller operation not completed.
Definition: dcl_error.h:64
dcl_input_range_err
@ dcl_input_range_err
Input range exceeded.
Definition: dcl_error.h:61