OpenClovis Logo

clCommonErrors.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2012 OpenClovis Solutions Inc. All Rights Reserved.
3  *
4  * This file is available under a commercial license from the
5  * copyright holder or the GNU General Public License Version 2.0.
6  *
7  * The source code for this program is not published or otherwise
8  * divested of its trade secrets, irrespective of what has been
9  * deposited with the U.S. Copyright office.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * For more information, see the file COPYING provided with this
17  * material.
18  */
19 /*******************************************************************************
20  * ModuleName : include
21  * File : clCommonErrors.h
22  *******************************************************************************/
23 
24 /*******************************************************************************
25  * Description :
26  * This module contains common error codes shared across
27  * multiple Clovis ASP components, and macros to be used
28  * do handle error codes.
29  *
30  * Retrun codes are forumated combining a 16-bit component ID (CID) and a
31  * 16-bit error code. Common codes are listed above; component-specific
32  * error codes are defined in the respective components Errors.h file.
33  * The first 256 error codes are reserved for common errors, the remaining
34  * range (256-65535) are available for each component. The CIDs are defined
35  * in clCommon.h.
36  *
37  *
38  *****************************************************************************/
39 
52 #ifndef _CL_COMMON_ERRORS_H_
53 #define _CL_COMMON_ERRORS_H_
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 #include <clCommon.h>
60 
61 /******************************************************************************
62  * COMMON ERROR CODES
63  *****************************************************************************/
64 
68 #define CL_OK 0x00
69 
73 #define CL_ERR_NO_MEMORY 0x01
74 
78 #define CL_ERR_INVALID_PARAMETER 0x02
79 
83 #define CL_ERR_NULL_POINTER 0x03
84 
88 #define CL_ERR_NOT_EXIST 0x04
89 
93 #define CL_ERR_INVALID_HANDLE 0x05
94 
98 #define CL_ERR_INVALID_BUFFER 0x06
99 
103 #define CL_ERR_NOT_IMPLEMENTED 0x07
104 
108 #define CL_ERR_DUPLICATE 0x08
109 
113 #define CL_ERR_QUEUE_NOT_AVAILABLE 0x09
114 
118 #define CL_ERR_OUT_OF_RANGE 0x0a
119 
123 #define CL_ERR_NO_RESOURCE 0x0b
124 
128 #define CL_ERR_INITIALIZED 0x0c
129 
133 #define CL_ERR_BUFFER_OVERRUN 0x0d
134 
138 #define CL_ERR_NOT_INITIALIZED 0x0e
139 
143 #define CL_ERR_VERSION_MISMATCH 0x0f
144 
148 #define CL_ERR_ALREADY_EXIST 0x10
149 
153 #define CL_ERR_UNSPECIFIED 0x11
154 
158 #define CL_ERR_INVALID_STATE 0x12
159 
163 #define CL_ERR_DOESNT_EXIST 0x13
164 
168 #define CL_ERR_TIMEOUT 0x14
169 
173 #define CL_ERR_INUSE 0x15
174 
178 #define CL_ERR_TRY_AGAIN 0x16
179 
183 #define CL_ERR_NO_CALLBACK 0x17
184 
188 #define CL_ERR_MUTEX_ERROR 0x18
189 
193 #define CL_ERR_NO_OP 0x19
194 
198 #define CL_ERR_NAME_TOO_LONG 0x1a
199 
203 #define CL_ERR_NAME_NOT_FOUND 0x1b
204 
208 #define CL_ERR_MESSAGE_ERROR 0x1c
209 
213 #define CL_ERR_TOO_BIG 0x1d
214 
218 #define CL_ERR_NO_SECTIONS 0x1e
219 
223 #define CL_ERR_FAILED_OPERATION 0x1f
224 
228 #define CL_ERR_OP_NOT_PERMITTED 0x20
229 
233 #define CL_ERR_NO_SPACE 0x21
234 
238 #define CL_ERR_BAD_FLAG 0x22
239 
243 #define CL_ERR_BAD_OPERATION 0x23
244 
248 #define CL_ERR_LIBRARY 0x24
249 
253 #define CL_ERR_NOT_SUPPORTED 0x25
254 
258 #define CL_ERR_INTERRUPT 0x26
259 
260 #define CL_ERR_CONTINUE 0x27
261 
265 #define CL_ERR_COMMON_MAX 0xff
266 
267 /******************************************************************************
268  * ERROR/RETRUN CODE HANDLING MACROS
269  *****************************************************************************/
270 /*
271  * The following macros assist in constructing return codes,
272  * and in extracting the CID or the error code from the return code.
273  */
274 
278 #define CL_CID_OFFSET 16 /* 16 bit positions */
279 
283 #define CL_ERROR_CODE_MASK 0xffff /* 16 bits */
284 
289 #define CL_RC(CID, ERROR_CODE) ((ClUint32T) \
290  (((ERROR_CODE) == CL_OK) ? \
291  (ERROR_CODE) : \
292  ((ClUint32T) (((CID) << CL_CID_OFFSET) | \
293  ((ERROR_CODE) & CL_ERROR_CODE_MASK)))))
294 
297 #define CL_GET_ERROR_CODE(RC) ((ClUint32T) ((RC) & CL_ERROR_CODE_MASK))
298 
302 #define CL_GET_CID(RC) ((ClUint32T) ((RC) >> CL_CID_OFFSET))
303 
304 #ifdef __cplusplus
305 }
306 #endif
307 
312 #endif /* _CL_COMMON_ERRORS_H_ */

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen