1
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3
File: oct6100_miscellaneous_priv.h
5
Copyright (c) 2001-2007 Octasic Inc.
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.
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.
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
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.
27
$Octasic_Release: OCT612xAPI-01.00-PR49 $
29
$Octasic_Revision: 20 $
31
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
33
#ifndef __OCT6100_MISCELLANEOUS_PRIV_H__
34
#define __OCT6100_MISCELLANEOUS_PRIV_H__
36
/***************************** INCLUDE FILES *******************************/
39
/***************************** DEFINES *************************************/
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
\*---------------------------------------------------------------------------*/
51
#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
52
#define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \
54
PVOID _pProcessContext; \
55
UINT32 _ulUserChipId; \
56
UINT32 _ulWriteAddress; \
57
UINT16 _usWriteData; \
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; \
65
/* Call user function. */ \
66
ulResult = Oct6100UserDriverWriteApi( &WriteParams ); \
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; \
77
#define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \
78
ulResult = Oct6100UserDriverWriteApi( &WriteParams );
79
#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
82
#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
83
#define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \
85
PVOID _pProcessContext; \
86
UINT32 _ulUserChipId; \
87
UINT32 _ulWriteAddress; \
88
UINT16 _usWriteData; \
89
UINT32 _ulWriteLength; \
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; \
98
/* Call user function. */ \
99
ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams ); \
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; \
109
#define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \
110
ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams );
111
#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
114
#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
115
#define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \
117
PVOID _pProcessContext; \
118
UINT32 _ulUserChipId; \
119
UINT32 _ulWriteAddress; \
120
PUINT16 _pusWriteData; \
121
UINT32 _ulWriteLength; \
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; \
130
/* Call user function. */ \
131
ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams ); \
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; \
142
#define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \
143
ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams );
144
#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
147
#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
148
#define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \
150
PVOID _pProcessContext; \
151
UINT32 _ulUserChipId; \
152
UINT32 _ulReadAddress; \
153
PUINT16 _pusReadData; \
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; \
161
/* Call user function. */ \
162
ulResult = Oct6100UserDriverReadApi( &ReadParams ); \
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; \
172
#define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \
173
ulResult = Oct6100UserDriverReadApi( &ReadParams );
174
#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
177
#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK
178
#define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \
180
PVOID _pProcessContext; \
181
UINT32 _ulUserChipId; \
182
UINT32 _ulReadAddress; \
183
PUINT16 _pusReadData; \
184
UINT32 _ulReadLength; \
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; \
193
/* Call user function. */ \
194
ulResult = Oct6100UserDriverReadBurstApi( &BurstParams ); \
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; \
205
#define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \
206
ulResult = Oct6100UserDriverReadBurstApi( &BurstParams );
207
#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */
209
#define mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, Params )
211
#define mOCT6100_CREATE_FEATURE_MASK( f_ulFieldSize, f_ulFieldBitOffset, f_pulFieldMask ) \
213
(*f_pulFieldMask) = ( 1 << f_ulFieldSize ); \
214
(*f_pulFieldMask) --; \
215
(*f_pulFieldMask) <<= f_ulFieldBitOffset; \
219
/***************************** TYPES ***************************************/
222
/************************** FUNCTION PROTOTYPES *****************************/
224
UINT32 Oct6100ApiWaitForTime(
225
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
226
IN UINT32 f_aulWaitTime[ 2 ] );
228
UINT32 Oct6100ApiWaitForPcRegisterBit(
229
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
230
IN UINT32 f_ulPcRegAdd,
231
IN UINT32 f_ulPcBitNum,
233
IN UINT32 f_ulTimeoutUs,
234
OUT PBOOL f_pfBitEqual );
236
UINT32 Oct6100ApiWriteDword(
237
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
238
IN UINT32 f_ulAddress,
239
IN UINT32 f_ulWriteData );
241
UINT32 Oct6100ApiReadDword(
242
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
243
IN UINT32 f_ulAddress,
244
OUT PUINT32 f_pulReadData );
246
VOID Oct6100ApiCreateFeatureMask(
247
IN UINT32 f_ulFieldSize,
248
IN UINT32 f_ulFieldBitOffset,
249
OUT PUINT32 f_pulFieldMask );
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 );
256
UINT32 Oct6100ApiStrLen(
257
IN unsigned char const *f_pszString );
259
UINT32 Oct6100ApiAsciiToHex(
260
IN UINT8 f_chCharacter,
261
IN PUINT32 f_pulValue );
263
UINT8 Oct6100ApiHexToAscii(
264
IN UINT32 f_ulNumber );
266
UINT32 Oct6100ApiRand(
267
IN UINT32 f_ulRange );
269
UINT32 oct6100_retrieve_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst,
270
tPOCT6100_API_CHANNEL f_pChanEntry,
272
UINT32 *f_pulConfigDword);
274
UINT32 oct6100_save_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst,
275
tPOCT6100_API_CHANNEL f_pChanEntry,
277
UINT32 f_ulConfigDword);
279
#endif /* __OCT6100_MISCELLANEOUS_PRIV_H__ */