summaryrefslogtreecommitdiff
path: root/drivers/misc/gpsip/cgdriver/CgReturnCodes.h
blob: 470e9ca04f44a5045cdf327edd8f00ca39e45540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/******************************************************************************
 *                                LEGAL NOTICE                                *
 *                                                                            *
 *  USE OF THIS SOFTWARE (including any copy or compiled version thereof) AND *
 *  DOCUMENTATION IS SUBJECT TO THE SOFTWARE LICENSE AND RESTRICTIONS AND THE *
 *  WARRANTY DISLCAIMER SET FORTH IN LEGAL_NOTICE.TXT FILE. IF YOU DO NOT     *
 *  FULLY ACCEPT THE TERMS, YOU MAY NOT INSTALL OR OTHERWISE USE THE SOFTWARE *
 *  OR DOCUMENTATION.                                                         *
 *  NOTWITHSTANDING ANYTHING TO THE CONTRARY IN THIS NOTICE, INSTALLING OR    *
 *  OTHERISE USING THE SOFTWARE OR DOCUMENTATION INDICATES YOUR ACCEPTANCE OF *
 *  THE LICENSE TERMS AS STATED.                                              *
 *                                                                            *
 ******************************************************************************/
/* Version: 1.8.9\3686 */
/* Build  : 13 */
/* Date   : 12/08/2012 */
/**
	\file
	\brief Cell-Guide common return codes
	\attention This file should not be modified.
		If you think something is wrong here, please contact CellGuide

	This file define the infrastructure and common error codes for cell-guide projects
 */
#ifndef CG_RETURN_CODES_H
#define CG_RETURN_CODES_H

