Debian Codegraph @

drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h

raw symbols SCIP
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 UINT32 _ulWriteAddress; \
88 UINT16 _usWriteData; \
89 UINT32 _ulWriteLength; \
90 \
91 /* Store the data that is to be passed to the user. */ \
92 _pProcessContext = SmearParams.pProcessContext; \
93 _ulUserChipId = SmearParams.ulUserChipId; \
94 _ulWriteAddress = SmearParams.ulWriteAddress; \
95 _usWriteData = SmearParams.usWriteData; \
96 _ulWriteLength = SmearParams.ulWriteLength; \
97 \
98 /* Call user function. */ \
99 ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams ); \
100 \
101 /* Check if user changed members of function's paraeter structure. */ \
102 if ( SmearParams.pProcessContext != _pProcessContext || \
103 SmearParams.ulUserChipId != _ulUserChipId || \
104 SmearParams.usWriteData != _usWriteData || \
105 SmearParams.ulWriteLength != _ulWriteLength) \
106 ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_SMEAR_API; \
107 }
108 #else
109 #define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \
110 ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams );
111 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
112
113
114 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
115 #define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \
116 { \
117 PVOID _pProcessContext; \
118 UINT32 _ulUserChipId; \
119 UINT32 _ulWriteAddress; \
120 PUINT16 _pusWriteData; \
121 UINT32 _ulWriteLength; \
122 \
123 /* Store the data that is to be passed to the user. */ \
124 _pProcessContext = BurstParams.pProcessContext; \
125 _ulUserChipId = BurstParams.ulUserChipId; \
126 _ulWriteAddress = BurstParams.ulWriteAddress; \
127 _pusWriteData = BurstParams.pusWriteData; \
128 _ulWriteLength = BurstParams.ulWriteLength; \
129 \
130 /* Call user function. */ \
131 ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams ); \
132 \
133 /* Check if user changed members of function's parameter structure. */ \
134 if ( BurstParams.pProcessContext != _pProcessContext || \
135 BurstParams.ulUserChipId != _ulUserChipId || \
136 BurstParams.ulWriteAddress != _ulWriteAddress || \
137 BurstParams.pusWriteData != _pusWriteData || \
138 BurstParams.ulWriteLength != _ulWriteLength ) \
139 ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_BURST_API; \
140 }
141 #else
142 #define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \
143 ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams );
144 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
145
146
147 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
148 #define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \
149 { \
150 PVOID _pProcessContext; \
151 UINT32 _ulUserChipId; \
152 UINT32 _ulReadAddress; \
153 PUINT16 _pusReadData; \
154 \
155 /* Store the data that is to be passed to the user. */ \
156 _pProcessContext = ReadParams.pProcessContext; \
157 _ulUserChipId = ReadParams.ulUserChipId; \
158 _ulReadAddress = ReadParams.ulReadAddress; \
159 _pusReadData = ReadParams.pusReadData; \
160 \
161 /* Call user function. */ \
162 ulResult = Oct6100UserDriverReadApi( &ReadParams ); \
163 \
164 /* Check if user changed members of function's parameter structure. */ \
165 if ( ReadParams.pProcessContext != _pProcessContext || \
166 ReadParams.ulUserChipId != _ulUserChipId || \
167 ReadParams.ulReadAddress != _ulReadAddress || \
168 ReadParams.pusReadData != _pusReadData ) \
169 ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_API; \
170 }
171 #else
172 #define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \
173 ulResult = Oct6100UserDriverReadApi( &ReadParams );
174 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
175
176
177 #ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
178 #define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \
179 { \
180 PVOID _pProcessContext; \
181 UINT32 _ulUserChipId; \
182 UINT32 _ulReadAddress; \
183 PUINT16 _pusReadData; \
184 UINT32 _ulReadLength; \
185 \
186 /* Store the data that is to be passed to the user. */ \
187 _pProcessContext = BurstParams.pProcessContext; \
188 _ulUserChipId = BurstParams.ulUserChipId; \
189 _ulReadAddress = BurstParams.ulReadAddress; \
190 _pusReadData = BurstParams.pusReadData; \
191 _ulReadLength = BurstParams.ulReadLength; \
192 \
193 /* Call user function. */ \
194 ulResult = Oct6100UserDriverReadBurstApi( &BurstParams ); \
195 \
196 /* Check if user changed members of function's parameter structure. */ \
197 if ( BurstParams.pProcessContext != _pProcessContext || \
198 BurstParams.ulUserChipId != _ulUserChipId || \
199 BurstParams.ulReadAddress != _ulReadAddress || \
200 BurstParams.pusReadData != _pusReadData || \
201 BurstParams.ulReadLength != _ulReadLength ) \
202 ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_BURST_API; \
203 }
204 #else
205 #define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \
206 ulResult = Oct6100UserDriverReadBurstApi( &BurstParams );
207 #endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
208
209 #define mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, Params )
210
211 #define mOCT6100_CREATE_FEATURE_MASK( f_ulFieldSize, f_ulFieldBitOffset, f_pulFieldMask ) \
212 { \
213 (*f_pulFieldMask) = ( 1 << f_ulFieldSize ); \
214 (*f_pulFieldMask) --; \
215 (*f_pulFieldMask) <<= f_ulFieldBitOffset; \
216 }
217
218
219 /***************************** TYPES ***************************************/
220
221
222 /************************** FUNCTION PROTOTYPES *****************************/
223
224 UINT32 Oct6100ApiWaitForTime(
225 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
226 IN UINT32 f_aulWaitTime[ 2 ] );
227
228 UINT32 Oct6100ApiWaitForPcRegisterBit(
229 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
230 IN UINT32 f_ulPcRegAdd,
231 IN UINT32 f_ulPcBitNum,
232 IN UINT32 f_ulValue,
233 IN UINT32 f_ulTimeoutUs,
234 OUT PBOOL f_pfBitEqual );
235
236 UINT32 Oct6100ApiWriteDword(
237 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
238 IN UINT32 f_ulAddress,
239 IN UINT32 f_ulWriteData );
240
241 UINT32 Oct6100ApiReadDword(
242 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
243 IN UINT32 f_ulAddress,
244 OUT PUINT32 f_pulReadData );
245
246 VOID Oct6100ApiCreateFeatureMask(
247 IN UINT32 f_ulFieldSize,
248 IN UINT32 f_ulFieldBitOffset,
249 OUT PUINT32 f_pulFieldMask );
250
251 unsigned char const *Oct6100ApiStrStr(
252 IN unsigned char const *f_pszSource,
253 IN unsigned char const *f_pszString,
254 IN unsigned char const *f_pszLastCharPtr );
255
256 UINT32 Oct6100ApiStrLen(
257 IN unsigned char const *f_pszString );
258
259 UINT32 Oct6100ApiAsciiToHex(
260 IN UINT8 f_chCharacter,
261 IN PUINT32 f_pulValue );
262
263 UINT8 Oct6100ApiHexToAscii(
264 IN UINT32 f_ulNumber );
265
266 UINT32 Oct6100ApiRand(
267 IN UINT32 f_ulRange );
268
269 UINT32 oct6100_retrieve_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst,
270 tPOCT6100_API_CHANNEL f_pChanEntry,
271 UINT32 f_ulAddress,
272 UINT32 *f_pulConfigDword);
273
274 UINT32 oct6100_save_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst,
275 tPOCT6100_API_CHANNEL f_pChanEntry,
276 UINT32 f_ulAddress,
277 UINT32 f_ulConfigDword);
278
279 #endif /* __OCT6100_MISCELLANEOUS_PRIV_H__ */