~ubuntu-branches/ubuntu/quantal/zaptel/quantal

« back to all changes in this revision

Viewing changes to oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h

  • Committer: Bazaar Package Importer
  • Author(s): Tzafrir Cohen
  • Date: 2008-08-28 22:58:23 UTC
  • mfrom: (11.1.11 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080828225823-r8bdunirm8hmc76m
Tags: 1:1.4.11~dfsg-2
* Patch xpp_fxs_power: Fixed an issue with hook detection of the Astribank
  FXS module.
* Don't fail init.d script if fxotune fails. This may happen if running it
  when Asterisk is already running.
* Bump standards version to 3.8.0.0 .
* Ignore false lintian warning ("m-a a-i" has "a a").
* Patch xpp_fxo_cid_always: do always pass PCM if that's what the user
  asked.
* Patch vzaphfc_proc_root_dir: fix vzaphfc on 2.6.26.
* Patch wcte12xp_flags: Proper time for irq save flags.
* Patch headers_2627: Fix location of semaphore.h for 2.6.27 .
* Patch xpp_fxs_dtmf_leak: Don't play DTMFs to the wrong channel.
* Patch wctdm_fix_alarm: Fix sending channel alarms.
* Patch device_class_2626: Fix building 2.6.26 (Closes: #493397).
* Using dh_lintian for lintian overrides, hence requiring debhelper 6.0.7.
* Lintian: we know we have direct changes. Too bad we're half-upstream :-(
* Fix doc-base section names. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
2
 
 
3
 
File:  oct6100_miscellaneous_priv.h
4
 
 
5
 
    Copyright (c) 2001-2006 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-PR43 $
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
 
 
212
 
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
213
 
 
214
 
Function:               mOCT6100_RETRIEVE_NLP_CONF_DWORD
215
 
 
216
 
Description:    This function is used by the API to store on a per channel basis
217
 
                                the various confguration DWORD from the device. The API performs 
218
 
                                less read to the chip that way since it is always in synch 
219
 
                                with the chip.
220
 
 
221
 
-------------------------------------------------------------------------------
222
 
|       Argument                |       Description
223
 
-------------------------------------------------------------------------------
224
 
 
225
 
IN      f_pApiInst                              Pointer to API instance. This memory is used to keep
226
 
                                                        the present state of the chip and all its resources.
227
 
IN      f_pChanEntry                    Pointer to an API channel structure..
228
 
IN      f_ulAddress                             Address that needs to be modified..
229
 
IN      f_pulConfigDword                Pointer to the content stored in the API located at the
230
 
                                                        desired address.
231
 
 
232
 
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
233
 
#define mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_pulConfigDword, f_ulResult ) \
234
 
{                                                                                                                                                                                                                               \
235
 
        UINT32  _ulFirstEmptyIndex = 0xFFFFFFFF;                                                                                                                                        \
236
 
        UINT32  _i;                                                                                                                                                                                                     \
237
 
                                                                                                                                                                                                                                \
238
 
        f_ulResult = cOCT6100_ERR_FATAL_8E;                                                                                                                                                     \
239
 
        (*f_pulConfigDword) = cOCT6100_INVALID_VALUE;                                                                                                                           \
240
 
                                                                                                                                                                                                                                \
241
 
        /* Search for the Dword.*/                                                                                                                                                                      \
242
 
        for ( _i = 0; _i < cOCT6100_MAX_NLP_CONF_DWORD; _i++ )                                                                                                          \
243
 
        {                                                                                                                                                                                                                       \
244
 
                if ( ( _ulFirstEmptyIndex == 0xFFFFFFFF ) && ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == 0x0 ) )              \
245
 
                        _ulFirstEmptyIndex = _i;                                                                                                                                                        \
246
 
                                                                                                                                                                                                                                \
247
 
                if ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == f_ulAddress )                                                                                  \
248
 
                {                                                                                                                                                                                                               \
249
 
                        /* We found the matching Dword.*/                                                                                                                                       \
250
 
                        (*f_pulConfigDword) = f_pChanEntry->aulNlpConfDword[ _i ][ 1 ];                                                                         \
251
 
                        f_ulResult = cOCT6100_ERR_OK;                                                                                                                                           \
252
 
                }                                                                                                                                                                                                               \
253
 
        }                                                                                                                                                                                                                       \
254
 
                                                                                                                                                                                                                                \
255
 
        if ( ( _i == cOCT6100_MAX_NLP_CONF_DWORD ) && ( _ulFirstEmptyIndex == 0xFFFFFFFF ) )                                            \
256
 
        {                                                                                                                                                                                                                       \
257
 
                /* Nothing to do here, a fatal error occured, no memory was left. */                                                                    \
258
 
        }                                                                                                                                                                                                                       \
259
 
        else                                                                                                                                                                                                            \
260
 
        {                                                                                                                                                                                                                       \
261
 
                if ( f_ulResult != cOCT6100_ERR_OK )                                                                                                                                    \
262
 
                {                                                                                                                                                                                                               \
263
 
                        tOCT6100_READ_PARAMS    _ReadParams;                                                                                                                            \
264
 
                        UINT16                                  _usReadData;                                                                                                                            \
265
 
                                                                                                                                                                                                                                \
266
 
                        /* We did not found any entry, let's create a new entry.*/                                                                                      \
267
 
                        f_pChanEntry->aulNlpConfDword[ _ulFirstEmptyIndex ][ 0 ] = f_ulAddress;                                                         \
268
 
                                                                                                                                                                                                                                \
269
 
                        _ReadParams.pProcessContext = f_pApiInst->pProcessContext;                                                                                      \
270
 
                        mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, _ReadParams );                                                                         \
271
 
                        _ReadParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId;                                            \
272
 
                        _ReadParams.pusReadData = &_usReadData;                                                                                                                         \
273
 
                                                                                                                                                                                                                                \
274
 
                        /* Read the first 16 bits.*/                                                                                                                                            \
275
 
                        _ReadParams.ulReadAddress = f_ulAddress;                                                                                                                        \
276
 
                        mOCT6100_DRIVER_READ_API( _ReadParams, f_ulResult );                                                                                            \
277
 
                        if ( f_ulResult == cOCT6100_ERR_OK )                                                                                                                            \
278
 
                        {                                                                                                                                                                                                       \
279
 
                                /* Save data.*/                                                                                                                                                                 \
280
 
                                (*f_pulConfigDword) = _usReadData << 16;                                                                                                                \
281
 
                                                                                                                                                                                                                                \
282
 
                                /* Read the last 16 bits .*/                                                                                                                                    \
283
 
                                _ReadParams.ulReadAddress += 2;                                                                                                                                 \
284
 
                                mOCT6100_DRIVER_READ_API( _ReadParams, f_ulResult );                                                                                    \
285
 
                                if ( f_ulResult == cOCT6100_ERR_OK )                                                                                                                    \
286
 
                                {                                                                                                                                                                                               \
287
 
                                        /* Save data.*/                                                                                                                                                         \
288
 
                                        (*f_pulConfigDword) |= _usReadData;                                                                                                                     \
289
 
                                        f_ulResult = cOCT6100_ERR_OK;                                                                                                                           \
290
 
                                }                                                                                                                                                                                               \
291
 
                        }                                                                                                                                                                                                       \
292
 
                }                                                                                                                                                                                                               \
293
 
        }                                                                                                                                                                                                                       \