#ifdef __cplusplus
extern "C" {
#endif

#include "CgTypes.h"						/**< CellGuide Types */

#define CG_RETURN_CODE_SUB_RANGE         (0x400)
#define RANGE_MASK ~(CG_RETURN_CODE_SUB_RANGE-1)

#define ECgCommonErrorBase               (0)
#define ECgPrivateErrorBase              (-1 * CG_RETURN_CODE_SUB_RANGE)
#define ECgPrivateMsgBase                (+1 * CG_RETURN_CODE_SUB_RANGE)


/* System-wide positives */

/** OK status */
#define ECgOk                            (0)
#define ECgProgressNotification          ( ECgCommonErrorBase + 1 )

/* System-wide errors */
#define ECgBadArgument                   	( ECgCommonErrorBase - 1 )
#define ECgNotSupported                  	( ECgCommonErrorBase - 2 )
#define ECgGeneralFailure                	( ECgCommonErrorBase - 3 )
#define ECgInitFailure                   	( ECgCommonErrorBase - 4 )
#define ECgErrMemory                     	( ECgCommonErrorBase - 5 )
#define ECgErrGeneral                    	( ECgCommonErrorBase - 6 )
#define ECgErrNotInitialized             	( ECgCommonErrorBase - 7 )
#define ECgOutOfBounds                   	( ECgCommonErrorBase - 8 )
#define ECgDataNotFound                  	( ECgCommonErrorBase - 9 )
#define ECgPermissionDenied              	( ECgCommonErrorBase - 10 )
#define ECgNullPointer                   	( ECgCommonErrorBase - 11 )
#define ECgFileOpen                      	( ECgCommonErrorBase - 12 )
#define ECgFileRead                      	( ECgCommonErrorBase - 13 )
#define ECgFileChecksum                  	( ECgCommonErrorBase - 14 )
#define ECgTimeout                       	( ECgCommonErrorBase - 15 )
#define ECgTimeNotValid                  	( ECgCommonErrorBase - 16 )
#define ECgEndOfFile                     	( ECgCommonErrorBase - 17 )
#define ECgInvalidCharacter              	( ECgCommonErrorBase - 18 )
#define ECgFatalError                    	( ECgCommonErrorBase - 19 )
#define ECgBadConfiguration              	( ECgCommonErrorBase - 20 )
#define ECgReadOnlyProperty              	( ECgCommonErrorBase - 21 )
#define ECgExitModeFlag      	         	( ECgCommonErrorBase - 22 )
#define ECgFatalInternalError  	         	( ECgCommonErrorBase - 23 )


#define ECgPropertiesMissingLevel        	( ECgCommonErrorBase - 24 )
#define ECgPropertiesMissingGetMethod    	( ECgCommonErrorBase - 25 )

#define ECgNotAllowed				     	( ECgCommonErrorBase - 26 )

#define ECgDataNotValid 				 	( ECgCommonErrorBase - 27 )
#define ECgDataNotEqual 				 	( ECgCommonErrorBase - 28 )

#define	ECgDataNotAvailable		         	( ECgCommonErrorBase - 30 )
#define	ECgFileNotFound			         	( ECgCommonErrorBase - 31 )
#define	ECgPathNotFound			         	( ECgCommonErrorBase - 32 )
#define ECgNoMoreFiles				     	( ECgCommonErrorBase - 33 )
#define ECgNoMoreSlots					 	( ECgCommonErrorBase - 34 )
#define ECgInvalidData					 	( ECgCommonErrorBase - 35 )
#define ECgPathExists                    	( ECgCommonErrorBase - 36 )
#define ECgNotEnoughData                 	( ECgCommonErrorBase - 37 )
#define ECgBusy                          	( ECgCommonErrorBase - 38 )
#define ECgAnyErrCode                    	( ECgCommonErrorBase - 39 )

#define ECgNetworkNotInitialized		 	( ECgCommonErrorBase - 40 )
#define ECgNetworkSubsysFailed			 	( ECgCommonErrorBase - 41 )
#define ECgNetworkPortInUse				 	( ECgCommonErrorBase - 42 )
#define ECgNetworkInvalidAddress		 	( ECgCommonErrorBase - 43 )
#define ECgNetworkPortAlreadyInUse		 	( ECgCommonErrorBase - 44 )
#define ECgNetworkTooManyConnections	 	( ECgCommonErrorBase - 45 )
#define ECgInvalidFileName				 	( ECgCommonErrorBase - 46 )
#define ECgDeviceOpenFail				 	( ECgCommonErrorBase - 47 )
#define ECgDataOverrun				     	( ECgCommonErrorBase - 48 )
#define ECgNetworkInvalidPort			 	( ECgCommonErrorBase - 49 )
#define ECgNetworkSocketNotConnected	 	( ECgCommonErrorBase - 50 )

#define ECgResume						 	( ECgCommonErrorBase - 61 )
#define ECgPowerOff							( ECgCommonErrorBase - 62 )

#define ECgGreater						 	( ECgCommonErrorBase - 100 )
#define ECgSmaller						 	( ECgCommonErrorBase - 101 )

#define ECgTerminate					 	( ECgCommonErrorBase - 102 )
#define ECgNotOwner						 	( ECgCommonErrorBase - 103 )
#define ECgCanceled						 	( ECgCommonErrorBase - 104 )

#define ECgIoPending					 	( ECgCommonErrorBase - 105 )
#define ECgSingularMatrix                	( ECgCommonErrorBase - 106 )

#define ECgIntegerOverFlow				 	( ECgCommonErrorBase - 107 )
#define EcgInSufficientWorkPadSize		 	( ECgCommonErrorBase - 108 )
#define ECgSatelliteOverflow             	( ECgCommonErrorBase - 109 )
#define ECgLastItem						 	( ECgCommonErrorBase - 110 )


typedef S32 TCgReturnCode;


//#if (CG_USE_MAX_LOG_LEVEL >= CGLOG_FATAL)
//#ifdef CG_LOG_H	// CG_LOG_H_USED indicates CgLog.h is included in the compilation
#ifndef CGXDRIVER_EXPORTS
	#ifdef CGTEST
		#define CG_STORE_ERROR_LINE
	#elif defined DEBUG
		#define CG_STORE_ERROR_LINE
	#elif defined _DEBUG
		#define CG_STORE_ERROR_LINE
	#endif
#endif

#ifdef CG_STORE_ERROR_LINE
	#undef CG_STORE_ERROR_LINE
#endif

//#endif
//#endif

BOOL cgRetCode_store_error_line(const char * aFileName, long lineNumber, TCgReturnCode rc);
BOOL cglog_wrn_file_and_line(const char * aFileName, long aLineNumber, long rc);

#ifdef CG_STORE_ERROR_LINE
	#define OK(rc) (rc >= ECgOk ? TRUE : cgRetCode_store_error_line(__FILE__,__LINE__,rc))
	#define FAIL(rc) (rc < ECgOk ? !cgRetCode_store_error_line(__FILE__,__LINE__,rc) : FALSE)
	//#define OK(rc) (rc >= ECgOk ? TRUE : cglog_wrn_file_and_line(__FILE__,__LINE__,rc))
	//#define FAIL(rc) (rc < ECgOk ? !cglog_wrn_file_and_line(__FILE__,__LINE__,rc) : FALSE)
#else
	#define OK(rc) (rc >= ECgOk)
	#define FAIL(rc) (rc < ECgOk)
#endif

#define SELECT_FIRST_ERROR2(rc1,rc2)			(rc1 == ECgOk) ? rc2 : rc1
#define SELECT_FIRST_ERROR3(rc1,rc2,rc3)		SELECT_FIRST_ERROR2((SELECT_FIRST_ERROR2(rc1,rc2)),rc3)
#define SELECT_FIRST_ERROR4(rc1,rc2,rc3,rc4)	SELECT_FIRST_ERROR2((SELECT_FIRST_ERROR3(rc1,rc2,rc3)),rc4)
#define SELECT_FIRST_ERROR5(rc1,rc2,rc3,rc4,rc5)SELECT_FIRST_ERROR2((SELECT_FIRST_ERROR4(rc1,rc2,rc3,rc4)),rc5)

// 0 indicates no error. index starts at 1.
#define INDEX_FIRST_ERROR2(rc1,rc2)			((rc1 == ECgOk) ? ((rc2 == ECgOk) ? 0 : 2) : 1)
#define INDEX_FIRST_ERROR3(rc1,rc2,rc3)		((rc3 == ECgOk) ? INDEX_FIRST_ERROR2(rc1,rc2) : 3)

#ifdef __cplusplus
}
#endif

#endif // CG_RETURN_CODES_H