Debian Codegraph @

xpp/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h

raw
1 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
2
3 File: oct6100_miscellaneous_priv.h
4
5 Copyright (c) 2001-2007 Octasic Inc.
6
7 Description:
8
9 File containing all private defines, macros, structures and prototypes
10 pertaining to the file oct6100_miscellaneous.c. All elements defined in
11 this file are for private usage of the API.
12
13 This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is
14 free software; you can redistribute it and/or modify it under the terms of
15 the GNU General Public License as published by the Free Software Foundation;
16 either version 2 of the License, or (at your option) any later version.
17
18 The OCT6100 GPL API is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with the OCT6100 GPL API; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26
27 $Octasic_Release: OCT612xAPI-01.00-PR49 $
28
29 $Octasic_Revision: 20 $
30
31 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
32
33 #ifndef __OCT6100_MISCELLANEOUS_PRIV_H__
34 #define __OCT6100_MISCELLANEOUS_PRIV_H__
35
36 /***************************** INCLUDE FILES *******************************/
37
38
39 /***************************** DEFINES *************************************/
40
41
42 /*---------------------------------------------------------------------------*\
43 Macros used to shell the user function calls. These macros are used to
44 assert that the user does not change any of the members of the function's
45 parameter structure, as required and indicated in the API specification.
46 Ofcourse, these macros make the code heavier and thus slower. That is why
47 there is a compile option for disabling the extra checking. These can be
48 very helpful tools in debugging.
49 \*---------------------------------------------------------------------------*/
50
51 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
52 #define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \
53 { \
54 PVOID _pProcessContext; \
55 UINT32 _ulUserChipId; \
56 UINT32 _ulWriteAddress; \
57 UINT16 _usWriteData; \
58 \
59 /* Store the data that is to be passed to the user. */ \
60 _pProcessContext = WriteParams.pProcessContext; \
61 _ulUserChipId = WriteParams.ulUserChipId; \
62 _ulWriteAddress = WriteParams.ulWriteAddress; \
63 _usWriteData = WriteParams.usWriteData; \
64 \
65 /* Call user function. */ \
66 ulResult = Oct6100UserDriverWriteApi( &WriteParams ); \
67 \
68 /* Check if user changed members of function's parameter structure. */ \
69 if ( WriteParams.pProcessContext != _pProcessContext || \
70 WriteParams.ulUserChipId != _ulUserChipId || \
71 WriteParams.ulWriteAddress != _ulWriteAddress || \
72 WriteParams.ulWriteAddress != _ulWriteAddress || \
73 WriteParams.usWriteData != _usWriteData ) \
74 ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_API; \
75 }
76 #else
77 #define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \
78 ulResult = Oct6100UserDriverWriteApi( &WriteParams );
79 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
80
81
82 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
83 #define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \
84 { \
85 PVOID _pProcessContext; \
86 UINT32 _ulUserChipId; \
87 UINT16 _usWriteData; \
88 UINT32 _ulWriteLength; \
89 \
90 /* Store the data that is to be passed to the user. */ \
91 _pProcessContext = SmearParams.pProcessContext; \
92 _ulUserChipId = SmearParams.ulUserChipId; \
93 _usWriteData = SmearParams.usWriteData; \
94 _ulWriteLength = SmearParams.ulWriteLength; \
95 \
96 /* Call user function. */ \
97 ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams ); \
98 \
99 /* Check if user changed members of function's paraeter structure. */ \
100 if ( SmearParams.pProcessContext != _pProcessContext || \
101 SmearParams.ulUserChipId != _ulUserChipId || \
102 SmearParams.usWriteData != _usWriteData || \
103 SmearParams.ulWriteLength != _ulWriteLength) \
104 ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_SMEAR_API; \
105 }
106 #else
107 #define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \
108 ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams );
109 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
110
111
112 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
113 #define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \
114 { \
115 PVOID _pProcessContext; \
116 UINT32 _ulUserChipId; \
117 UINT32 _ulWriteAddress; \
118 PUINT16 _pusWriteData; \
119 UINT32 _ulWriteLength; \
120 \
121 /* Store the data that is to be passed to the user. */ \
122 _pProcessContext = BurstParams.pProcessContext; \
123 _ulUserChipId = BurstParams.ulUserChipId; \
124 _ulWriteAddress = BurstParams.ulWriteAddress; \
125 _pusWriteData = BurstParams.pusWriteData; \
126 _ulWriteLength = BurstParams.ulWriteLength; \
127 \
128 /* Call user function. */ \
129 ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams ); \
130 \
131 /* Check if user changed members of function's parameter structure. */ \
132 if ( BurstParams.pProcessContext != _pProcessContext || \
133 BurstParams.ulUserChipId != _ulUserChipId || \
134 BurstParams.ulWriteAddress != _ulWriteAddress || \
135 BurstParams.pusWriteData != _pusWriteData || \
136 BurstParams.ulWriteLength != _ulWriteLength ) \
137 ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_BURST_API; \
138 }
139 #else
140 #define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \
141 ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams );
142 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
143
144
145 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
146 #define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \
147 { \
148 PVOID _pProcessContext; \
149 UINT32 _ulUserChipId; \
150 UINT32 _ulReadAddress; \
151 PUINT16 _pusReadData; \
152 \
153 /* Store the data that is to be passed to the user. */ \
154 _pProcessContext = ReadParams.pProcessContext; \
155 _ulUserChipId = ReadParams.ulUserChipId; \
156 _ulReadAddress = ReadParams.ulReadAddress; \
157 _pusReadData = ReadParams.pusReadData; \
158 \
159 /* Call user function. */ \
160 ulResult = Oct6100UserDriverReadApi( &ReadParams ); \
161 \
162 /* Check if user changed members of function's parameter structure. */ \
163 if ( ReadParams.pProcessContext != _pProcessContext || \
164 ReadParams.ulUserChipId != _ulUserChipId || \
165 ReadParams.ulReadAddress != _ulReadAddress || \
166 ReadParams.pusReadData != _pusReadData ) \
167 ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_API; \
168 }
169 #else
170 #define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \
171 ulResult = Oct6100UserDriverReadApi( &ReadParams );
172 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
173
174
175 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
176 #define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \
177 { \
178 PVOID _pProcessContext; \
179 UINT32 _ulUserChipId; \
180 UINT32 _ulReadAddress; \
181 PUINT16 _pusReadData; \
182 UINT32 _ulReadLength; \
183 \
184 /* Store the data that is to be passed to the user. */ \
185 _pProcessContext = BurstParams.pProcessContext; \
186 _ulUserChipId = BurstParams.ulUserChipId; \
187 _ulReadAddress = BurstParams.ulReadAddress; \
188 _pusReadData = BurstParams.pusReadData; \
189 _ulReadLength = BurstParams.ulReadLength; \
190 \
191 /* Call user function. */ \
192 ulResult = Oct6100UserDriverReadBurstApi( &BurstParams ); \
193 \
194 /* Check if user changed members of function's parameter structure. */ \
195 if ( BurstParams.pProcessContext != _pProcessContext || \
196 BurstParams.ulUserChipId != _ulUserChipId || \
197 BurstParams.ulReadAddress != _ulReadAddress || \
198 BurstParams.pusReadData != _pusReadData || \
199 BurstParams.ulReadLength != _ulReadLength ) \
200 ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_BURST_API; \
201 }
202 #else
203 #define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \
204 ulResult = Oct6100UserDriverReadBurstApi( &BurstParams );
205 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
206
207 #define mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, Params )
208
209 #define mOCT6100_CREATE_FEATURE_MASK( f_ulFieldSize, f_ulFieldBitOffset, f_pulFieldMask ) \
210 { \
211 (*f_pulFieldMask) = ( 1 << f_ulFieldSize ); \
212 (*f_pulFieldMask) --; \
213 (*f_pulFieldMask) <<= f_ulFieldBitOffset; \
214 }
215
216
217 /***************************** TYPES ***************************************/
218
219
220 /************************** FUNCTION PROTOTYPES *****************************/
221
222 UINT32 Oct6100ApiWaitForTime(
223 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
224 IN UINT32 f_aulWaitTime[ 2 ] );
225
226 UINT32 Oct6100ApiWaitForPcRegisterBit(
227 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
228 IN UINT32 f_ulPcRegAdd,
229 IN UINT32 f_ulPcBitNum,
230 IN UINT32 f_ulValue,
231 IN UINT32 f_ulTimeoutUs,
232 OUT PBOOL f_pfBitEqual );
233
234 UINT32 Oct6100ApiWriteDword(
235 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
236 IN UINT32 f_ulAddress,
237 IN UINT32 f_ulWriteData );
238
239 UINT32 Oct6100ApiReadDword(
240 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
241 IN UINT32 f_ulAddress,
242 OUT PUINT32 f_pulReadData );
243
244 VOID Oct6100ApiCreateFeatureMask(
245 IN UINT32 f_ulFieldSize,
246 IN UINT32 f_ulFieldBitOffset,
247 OUT PUINT32 f_pulFieldMask );
248
249 unsigned char const *Oct6100ApiStrStr(
250 IN unsigned char const *f_pszSource,
251 IN unsigned char const *f_pszString,
252 IN unsigned char const *f_pszLastCharPtr );
253
254 UINT32 Oct6100ApiStrLen(
255 IN unsigned char const *f_pszString );
256
257 UINT32 Oct6100ApiAsciiToHex(
258 IN UINT8 f_chCharacter,
259 IN PUINT32 f_pulValue );
260
261 UINT8 Oct6100ApiHexToAscii(
262 IN UINT32 f_ulNumber );
263
264 UINT32 Oct6100ApiRand(
265 IN UINT32 f_ulRange );
266
267 UINT32 oct6100_retrieve_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst,
268 tPOCT6100_API_CHANNEL f_pChanEntry,
269 UINT32 f_ulAddress,
270 UINT32 *f_pulConfigDword);
271
272 UINT32 oct6100_save_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst,
273 tPOCT6100_API_CHANNEL f_pChanEntry,
274 UINT32 f_ulAddress,
275 UINT32 f_ulConfigDword);
276
277 #endif /* __OCT6100_MISCELLANEOUS_PRIV_H__ */