294
 
}
295
 
 
296
 
 
297
 
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
298
 
 
299
 
Function:               mOCT6100_SAVE_NLP_CONF_DWORD
300
 
 
301
 
Description:    This function stores a configuration Dword within an API channel
302
 
                                structure and then writes it into the chip.
303
 
 
304
 
-------------------------------------------------------------------------------
305
 
|       Argument                |       Description
306
 
-------------------------------------------------------------------------------
307
 
 
308
 
IN      f_pApiInst                              Pointer to API instance. This memory is used to keep
309
 
                                                        the present state of the chip and all its resources.
310
 
IN      f_pChanEntry                    Pointer to an API channel structure..
311
 
IN      f_ulAddress                             Address that needs to be modified..
312
 
IN      f_pulConfigDword                content to be stored in the API located at the
313
 
                                                        desired address.
314
 
 
315
 
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
316
 
#define mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_ulConfigDword, f_ulResult )      \
317
 
{                                                                                                                                                                                                                       \
318
 
        UINT32  _i;                                                                                                                                                                                             \
319
 
        UINT32  _ulLastValue = 0x0;                                                                                                                                                             \
320
 
                                                                                                                                                                                                                        \
321
 
        /* Search for the Dword.*/                                                                                                                                                              \
322
 
        for ( _i = 0; _i < cOCT6100_MAX_NLP_CONF_DWORD; _i++ )                                                                                                  \
323
 
        {                                                                                                                                                                                                               \
324
 
                if ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == f_ulAddress )                                                                          \
325
 
                {                                                                                                                                                                                                       \
326
 
                        /* We found the matching Dword.*/                                                                                                                               \
327
 
                        _ulLastValue = f_pChanEntry->aulNlpConfDword[ _i ][ 1 ];                                                                                \
328
 
                        f_pChanEntry->aulNlpConfDword[ _i ][ 1 ] = f_ulConfigDword;                                                                             \
329
 
                        break;                                                                                                                                                                                  \
330
 
                }                                                                                                                                                                                                       \
331
 
        }                                                                                                                                                                                                               \
