OpenNSL API Guide and Reference Manual
Welcome
OpenNSL Documentation
API Reference
Files
File List
Globals
include
shared
error.h
Go to the documentation of this file.
1
/*********************************************************************
2
*
3
* (C) Copyright Broadcom Corporation 2013-2016
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
**********************************************************************
18
* File: error.h
19
* Details: This file defines common error codes to be shared
20
* between API layers.
21
*
22
* Its contents are not used directly by applications;
23
* it is used only by header files of parent APIs which
24
* need to define error codes.
25
*********************************************************************/
26
27
#ifndef _SHR_ERROR_H
28
#define _SHR_ERROR_H
29
30
typedef
enum
{
31
_SHR_E_NONE
= 0,
32
_SHR_E_INTERNAL
= -1,
33
_SHR_E_MEMORY
= -2,
34
_SHR_E_UNIT
= -3,
35
_SHR_E_PARAM
= -4,
36
_SHR_E_EMPTY
= -5,
37
_SHR_E_FULL
= -6,
38
_SHR_E_NOT_FOUND
= -7,
39
_SHR_E_EXISTS
= -8,
40
_SHR_E_TIMEOUT
= -9,
41
_SHR_E_BUSY
= -10,
42
_SHR_E_FAIL
= -11,
43
_SHR_E_DISABLED
= -12,
44
_SHR_E_BADID
= -13,
45
_SHR_E_RESOURCE
= -14,
46
_SHR_E_CONFIG
= -15,
47
_SHR_E_UNAVAIL
= -16,
48
_SHR_E_INIT
= -17,
49
_SHR_E_PORT
= -18,
50
51
_SHR_E_LIMIT
= -19
/* Must come last */
52
}
_shr_error_t
;
53
/* __doxy_func_body_end__ */
54
55
#define _SHR_ERRMSG_INIT { \
56
"Ok",
/* E_NONE */
\
57
"Internal error",
/* E_INTERNAL */
\
58
"Out of memory",
/* E_MEMORY */
\
59
"Invalid unit",
/* E_UNIT */
\
60
"Invalid parameter",
/* E_PARAM */
\
61
"Table empty",
/* E_EMPTY */
\
62
"Table full",
/* E_FULL */
\
63
"Entry not found",
/* E_NOT_FOUND */
\
64
"Entry exists",
/* E_EXISTS */
\
65
"Operation timed out",
/* E_TIMEOUT */
\
66
"Operation still running",
/* E_BUSY */
\
67
"Operation failed",
/* E_FAIL */
\
68
"Operation disabled",
/* E_DISABLED */
\
69
"Invalid identifier",
/* E_BADID */
\
70
"No resources for operation",
/* E_RESOURCE */
\
71
"Invalid configuration",
/* E_CONFIG */
\
72
"Feature unavailable",
/* E_UNAVAIL */
\
73
"Feature not initialized",
/* E_INIT */
\
74
"Invalid port",
/* E_PORT */
\
75
"Unknown error"
/* E_LIMIT */
\
76
}
77
/* __doxy_func_body_end__ */
78
79
extern
char
*
_shr_errmsg
[];
80
81
#define _SHR_ERRMSG(r) \
82
_shr_errmsg[(((int)r) <= 0 && ((int)r) > _SHR_E_LIMIT) ? -(r) : -_SHR_E_LIMIT]
83
84
#define _SHR_E_SUCCESS(rv) ((rv) >= 0)
85
#define _SHR_E_FAILURE(rv) ((rv) < 0)
86
87
#define _SHR_ERROR_TRACE(__errcode__)
88
#define _SHR_RETURN(__expr__) return (__expr__)
89
90
#define _SHR_E_IF_ERROR_RETURN(op) \
91
do { int __rv__; if ((__rv__ = (op)) < 0) { _SHR_ERROR_TRACE(__rv__); return(__rv__); } } while(0)
92
/* __doxy_func_body_end__ */
93
94
#define _SHR_E_IF_ERROR_CLEAN_RETURN(op,exop) \
95
do { int __rv__; if ((__rv__ = (op)) < 0) { _SHR_ERROR_TRACE(__rv__); (exop); return(__rv__); } } while(0)
96
/* __doxy_func_body_end__ */
97
98
#define _SHR_E_IF_ERROR_NOT_UNAVAIL_RETURN(op) \
99
do { \
100
int __rv__; \
101
if (((__rv__ = (op)) < 0) && (__rv__ != _SHR_E_UNAVAIL)) { \
102
return(__rv__); \
103
} \
104
} while(0)
105
/* __doxy_func_body_end__ */
106
107
108
typedef
enum
{
109
_SHR_SWITCH_EVENT_IO_ERROR
= 1,
110
_SHR_SWITCH_EVENT_PARITY_ERROR
= 2,
111
_SHR_SWITCH_EVENT_THREAD_ERROR
= 3,
112
_SHR_SWITCH_EVENT_ACCESS_ERROR
= 4,
113
_SHR_SWITCH_EVENT_ASSERT_ERROR
= 5,
114
_SHR_SWITCH_EVENT_MODID_CHANGE
= 6,
115
_SHR_SWITCH_EVENT_DOS_ATTACK
= 7,
116
_SHR_SWITCH_EVENT_STABLE_FULL
= 8,
117
_SHR_SWITCH_EVENT_STABLE_ERROR
= 9,
118
_SHR_SWITCH_EVENT_UNCONTROLLED_SHUTDOWN
= 10,
119
_SHR_SWITCH_EVENT_WARM_BOOT_DOWNGRADE
= 11,
120
_SHR_SWITCH_EVENT_TUNE_ERROR
= 12,
121
_SHR_SWITCH_EVENT_DEVICE_INTERRUPT
= 13,
122
_SHR_SWITCH_EVENT_ALARM
= 14,
123
_SHR_SWITCH_EVENT_MMU_BST_TRIGGER
= 15,
124
_SHR_SWITCH_EVENT_EPON_ALARM
= 16,
125
_SHR_SWITCH_EVENT_RUNT_DETECT
= 17,
126
_SHR_SWITCH_EVENT_AUTONEG_SPEED_ERROR
= 18,
127
_SHR_SWITCH_EVENT_COUNT
/* last, as always */
128
}
_shr_switch_event_t
;
129
/* __doxy_func_body_end__ */
130
131
#endif
/* !_SHR_ERROR_H */
© 2016-17 by Broadcom Limited. All rights reserved.