332
 
                                                                                                                                                                                                                        \
333
 
        if ( _i == cOCT6100_MAX_NLP_CONF_DWORD )                                                                                                                                \
334
 
        {                                                                                                                                                                                                               \
335
 
                f_ulResult = cOCT6100_ERR_FATAL_8F;                                                                                                                                     \
336
 
        }                                                                                                                                                                                                               \
337
 
        else                                                                                                                                                                                                    \
338
 
        {                                                                                                                                                                                                               \
339
 
                /* Write the config DWORD. */                                                                                                                                           \
340
 
                tOCT6100_WRITE_PARAMS   _WriteParams;                                                                                                                           \
341
 
                                                                                                                                                                                                                        \
342
 
                _WriteParams.pProcessContext = f_pApiInst->pProcessContext;                                                                                     \
343
 
                mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, _WriteParams )                                                                         \
344
 
                _WriteParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId;                                           \
345
 
                                                                                                                                                                                                                        \
346
 
                        /* Check if it is worth calling the user function. */                                                                                   \
347
 
                if ( ( f_ulConfigDword & 0xFFFF0000 ) != ( _ulLastValue & 0xFFFF0000 ) )                                                        \
348
 
                {                                                                                                                                                                                                       \
349
 
                        /* Write the first 16 bits. */                                                                                                                                  \
350
 
                        _WriteParams.ulWriteAddress = f_ulAddress;                                                                                                              \
351
 
                        _WriteParams.usWriteData = (UINT16)((f_ulConfigDword >> 16) & 0xFFFF);                                                  \
352
 
                        mOCT6100_DRIVER_WRITE_API( _WriteParams, f_ulResult );                                                                                  \
353
 
                }                                                                                                                                                                                                       \
354
 
                else                                                                                                                                                                                            \
355
 
                {                                                                                                                                                                                                       \
356
 
                        f_ulResult = cOCT6100_ERR_OK;                                                                                                                                   \
357
 
                }                                                                                                                                                                                                       \
358
 
                                                                                                                                                                                                                        \
359
 
                if ( f_ulResult == cOCT6100_ERR_OK )                                                                                                                            \
360
 
                {                                                                                                                                                                                                       \
361
 
                        if ( ( f_ulConfigDword & 0x0000FFFF ) != ( _ulLastValue & 0x0000FFFF ) )                                                \
362
 
                        {                                                                                                                                                                                               \
363
 
                                /* Write the last word. */                                                                                                                                      \
364
 
                                _WriteParams.ulWriteAddress = f_ulAddress + 2;                                                                                          \
365
 
                                _WriteParams.usWriteData = (UINT16)(f_ulConfigDword & 0xFFFF);                                                          \
366
 
                                mOCT6100_DRIVER_WRITE_API( _WriteParams, f_ulResult );                                                                          \
367
 
                        }                                                                                                                                                                                               \
368
 
                }                                                                                                                                                                                                       \
369
 
        }                                                                                                                                                                                                               \
370
 
}
371
 
 
372
 
 
373
 
#define mOCT6100_CREATE_FEATURE_MASK( f_ulFieldSize, f_ulFieldBitOffset, f_pulFieldMask )                                       \
374
 
{                                                                                                                                                                                                                       \
375
 
        (*f_pulFieldMask) = ( 1 << f_ulFieldSize );                                                                                                                             \
376
 
        (*f_pulFieldMask) --;                                                                                                                                                                   \
377
 
        (*f_pulFieldMask) <<= f_ulFieldBitOffset;                                                                                                                               \
378
 
}
379
 
 
380
 
 
381
 
/*****************************  TYPES  ***************************************/
382
 
 
383
 
 
384
 
/************************** FUNCTION PROTOTYPES  *****************************/
385
 
 
386
 
UINT32 Oct6100ApiWaitForTime(
387
 
                                IN OUT  tPOCT6100_INSTANCE_API          f_pApiInstance,
388
 
                                IN              UINT32                                          f_aulWaitTime[ 2 ] );
389
 
 
390
 
UINT32 Oct6100ApiWaitForPcRegisterBit(
391
 
                                IN OUT  tPOCT6100_INSTANCE_API          f_pApiInstance,
392
 
                                IN              UINT32                                          f_ulPcRegAdd,
393
 
                                IN              UINT32                                          f_ulPcBitNum,
394
 
                                IN              UINT32                                          f_ulValue,
395
 
                                IN              UINT32                                          f_ulTimeoutUs,
396
 
                                OUT             PBOOL                                           f_pfBitEqual );
397
 
 
398
 
UINT32 Oct6100ApiWriteDword( 
399
 
                                IN OUT  tPOCT6100_INSTANCE_API          f_pApiInstance,
400
 
                                IN              UINT32                                          f_ulAddress,
401
 
                                IN              UINT32                                          f_ulWriteData );
402
 
 
403
 
UINT32 Oct6100ApiReadDword( 
404
 
                                IN OUT  tPOCT6100_INSTANCE_API          f_pApiInstance,
405
 
                                IN              UINT32                                          f_ulAddress,
406
 
                                OUT             PUINT32                                         f_pulReadData );
407
 
 
408
 
VOID Oct6100ApiCreateFeatureMask( 
409
 
                                IN              UINT32                                          f_ulFieldSize,
410
 
                                IN              UINT32                                          f_ulFieldBitOffset,
411
 
                                OUT             PUINT32                                         f_pulFieldMask );
412
 
 
413
 
PUINT8 Oct6100ApiStrStr( 
414
 
                                IN              PUINT8                                          f_pszSource, 
415
 
                                IN              PUINT8                                          f_pszString, 
416
 
                                IN              PUINT8                                          f_pszLastCharPtr );
417
 
 
418
 
UINT32 Oct6100ApiStrLen( 
419
 
                                IN              PUINT8                                          f_pszString );
420
 
 
421
 
UINT32 Oct6100ApiAsciiToHex( 
422
 
                                IN              UINT8                                           f_chCharacter, 
423
 
                                IN              PUINT32                                         f_pulValue );
424
 
 
425
 
UINT8 Oct6100ApiHexToAscii( 
426
 
                                IN              UINT32                                          f_ulNumber );
427
 
 
428
 
UINT32 Oct6100ApiRand( 
429
 
                                IN              UINT32                                          f_ulRange );
430
 
 
431
 
#endif /* __OCT6100_MISCELLANEOUS_PRIV_H__ */