Debian Codegraph @

xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c

raw
1 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
2
3 File: oct6100_conf_bridge.c
4
5 Copyright (c) 2001-2007 Octasic Inc.
6
7 Description:
8
9 This file contains all functions related to a conference bridge. Procedures
10 needed to open/close a bridge, add/remove a participant to a conference
11 bridge, mute/unmute a participant, etc.. are all present in this source
12 file.
13
14 This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is
15 free software; you can redistribute it and/or modify it under the terms of
16 the GNU General Public License as published by the Free Software Foundation;
17 either version 2 of the License, or (at your option) any later version.
18
19 The OCT6100 GPL API is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with the OCT6100 GPL API; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27
28 $Octasic_Release: OCT612xAPI-01.00-PR49 $
29
30 $Octasic_Revision: 146 $
31
32 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
33
34
35 /***************************** INCLUDE FILES *******************************/
36
37 #include "octdef.h"
38
39 #include "oct6100api/oct6100_defines.h"
40 #include "oct6100api/oct6100_errors.h"
41 #include "oct6100api/oct6100_apiud.h"
42
43 #include "apilib/octapi_llman.h"
44
45 #include "oct6100api/oct6100_tlv_inst.h"
46 #include "oct6100api/oct6100_chip_open_inst.h"
47 #include "oct6100api/oct6100_chip_stats_inst.h"
48 #include "oct6100api/oct6100_interrupts_inst.h"
49 #include "oct6100api/oct6100_remote_debug_inst.h"
50 #include "oct6100api/oct6100_debug_inst.h"
51 #include "oct6100api/oct6100_api_inst.h"
52 #include "oct6100api/oct6100_channel_inst.h"
53 #include "oct6100api/oct6100_mixer_inst.h"
54 #include "oct6100api/oct6100_conf_bridge_inst.h"
55
56 #include "oct6100api/oct6100_interrupts_pub.h"
57 #include "oct6100api/oct6100_chip_open_pub.h"
58 #include "oct6100api/oct6100_channel_pub.h"
59 #include "oct6100api/oct6100_mixer_pub.h"
60 #include "oct6100api/oct6100_conf_bridge_pub.h"
61
62 #include "oct6100_chip_open_priv.h"
63 #include "oct6100_miscellaneous_priv.h"
64 #include "oct6100_memory_priv.h"
65 #include "oct6100_tsst_priv.h"
66 #include "oct6100_channel_priv.h"
67 #include "oct6100_mixer_priv.h"
68 #include "oct6100_conf_bridge_priv.h"
69
70
71 /**************************** PUBLIC FUNCTIONS *****************************/
72
73
74 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
75
76 Function: Oct6100ConfBridgeOpen
77
78 Description: This function opens a conference bridge.
79
80 -------------------------------------------------------------------------------
81 | Argument | Description
82 -------------------------------------------------------------------------------
83 f_pApiInstance Pointer to API instance. This memory is used to keep the
84 present state of the chip and all its resources.
85
86 f_pConfBridgeOpen Pointer to conference bridge open structure.
87
88 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
89 #if !SKIP_Oct6100ConfBridgeOpenDef
90 UINT32 Oct6100ConfBridgeOpenDef(
91 tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen )
92 {
93 f_pConfBridgeOpen->pulConfBridgeHndl = NULL;
94 f_pConfBridgeOpen->fFlexibleConferencing = FALSE;
95
96 return cOCT6100_ERR_OK;
97 }
98 #endif
99
100
101 #if !SKIP_Oct6100ConfBridgeOpen
102 UINT32 Oct6100ConfBridgeOpen(
103 tPOCT6100_INSTANCE_API f_pApiInstance,
104 tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen )
105 {
106 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
107 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
108 UINT32 ulSerRes = cOCT6100_ERR_OK;
109 UINT32 ulFncRes = cOCT6100_ERR_OK;
110
111 /* Set the process context of the serialize structure.*/
112 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
113 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
114
115 /* Seize all list semaphores needed by this function. */
116 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
117 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
118 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
119 if ( ulSerRes == cOCT6100_ERR_OK )
120 {
121 /* Call the serialized function. */
122 ulFncRes = Oct6100ConfBridgeOpenSer( f_pApiInstance, f_pConfBridgeOpen );
123 }
124 else
125 {
126 return ulSerRes;
127 }
128
129 /* Release the seized semaphores. */
130 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
131 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
132
133 /* If an error occured then return the error code. */
134 if ( ulSerRes != cOCT6100_ERR_OK )
135 return ulSerRes;
136 if ( ulFncRes != cOCT6100_ERR_OK )
137 return ulFncRes;
138
139 return cOCT6100_ERR_OK;
140 }
141 #endif
142
143
144 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
145
146 Function: Oct6100ConfBridgeClose
147
148 Description: This function closes a conference bridge. A conference
149 bridge can only be closed if no participants are present on
150 the bridge.
151
152 -------------------------------------------------------------------------------
153 | Argument | Description
154 -------------------------------------------------------------------------------
155 f_pApiInstance Pointer to API instance. This memory is used to keep the
156 present state of the chip and all its resources.
157
158 f_pConfBridgeClose Pointer to conference bridge close structure.
159
160 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
161 #if !SKIP_Oct6100ConfBridgeCloseDef
162 UINT32 Oct6100ConfBridgeCloseDef(
163 tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose )
164 {
165 f_pConfBridgeClose->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE;
166
167 return cOCT6100_ERR_OK;
168 }
169 #endif
170
171
172 #if !SKIP_Oct6100ConfBridgeClose
173 UINT32 Oct6100ConfBridgeClose(
174 tPOCT6100_INSTANCE_API f_pApiInstance,
175 tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose )
176 {
177 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
178 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
179 UINT32 ulSerRes = cOCT6100_ERR_OK;
180 UINT32 ulFncRes = cOCT6100_ERR_OK;
181
182 /* Set the process context of the serialize structure. */
183 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
184 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
185
186 /* Seize all list semaphores needed by this function. */
187 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
188 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
189 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
190 if ( ulSerRes == cOCT6100_ERR_OK )
191 {
192 /* Call the serialized function. */
193 ulFncRes = Oct6100ConfBridgeCloseSer( f_pApiInstance, f_pConfBridgeClose );
194 }
195 else
196 {
197 return ulSerRes;
198 }
199
200 /* Release the seized semaphores. */
201 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
202 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
203
204 /* If an error occured then return the error code. */
205 if ( ulSerRes != cOCT6100_ERR_OK )
206 return ulSerRes;
207 if ( ulFncRes != cOCT6100_ERR_OK )
208 return ulFncRes;
209
210 return cOCT6100_ERR_OK;
211 }
212 #endif
213
214
215 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
216
217 Function: Oct6100ConfBridgeChanAdd
218
219 Description: This function adds an echo channel (participant) to a
220 conference bridge.
221
222 -------------------------------------------------------------------------------
223 | Argument | Description
224 -------------------------------------------------------------------------------
225 f_pApiInstance Pointer to API instance. This memory is used to keep the
226 present state of the chip and all its resources.
227
228 f_pConfBridgeAdd Pointer to conference bridge channel addition structure.
229
230 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
231 #if !SKIP_Oct6100ConfBridgeChanAddDef
232 UINT32 Oct6100ConfBridgeChanAddDef(
233 tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd )
234 {
235 f_pConfBridgeAdd->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE;
236 f_pConfBridgeAdd->ulChannelHndl = cOCT6100_INVALID_HANDLE;
237 f_pConfBridgeAdd->ulInputPort = cOCT6100_CHANNEL_PORT_SOUT;
238 f_pConfBridgeAdd->ulListenerMaskIndex = cOCT6100_INVALID_VALUE;
239 f_pConfBridgeAdd->ulListenerMask = 0;
240 f_pConfBridgeAdd->fMute = FALSE;
241 f_pConfBridgeAdd->ulTappedChannelHndl = cOCT6100_INVALID_HANDLE;
242
243 return cOCT6100_ERR_OK;
244 }
245 #endif
246
247
248 #if !SKIP_Oct6100ConfBridgeChanAdd
249 UINT32 Oct6100ConfBridgeChanAdd(
250 tPOCT6100_INSTANCE_API f_pApiInstance,
251 tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd )
252 {
253 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
254 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
255 UINT32 ulSerRes = cOCT6100_ERR_OK;
256 UINT32 ulFncRes = cOCT6100_ERR_OK;
257
258 /* Set the process context of the serialize structure. */
259 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
260 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
261
262 /* Seize all list semaphores needed by this function. */
263 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
264 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
265 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
266 if ( ulSerRes == cOCT6100_ERR_OK )
267 {
268 /* Call the serialized function. */
269 ulFncRes = Oct6100ConfBridgeChanAddSer( f_pApiInstance, f_pConfBridgeAdd );
270 }
271 else
272 {
273 return ulSerRes;
274 }
275
276 /* Release the seized semaphores. */
277 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
278 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
279
280 /* If an error occured then return the error code. */
281 if ( ulSerRes != cOCT6100_ERR_OK )
282 return ulSerRes;
283 if ( ulFncRes != cOCT6100_ERR_OK )
284 return ulFncRes;
285
286 return cOCT6100_ERR_OK;
287 }
288 #endif
289
290
291 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
292
293 Function: Oct6100ConfBridgeChanRemove
294
295 Description: This function removes an echo channel (participant) from a
296 conference bridge. All participants can be removed from
297 the bridge if a special flag (fRemoveAll) is set to TRUE.
298
299 -------------------------------------------------------------------------------
300 | Argument | Description
301 -------------------------------------------------------------------------------
302 f_pApiInstance Pointer to API instance. This memory is used to keep the
303 present state of the chip and all its resources.
304
305 f_pConfBridgeRemove Pointer to conference bridge channel removal structure.
306
307 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
308 #if !SKIP_Oct6100ConfBridgeChanRemoveDef
309 UINT32 Oct6100ConfBridgeChanRemoveDef(
310 tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove )
311 {
312 f_pConfBridgeRemove->ulChannelHndl = cOCT6100_INVALID_HANDLE;
313 f_pConfBridgeRemove->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE;
314 f_pConfBridgeRemove->fRemoveAll = FALSE;
315
316 return cOCT6100_ERR_OK;
317 }
318 #endif
319
320
321 #if !SKIP_Oct6100ConfBridgeChanRemove
322 UINT32 Oct6100ConfBridgeChanRemove(
323 tPOCT6100_INSTANCE_API f_pApiInstance,
324 tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove )
325 {
326 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
327 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
328 UINT32 ulSerRes = cOCT6100_ERR_OK;
329 UINT32 ulFncRes = cOCT6100_ERR_OK;
330
331 /* Set the process context of the serialize structure.*/
332 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
333 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
334
335 /* Seize all list semaphores needed by this function. */
336 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
337 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
338 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
339 if ( ulSerRes == cOCT6100_ERR_OK )
340 {
341 /* Call the serialized function. */
342 ulFncRes = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, f_pConfBridgeRemove );
343 }
344 else
345 {
346 return ulSerRes;
347 }
348
349 /* Release the seized semaphores. */
350 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
351 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
352
353 /* If an error occured then return the error code. */
354 if ( ulSerRes != cOCT6100_ERR_OK )
355 return ulSerRes;
356 if ( ulFncRes != cOCT6100_ERR_OK )
357 return ulFncRes;
358
359 return cOCT6100_ERR_OK;
360 }
361 #endif
362
363
364 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
365
366 Function: Oct6100ConfBridgeChanMute
367
368 Description: This function mutes a participant present on a conference bridge.
369
370 -------------------------------------------------------------------------------
371 | Argument | Description
372 -------------------------------------------------------------------------------
373 f_pApiInstance Pointer to API instance. This memory is used to keep the
374 present state of the chip and all its resources.
375
376 f_pConfBridgeMute Pointer to conference bridge channel mute structure.
377
378 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
379 #if !SKIP_Oct6100ConfBridgeChanMuteDef
380 UINT32 Oct6100ConfBridgeChanMuteDef(
381 tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute )
382 {
383 f_pConfBridgeMute->ulChannelHndl = cOCT6100_INVALID_HANDLE;
384
385 return cOCT6100_ERR_OK;
386 }
387 #endif
388
389
390 #if !SKIP_Oct6100ConfBridgeChanMute
391 UINT32 Oct6100ConfBridgeChanMute(
392 tPOCT6100_INSTANCE_API f_pApiInstance,
393 tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute )
394 {
395 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
396 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
397 UINT32 ulSerRes = cOCT6100_ERR_OK;
398 UINT32 ulFncRes = cOCT6100_ERR_OK;
399
400 /* Set the process context of the serialize structure. */
401 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
402 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
403
404 /* Seize all list semaphores needed by this function. */
405 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
406 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
407 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
408 if ( ulSerRes == cOCT6100_ERR_OK )
409 {
410 /* Call the serialized function. */
411 ulFncRes = Oct6100ConfBridgeChanMuteSer( f_pApiInstance, f_pConfBridgeMute );
412 }
413 else
414 {
415 return ulSerRes;
416 }
417
418 /* Release the seized semaphores. */
419 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
420 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
421
422 /* If an error occured then return the error code. */
423 if ( ulSerRes != cOCT6100_ERR_OK )
424 return ulSerRes;
425 if ( ulFncRes != cOCT6100_ERR_OK )
426 return ulFncRes;
427
428 return cOCT6100_ERR_OK;
429 }
430 #endif
431
432
433 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
434
435 Function: Oct6100ConfBridgeChanUnMute
436
437 Description: This function unmutes a channel on a bridge. The other member
438 of the conference will start to hear this participant again.
439
440 -------------------------------------------------------------------------------
441 | Argument | Description
442 -------------------------------------------------------------------------------
443 f_pApiInstance Pointer to API instance. This memory is used to keep the
444 present state of the chip and all its resources.
445
446 f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure.
447
448 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
449 #if !SKIP_Oct6100ConfBridgeChanUnMuteDef
450 UINT32 Oct6100ConfBridgeChanUnMuteDef(
451 tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute )
452 {
453 f_pConfBridgeUnMute->ulChannelHndl = cOCT6100_INVALID_HANDLE;
454
455 return cOCT6100_ERR_OK;
456 }
457 #endif
458
459 #if !SKIP_Oct6100ConfBridgeChanUnMute
460 UINT32 Oct6100ConfBridgeChanUnMute(
461 tPOCT6100_INSTANCE_API f_pApiInstance,
462 tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute )
463 {
464 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
465 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
466 UINT32 ulSerRes = cOCT6100_ERR_OK;
467 UINT32 ulFncRes = cOCT6100_ERR_OK;
468
469 /* Set the process context of the serialize structure.*/
470 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
471 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
472
473 /* Seize all list semaphores needed by this function. */
474 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
475 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
476 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
477 if ( ulSerRes == cOCT6100_ERR_OK )
478 {
479 /* Call the serialized function. */
480 ulFncRes = Oct6100ConfBridgeChanUnMuteSer( f_pApiInstance, f_pConfBridgeUnMute );
481 }
482 else
483 {
484 return ulSerRes;
485 }
486
487 /* Release the seized semaphores. */
488 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
489 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
490
491 /* If an error occured then return the error code. */
492 if ( ulSerRes != cOCT6100_ERR_OK )
493 return ulSerRes;
494 if ( ulFncRes != cOCT6100_ERR_OK )
495 return ulFncRes;
496
497 return cOCT6100_ERR_OK;
498 }
499 #endif
500
501
502 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
503
504 Function: Oct6100ConfBridgeDominantSpeakerSet
505
506 Description: This function sets a participant present on a conference
507 bridge as the dominant speaker.
508
509 -------------------------------------------------------------------------------
510 | Argument | Description
511 -------------------------------------------------------------------------------
512 f_pApiInstance Pointer to API instance. This memory is used to
513 keep the present state of the chip and all its
514 resources.
515
516 f_pConfBridgeDominant Pointer to conference bridge dominant speaker
517 structure.
518
519 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
520 #if !SKIP_Oct6100ConfBridgeDominantSpeakerSetDef
521 UINT32 Oct6100ConfBridgeDominantSpeakerSetDef(
522 tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker )
523 {
524 f_pConfBridgeDominantSpeaker->ulChannelHndl = cOCT6100_INVALID_HANDLE;
525 f_pConfBridgeDominantSpeaker->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE;
526
527 return cOCT6100_ERR_OK;
528 }
529 #endif
530
531
532 #if !SKIP_Oct6100ConfBridgeDominantSpeakerSet
533 UINT32 Oct6100ConfBridgeDominantSpeakerSet(
534 tPOCT6100_INSTANCE_API f_pApiInstance,
535 tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker )
536 {
537 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
538 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
539 UINT32 ulSerRes = cOCT6100_ERR_OK;
540 UINT32 ulFncRes = cOCT6100_ERR_OK;
541
542 /* Set the process context of the serialize structure.*/
543 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
544 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
545
546 /* Seize all list semaphores needed by this function. */
547 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
548 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
549 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
550 if ( ulSerRes == cOCT6100_ERR_OK )
551 {
552 /* Call the serialized function. */
553 ulFncRes = Oct6100ConfBridgeDominantSpeakerSetSer( f_pApiInstance, f_pConfBridgeDominantSpeaker );
554 }
555 else
556 {
557 return ulSerRes;
558 }
559
560 /* Release the seized semaphores. */
561 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
562 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
563
564 /* If an error occured then return the error code. */
565 if ( ulSerRes != cOCT6100_ERR_OK )
566 return ulSerRes;
567 if ( ulFncRes != cOCT6100_ERR_OK )
568 return ulFncRes;
569
570 return cOCT6100_ERR_OK;
571 }
572 #endif
573
574
575 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
576
577 Function: Oct6100ConfBridgeMaskChange
578
579 Description: This function changes the mask of a flexible bridge participant.
580
581 -------------------------------------------------------------------------------
582 | Argument | Description
583 -------------------------------------------------------------------------------
584 f_pApiInstance Pointer to API instance. This memory is used to
585 keep the present state of the chip and all its
586 resources.
587
588 f_pConfBridgeMaskChange Pointer to conference bridge change of mask
589 structure.
590
591 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
592 #if !SKIP_Oct6100ConfBridgeMaskChangeDef
593 UINT32 Oct6100ConfBridgeMaskChangeDef(
594 tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange )
595 {
596 f_pConfBridgeMaskChange->ulChannelHndl = cOCT6100_INVALID_HANDLE;
597 f_pConfBridgeMaskChange->ulNewListenerMask = 0x0;
598
599 return cOCT6100_ERR_OK;
600 }
601 #endif
602
603
604 #if !SKIP_Oct6100ConfBridgeMaskChange
605 UINT32 Oct6100ConfBridgeMaskChange(
606 tPOCT6100_INSTANCE_API f_pApiInstance,
607 tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange )
608 {
609 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
610 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
611 UINT32 ulSerRes = cOCT6100_ERR_OK;
612 UINT32 ulFncRes = cOCT6100_ERR_OK;
613
614 /* Set the process context of the serialize structure. */
615 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
616 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
617
618 /* Seize all list semaphores needed by this function. */
619 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
620 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
621 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
622 if ( ulSerRes == cOCT6100_ERR_OK )
623 {
624 /* Call the serialized function. */
625 ulFncRes = Oct6100ConfBridgeMaskChangeSer( f_pApiInstance, f_pConfBridgeMaskChange );
626 }
627 else
628 {
629 return ulSerRes;
630 }
631
632 /* Release the seized semaphores. */
633 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
634 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
635
636 /* If an error occured then return the error code. */
637 if ( ulSerRes != cOCT6100_ERR_OK )
638 return ulSerRes;
639 if ( ulFncRes != cOCT6100_ERR_OK )
640 return ulFncRes;
641
642 return cOCT6100_ERR_OK;
643 }
644 #endif
645
646
647 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
648
649 Function: Oct6100ConfBridgeGetStats
650
651 Description: This function returns the stats for a conference bridge.
652
653 -------------------------------------------------------------------------------
654 | Argument | Description
655 -------------------------------------------------------------------------------
656 f_pApiInstance Pointer to API instance. This memory is used to keep the
657 present state of the chip and all its resources.
658
659 f_pConfBridgeStats Pointer to conference bridge channel stats structure.
660
661 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
662 #if !SKIP_Oct6100ConfBridgeGetStatsDef
663 UINT32 Oct6100ConfBridgeGetStatsDef(
664 tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats )
665 {
666 f_pConfBridgeStats->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE;
667 f_pConfBridgeStats->ulNumChannels = cOCT6100_INVALID_STAT;
668 f_pConfBridgeStats->ulNumTappedChannels = cOCT6100_INVALID_STAT;
669 f_pConfBridgeStats->fFlexibleConferencing = cOCT6100_INVALID_STAT;
670
671 return cOCT6100_ERR_OK;
672 }
673 #endif
674
675
676 #if !SKIP_Oct6100ConfBridgeGetStats
677 UINT32 Oct6100ConfBridgeGetStats(
678 tPOCT6100_INSTANCE_API f_pApiInstance,
679 tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats )
680 {
681 tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
682 tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
683 UINT32 ulSerRes = cOCT6100_ERR_OK;
684 UINT32 ulFncRes = cOCT6100_ERR_OK;
685
686 /* Set the process context of the serialize structure. */
687 SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
688 ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
689
690 /* Seize all list semaphores needed by this function. */
691 SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
692 SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
693 ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
694 if ( ulSerRes == cOCT6100_ERR_OK )
695 {
696 /* Call the serialized function. */
697 ulFncRes = Oct6100ConfBridgeGetStatsSer( f_pApiInstance, f_pConfBridgeStats );
698 }
699 else
700 {
701 return ulSerRes;
702 }
703
704 /* Release the seized semaphores. */
705 ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
706 ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
707
708 /* If an error occured then return the error code. */
709 if ( ulSerRes != cOCT6100_ERR_OK )
710 return ulSerRes;
711 if ( ulFncRes != cOCT6100_ERR_OK )
712 return ulFncRes;
713
714 return cOCT6100_ERR_OK;
715 }
716 #endif
717
718 /**************************** PRIVATE FUNCTIONS ****************************/
719
720
721 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
722
723 Function: Oct6100ApiGetConfBridgeSwSizes
724
725 Description: Gets the sizes of all portions of the API instance pertinent
726 to the management of conference bridges.
727
728 -------------------------------------------------------------------------------
729 | Argument | Description
730 -------------------------------------------------------------------------------
731 f_pOpenChip Pointer to chip configuration struct.
732 f_pInstSizes Pointer to struct containing instance sizes.
733
734 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
735 #if !SKIP_Oct6100ApiGetConfBridgeSwSizes
736 UINT32 Oct6100ApiGetConfBridgeSwSizes(
737 IN tPOCT6100_CHIP_OPEN f_pOpenChip,
738 OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes )
739 {
740 UINT32 ulTempVar;
741 UINT32 ulResult;
742
743 /* Calculate memory needed for conference bridge list. */
744 if ( f_pOpenChip->ulMaxConfBridges == 0 && f_pOpenChip->fEnableChannelRecording == TRUE )
745 f_pOpenChip->ulMaxConfBridges = 1;
746 f_pInstSizes->ulConfBridgeList = f_pOpenChip->ulMaxConfBridges * sizeof( tOCT6100_API_CONF_BRIDGE );
747
748 /* Calculate memory needed for conference bridge allocation software. */
749 if ( f_pOpenChip->ulMaxConfBridges > 0 )
750 {
751 /* Get size of bridge allocation memory */
752 ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxConfBridges, &f_pInstSizes->ulConfBridgeAlloc );
753 if ( ulResult != cOCT6100_ERR_OK )
754 return cOCT6100_ERR_FATAL_1C;
755
756 /* Check if the user wants to build flexible conference bridges. */
757 if ( f_pOpenChip->ulMaxFlexibleConfParticipants > 0 )
758 {
759 /* Allocate the lowest quantity according to what the user requested. */
760 if ( f_pOpenChip->ulMaxFlexibleConfParticipants < ( f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ) )
761 f_pInstSizes->ulFlexConfParticipantsList = f_pOpenChip->ulMaxFlexibleConfParticipants * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT );
762 else
763 {
764 f_pOpenChip->ulMaxFlexibleConfParticipants = f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE;
765 f_pInstSizes->ulFlexConfParticipantsList = f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT );
766 }
767
768 /* Get size of flexible conferencing participants allocation memory */
769 ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxFlexibleConfParticipants, &f_pInstSizes->ulFlexConfParticipantsAlloc );
770 if ( ulResult != cOCT6100_ERR_OK )
771 return cOCT6100_ERR_FATAL_1C;
772 }
773 else
774 {
775 f_pInstSizes->ulFlexConfParticipantsList = 0;
776 f_pInstSizes->ulFlexConfParticipantsAlloc = 0;
777 }
778 }
779 else
780 {
781 f_pInstSizes->ulMixerEventList = 0;
782 f_pInstSizes->ulMixerEventAlloc = 0;
783 f_pInstSizes->ulConfBridgeAlloc = 0;
784
785 /* Make sure flexible conferencing is not used. */
786 f_pInstSizes->ulFlexConfParticipantsList = 0;
787 f_pInstSizes->ulFlexConfParticipantsAlloc = 0;
788 }
789
790 /* Calculate memory needed for list and allocation software serialization. */
791 mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConfBridgeList, ulTempVar )
792 mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConfBridgeAlloc, ulTempVar )
793
794 mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulFlexConfParticipantsList, ulTempVar )
795 mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulFlexConfParticipantsAlloc, ulTempVar )
796
797 return cOCT6100_ERR_OK;
798 }
799 #endif
800
801
802 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
803
804 Function: Oct6100ApiConfBridgeSwInit
805
806 Description: Initializes all elements of the instance structure associated
807 to conference bridges.
808
809 -------------------------------------------------------------------------------
810 | Argument | Description
811 -------------------------------------------------------------------------------
812 f_pApiInstance Pointer to API instance. This memory is used to keep
813 the present state of the chip and all its resources.
814
815 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
816 #if !SKIP_Oct6100ApiConfBridgeSwInit
817 UINT32 Oct6100ApiConfBridgeSwInit(
818 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance )
819 {
820 tPOCT6100_SHARED_INFO pSharedInfo;
821 tPOCT6100_API_CONF_BRIDGE pConfBridgeList;
822 tPOCT6100_API_FLEX_CONF_PARTICIPANT pFlexConfParticipantList;
823 PVOID pFlexConfPartipantsAlloc;
824 UINT32 ulMaxFlexConfParicipants;
825 PVOID pConfBridgeAlloc;
826 UINT32 ulMaxConfBridges;
827 UINT32 ulResult;
828
829 /* Get local pointer to shared portion of instance. */
830 pSharedInfo = f_pApiInstance->pSharedInfo;
831
832 /* Get the maximum number of conference bridges. */
833 ulMaxConfBridges = pSharedInfo->ChipConfig.usMaxConfBridges;
834
835 /*===================================================================*/
836 /* Set all entries in the conference bridge list to unused. */
837
838 mOCT6100_GET_CONF_BRIDGE_LIST_PNT( pSharedInfo, pConfBridgeList );
839
840 /* Initialize the conference bridge allocation software to "all free". */
841 if ( ulMaxConfBridges > 0 )
842 {
843 /* Clear the bridge memory */
844 Oct6100UserMemSet( pConfBridgeList, 0x00, ulMaxConfBridges * sizeof( tOCT6100_API_CONF_BRIDGE ));
845
846 mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( pSharedInfo, pConfBridgeAlloc )
847
848 ulResult = OctapiLlmAllocInit( &pConfBridgeAlloc, ulMaxConfBridges );
849 if ( ulResult != cOCT6100_ERR_OK )
850 return cOCT6100_ERR_FATAL_1E;
851 }
852 /*===================================================================*/
853
854
855 /*===================================================================*/
856 /* Set all entries in the flexible conferencing participant list to unused. */
857
858 /* Get the maximum number of flexible conferencing participants. */
859 ulMaxFlexConfParicipants = pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants;
860
861 mOCT6100_GET_FLEX_CONF_PARTICIPANT_LIST_PNT( pSharedInfo, pFlexConfParticipantList );
862
863 /* Initialize the flexible conferencing allocation software. */
864 if ( ulMaxFlexConfParicipants > 0 )
865 {
866 UINT32 i, ulEventIndex;
867
868 /* Clear the participants memory */
869 Oct6100UserMemSet( pFlexConfParticipantList, 0x00, ulMaxFlexConfParicipants * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT ));
870
871 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( pSharedInfo, pFlexConfPartipantsAlloc )
872
873 ulResult = OctapiLlmAllocInit( &pFlexConfPartipantsAlloc, ulMaxFlexConfParicipants );
874 if ( ulResult != cOCT6100_ERR_OK )
875 return cOCT6100_ERR_FATAL_1E;
876
877 /* Initialize the conferencing indexes. */
878 for ( i = 0; i < ulMaxFlexConfParicipants; i ++ )
879 {
880 for ( ulEventIndex = 0; ulEventIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulEventIndex ++ )
881 pFlexConfParticipantList[ i ].ausLoadOrAccumulateEventIndex[ ulEventIndex ] = cOCT6100_INVALID_INDEX;
882 }
883 }
884
885 /*===================================================================*/
886
887 return cOCT6100_ERR_OK;
888 }
889 #endif
890
891
892 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
893
894 Function: Oct6100ConfBridgeOpenSer
895
896 Description: Open a conference bridge. Note that no chip resources are
897 allocated until a channel is added to the bridge.
898
899 -------------------------------------------------------------------------------
900 | Argument | Description
901 -------------------------------------------------------------------------------
902 f_pApiInstance Pointer to API instance. This memory is used to keep the
903 present state of the chip and all its resources.
904
905 f_pConfBridgeOpen Pointer to conference bridge configuration structure.
906 The handle identifying the conference bridge in all
907 future function calls is returned in this structure.
908
909 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
910 #if !SKIP_Oct6100ConfBridgeOpenSer
911 UINT32 Oct6100ConfBridgeOpenSer(
912 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
913 IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen )
914 {
915 UINT16 usBridgeIndex;
916 UINT32 ulResult;
917
918 /* Check the user's configuration of the conference bridge for errors. */
919 ulResult = Oct6100ApiCheckBridgeParams( f_pApiInstance, f_pConfBridgeOpen );
920 if ( ulResult != cOCT6100_ERR_OK )
921 return ulResult;
922
923 /* Reserve all resources needed by the conference bridge. */
924 ulResult = Oct6100ApiReserveBridgeResources( f_pApiInstance, &usBridgeIndex );
925 if ( ulResult != cOCT6100_ERR_OK )
926 return ulResult;
927
928 /* Update the new conference bridge's entry in the conference bridge list. */
929 ulResult = Oct6100ApiUpdateBridgeEntry( f_pApiInstance, f_pConfBridgeOpen, usBridgeIndex);
930 if ( ulResult != cOCT6100_ERR_OK )
931 return ulResult;
932
933 return cOCT6100_ERR_OK;
934 }
935 #endif
936
937
938 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
939
940 Function: Oct6100ApiCheckBridgeParams
941
942 Description: Checks the user's conference bridge open configuration for errors.
943
944 -------------------------------------------------------------------------------
945 | Argument | Description
946 -------------------------------------------------------------------------------
947 f_pApiInstance Pointer to API instance. This memory is used to keep the
948 present state of the chip and all its resources.
949
950 f_pConfBridgeOpen Pointer to conference bridge configuration structure.
951
952 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
953 #if !SKIP_Oct6100ApiCheckBridgeParams
954 UINT32 Oct6100ApiCheckBridgeParams(
955 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
956 IN tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen )
957 {
958 /* Check for errors. */
959 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
960 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
961
962 if ( f_pConfBridgeOpen->pulConfBridgeHndl == NULL )
963 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
964
965 if ( f_pApiInstance->pSharedInfo->ImageInfo.fConferencing == FALSE )
966 return cOCT6100_ERR_NOT_SUPPORTED_CONF_BRIDGE;
967
968 if ( f_pConfBridgeOpen->fFlexibleConferencing != FALSE
969 && f_pConfBridgeOpen->fFlexibleConferencing != TRUE )
970 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF;
971
972 return cOCT6100_ERR_OK;
973 }
974 #endif
975
976
977 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
978
979 Function: Oct6100ApiReserveBridgeResources
980
981 Description: Reserves all resources needed for the new conference bridge.
982
983 -------------------------------------------------------------------------------
984 | Argument | Description
985 -------------------------------------------------------------------------------
986 f_pApiInstance Pointer to API instance. This memory is used to keep the
987 present state of the chip and all its resources.
988
989 f_pusBridgeIndex Allocated entry in the API conference bridge list.
990
991 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
992 #if !SKIP_Oct6100ApiReserveBridgeResources
993 UINT32 Oct6100ApiReserveBridgeResources(
994 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
995 OUT PUINT16 f_pusBridgeIndex )
996 {
997 tPOCT6100_SHARED_INFO pSharedInfo;
998 UINT32 ulResult;
999
1000 /* Obtain local pointer to shared portion of instance. */
1001 pSharedInfo = f_pApiInstance->pSharedInfo;
1002
1003 /* Reserve an entry in the conference bridge list. */
1004 ulResult = Oct6100ApiReserveBridgeEntry( f_pApiInstance, f_pusBridgeIndex );
1005 if ( ulResult != cOCT6100_ERR_OK )
1006 return ulResult;
1007
1008 return cOCT6100_ERR_OK;
1009 }
1010 #endif
1011
1012
1013 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
1014
1015 Function: Oct6100ApiUpdateBridgeEntry
1016
1017 Description: Updates the new conference bridge's entry in the conference
1018 bridge list.
1019
1020 -------------------------------------------------------------------------------
1021 | Argument | Description
1022 -------------------------------------------------------------------------------
1023 f_pApiInstance Pointer to API instance. This memory is used to keep
1024 the present state of the chip and all its resources.
1025
1026 f_pConfBridgeOpen Pointer to conference bridge configuration structure.
1027 f_usBridgeIndex Allocated entry in API conference bridge list.
1028
1029 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
1030 #if !SKIP_Oct6100ApiUpdateBridgeEntry
1031 UINT32 Oct6100ApiUpdateBridgeEntry(
1032 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
1033 IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen,
1034 IN UINT16 f_usBridgeIndex )
1035 {
1036 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
1037 tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry;
1038
1039 /*================================================================================*/
1040 /* Obtain a pointer to the new conference bridge's list entry. */
1041
1042 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex )
1043
1044 /* No clients are currently connected to the bridge. */
1045 pBridgeEntry->usNumClients = 0;
1046 /* Nobody is tapped for now. */
1047 pBridgeEntry->usNumTappedClients = 0;
1048 pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX;
1049 pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX;
1050 pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX;
1051
1052 pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX;
1053
1054 pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX;
1055
1056 /* Now update the bridge pointer. */
1057 if ( f_pApiInstance->pSharedInfo->MiscVars.usNumBridgesOpened == 0 )
1058 {
1059 pBridgeEntry->usNextBridgePtr = cOCT6100_INVALID_INDEX;
1060 pBridgeEntry->usPrevBridgePtr = cOCT6100_INVALID_INDEX;
1061
1062 /* Set the global first bridge to this bridge. */
1063 f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge = f_usBridgeIndex;
1064 }
1065 else /* Insert this bridge at the head of the bridge list.*/
1066 {
1067 if ( f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge == cOCT6100_INVALID_INDEX )
1068 return cOCT6100_ERR_FATAL_22;
1069
1070 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge )
1071
1072 if ( pTempBridgeEntry->fReserved != TRUE )
1073 return cOCT6100_ERR_FATAL_23;
1074
1075 /* Modify the old first entry. */
1076 pTempBridgeEntry->usPrevBridgePtr = f_usBridgeIndex;
1077
1078 /* Modify current pointer. */
1079 pBridgeEntry->usPrevBridgePtr = cOCT6100_INVALID_INDEX;
1080 pBridgeEntry->usNextBridgePtr = f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge;
1081
1082 /* Set the new first bridge of the list. */
1083 f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge = f_usBridgeIndex;
1084 }
1085
1086 /* Form handle returned to user. */
1087 *f_pConfBridgeOpen->pulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usBridgeIndex;
1088
1089 /* Remember whether or not we are a flexible conference bridge. */
1090 pBridgeEntry->fFlexibleConferencing = (UINT8)( f_pConfBridgeOpen->fFlexibleConferencing & 0xFF );
1091
1092 /* Finally, mark the conference bridge as opened. */
1093 pBridgeEntry->fReserved = TRUE;
1094
1095 /* Increment the number of conference bridge opened. */
1096 f_pApiInstance->pSharedInfo->ChipStats.usNumberConfBridges++;
1097 f_pApiInstance->pSharedInfo->MiscVars.usNumBridgesOpened++;
1098
1099 /*================================================================================*/
1100
1101 return cOCT6100_ERR_OK;
1102 }
1103 #endif
1104
1105
1106 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
1107
1108 Function: Oct6100ConfBridgeCloseSer
1109
1110 Description: Closes a conference bridge. Note that no client must be present
1111 on the bridge for the bridge to be closed.
1112
1113 -------------------------------------------------------------------------------
1114 | Argument | Description
1115 -------------------------------------------------------------------------------
1116 f_pApiInstance Pointer to API instance. This memory is used to keep the
1117 present state of the chip and all its resources.
1118
1119 f_pConfBridgeClose Pointer to conference bridge close structure.
1120
1121 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
1122 #if !SKIP_Oct6100ConfBridgeCloseSer
1123 UINT32 Oct6100ConfBridgeCloseSer(
1124 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
1125 IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose )
1126 {
1127 UINT16 usBridgeIndex;
1128 UINT32 ulResult;
1129
1130 /* Verify that all the parameters given match the state of the API. */
1131 ulResult = Oct6100ApiAssertBridgeParams( f_pApiInstance, f_pConfBridgeClose, &usBridgeIndex );
1132 if ( ulResult != cOCT6100_ERR_OK )
1133 return ulResult;
1134
1135 /* Release all resources associated to the conference bridge. */
1136 ulResult = Oct6100ApiReleaseBridgeResources( f_pApiInstance, usBridgeIndex );
1137 if ( ulResult != cOCT6100_ERR_OK )
1138 return ulResult;
1139
1140 /* Invalidate the handle. */
1141 f_pConfBridgeClose->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE;
1142
1143 return cOCT6100_ERR_OK;
1144 }
1145 #endif
1146
1147
1148 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
1149
1150 Function: Oct6100ApiAssertBridgeParams
1151
1152 Description: Checks the user's conference bridge close configuration for errors.
1153
1154 -------------------------------------------------------------------------------
1155 | Argument | Description
1156 -------------------------------------------------------------------------------
1157 f_pApiInstance Pointer to API instance. This memory is used to keep the
1158 present state of the chip and all its resources.
1159
1160 f_pConfBridgeClose Pointer to conference bridge close structure.
1161 f_pusBridgeIndex Pointer to API instance conference bridge index.
1162
1163 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
1164 #if !SKIP_Oct6100ApiAssertBridgeParams
1165 UINT32 Oct6100ApiAssertBridgeParams(
1166 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
1167 IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose,
1168 OUT PUINT16 f_pusBridgeIndex )
1169 {
1170 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
1171 UINT32 ulEntryOpenCnt;
1172
1173 /* Check the provided handle. */
1174 if ( (f_pConfBridgeClose->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
1175 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1176
1177 *f_pusBridgeIndex = (UINT16)( f_pConfBridgeClose->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
1178 if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
1179 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1180
1181 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
1182
1183 /* Extract the entry open count from the provided handle. */
1184 ulEntryOpenCnt = (f_pConfBridgeClose->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
1185
1186 /* Check for errors. */
1187 if ( pBridgeEntry->fReserved != TRUE )
1188 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
1189 if ( pBridgeEntry->usNumClients != 0 )
1190 return cOCT6100_ERR_CONF_BRIDGE_ACTIVE_DEPENDENCIES;
1191 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
1192 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1193
1194 return cOCT6100_ERR_OK;
1195 }
1196 #endif
1197
1198
1199 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
1200
1201 Function: Oct6100ApiReleaseBridgeResources
1202
1203 Description: Release all resources reserved for the conference bridge.
1204
1205 -------------------------------------------------------------------------------
1206 | Argument | Description
1207 -------------------------------------------------------------------------------
1208 f_pApiInstance Pointer to API instance. This memory is used to keep the
1209 present state of the chip and all its resources.
1210
1211 f_usBridgeIndex Allocated external memory block for the conference bridge.
1212
1213 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
1214 #if !SKIP_Oct6100ApiReleaseBridgeResources
1215 UINT32 Oct6100ApiReleaseBridgeResources(
1216 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
1217 IN UINT16 f_usBridgeIndex )
1218 {
1219 tPOCT6100_SHARED_INFO pSharedInfo;
1220 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
1221 tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry;
1222 UINT32 ulResult;
1223
1224 /* Obtain local pointer to shared portion of instance. */
1225 pSharedInfo = f_pApiInstance->pSharedInfo;
1226
1227 /* Release the entry from the conference bridge list. */
1228 ulResult = Oct6100ApiReleaseBridgeEntry( f_pApiInstance, f_usBridgeIndex );
1229 if ( ulResult != cOCT6100_ERR_OK )
1230 return cOCT6100_ERR_FATAL_24;
1231
1232 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
1233
1234 /* Remove the bridge entry from the bridge list. */
1235 if ( pSharedInfo->MiscVars.usNumBridgesOpened == 1 )
1236 {
1237 /* This bridge was the only one opened. */
1238 pSharedInfo->MiscVars.usFirstBridge = cOCT6100_INVALID_INDEX;
1239 }
1240 else if ( pSharedInfo->MiscVars.usNumBridgesOpened > 1 )
1241 {
1242 /* There are more then one bridge open, must update the list. */
1243 if ( pBridgeEntry->usPrevBridgePtr != cOCT6100_INVALID_INDEX )
1244 {
1245 /* There is a valid entry before this bridge, let's update this entry. */
1246 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, pBridgeEntry->usPrevBridgePtr );
1247
1248 pTempBridgeEntry->usNextBridgePtr = pBridgeEntry->usNextBridgePtr;
1249 }
1250
1251 if ( pBridgeEntry->usNextBridgePtr != cOCT6100_INVALID_INDEX )
1252 {
1253 /* There is a valid entry after this bridge, let's update this entry. */
1254 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, pBridgeEntry->usNextBridgePtr );
1255
1256 pTempBridgeEntry->usPrevBridgePtr = pBridgeEntry->usPrevBridgePtr;
1257 }
1258
1259 if ( pSharedInfo->MiscVars.usFirstBridge == f_usBridgeIndex )
1260 {
1261 /* This entry was the first of the list, make the next one be the first now. */
1262 pSharedInfo->MiscVars.usFirstBridge = pBridgeEntry->usNextBridgePtr;
1263 }
1264 }
1265 else
1266 {
1267 /* Variable has become out of sync. */
1268 return cOCT6100_ERR_FATAL_25;
1269 }
1270
1271 /*=============================================================*/
1272 /* Update the conference bridge's list entry. */
1273
1274 /* Mark the bridge as closed. */
1275 pBridgeEntry->fFlexibleConferencing = FALSE;
1276 pBridgeEntry->fReserved = FALSE;
1277 pBridgeEntry->byEntryOpenCnt++;
1278
1279 /* Decrement the number of conference bridges opened. */
1280 pSharedInfo->MiscVars.usNumBridgesOpened--;
1281 pSharedInfo->ChipStats.usNumberConfBridges--;
1282
1283 /*=============================================================*/
1284
1285 return cOCT6100_ERR_OK;
1286 }
1287 #endif
1288
1289
1290 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
1291
1292 Function: Oct6100ConfBridgeChanAddSer
1293
1294 Description: Adds an echo channel (participant) to a conference bridge.
1295
1296 -------------------------------------------------------------------------------
1297 | Argument | Description
1298 -------------------------------------------------------------------------------
1299 f_pApiInstance Pointer to API instance. This memory is used to keep the
1300 present state of the chip and all its resources.
1301
1302 f_pConfBridgeAdd Pointer to conference bridge channel add structure.
1303
1304 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
1305 #if !SKIP_Oct6100ConfBridgeChanAddSer
1306 UINT32 Oct6100ConfBridgeChanAddSer(
1307 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
1308 IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd )
1309 {
1310 UINT16 usBridgeIndex;
1311 UINT16 usChanIndex;
1312 UINT16 usLoadEventIndex;
1313 UINT16 usSubStoreEventIndex;
1314 UINT16 usCopyEventIndex;
1315 UINT32 ulInputPort;
1316 UINT8 fFlexibleConfBridge;
1317 UINT32 ulListenerMaskIndex;
1318 UINT32 ulListenerMask;
1319 UINT16 usTapChanIndex;
1320 UINT16 usTapBridgeIndex;
1321 UINT8 fMute;
1322 UINT8 fTap;
1323 UINT32 ulResult;
1324
1325 /* Check the validity of the channel and conference bridge given. */
1326 ulResult = Oct6100ApiCheckBridgeAddParams(
1327 f_pApiInstance,
1328 f_pConfBridgeAdd,
1329 &usBridgeIndex,
1330 &usChanIndex,
1331 &fMute,
1332 &ulInputPort,
1333 &fFlexibleConfBridge,
1334 &ulListenerMaskIndex,
1335 &ulListenerMask,
1336 &fTap,
1337 &usTapChanIndex );
1338 if ( ulResult != cOCT6100_ERR_OK )
1339 return ulResult;
1340
1341 /* Reserve all resources needed by the conference bridge. */
1342 ulResult = Oct6100ApiReserveBridgeAddResources(
1343 f_pApiInstance,
1344 usBridgeIndex,
1345 usChanIndex,
1346 ulInputPort,
1347 fFlexibleConfBridge,
1348 ulListenerMaskIndex,
1349 ulListenerMask,
1350 fTap,
1351 &usLoadEventIndex,
1352 &usSubStoreEventIndex,
1353 &usCopyEventIndex,
1354 &usTapBridgeIndex );
1355 if ( ulResult != cOCT6100_ERR_OK )
1356 return ulResult;
1357
1358 /* Reserve all resources needed by the conference bridge. */
1359 ulResult = Oct6100ApiBridgeEventAdd(
1360 f_pApiInstance,
1361 usBridgeIndex,
1362 usChanIndex,
1363 fFlexibleConfBridge,
1364 usLoadEventIndex,
1365 usSubStoreEventIndex,
1366 usCopyEventIndex,
1367 ulInputPort,
1368 fMute,
1369 ulListenerMaskIndex,
1370 ulListenerMask,
1371 fTap,
1372 usTapBridgeIndex,
1373 usTapChanIndex );
1374 if ( ulResult != cOCT6100_ERR_OK )
1375 return ulResult;
1376
1377 return cOCT6100_ERR_OK;
1378 }
1379 #endif
1380
1381
1382 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
1383
1384 Function: Oct6100ApiCheckBridgeAddParams
1385
1386 Description: Check the validity of the channel and conference bridge given.
1387
1388 -------------------------------------------------------------------------------
1389 | Argument | Description
1390 -------------------------------------------------------------------------------
1391 f_pApiInstance Pointer to API instance. This memory is used to keep the
1392 present state of the chip and all its resources.
1393 f_pConfBridgeAdd Pointer to conference bridge channenl add structure.
1394 f_pusBridgeIndex Extracted bridge index where this channel should be
1395 added.
1396 f_pusChannelIndex Extracted channel index related to the channel handle
1397 to be added to the bridge.
1398 f_pfMute Whether to mute this channel in the bridge or not.
1399 f_pulInputPort Input port where the channel signal should be
1400 copied from.
1401 f_pfFlexibleConfBridge If this is a flexible conference bridge.
1402 f_pulListenerMaskIndex Index of the listener in this flexible conference bridge.
1403 f_pulListenerMask Mask of listeners in this flexible conference bridge.
1404
1405 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
1406 #if !SKIP_Oct6100ApiCheckBridgeAddParams
1407 UINT32 Oct6100ApiCheckBridgeAddParams(
1408 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
1409 IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd,
1410 OUT PUINT16 f_pusBridgeIndex,
1411 OUT PUINT16 f_pusChannelIndex,
1412 OUT PUINT8 f_pfMute,
1413 OUT PUINT32 f_pulInputPort,
1414 OUT PUINT8 f_pfFlexibleConfBridge,
1415 OUT PUINT32 f_pulListenerMaskIndex,
1416 OUT PUINT32 f_pulListenerMask,
1417 OUT PUINT8 f_pfTap,
1418 OUT PUINT16 f_pusTapChannelIndex )
1419 {
1420 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
1421 tPOCT6100_API_CHANNEL pEchoChanEntry;
1422 UINT32 ulEntryOpenCnt;
1423 UINT8 byTapChannelLaw;
1424
1425 /* Check for errors. */
1426 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
1427 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
1428
1429 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 1 &&
1430 f_pApiInstance->pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE )
1431 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
1432
1433 if ( f_pConfBridgeAdd->ulConfBridgeHndl == cOCT6100_INVALID_HANDLE )
1434 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1435
1436 if ( f_pConfBridgeAdd->ulChannelHndl == cOCT6100_INVALID_HANDLE )
1437 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE;
1438
1439 if( f_pConfBridgeAdd->ulInputPort != cOCT6100_CHANNEL_PORT_SOUT
1440 && f_pConfBridgeAdd->ulInputPort != cOCT6100_CHANNEL_PORT_RIN )
1441 return cOCT6100_ERR_CONF_BRIDGE_INVALID_INPUT_PORT;
1442
1443 if ( f_pConfBridgeAdd->fMute != TRUE && f_pConfBridgeAdd->fMute != FALSE )
1444 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_MUTE;
1445
1446 /*=====================================================================*/
1447 /* Check the conference bridge handle. */
1448
1449 if ( (f_pConfBridgeAdd->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
1450 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1451
1452 *f_pusBridgeIndex = (UINT16)( f_pConfBridgeAdd->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
1453 if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
1454 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1455
1456 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
1457
1458 /* Extract the entry open count from the provided handle. */
1459 ulEntryOpenCnt = (f_pConfBridgeAdd->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
1460
1461 /* Check for errors. */
1462 if ( pBridgeEntry->fReserved != TRUE )
1463 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
1464 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
1465 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1466
1467 /* When we a flexible conference bridge, more things need to be checked. */
1468 if ( pBridgeEntry->fFlexibleConferencing == TRUE )
1469 {
1470 /* Check if flexible conferencing has been activated. */
1471 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants == 0 )
1472 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_DISABLED;
1473
1474 /* Check the number of clients on the bridge. */
1475 if ( pBridgeEntry->usNumClients >= cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE )
1476 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_PARTICIPANT_CNT;
1477
1478 /* Check if the listener index in a flexible bridge is valid. */
1479 if ( f_pConfBridgeAdd->ulListenerMaskIndex == cOCT6100_INVALID_VALUE
1480 || f_pConfBridgeAdd->ulListenerMaskIndex >= cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE )
1481 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_MASK_INDEX;
1482 }
1483
1484 if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE )
1485 {
1486 if ( pBridgeEntry->fFlexibleConferencing == TRUE )
1487 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_TAP_NOT_SUPPORTED;
1488 }
1489
1490 /*=====================================================================*/
1491
1492
1493 /*=====================================================================*/
1494 /* Check the channel handle. */
1495
1496 if ( (f_pConfBridgeAdd->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
1497 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE;
1498
1499 *f_pusChannelIndex = (UINT16)( f_pConfBridgeAdd->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
1500 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
1501 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE;
1502
1503 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
1504
1505 /* Extract the entry open count from the provided handle. */
1506 ulEntryOpenCnt = (f_pConfBridgeAdd->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
1507
1508 /* Check for errors. */
1509 if ( pEchoChanEntry->fReserved != TRUE )
1510 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
1511 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
1512 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
1513 if ( pEchoChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX )
1514 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ALREADY_ON_BRIDGE;
1515 if ( pEchoChanEntry->fBiDirChannel == TRUE )
1516 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_BIDIR;
1517 /* Law conversion is not allowed on a conference bridge. */
1518 if ( ( pEchoChanEntry->TdmConfig.usRinTimeslot != cOCT6100_UNASSIGNED )
1519 && ( pEchoChanEntry->TdmConfig.usRoutTimeslot != cOCT6100_UNASSIGNED ) )
1520 {
1521 if ( pEchoChanEntry->TdmConfig.byRinPcmLaw != pEchoChanEntry->TdmConfig.byRoutPcmLaw )
1522 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION;
1523 }
1524 if ( ( pEchoChanEntry->TdmConfig.usSinTimeslot != cOCT6100_UNASSIGNED )
1525 && ( pEchoChanEntry->TdmConfig.usSoutTimeslot != cOCT6100_UNASSIGNED ) )
1526 {
1527 if ( pEchoChanEntry->TdmConfig.bySinPcmLaw != pEchoChanEntry->TdmConfig.bySoutPcmLaw )
1528 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION;
1529 }
1530 if ( pEchoChanEntry->fRinRoutCodecActive == TRUE || pEchoChanEntry->fSinSoutCodecActive == TRUE )
1531 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_CODEC_ACTIVE;
1532 if ( pEchoChanEntry->fEnableExtToneDetection == TRUE )
1533 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_EXT_TONE_ENABLED;
1534 if ( pEchoChanEntry->usCopyEventCnt != 0x0 )
1535 return cOCT6100_ERR_CONF_BRIDGE_COPY_EVENTS;
1536
1537 /* If the bridge is flexible, few more things need to be checked. */
1538 if ( pBridgeEntry->fFlexibleConferencing == TRUE )
1539 {
1540 tPOCT6100_SHARED_INFO pSharedInfo;
1541 UINT16 usChannelIndex;
1542 UINT32 ulResult = cOCT6100_ERR_OK;
1543
1544 /* Obtain local pointer to shared portion of instance. */
1545 pSharedInfo = f_pApiInstance->pSharedInfo;
1546
1547 /* Check if the listener index has been used by another channel in the specified bridge. */
1548 for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ )
1549 {
1550 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usChannelIndex );
1551
1552 /* Channel reserved? */
1553 if ( ( usChannelIndex != ( *f_pusChannelIndex ) ) && ( pEchoChanEntry->fReserved == TRUE ) )
1554 {
1555 /* On current bridge? */
1556 if ( pEchoChanEntry->usBridgeIndex == ( *f_pusBridgeIndex ) )
1557 {
1558 tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant;
1559
1560 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
1561
1562 /* Check if this participant has the same listener index. */
1563 if ( f_pConfBridgeAdd->ulListenerMaskIndex == pCurrentParticipant->ulListenerMaskIndex )
1564 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_INDEX_USED;
1565 }
1566 }
1567 }
1568 }
1569
1570 if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE )
1571 {
1572 /* For internal logic, make sure the mute flag is set to false. */
1573 f_pConfBridgeAdd->fMute = FALSE;
1574
1575 /* Force input port to Sout for logic below. */
1576 f_pConfBridgeAdd->ulInputPort = cOCT6100_CHANNEL_PORT_SOUT;
1577
1578 /* Keep law to check for conversion. */
1579 /* Check if the same law. */
1580 byTapChannelLaw = pEchoChanEntry->TdmConfig.bySoutPcmLaw;
1581
1582 /* Check the tap handle. */
1583 if ( (f_pConfBridgeAdd->ulTappedChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
1584 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE;
1585
1586 *f_pusTapChannelIndex = (UINT16)( f_pConfBridgeAdd->ulTappedChannelHndl & cOCT6100_HNDL_INDEX_MASK );
1587 if ( *f_pusTapChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
1588 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE;
1589
1590 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusTapChannelIndex )
1591
1592 /* Extract the entry open count from the provided handle. */
1593 ulEntryOpenCnt = (f_pConfBridgeAdd->ulTappedChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
1594
1595 /* Check for errors. */
1596 if ( pEchoChanEntry->fReserved != TRUE )
1597 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
1598 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
1599 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE;
1600 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
1601 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_BRIDGE;
1602 if ( pEchoChanEntry->usBridgeIndex != *f_pusBridgeIndex )
1603 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_SAME_BRIDGE;
1604
1605 /* We can only tap a channel added on the Sout port. */
1606 if ( pEchoChanEntry->usSinCopyEventIndex == cOCT6100_INVALID_INDEX )
1607 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_TAP_SOUT_ONLY;
1608
1609 /* Check if already tapped. */
1610 if ( pEchoChanEntry->fBeingTapped == TRUE )
1611 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_ALREADY_TAPPED;
1612 }
1613
1614 /*=====================================================================*/
1615
1616 /* Return the tap flag. */
1617 if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE )
1618 {
1619 *f_pfTap = TRUE;
1620 }
1621 else
1622 {
1623 *f_pfTap = FALSE;
1624 }
1625
1626 /* Return the mute config specified. */
1627 *f_pfMute = (UINT8)( f_pConfBridgeAdd->fMute & 0xFF );
1628
1629 /* Return the input port specified. */
1630 *f_pulInputPort = f_pConfBridgeAdd->ulInputPort;
1631
1632 /* Return whether we are in the flexible conference bridge case. */
1633 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
1634
1635 /* Return the listener mask index as specified. */
1636 *f_pulListenerMaskIndex = f_pConfBridgeAdd->ulListenerMaskIndex;
1637
1638 /* Return the listener mask as specified. */
1639 *f_pulListenerMask = f_pConfBridgeAdd->ulListenerMask;
1640
1641 return cOCT6100_ERR_OK;
1642 }
1643 #endif
1644
1645
1646 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
1647
1648 Function: Oct6100ApiReserveBridgeAddResources
1649
1650 Description: Reserves all resources needed for the addition of a channel to
1651 the conference bridge.
1652
1653 -------------------------------------------------------------------------------
1654 | Argument | Description
1655 -------------------------------------------------------------------------------
1656 f_pApiInstance Pointer to API instance. This memory is used to keep the
1657 present state of the chip and all its resources.
1658 f_usBridgeIndex Bridge index of the bridge where this channel is added.
1659 f_usChanIndex Channel index of the channel to be added to the bridge.
1660 f_ulInputPort Input port where to copy samples from.
1661 f_fFlexibleConfBridge If this is a flexible conference bridge.
1662 f_ulListenerMaskIndex Index of the listener in this flexible conference bridge.
1663 f_ulListenerMask Mask of listeners in this flexible conference bridge.
1664 f_pusLoadEventIndex Load event index within the API's list of mixer event.
1665 f_pusSubStoreEventIndex Sub-Store event index within the API's list of mixer event.
1666 f_pusCopyEventIndex Copy event index within the API's list of mixer event.
1667
1668 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
1669 #if !SKIP_Oct6100ApiReserveBridgeAddResources
1670 UINT32 Oct6100ApiReserveBridgeAddResources(
1671 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
1672 IN UINT16 f_usBridgeIndex,
1673 IN UINT16 f_usChanIndex,
1674 IN UINT32 f_ulInputPort,
1675 IN UINT8 f_fFlexibleConfBridge,
1676 IN UINT32 f_ulListenerMaskIndex,
1677 IN UINT32 f_ulListenerMask,
1678 IN UINT8 f_fTap,
1679 OUT PUINT16 f_pusLoadEventIndex,
1680 OUT PUINT16 f_pusSubStoreEventIndex,
1681 OUT PUINT16 f_pusCopyEventIndex,
1682 OUT PUINT16 f_pusTapBridgeIndex )
1683 {
1684 tPOCT6100_API_CHANNEL pChanEntry;
1685 tPOCT6100_SHARED_INFO pSharedInfo;
1686 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
1687 UINT32 ulResult;
1688 UINT32 ulTempVar;
1689 UINT16 usChannelIndex;
1690 BOOL fLoadEventReserved = FALSE;
1691 BOOL fStoreEventReserved = FALSE;
1692 BOOL fCopyEventReserved = FALSE;
1693 BOOL fExtraSinTsiReserved = FALSE;
1694 BOOL fExtraRinTsiReserved = FALSE;
1695
1696 /* Obtain local pointer to shared portion of instance. */
1697 pSharedInfo = f_pApiInstance->pSharedInfo;
1698
1699 /* Get a pointer to the channel's list entry. */
1700 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex )
1701
1702 /* Resources must be reserved according to the type of bridge we are adding to. */
1703 if ( f_fFlexibleConfBridge == TRUE )
1704 {
1705 tPOCT6100_API_FLEX_CONF_PARTICIPANT pNewParticipant;
1706 tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant;
1707
1708 /*========================================================================*/
1709 /* If we are in the flexible conferencing case, things are a little */
1710 /* different. We create a mixer for every participant instead of the */
1711 /* usual same mixer for everyone. For example, if we have 3 participants */
1712 /* of type client - agent - coach, we build the mixers as follows: */
1713 /* */
1714 /* Client: - Load Agent */
1715 /* - Store */
1716 /* */
1717 /* Agent: - Load Client */
1718 /* - Accumulate Coach */
1719 /* - Store */
1720 /* */
1721 /* Coach: - Load Client */
1722 /* - Accumulate Agent */
1723 /* - Store */
1724 /* */
1725 /*========================================================================*/
1726
1727 /* First reserve a flexible conferencing participant entry. */
1728 ulResult = Oct6100ApiReserveFlexConfParticipantEntry( f_pApiInstance, &pChanEntry->usFlexConfParticipantIndex );
1729 if ( ulResult != cOCT6100_ERR_OK )
1730 return ulResult;
1731
1732 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pNewParticipant, pChanEntry->usFlexConfParticipantIndex );
1733
1734 /* Reserve an entry for the store event in the mixer memory. */
1735 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusSubStoreEventIndex );
1736 if ( ulResult == cOCT6100_ERR_OK )
1737 {
1738 /* If using the SOUT port, we must copy this entry */
1739 if( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
1740 {
1741 /* Reserve an entry for the copy event in the Mixer memory. */
1742 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusCopyEventIndex );
1743 if ( ulResult == cOCT6100_ERR_OK )
1744 {
1745 fCopyEventReserved = TRUE;
1746
1747 /* Reserve a SIN copy entry if none were reserved before.*/
1748 if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX )
1749 {
1750 /* Reserve an entry for the extra tsi chariot memory. */
1751 ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance,
1752 &pChanEntry->usExtraSinTsiMemIndex );
1753 if ( ulResult == cOCT6100_ERR_OK )
1754 fExtraSinTsiReserved = TRUE;
1755 }
1756 }
1757 }
1758 else /* if( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
1759 {
1760 /* Reserve a RIN copy entry if none were reserved before.*/
1761 if ( pChanEntry->usExtraRinTsiMemIndex == cOCT6100_INVALID_INDEX )
1762 {
1763 /* Reserve an entry for the extra tsi chariot memory. */
1764 ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance,
1765 &pChanEntry->usExtraRinTsiMemIndex );
1766 if ( ulResult == cOCT6100_ERR_OK )
1767 fExtraRinTsiReserved = TRUE;
1768 }
1769 }
1770
1771 /* Must travel all clients of this conference and reserve a load or accumulate event for */
1772 /* all participants which can hear us. */
1773
1774 /* Search through the list of API channel entry for the ones on to this bridge.*/
1775 for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ )
1776 {
1777 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
1778
1779 /* Channel reserved? */
1780 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
1781 {
1782 /* On current bridge? */
1783 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
1784 {
1785 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
1786
1787 /* Check if we can hear this participant. */
1788 if ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 )
1789 {
1790 /* Must reserve a load or accumulate entry mixer event here! */
1791 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] );
1792 if ( ulResult != cOCT6100_ERR_OK )
1793 {
1794 /* Most probably, the hardware is out of mixer events. */
1795 break;
1796 }
1797 }
1798
1799 /* Check if this participant can hear us. */
1800 if ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 )
1801 {
1802 /* Must reserve a load or accumulate entry mixer event here! */
1803 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] );
1804 if ( ulResult != cOCT6100_ERR_OK )
1805 {
1806 /* Most probably, the hardware is out of mixer events. */
1807 break;
1808 }
1809 }
1810 }
1811 }
1812 }
1813
1814 /* If an error is returned, make sure everything is cleaned up properly. */
1815 if ( ulResult != cOCT6100_ERR_OK )
1816 {
1817 /* Release the flexible conferencing participant entry. */
1818 ulTempVar = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pChanEntry->usFlexConfParticipantIndex );
1819 if ( ulTempVar != cOCT6100_ERR_OK )
1820 return ulTempVar;
1821
1822 pChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX;
1823
1824 /* Release the substore event in the mixer memory. */
1825 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusSubStoreEventIndex );
1826 if ( ulTempVar != cOCT6100_ERR_OK )
1827 return ulTempVar;
1828
1829 if ( fCopyEventReserved == TRUE )
1830 {
1831 /* Release the copy event in the mixer memory. */
1832 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusCopyEventIndex );
1833 if ( ulTempVar != cOCT6100_ERR_OK )
1834 return ulTempVar;
1835 }
1836
1837 if ( fExtraSinTsiReserved == TRUE )
1838 {
1839 /* Release the extra Sin TSI in TSI memory. */
1840 ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraSinTsiMemIndex );
1841 if ( ulTempVar != cOCT6100_ERR_OK )
1842 return ulTempVar;
1843
1844 pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
1845 }
1846
1847 if ( fExtraRinTsiReserved == TRUE )
1848 {
1849 /* Release the extra Rin TSI in TSI memory. */
1850 ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraRinTsiMemIndex );
1851 if ( ulTempVar != cOCT6100_ERR_OK )
1852 return ulTempVar;
1853
1854 pChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX;
1855 }
1856
1857 /* Search through the list of API channel entry for the ones on to this bridge. */
1858 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
1859 {
1860 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
1861
1862 /* Channel reserved? */
1863 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
1864 {
1865 /* On current bridge? */
1866 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
1867 {
1868 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
1869
1870 /* Check if we can hear this participant. */
1871 if ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 )
1872 {
1873 /* If the load or event entry in the mixer memory was reserved. */
1874 if ( pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX )
1875 {
1876 /* Must release the load or accumulate entry mixer event. */
1877 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] );
1878 if ( ulTempVar != cOCT6100_ERR_OK )
1879 return ulTempVar;
1880
1881 pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
1882 }
1883 }
1884
1885 /* Check this participant can hear us. */
1886 if ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 )
1887 {
1888 /* If the load or event entry in the mixer memory was reserved. */
1889 if ( pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX )
1890 {
1891 /* Must release the load or accumulate entry mixer event. */
1892 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] );
1893 if ( ulTempVar != cOCT6100_ERR_OK )
1894 return ulTempVar;
1895
1896 pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
1897 }
1898 }
1899 }
1900 }
1901 }
1902
1903 return ulResult;
1904 }
1905 }
1906 else /* if ( ulResult != cOCT6100_ERR_OK ) */
1907 {
1908 ulTempVar = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pChanEntry->usFlexConfParticipantIndex );
1909 if ( ulTempVar != cOCT6100_ERR_OK )
1910 return ulTempVar;
1911
1912 pChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX;
1913
1914 /* Return the error code to the user. The mixer event allocation failed. */
1915 return ulResult;
1916 }
1917
1918 /*=======================================================================*/
1919 }
1920 else /* if ( f_fFlexibleConfBridge == FALSE ) */
1921 {
1922 /*=======================================================================*/
1923 /* Normal conferencing. */
1924
1925 /* Reserve an entry for the load event in the mixer memory. */
1926 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusLoadEventIndex );
1927 if ( ulResult == cOCT6100_ERR_OK )
1928 {
1929 fLoadEventReserved = TRUE;
1930 /* Reserve an entry for the substract and store event in the mixer memory. */
1931 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusSubStoreEventIndex );
1932 if ( ulResult == cOCT6100_ERR_OK )
1933 {
1934 fStoreEventReserved = TRUE;
1935
1936 /* If using the SOUT port, we must copy this entry */
1937 if( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
1938 {
1939 /* Reserve an entry for the copy event in the mixer memory. */
1940 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusCopyEventIndex );
1941 if ( ulResult == cOCT6100_ERR_OK )
1942 {
1943 fCopyEventReserved = TRUE;
1944
1945 /* Reserve a SIN copy entry if none were reserved before. */
1946 if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX )
1947 {
1948 /* Reserve an entry for the extra tsi chariot memory. */
1949 ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance,
1950 &pChanEntry->usExtraSinTsiMemIndex );
1951
1952 if ( ulResult == cOCT6100_ERR_OK )
1953 fExtraSinTsiReserved = TRUE;
1954 }
1955 }
1956 }
1957 }
1958 }
1959
1960 if ( ( ulResult == cOCT6100_ERR_OK ) && ( f_fTap == TRUE ) )
1961 {
1962 /* Reserve a "tap" bridge. */
1963 tOCT6100_CONF_BRIDGE_OPEN ConfBridgeOpen;
1964 UINT32 ulTapBridgeHndl = 0;
1965
1966 Oct6100ConfBridgeOpenDef( &ConfBridgeOpen );
1967
1968 ConfBridgeOpen.pulConfBridgeHndl = &ulTapBridgeHndl;
1969
1970 ulResult = Oct6100ConfBridgeOpenSer( f_pApiInstance, &ConfBridgeOpen );
1971
1972 *f_pusTapBridgeIndex = (UINT16)( ulTapBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
1973 }
1974
1975 if ( ulResult != cOCT6100_ERR_OK )
1976 {
1977 if ( fLoadEventReserved == TRUE )
1978 {
1979 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusLoadEventIndex );
1980 if ( ulTempVar != cOCT6100_ERR_OK )
1981 return ulTempVar;
1982 }
1983
1984 if ( fStoreEventReserved == TRUE )
1985 {
1986 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusSubStoreEventIndex );
1987 if ( ulTempVar != cOCT6100_ERR_OK )
1988 return ulTempVar;
1989 }
1990
1991 if ( fCopyEventReserved == TRUE )
1992 {
1993 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusCopyEventIndex );
1994 if ( ulTempVar != cOCT6100_ERR_OK )
1995 return ulTempVar;
1996 }
1997
1998 if ( fExtraSinTsiReserved == TRUE )
1999 {
2000 ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraSinTsiMemIndex );
2001 if ( ulTempVar != cOCT6100_ERR_OK )
2002 return ulTempVar;
2003
2004 pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
2005 }
2006
2007 return ulResult;
2008 }
2009
2010 /*=======================================================================*/
2011 }
2012
2013 return cOCT6100_ERR_OK;
2014 }
2015 #endif
2016
2017
2018 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
2019
2020 Function: Oct6100ApiBridgeEventAdd
2021
2022 Description: Add the event into the global event list of the chip and update
2023 the bridge and channel structures.
2024
2025 -------------------------------------------------------------------------------
2026 | Argument | Description
2027 -------------------------------------------------------------------------------
2028 f_pApiInstance Pointer to API instance. This memory is used to
2029 keep the present state of the chip and all its
2030 resources.
2031 f_usBridgeIndex Index of the current bridge in the API list.
2032 f_usChanIndex Index of the current channel in the API list.
2033 f_fFlexibleConfBridge If this is a flexible conference bridge.
2034 f_usLoadEventIndex Allocated entry for the Load event of the
2035 channel.
2036 f_usSubStoreEventIndex Allocated entry for the substract and store
2037 event of the channel.
2038 f_usCopyEventIndex Allocated entry for the copy event of the
2039 channel.
2040 f_ulInputPort Input port where to copy samples from.
2041 f_fMute Mute flag indicating if the channel is added in
2042 a mute state.
2043 f_ulListenerMaskIndex Index of the listener in this flexible conference bridge.
2044 f_ulListenerMask Mask of listeners in this flexible conference bridge.
2045
2046 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
2047 #if !SKIP_Oct6100ApiBridgeEventAdd
2048 UINT32 Oct6100ApiBridgeEventAdd(
2049 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
2050 IN UINT16 f_usBridgeIndex,
2051 IN UINT16 f_usChanIndex,
2052 IN UINT8 f_fFlexibleConfBridge,
2053 IN UINT16 f_usLoadEventIndex,
2054 IN UINT16 f_usSubStoreEventIndex,
2055 IN UINT16 f_usCopyEventIndex,
2056 IN UINT32 f_ulInputPort,
2057 IN UINT8 f_fMute,
2058 IN UINT32 f_ulListenerMaskIndex,
2059 IN UINT32 f_ulListenerMask,
2060 IN UINT8 f_fTap,
2061 IN UINT16 f_usTapBridgeIndex,
2062 IN UINT16 f_usTapChanIndex )
2063 {
2064 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
2065
2066 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
2067 tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry;
2068 tPOCT6100_API_MIXER_EVENT pTempEntry;
2069
2070 tPOCT6100_API_CHANNEL pEchoChanEntry;
2071 tPOCT6100_API_CHANNEL pTapEchoChanEntry = NULL;
2072 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
2073
2074 tPOCT6100_SHARED_INFO pSharedInfo;
2075 tOCT6100_WRITE_PARAMS WriteParams;
2076
2077 UINT32 ulResult;
2078 UINT16 usChannelIndex;
2079 UINT16 usLastSubStoreEventIndex;
2080 UINT16 usLastLoadEventIndex;
2081
2082 BOOL fAddSinCopy = FALSE;
2083
2084 /* Obtain local pointer to shared portion of instance. */
2085 pSharedInfo = f_pApiInstance->pSharedInfo;
2086
2087 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
2088
2089 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
2090
2091 /* Get the bridge and channel entries of interest. */
2092 if ( f_fTap == FALSE )
2093 {
2094 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usBridgeIndex );
2095 }
2096 else
2097 {
2098 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usTapBridgeIndex );
2099 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTapEchoChanEntry, f_usTapChanIndex );
2100 }
2101 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
2102
2103 if ( f_fFlexibleConfBridge == TRUE )
2104 {
2105 tPOCT6100_API_FLEX_CONF_PARTICIPANT pNewParticipant;
2106 tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant;
2107
2108 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pNewParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
2109
2110 /* Search through the list of API channel entry for the ones onto this bridge. */
2111 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
2112 {
2113 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
2114
2115 /* Channel reserved? */
2116 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
2117 {
2118 /* On current bridge? */
2119 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
2120 {
2121 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
2122
2123 /* Check if we can hear this participant. */
2124 if ( ( pTempEchoChanEntry->fMute == FALSE ) && ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 ) )
2125 {
2126 /* First create/update the current channel's mixer. */
2127 ulResult = Oct6100ApiBridgeAddParticipantToChannel(
2128 f_pApiInstance,
2129 f_usBridgeIndex,
2130 usChannelIndex,
2131 f_usChanIndex,
2132 pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ],
2133 f_usSubStoreEventIndex,
2134 f_usCopyEventIndex,
2135 pCurrentParticipant->ulInputPort,
2136 f_ulInputPort );
2137 if ( ulResult != cOCT6100_ERR_OK )
2138 return ulResult;
2139 }
2140
2141 /* Check if this participant can hear us. */
2142 if ( ( f_fMute == FALSE ) && ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 ) )
2143 {
2144 /* Then create/update this channel's mixer. */
2145 ulResult = Oct6100ApiBridgeAddParticipantToChannel(
2146 f_pApiInstance,
2147 f_usBridgeIndex,
2148 f_usChanIndex,
2149 usChannelIndex,
2150 pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ],
2151 pTempEchoChanEntry->usSubStoreEventIndex,
2152 pTempEchoChanEntry->usSinCopyEventIndex,
2153 f_ulInputPort,
2154 pCurrentParticipant->ulInputPort );
2155 if ( ulResult != cOCT6100_ERR_OK )
2156 return ulResult;
2157
2158 /* Check if the Rin silence event can be cleared now that the */
2159 /* channel has been added to a conference. */
2160 if ( ( pCurrentParticipant->fFlexibleMixerCreated == TRUE )
2161 && ( pTempEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) )
2162 {
2163 /* Remove the event from the list. */
2164 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
2165 pTempEchoChanEntry->usRinSilenceEventIndex,
2166 cOCT6100_EVENT_TYPE_SOUT_COPY );
2167 if ( ulResult != cOCT6100_ERR_OK )
2168 return ulResult;
2169
2170 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempEchoChanEntry->usRinSilenceEventIndex );
2171 if ( ulResult != cOCT6100_ERR_OK )
2172 return cOCT6100_ERR_FATAL_DF;
2173
2174 pTempEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX;
2175 }
2176 }
2177 }
2178 }
2179 }
2180
2181 /* Check if the mixer for the destination channel has been created. */
2182 if ( pNewParticipant->fFlexibleMixerCreated == FALSE )
2183 {
2184 /* Save store event index that might be used for next channel added. */
2185 pEchoChanEntry->usSubStoreEventIndex = f_usSubStoreEventIndex;
2186 }
2187 else
2188 {
2189 /* Check if the Rin silence event can be cleared now that the */
2190 /* channel has been added to a conference. */
2191 if ( pEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX )
2192 {
2193 /* Remove the event from the list.*/
2194 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
2195 pEchoChanEntry->usRinSilenceEventIndex,
2196 cOCT6100_EVENT_TYPE_SOUT_COPY );
2197 if ( ulResult != cOCT6100_ERR_OK )
2198 return ulResult;
2199
2200 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usRinSilenceEventIndex );
2201 if ( ulResult != cOCT6100_ERR_OK )
2202 return cOCT6100_ERR_FATAL_DF;
2203
2204 pEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX;
2205 }
2206 }
2207
2208 pNewParticipant->ulListenerMaskIndex = f_ulListenerMaskIndex;
2209 pNewParticipant->ulListenerMask = f_ulListenerMask;
2210
2211 /* Remember this channel's input port. */
2212 pNewParticipant->ulInputPort = f_ulInputPort;
2213
2214 /*=======================================================================*/
2215 }
2216 else /* if ( f_fFlexibleConfBridge == FALSE ) */
2217 {
2218 /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */
2219 if ( ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( f_fTap == FALSE ) )
2220 {
2221 if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
2222 {
2223 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
2224 pEchoChanEntry->usSinTsstIndex,
2225 pEchoChanEntry->usExtraSinTsiMemIndex,
2226 pEchoChanEntry->TdmConfig.bySinPcmLaw );
2227 if ( ulResult != cOCT6100_ERR_OK )
2228 return ulResult;
2229 }
2230
2231 /* If the silence TSI is loaded on this port, update with the extra sin TSI. */
2232 if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
2233 {
2234 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2235
2236 WriteParams.ulWriteAddress += 2;
2237 WriteParams.usWriteData = pEchoChanEntry->usExtraSinTsiMemIndex;
2238
2239 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2240 if ( ulResult != cOCT6100_ERR_OK )
2241 return ulResult;
2242 }
2243 }
2244
2245 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex );
2246 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
2247
2248 /*=======================================================================*/
2249 /* Program the Load event.*/
2250 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2251
2252 if ( ( f_fMute == FALSE ) || ( f_fTap == TRUE ) )
2253 {
2254 if ( pBridgeEntry->usLoadIndex != cOCT6100_INVALID_INDEX )
2255 {
2256 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
2257
2258 /* Set the event type. */
2259 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
2260
2261 if ( f_fTap == TRUE )
2262 return cOCT6100_ERR_FATAL_D1;
2263 }
2264 else /* pBridgeEntry->usLoadIndex == cOCT6100_INVALID_INDEX */
2265 {
2266 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
2267
2268 /* Modify the bridge entry to show store the new load index.*/
2269 pBridgeEntry->usLoadIndex = f_usLoadEventIndex;
2270
2271 /* Set the event type.*/
2272 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
2273 }
2274
2275 /* Select the TSI memory index according to the source port. */
2276 if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2277 {
2278 if ( f_fTap == FALSE )
2279 {
2280 WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex;
2281 }
2282 else
2283 {
2284 tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry;
2285 UINT16 usTempWriteData;
2286 UINT32 ulTempWriteAddress;
2287
2288 /* Save temp write data before trying to clear the Rin TSST. */
2289 usTempWriteData = WriteParams.usWriteData;
2290 ulTempWriteAddress = WriteParams.ulWriteAddress;
2291
2292 /* Clear the Rin TSST if used. */
2293 if ( pTapEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
2294 {
2295 /* Deactivate the TSST entry.*/
2296 WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pTapEchoChanEntry->usRinTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE );
2297 WriteParams.usWriteData = 0x0000;
2298
2299 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2300 if ( ulResult != cOCT6100_ERR_OK )
2301 return ulResult;
2302 }
2303
2304 /* Reassign write data that might have been cleared by write above. */
2305 WriteParams.usWriteData = usTempWriteData;
2306 WriteParams.ulWriteAddress = ulTempWriteAddress;
2307 WriteParams.usWriteData |= pTapEchoChanEntry->usRinRoutTsiMemIndex;
2308
2309 /* Remember that this channel is being tapped by us. */
2310 pTapEchoChanEntry->fBeingTapped = TRUE;
2311 pTapEchoChanEntry->usTapChanIndex = f_usChanIndex;
2312
2313 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pTempBridgeEntry, f_usBridgeIndex );
2314
2315 pTempBridgeEntry->usNumTappedClients++;
2316 }
2317 }
2318 else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
2319 {
2320 WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex;
2321 }
2322 }
2323 else /* f_fMute == TRUE */
2324 {
2325 /* Do not load the sample if the channel is muted. */
2326 if ( pBridgeEntry->usNumClients == 0 )
2327 {
2328 /* If the participant to be added is muted, and it would cause the conference to */
2329 /* be completely muted, load the silence TSI. */
2330 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
2331 WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */
2332
2333 /* We know for sure that the load of the bridge will be the silence one. */
2334 pBridgeEntry->usSilenceLoadEventPtr = f_usLoadEventIndex;
2335 }
2336 else
2337 {
2338 /* Do nothing! */
2339 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
2340 }
2341
2342 /* Set the event type. */
2343 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
2344 }
2345
2346 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2347 if ( ulResult != cOCT6100_ERR_OK )
2348 return ulResult;
2349
2350 /*=======================================================================*/
2351
2352 /*=======================================================================*/
2353 /* Program the Substract and store event.*/
2354 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2355
2356 if ( ( f_fMute == FALSE ) && ( f_fTap == FALSE ) )
2357 {
2358 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE;
2359 /* Select the TSI memory index and PCM law according to the source port. */
2360 if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2361 {
2362 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
2363 WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex;
2364 }
2365 else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
2366 {
2367 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
2368 WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex;
2369 }
2370
2371 /* Set the event type. */
2372 pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE;
2373 }
2374 else /* f_fMute == TRUE */
2375 {
2376 /* Do not substore the sample if the channel is muted. */
2377 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE;
2378
2379 /* Select the PCM law according to the source port. */
2380 if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2381 {
2382 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
2383 }
2384 else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
2385 {
2386 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
2387 }
2388 /* Set the event type. */
2389 pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE;
2390 }
2391
2392 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2393 if ( ulResult != cOCT6100_ERR_OK )
2394 return ulResult;
2395
2396 WriteParams.ulWriteAddress += 2;
2397 WriteParams.usWriteData = pEchoChanEntry->usRinRoutTsiMemIndex;
2398
2399 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2400 if ( ulResult != cOCT6100_ERR_OK )
2401 return ulResult;
2402
2403 /*=======================================================================*/
2404
2405
2406 /*=======================================================================*/
2407 /* Program the Copy event - if using the SOUT port */
2408 if ( ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( f_fTap == FALSE ) )
2409 {
2410 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2411
2412 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY;
2413 WriteParams.usWriteData |= pEchoChanEntry->usExtraSinTsiMemIndex;
2414 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
2415
2416 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2417 if ( ulResult != cOCT6100_ERR_OK )
2418 return ulResult;
2419
2420 WriteParams.ulWriteAddress += 2;
2421 WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex;
2422
2423 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2424 if ( ulResult != cOCT6100_ERR_OK )
2425 return ulResult;
2426
2427 /* Set add copy event flag. */
2428 fAddSinCopy = TRUE;
2429
2430 /* For sure. */
2431 pEchoChanEntry->fCopyEventCreated = TRUE;
2432 }
2433 else if ( f_fTap == TRUE )
2434 {
2435 /* Accumulate the tapped channel's voice instead of building a copy event. */
2436
2437 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2438
2439 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
2440 WriteParams.usWriteData |= pTapEchoChanEntry->usSinSoutTsiMemIndex;
2441
2442 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2443 if ( ulResult != cOCT6100_ERR_OK )
2444 return ulResult;
2445
2446 /* Link to next operation. */
2447 WriteParams.ulWriteAddress += 4;
2448 WriteParams.usWriteData = f_usSubStoreEventIndex;
2449
2450 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2451 if ( ulResult != cOCT6100_ERR_OK )
2452 return ulResult;
2453
2454 /* Update the software model. */
2455 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, f_usCopyEventIndex );
2456
2457 pTempEntry->usSourceChanIndex = f_usTapChanIndex;
2458 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
2459 pTempEntry->usNextEventPtr = f_usSubStoreEventIndex;
2460 pTempEntry->usDestinationChanIndex = cOCT6100_INVALID_INDEX;
2461 pTempEntry->fReserved = TRUE;
2462 }
2463 /*=======================================================================*/
2464
2465 /*=======================================================================*/
2466 /* Now insert the event into the list.*/
2467 if ( pBridgeEntry->usNumClients == 0 )
2468 {
2469 /* This is the first entry for this bridge. Insert the two events at the head
2470 of the list just after the last sub-store event.*/
2471 if ( f_fTap == FALSE )
2472 {
2473 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usLastSubStoreEventIndex );
2474 if ( ulResult != cOCT6100_ERR_OK )
2475 {
2476 if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND )
2477 {
2478 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
2479 {
2480 usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE;
2481 }
2482 else
2483 {
2484 usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
2485 }
2486 }
2487 else
2488 {
2489 return cOCT6100_ERR_FATAL_26;
2490 }
2491 }
2492 }
2493 else
2494 {
2495 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
2496 {
2497 usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE;
2498 }
2499 else
2500 {
2501 usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
2502 }
2503 }
2504
2505 /* An Entry was found, now, modify it's value.*/
2506 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex );
2507
2508 /* Set the Sub-Store event first.*/
2509 pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE;
2510 pSubStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr;
2511
2512 /*=======================================================================*/
2513 /* Program the Sub-Store event. */
2514 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2515 WriteParams.ulWriteAddress += 4;
2516 WriteParams.usWriteData = (UINT16)( pSubStoreEventEntry->usNextEventPtr );
2517
2518 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2519 if ( ulResult != cOCT6100_ERR_OK )
2520 return ulResult;
2521
2522 /*=======================================================================*/
2523
2524 /* Set the load/accumulate event now.*/
2525 if ( f_fTap == FALSE )
2526 {
2527 pLoadEventEntry->usNextEventPtr = f_usSubStoreEventIndex;
2528 }
2529 else
2530 {
2531 /* This is a little tricky, we use the copy event index for accumulating the tapped channel's voice. */
2532 pLoadEventEntry->usNextEventPtr = f_usCopyEventIndex;
2533 }
2534
2535 /*=======================================================================*/
2536 /* Program the load/accumulate event. */
2537 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2538 WriteParams.ulWriteAddress += 4;
2539
2540 WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr );
2541
2542 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2543 if ( ulResult != cOCT6100_ERR_OK )
2544 return ulResult;
2545
2546 /*=======================================================================*/
2547
2548 /* Now modify the previous last Sub Store event from another bridge. */
2549 pTempEntry->usNextEventPtr = f_usLoadEventIndex;
2550
2551 /*=======================================================================*/
2552 /* Modify the last node of the other bridge. */
2553 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2554 WriteParams.ulWriteAddress += 4;
2555
2556 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
2557
2558 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2559 if ( ulResult != cOCT6100_ERR_OK )
2560 return ulResult;
2561
2562 /*=======================================================================*/
2563
2564 /* Set the event pointer info in the bridge stucture. */
2565 pBridgeEntry->usFirstLoadEventPtr = f_usLoadEventIndex;
2566 pBridgeEntry->usFirstSubStoreEventPtr = f_usSubStoreEventIndex;
2567 pBridgeEntry->usLastSubStoreEventPtr = f_usSubStoreEventIndex;
2568
2569 /* Update the global mixer pointers. */
2570 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == cOCT6100_INVALID_INDEX )
2571 {
2572 /* This bridge is the first to generate mixer event. */
2573 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadEventIndex;
2574 pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex;
2575 }
2576 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex )
2577 {
2578 /* The two entries were added at the end of the bridge section, */
2579 /* change only the last pointer. */
2580 pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex;
2581 }
2582 else if ( usLastSubStoreEventIndex == cOCT6100_MIXER_HEAD_NODE ||
2583 usLastSubStoreEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr )
2584 {
2585 /* The two entries were added at the start of the bridge section, */
2586 /* change only the first pointer. */
2587 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadEventIndex;
2588 }
2589 }
2590 else /* pBridgeEntry->usNumClients != 0 */
2591 {
2592 /* For sanity. */
2593 if ( f_fTap == TRUE )
2594 return cOCT6100_ERR_FATAL_D2;
2595
2596 /*=======================================================================*/
2597 /* Program the Load event. */
2598
2599 /* Now find the last load entry of this bridge. */
2600 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, pBridgeEntry->usFirstSubStoreEventPtr, 0, &usLastLoadEventIndex );
2601 if ( ulResult != cOCT6100_ERR_OK )
2602 return ulResult;
2603
2604 /* Add the load/accumulate event to the list. */
2605 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastLoadEventIndex );
2606
2607 /* Set the load event now. */
2608 pLoadEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr;
2609
2610 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2611 WriteParams.ulWriteAddress += 4;
2612
2613 WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr );
2614
2615 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2616 if ( ulResult != cOCT6100_ERR_OK )
2617 return ulResult;
2618
2619 /*=======================================================================*/
2620
2621
2622 /*=======================================================================*/
2623 /* Modify the previous last load event. */
2624
2625 /* Now modify the previous last load event. */
2626 pTempEntry->usNextEventPtr = f_usLoadEventIndex;
2627
2628 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2629 WriteParams.ulWriteAddress += 4;
2630
2631 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
2632
2633 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2634 if ( ulResult != cOCT6100_ERR_OK )
2635 return ulResult;
2636
2637 /*=======================================================================*/
2638
2639
2640 /*=======================================================================*/
2641 /* Program the Sub-Store event. */
2642
2643 usLastSubStoreEventIndex = pBridgeEntry->usLastSubStoreEventPtr;
2644
2645 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex );
2646
2647 /* Set the Sub-Store event first. */
2648 pSubStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr;
2649
2650 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2651 WriteParams.ulWriteAddress += 4;
2652
2653 WriteParams.usWriteData = (UINT16)( pSubStoreEventEntry->usNextEventPtr );
2654
2655 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2656 if ( ulResult != cOCT6100_ERR_OK )
2657 return ulResult;
2658
2659 /*=======================================================================*/
2660
2661
2662 /*=======================================================================*/
2663 /* Modify the previous last sub store event of the bridge. */
2664
2665 /* Now modify the last Load event of the bridge. */
2666 pTempEntry->usNextEventPtr = f_usSubStoreEventIndex;
2667
2668 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2669 WriteParams.ulWriteAddress += 4;
2670
2671 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
2672
2673 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2674 if ( ulResult != cOCT6100_ERR_OK )
2675 return ulResult;
2676
2677 /*=======================================================================*/
2678
2679 /* Update the bridge pointers. */
2680 pBridgeEntry->usLastSubStoreEventPtr = f_usSubStoreEventIndex;
2681
2682 /* Check if modification to the global mixer pointer are required. */
2683 if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex )
2684 {
2685 /* We have a new last bridge pointer. */
2686 pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex;
2687 }
2688 }
2689
2690 if ( f_fTap == TRUE )
2691 {
2692 if ( pEchoChanEntry->usRinTsstIndex == cOCT6100_INVALID_INDEX )
2693 {
2694 /* Remove the mute on the Rin port. */
2695
2696 UINT32 ulTempData;
2697 UINT32 ulMask;
2698 UINT32 ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usChanIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst;
2699
2700 /* Configure the level control. */
2701
2702 UINT32 ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.usDwordOffset * 4;
2703 UINT32 ulFeatureBitOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.byBitOffset;
2704 UINT32 ulFeatureFieldLength = pSharedInfo->MemoryMap.RinLevelControlOfst.byFieldSize;
2705
2706 ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance,
2707 pEchoChanEntry,
2708 ulBaseAddress + ulFeatureBytesOffset,
2709 &ulTempData);
2710 if ( ulResult != cOCT6100_ERR_OK )
2711 return ulResult;
2712
2713 /* Clear previous value set in the feature field.*/
2714 mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask );
2715
2716 ulTempData &= (~ulMask);
2717
2718 /* Set the DC filter to pass through.*/
2719 ulTempData |= ( cOCT6100_PASS_THROUGH_LEVEL_CONTROL << ulFeatureBitOffset );
2720
2721 /* First read the DWORD where the field is located. */
2722 ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance,
2723 pEchoChanEntry,
2724 ulBaseAddress + ulFeatureBytesOffset,
2725 ulTempData);
2726 if ( ulResult != cOCT6100_ERR_OK )
2727 return ulResult;
2728 }
2729 }
2730
2731 /* Set the event entries as reserved. */
2732 pLoadEventEntry->fReserved = TRUE;
2733 pSubStoreEventEntry->fReserved = TRUE;
2734
2735 /* Store the event indexes into the channel structure. */
2736 pEchoChanEntry->usLoadEventIndex = f_usLoadEventIndex;
2737 pEchoChanEntry->usSubStoreEventIndex = f_usSubStoreEventIndex;
2738
2739 /* Check if must insert the Sin copy event in the list. */
2740 if ( fAddSinCopy == TRUE )
2741 {
2742 /* Now insert the Sin copy event into the list. */
2743 ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance,
2744 f_usCopyEventIndex,
2745 cOCT6100_EVENT_TYPE_SIN_COPY,
2746 f_usChanIndex );
2747 }
2748
2749 /* Check if the Rin silence event can be cleared now that the */
2750 /* channel has been added to a conference. */
2751 if ( ( f_fTap == FALSE ) && ( pEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) )
2752 {
2753 /* Remove the event from the list. */
2754 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
2755 pEchoChanEntry->usRinSilenceEventIndex,
2756 cOCT6100_EVENT_TYPE_SOUT_COPY );
2757 if ( ulResult != cOCT6100_ERR_OK )
2758 return ulResult;
2759
2760 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usRinSilenceEventIndex );
2761 if ( ulResult != cOCT6100_ERR_OK )
2762 return cOCT6100_ERR_FATAL_DF;
2763
2764 pEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX;
2765 }
2766 }
2767
2768 /* Configure the RIN copy mixer entry and memory - if using the RIN port. */
2769 if ( ( f_fFlexibleConfBridge == TRUE ) && ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) )
2770 {
2771 if ( pEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
2772 {
2773 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
2774 pEchoChanEntry->usRinTsstIndex,
2775 pEchoChanEntry->usExtraRinTsiMemIndex,
2776 pEchoChanEntry->TdmConfig.byRinPcmLaw );
2777 if ( ulResult != cOCT6100_ERR_OK )
2778 return ulResult;
2779 }
2780 }
2781
2782 if ( pBridgeEntry->fDominantSpeakerSet == TRUE )
2783 {
2784 /* Dominant speaker is another channel. Set accordingly for this new conference channel. */
2785 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, pBridgeEntry->usDominantSpeakerChanIndex );
2786 if ( ulResult != cOCT6100_ERR_OK )
2787 return ulResult;
2788 }
2789 else
2790 {
2791 /* No dominant speaker set on this bridge yet. */
2792 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED );
2793 if ( ulResult != cOCT6100_ERR_OK )
2794 return ulResult;
2795 }
2796
2797 /* Update the bridge entry. */
2798 pBridgeEntry->usNumClients++;
2799
2800 /* Store the bridge index into the channel structure. */
2801 pEchoChanEntry->usBridgeIndex = f_usBridgeIndex;
2802
2803 /* Store the copy event index into the channel structure. */
2804 if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2805 {
2806 pEchoChanEntry->usSinCopyEventIndex = f_usCopyEventIndex;
2807 }
2808 else
2809 {
2810 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
2811 }
2812
2813 /* Remember if the channel is muted in the conference. */
2814 pEchoChanEntry->fMute = f_fMute;
2815
2816 /* Remember if the channel is a tap in a conference. */
2817 pEchoChanEntry->fTap = f_fTap;
2818
2819 /* We start by not being tapped. */
2820 pEchoChanEntry->fBeingTapped = FALSE;
2821 pEchoChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX;
2822
2823 /* Remember the tap bridge index if necessary. */
2824 if ( pEchoChanEntry->fTap == TRUE )
2825 {
2826 pEchoChanEntry->usTapBridgeIndex = f_usTapBridgeIndex;
2827 }
2828 else
2829 {
2830 pEchoChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX;
2831 }
2832
2833 /* Indicate that the extra SIN TSI is currently in used by the conference bridge. */
2834 if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2835 {
2836 pEchoChanEntry->usExtraSinTsiDependencyCnt++;
2837 }
2838
2839 /* Indicate that the extra RIN TSI is currently in used by the conference bridge. */
2840 if ( ( f_fFlexibleConfBridge == TRUE ) && ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) )
2841 {
2842 pEchoChanEntry->usExtraRinTsiDependencyCnt++;
2843 }
2844
2845 /* Update the chip stats structure. */
2846 pSharedInfo->ChipStats.usNumEcChanUsingMixer++;
2847
2848 return cOCT6100_ERR_OK;
2849 }
2850 #endif
2851
2852
2853 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
2854
2855 Function: Oct6100ApiBridgeAddParticipantToChannel
2856
2857 Description: Used for the flexible conference bridges. Insert a participant
2858 onto a channel that is on a conference.
2859
2860 -------------------------------------------------------------------------------
2861 | Argument | Description
2862 -------------------------------------------------------------------------------
2863 f_pApiInstance Pointer to API instance. This memory is used to keep the
2864 present state of the chip and all its resources.
2865 f_usBridgeIndex Bridge index where this channel is located.
2866 f_usSourceChannelIndex Source channel to copy voice from.
2867 f_usDestinationChannelIndex Destination channel to store resulting voice to.
2868 f_usLoadOrAccumulateEventIndex Load or Accumulate allocated event index.
2869 f_usStoreEventIndex Store allocated event index.
2870 f_usCopyEventIndex Copy allocated event index.
2871 f_ulSourceInputPort Source input port of the conference for this channel.
2872 f_ulDestinationInputPort Destination input port of the conference for this channel.
2873
2874 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
2875 #if !SKIP_Oct6100ApiBridgeAddParticipantToChannel
2876 UINT32 Oct6100ApiBridgeAddParticipantToChannel(
2877 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
2878 IN UINT16 f_usBridgeIndex,
2879 IN UINT16 f_usSourceChannelIndex,
2880 IN UINT16 f_usDestinationChannelIndex,
2881 IN UINT16 f_usLoadOrAccumulateEventIndex,
2882 IN UINT16 f_usStoreEventIndex,
2883 IN UINT16 f_usCopyEventIndex,
2884 IN UINT32 f_ulSourceInputPort,
2885 IN UINT32 f_ulDestinationInputPort )
2886 {
2887 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
2888
2889 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
2890 tPOCT6100_API_MIXER_EVENT pStoreEventEntry;
2891 tPOCT6100_API_MIXER_EVENT pTempEntry;
2892
2893 tPOCT6100_API_CHANNEL pSourceChanEntry;
2894 tPOCT6100_API_CHANNEL pDestinationChanEntry;
2895
2896 tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant;
2897
2898 tPOCT6100_SHARED_INFO pSharedInfo;
2899 tOCT6100_WRITE_PARAMS WriteParams;
2900
2901 UINT32 ulResult;
2902 UINT16 usLastSubStoreEventIndex;
2903 UINT16 usLastLoadEventIndex;
2904 BOOL fInsertCopy = FALSE;
2905
2906 /* Obtain local pointer to shared portion of instance. */
2907 pSharedInfo = f_pApiInstance->pSharedInfo;
2908
2909 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
2910
2911 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
2912
2913 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
2914
2915 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex );
2916 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex );
2917 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex );
2918
2919 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadOrAccumulateEventIndex );
2920 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, f_usStoreEventIndex );
2921
2922 /* Check if we are creating the first event for this channel. */
2923 if ( pDestinationParticipant->fFlexibleMixerCreated == FALSE )
2924 {
2925 /*=======================================================================*/
2926 /* Before creating the participant's flexible mixer, make sure the extra Sin */
2927 /* mixer event is programmed correctly for sending the voice stream to the right place. */
2928
2929 /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */
2930 if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2931 {
2932 if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
2933 {
2934 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
2935 pDestinationChanEntry->usSinTsstIndex,
2936 pDestinationChanEntry->usExtraSinTsiMemIndex,
2937 pDestinationChanEntry->TdmConfig.bySinPcmLaw );
2938 if ( ulResult != cOCT6100_ERR_OK )
2939 return ulResult;
2940 }
2941
2942 /* If the silence TSI is loaded on this port, update with the extra sin TSI. */
2943 if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
2944 {
2945 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2946
2947 WriteParams.ulWriteAddress += 2;
2948 WriteParams.usWriteData = pDestinationChanEntry->usExtraSinTsiMemIndex;
2949
2950 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2951 if ( ulResult != cOCT6100_ERR_OK )
2952 return ulResult;
2953 }
2954 }
2955 /*=======================================================================*/
2956
2957
2958 /*=======================================================================*/
2959 /* Program the load event. This is the first event for this new destination channel. */
2960
2961 /* First set the TSI buffer where the resulting stream should be written to. */
2962 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2963
2964 /* For sure, we are loading. */
2965 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
2966
2967 /* Select the TSI memory index according to the source port. */
2968 if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2969 {
2970 WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex;
2971 }
2972 else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
2973 {
2974 WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex;
2975 }
2976
2977 /* Set the event type. */
2978 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
2979
2980 /* Set the source channel index. */
2981 pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex;
2982
2983 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2984 if ( ulResult != cOCT6100_ERR_OK )
2985 return ulResult;
2986
2987 /*=======================================================================*/
2988
2989
2990
2991 /*=======================================================================*/
2992 /* Program the store event. */
2993
2994 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2995
2996 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE;
2997
2998 /* Select the TSI memory index and PCM law according to the source port. */
2999 if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT )
3000 {
3001 WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
3002 WriteParams.usWriteData |= pDestinationChanEntry->usSinSoutTsiMemIndex;
3003 }
3004 else /* if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
3005 {
3006 WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
3007 WriteParams.usWriteData |= pDestinationChanEntry->usRinRoutTsiMemIndex;
3008 }
3009
3010 /* Set the event type. */
3011 pStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE;
3012
3013 /* Set the destination channel index. */
3014 pStoreEventEntry->usDestinationChanIndex = f_usDestinationChannelIndex;
3015
3016 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3017 if ( ulResult != cOCT6100_ERR_OK )
3018 return ulResult;
3019
3020 WriteParams.ulWriteAddress += 2;
3021 WriteParams.usWriteData = pDestinationChanEntry->usRinRoutTsiMemIndex;
3022
3023 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3024 if ( ulResult != cOCT6100_ERR_OK )
3025 return ulResult;
3026
3027 /*=======================================================================*/
3028
3029
3030
3031 /*=======================================================================*/
3032 /* Program the Copy event - if using the SOUT port */
3033
3034 if ( ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pDestinationChanEntry->fCopyEventCreated == FALSE ) )
3035 {
3036 /* The copy event has not been created, create it once for the life of the participant on the bridge. */
3037 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3038
3039 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY;
3040 WriteParams.usWriteData |= pDestinationChanEntry->usExtraSinTsiMemIndex;
3041 WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
3042
3043 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3044 if ( ulResult != cOCT6100_ERR_OK )
3045 return ulResult;
3046
3047 WriteParams.ulWriteAddress += 2;
3048 WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex;
3049
3050 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3051 if ( ulResult != cOCT6100_ERR_OK )
3052 return ulResult;
3053
3054 pDestinationChanEntry->fCopyEventCreated = TRUE;
3055
3056 /* Set insert copy flag. */
3057 fInsertCopy = TRUE;
3058 }
3059
3060 /*=======================================================================*/
3061
3062
3063
3064 /*=======================================================================*/
3065 /*=======================================================================*/
3066 /* Now, insert the events into the current list. */
3067 /*=======================================================================*/
3068 /*=======================================================================*/
3069
3070 /* This is the first entry for this channel. Insert the two events at the head */
3071 /* of the list just after the last Sub-Store or Store event. */
3072 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, f_usLoadOrAccumulateEventIndex, &usLastSubStoreEventIndex );
3073 if ( ulResult != cOCT6100_ERR_OK )
3074 {
3075 if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND )
3076 {
3077 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
3078 {
3079 usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE;
3080 }
3081 else
3082 {
3083 usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
3084 }
3085 }
3086 else
3087 {
3088 return cOCT6100_ERR_FATAL_26;
3089 }
3090 }
3091
3092 /* An entry was found, now, modify it's value. */
3093 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex );
3094
3095 /*=======================================================================*/
3096
3097
3098 /*=======================================================================*/
3099 /* Link the store event first. */
3100
3101 pStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr;
3102
3103 /* Link the store event. */
3104 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3105 WriteParams.ulWriteAddress += 4;
3106 WriteParams.usWriteData = (UINT16)( pStoreEventEntry->usNextEventPtr );
3107
3108 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3109 if ( ulResult != cOCT6100_ERR_OK )
3110 return ulResult;
3111
3112 /*=======================================================================*/
3113
3114
3115 /*=======================================================================*/
3116 /* Link the load event now.*/
3117
3118 pLoadEventEntry->usNextEventPtr = f_usStoreEventIndex;
3119
3120 /* Link the load event.*/
3121 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3122 WriteParams.ulWriteAddress += 4;
3123
3124 WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr );
3125
3126 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3127 if ( ulResult != cOCT6100_ERR_OK )
3128 return ulResult;
3129
3130 /*=======================================================================*/
3131
3132
3133 /*=======================================================================*/
3134 /* Now modify the previous last Sub-Store or Store event from another bridge, */
3135 /* such that it links to us. */
3136
3137 pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex;
3138
3139 /* Modify the last node of the other bridge. */
3140 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3141 WriteParams.ulWriteAddress += 4;
3142
3143 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
3144
3145 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3146 if ( ulResult != cOCT6100_ERR_OK )
3147 return ulResult;
3148
3149 /*=======================================================================*/
3150
3151
3152 /*=======================================================================*/
3153 /* Set the event pointer info in the bridge stucture. */
3154
3155 if ( pBridgeEntry->usFirstLoadEventPtr == cOCT6100_INVALID_INDEX )
3156 {
3157 /* We only do this once in case of the flexible conference bridges. */
3158 pBridgeEntry->usFirstLoadEventPtr = f_usLoadOrAccumulateEventIndex;
3159 pBridgeEntry->usFirstSubStoreEventPtr = f_usStoreEventIndex;
3160 }
3161
3162 pBridgeEntry->usLastSubStoreEventPtr = f_usStoreEventIndex;
3163
3164 /* Update the global mixer pointers. */
3165 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == cOCT6100_INVALID_INDEX )
3166 {
3167 /* This bridge is the first to generate mixer event. */
3168 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex;
3169 pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex;
3170 }
3171 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex )
3172 {
3173 /* The two entries were added at the end of the bridge section, */
3174 /* change only the last pointer. */
3175 pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex;
3176 }
3177 else if ( usLastSubStoreEventIndex == cOCT6100_MIXER_HEAD_NODE ||
3178 usLastSubStoreEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr )
3179 {
3180 /* The two entries were added at the start of the bridge section, */
3181 /* change only the first pointer.*/
3182 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex;
3183 }
3184
3185 /*=======================================================================*/
3186
3187
3188 /*=======================================================================*/
3189 /* Insert the copy event if needed in the mixer's list. */
3190
3191 if ( fInsertCopy == TRUE )
3192 {
3193 /* Now insert the Sin copy event into the list. */
3194 ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance,
3195 f_usCopyEventIndex,
3196 cOCT6100_EVENT_TYPE_SIN_COPY,
3197 f_usDestinationChannelIndex );
3198 if ( ulResult != cOCT6100_ERR_OK )
3199 return ulResult;
3200 }
3201
3202 /*=======================================================================*/
3203
3204
3205 /*=======================================================================*/
3206 /* Update the status of the instance structures. */
3207
3208 pDestinationParticipant->fFlexibleMixerCreated = TRUE;
3209
3210 /* Set the event entries as reserved. */
3211 pLoadEventEntry->fReserved = TRUE;
3212 pStoreEventEntry->fReserved = TRUE;
3213
3214 /* Store the event indexes into the channel structure. */
3215 pDestinationChanEntry->usLoadEventIndex = f_usLoadOrAccumulateEventIndex;
3216 pDestinationChanEntry->usSubStoreEventIndex = f_usStoreEventIndex;
3217
3218 /*=======================================================================*/
3219 }
3220 else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == TRUE ) */
3221 {
3222 /*=======================================================================*/
3223 /* Program the Accumulate event. */
3224
3225 /* First set the TSI buffer where the resulting stream should be written to. */
3226 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3227
3228 /* For sure, we are accumulating. */
3229 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
3230
3231 /* Select the TSI memory index according to the source port. */
3232 if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT )
3233 {
3234 WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex;
3235 }
3236 else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
3237 {
3238 WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex;
3239 }
3240
3241 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3242 if ( ulResult != cOCT6100_ERR_OK )
3243 return ulResult;
3244
3245 /*=======================================================================*/
3246
3247
3248
3249 /*=======================================================================*/
3250 /*=======================================================================*/
3251 /* Now, insert the Accumulate event into the current list. */
3252 /*=======================================================================*/
3253 /*=======================================================================*/
3254
3255 /* Use the Load entry of this channel. */
3256 usLastLoadEventIndex = pDestinationChanEntry->usLoadEventIndex;
3257
3258 /* Add the Accumulate event to the list. */
3259 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastLoadEventIndex );
3260
3261 /* Set the accumulate event now. */
3262 pLoadEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr;
3263
3264 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3265 WriteParams.ulWriteAddress += 4;
3266
3267 WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr );
3268
3269 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3270 if ( ulResult != cOCT6100_ERR_OK )
3271 return ulResult;
3272
3273 /*=======================================================================*/
3274
3275
3276
3277 /*=======================================================================*/
3278 /* Modify the previous Load event. */
3279
3280 /* Now modify the previous Load event. */
3281 pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex;
3282
3283 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3284 WriteParams.ulWriteAddress += 4;
3285
3286 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
3287
3288 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3289 if ( ulResult != cOCT6100_ERR_OK )
3290 return ulResult;
3291
3292 /*=======================================================================*/
3293
3294
3295
3296 /*=======================================================================*/
3297 /* Update the status of the instance structures. */
3298
3299 /* Set the Accumulate event entry as reserved. */
3300 pLoadEventEntry->fReserved = TRUE;
3301 /* Set the Event type. */
3302 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
3303 /* Set the source channel index. */
3304 pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex;
3305
3306 /*=======================================================================*/
3307 }
3308
3309 return cOCT6100_ERR_OK;
3310 }
3311 #endif
3312
3313
3314 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3315
3316 Function: Oct6100ConfBridgeChanRemoveSer
3317
3318 Description: Removes an echo channel from a conference bridge.
3319
3320 -------------------------------------------------------------------------------
3321 | Argument | Description
3322 -------------------------------------------------------------------------------
3323 f_pApiInstance Pointer to API instance. This memory is used to keep the
3324 present state of the chip and all its resources.
3325
3326 f_pConfBridgeRemove Pointer to conference bridge channel remove structure.
3327
3328 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3329 #if !SKIP_Oct6100ConfBridgeChanRemoveSer
3330 UINT32 Oct6100ConfBridgeChanRemoveSer(
3331 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3332 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove )
3333 {
3334 UINT16 usBridgeIndex;
3335 UINT16 usChanIndex = 0;
3336 UINT16 usLoadEventIndex;
3337 UINT16 usSubStoreEventIndex;
3338 UINT16 usCopyEventIndex;
3339 UINT32 ulResult;
3340 UINT8 fFlexibleConfBridge;
3341 UINT8 fTap;
3342
3343 /* Check the validity of the channel and conference bridge given. */
3344 ulResult = Oct6100ApiCheckChanRemoveParams(
3345 f_pApiInstance,
3346 f_pConfBridgeRemove,
3347 &usBridgeIndex,
3348 &usChanIndex,
3349 &fFlexibleConfBridge,
3350 &fTap,
3351 &usLoadEventIndex,
3352 &usSubStoreEventIndex,
3353 &usCopyEventIndex );
3354 if ( ulResult != cOCT6100_ERR_OK )
3355 return ulResult;
3356
3357 /* Release all resources reserved for the conference bridge. */
3358 ulResult = Oct6100ApiReleaseChanEventResources(
3359 f_pApiInstance,
3360 f_pConfBridgeRemove,
3361 usBridgeIndex,
3362 usChanIndex,
3363 fFlexibleConfBridge,
3364 usLoadEventIndex,
3365 usSubStoreEventIndex,
3366 usCopyEventIndex );
3367 if ( ulResult != cOCT6100_ERR_OK )
3368 return ulResult;
3369
3370 /* Clear the memory entry for this channel within the bridge. */
3371 ulResult = Oct6100ApiBridgeEventRemove(
3372 f_pApiInstance,
3373 f_pConfBridgeRemove,
3374 usBridgeIndex,
3375 usChanIndex,
3376 fFlexibleConfBridge,
3377 usLoadEventIndex,
3378 usSubStoreEventIndex,
3379 usCopyEventIndex,
3380 fTap );
3381 if ( ulResult != cOCT6100_ERR_OK )
3382 return ulResult;
3383
3384 return cOCT6100_ERR_OK;
3385 }
3386 #endif
3387
3388
3389 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3390
3391 Function: Oct6100ApiCheckChanRemoveParams
3392
3393 Description: Check the validity of the channel and conference bridge given.
3394
3395 -------------------------------------------------------------------------------
3396 | Argument | Description
3397 -------------------------------------------------------------------------------
3398 f_pApiInstance Pointer to API instance. This memory is used to keep the
3399 present state of the chip and all its resources.
3400 f_pConfBridgeRemove Pointer to conference bridge channenl add structure.
3401 f_pusBridgeIndex Pointer to the bridge index.
3402 f_pfFlexibleConfBridge If this is a flexible conference bridge
3403 f_pusChannelIndex Pointer to the channel index to be added to the bridge.
3404 f_pusLoadEventIndex Pointer to the load mixer event.
3405 f_pusSubStoreEventIndex Pointer to the sub-store mixer event.
3406 f_pusCopyEventIndex Pointer to the copy mixer event.
3407
3408 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3409 #if !SKIP_Oct6100ApiCheckChanRemoveParams
3410 UINT32 Oct6100ApiCheckChanRemoveParams(
3411 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3412 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove,
3413 OUT PUINT16 f_pusBridgeIndex,
3414 OUT PUINT16 f_pusChannelIndex,
3415 OUT PUINT8 f_pfFlexibleConfBridge,
3416 OUT PUINT8 f_pfTap,
3417 OUT PUINT16 f_pusLoadEventIndex,
3418 OUT PUINT16 f_pusSubStoreEventIndex,
3419 OUT PUINT16 f_pusCopyEventIndex )
3420 {
3421 UINT32 ulEntryOpenCnt;
3422 tPOCT6100_API_CHANNEL pEchoChanEntry;
3423 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
3424
3425 /* Verify if the remove all flag is valid. */
3426 if ( f_pConfBridgeRemove->fRemoveAll != TRUE &&
3427 f_pConfBridgeRemove->fRemoveAll != FALSE )
3428 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_ALL;
3429
3430 /* Check the channel handle only if the remove all flag is set to FALSE. */
3431 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3432 {
3433 /*=====================================================================*/
3434 /* Check the channel handle. */
3435
3436 if ( (f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
3437 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3438
3439 *f_pusChannelIndex = (UINT16)( f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
3440 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
3441 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3442
3443 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
3444
3445 /* Extract the entry open count from the provided handle. */
3446 ulEntryOpenCnt = (f_pConfBridgeRemove->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
3447
3448 /* Check for errors. */
3449 if ( pEchoChanEntry->fReserved != TRUE )
3450 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
3451 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
3452 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3453 if ( pEchoChanEntry->fBeingTapped == TRUE )
3454 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY;
3455
3456 /*=====================================================================*/
3457
3458 *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex;
3459 *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex;
3460 *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex;
3461 *f_pusCopyEventIndex = pEchoChanEntry->usSinCopyEventIndex;
3462
3463 /* Check if the channel is really part of the bridge. */
3464 if ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX )
3465 return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE;
3466
3467 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
3468
3469 /* Return whether this is a flexible bridge or not. */
3470 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
3471
3472 /* Return whether this is a tap or not. */
3473 *f_pfTap = pEchoChanEntry->fTap;
3474 }
3475 else /* f_pConfBridgeRemove->fRemoveAll == TRUE */
3476 {
3477 /* Check the provided handle. */
3478 if ( (f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
3479 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3480
3481 *f_pusBridgeIndex = (UINT16)( f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
3482 if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
3483 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3484
3485 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
3486
3487 /* Extract the entry open count from the provided handle. */
3488 ulEntryOpenCnt = (f_pConfBridgeRemove->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
3489
3490 /* Check for errors. */
3491 if ( pBridgeEntry->fReserved != TRUE )
3492 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
3493 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
3494 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3495
3496 /* This information is not currently available. */
3497 *f_pusLoadEventIndex = cOCT6100_INVALID_INDEX;
3498 *f_pusSubStoreEventIndex = cOCT6100_INVALID_INDEX;
3499 *f_pusCopyEventIndex = cOCT6100_INVALID_INDEX;
3500
3501 /* Return whether this is a flexible bridge or not. */
3502 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
3503
3504 *f_pfTap = FALSE;
3505 }
3506
3507 return cOCT6100_ERR_OK;
3508 }
3509 #endif
3510
3511
3512 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3513
3514 Function: Oct6100ApiReleaseChanEventResources
3515
3516 Description: Release all resources reserved to the channel part of the
3517 conference bridge.
3518
3519 -------------------------------------------------------------------------------
3520 | Argument | Description
3521 -------------------------------------------------------------------------------
3522 f_pApiInstance Pointer to API instance. This memory is used to keep the
3523 present state of the chip and all its resources.
3524 f_pConfBridgeRemove Pointer to conference bridge channel add structure.
3525 f_usBridgeIndex Index of the bridge structure within the API's bridge list.
3526 f_usChanIndex Index of the channel structure within the API's channel list
3527 f_fFlexibleConfBridge If this is a flexible conference bridge.
3528 f_usLoadEventIndex Index of the load mixer event.
3529 f_usSubStoreEventIndex Index of the sub-store mixer event.
3530 f_usCopyEventIndex Index of the copy mixer event.
3531
3532 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3533 #if !SKIP_Oct6100ApiReleaseChanEventResources
3534 UINT32 Oct6100ApiReleaseChanEventResources(
3535 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3536 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove,
3537 IN UINT16 f_usBridgeIndex,
3538 IN UINT16 f_usChanIndex,
3539 IN UINT8 f_fFlexibleConfBridge,
3540 IN UINT16 f_usLoadEventIndex,
3541 IN UINT16 f_usSubStoreEventIndex,
3542 IN UINT16 f_usCopyEventIndex )
3543 {
3544 tPOCT6100_SHARED_INFO pSharedInfo;
3545 tPOCT6100_API_CHANNEL pEchoChanEntry;
3546 UINT32 ulResult;
3547 UINT32 i;
3548
3549 /* Obtain local pointer to shared portion of instance. */
3550 pSharedInfo = f_pApiInstance->pSharedInfo;
3551
3552 if ( f_fFlexibleConfBridge == TRUE )
3553 {
3554 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
3555 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
3556
3557 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3558 {
3559 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
3560
3561 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
3562 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
3563
3564 /* Release an entry for the store event in the mixer memory. */
3565 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex );
3566 if ( ulResult != cOCT6100_ERR_OK )
3567 {
3568 return ulResult;
3569 }
3570
3571 /* Release an entry for the Sin copy event in the mixer memory. */
3572 /* This value can be invalid if the Rin port was used - no need to release. */
3573 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
3574 {
3575 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex );
3576 if ( ulResult != cOCT6100_ERR_OK )
3577 {
3578 return ulResult;
3579 }
3580 }
3581
3582 /* This value can be 0 if the Rin port was used - no need to release. */
3583 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3584 {
3585 /* Release the extra TSI entry.*/
3586 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3587 if ( ulResult != cOCT6100_ERR_OK )
3588 {
3589 return ulResult;
3590 }
3591 }
3592
3593 /* This value can be 0 if the Sout port was used - no need to release. */
3594 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
3595 {
3596 /* Release the extra TSI entry.*/
3597 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex );
3598 if ( ulResult != cOCT6100_ERR_OK )
3599 {
3600 return ulResult;
3601 }
3602 }
3603
3604 /* Must travel all clients of this conference and release the load or accumulate events for */
3605 /* all participants which can hear us and vice versa. */
3606
3607 /* Search through the list of API channel entry for the ones on to this bridge. */
3608 for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ )
3609 {
3610 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, i );
3611
3612 /* Channel reserved? */
3613 if ( ( i != f_usChanIndex ) && pTempEchoChanEntry->fReserved == TRUE )
3614 {
3615 /* On current bridge? */
3616 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3617 {
3618 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
3619
3620 /* Check if we can hear this participant. */
3621 if ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
3622 {
3623 /* Must release the allocated mixer event. */
3624 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
3625 if ( ulResult != cOCT6100_ERR_OK )
3626 {
3627 return ulResult;
3628 }
3629
3630 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
3631 }
3632
3633 /* Check if this participant can hear us. */
3634 if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
3635 {
3636 /* Must release the allocated mixer event. */
3637 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] );
3638 if ( ulResult != cOCT6100_ERR_OK )
3639 {
3640 return ulResult;
3641 }
3642
3643 pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
3644 }
3645 }
3646 }
3647 }
3648 }
3649 else /* f_pConfBridgeRemove->fRemoveAll == TRUE */
3650 {
3651 UINT32 ulListenerMaskIndex;
3652
3653 ulResult = cOCT6100_ERR_OK;
3654
3655 /* Search through the list of API channel entry for the ones on to this bridge.*/
3656 for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ )
3657 {
3658 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
3659
3660 /* Channel reserved? */
3661 if ( pEchoChanEntry->fReserved == TRUE )
3662 {
3663 /* On current bridge? */
3664 if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3665 {
3666 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
3667
3668 /* Release an entry for the Store event in the Mixer memory. */
3669 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSubStoreEventIndex );
3670 if ( ulResult != cOCT6100_ERR_OK )
3671 {
3672 return ulResult;
3673 }
3674
3675 /* Release an entry for the Sin copy event in the Mixer memory. */
3676 /* This value can be invalid if the Rin port was used - no need to release. */
3677 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
3678 {
3679 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex );
3680 if ( ulResult != cOCT6100_ERR_OK )
3681 {
3682 return ulResult;
3683 }
3684 }
3685
3686 /* This value can be 0 if the Rin port was used - no need to release. */
3687 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3688 {
3689 /* Release the extra TSI entry.*/
3690 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3691 if ( ulResult != cOCT6100_ERR_OK )
3692 {
3693 return ulResult;
3694 }
3695 }
3696
3697 /* This value can be 0 if the Sout port was used - no need to release. */
3698 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
3699 {
3700 /* Release the extra TSI entry.*/
3701 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex );
3702 if ( ulResult != cOCT6100_ERR_OK )
3703 {
3704 return ulResult;
3705 }
3706 }
3707
3708 /* Check if something can be freed. */
3709 for ( ulListenerMaskIndex = 0; ulListenerMaskIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulListenerMaskIndex ++ )
3710 {
3711 if ( pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX )
3712 {
3713 /* Must release the allocated mixer event. */
3714 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] );
3715 if ( ulResult != cOCT6100_ERR_OK )
3716 {
3717 return ulResult;
3718 }
3719
3720 pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
3721 }
3722 }
3723 }
3724 }
3725 }
3726
3727 if ( ulResult != cOCT6100_ERR_OK )
3728 return ulResult;
3729 }
3730 }
3731 else /* if ( f_fFlexibleConfBridge == FALSE ) */
3732 {
3733 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3734 {
3735 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
3736
3737 /* Release the entry for the load event in the mixer memory. */
3738 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usLoadEventIndex );
3739 if ( ulResult != cOCT6100_ERR_OK )
3740 {
3741 return ulResult;
3742 }
3743
3744 /* Release an entry for the substract and store event in the mixer memory. */
3745 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex );
3746 if ( ulResult != cOCT6100_ERR_OK )
3747 {
3748 return ulResult;
3749 }
3750
3751 /* Release an entry for the Sin copy event in the Mixer memory. */
3752 /* This value can be invalid if the Rin port was used - no need to release. */
3753 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
3754 {
3755 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex );
3756 if ( ulResult != cOCT6100_ERR_OK )
3757 {
3758 return ulResult;
3759 }
3760 }
3761
3762 /* This value can be 0 if the Rin port was used - no need to release. */
3763 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3764 {
3765 /* Release the extra TSI entry. */
3766 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3767 if ( ulResult != cOCT6100_ERR_OK )
3768 {
3769 return ulResult;
3770 }
3771 }
3772 }
3773 else /* f_pConfBridgeRemove->fRemoveAll == TRUE */
3774 {
3775 /* Search through the list of API channel entry for the ones on to the specified bridge.*/
3776 for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ )
3777 {
3778 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
3779
3780 if ( pEchoChanEntry->fReserved == TRUE )
3781 {
3782 if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) )
3783 {
3784 /* Release the entry for the load event in the mixer memory. */
3785 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance,
3786 pEchoChanEntry->usLoadEventIndex );
3787 if ( ulResult != cOCT6100_ERR_OK )
3788 {
3789 return ulResult;
3790 }
3791
3792 /* Release an entry for the substract and store event in the Mixer memory. */
3793 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance,
3794 pEchoChanEntry->usSubStoreEventIndex );
3795 if ( ulResult != cOCT6100_ERR_OK )
3796 {
3797 return ulResult;
3798 }
3799
3800 /* Release an entry for the Sin copy event in the Mixer memory. */
3801 /* This value can be invalid if the Rin port was used - no need to release. */
3802 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
3803 {
3804 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance,
3805 pEchoChanEntry->usSinCopyEventIndex );
3806 if ( ulResult != cOCT6100_ERR_OK )
3807 {
3808 return ulResult;
3809 }
3810 }
3811
3812 /* This value can be 0 if the Rin port was used - no need to release. */
3813 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3814 {
3815 /* Release the extra TSI entry.*/
3816 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3817 if ( ulResult != cOCT6100_ERR_OK )
3818 {
3819 return ulResult;
3820 }
3821 }
3822 }
3823 }
3824 }
3825 }
3826 }
3827
3828 return cOCT6100_ERR_OK;
3829 }
3830 #endif
3831
3832
3833 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3834
3835 Function: Oct6100ApiBridgeEventRemove
3836
3837 Description: Remove the event from the global event list of the chip and
3838 update the bridge and channel structures.
3839
3840 -------------------------------------------------------------------------------
3841 | Argument | Description
3842 -------------------------------------------------------------------------------
3843 f_pApiInstance Pointer to API instance. This memory is used to keep the
3844 present state of the chip and all its resources.
3845 f_pConfBridgeRemove Pointer to a conference bridge channel remove structure.
3846 f_usBridgeIndex Index of the current bridge in the API list.
3847 f_usChanIndex Index of the current channel in the API list.
3848 f_fFlexibleConfBridge If this is a flexible conference bridge.
3849 f_usLoadEventIndex Allocated entry for the Load event of the channel.
3850 f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel.
3851 f_usCopyEventIndex Allocated entry for the copy event of the channel.
3852
3853 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3854 #if !SKIP_Oct6100ApiBridgeEventRemove
3855 UINT32 Oct6100ApiBridgeEventRemove (
3856 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3857 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove,
3858 IN UINT16 f_usBridgeIndex,
3859 IN UINT16 f_usChanIndex,
3860 IN UINT8 f_fFlexibleConfBridge,
3861 IN UINT16 f_usLoadEventIndex,
3862 IN UINT16 f_usSubStoreEventIndex,
3863 IN UINT16 f_usCopyEventIndex,
3864 IN UINT8 f_fTap )
3865 {
3866 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
3867
3868 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
3869 tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry;
3870 tPOCT6100_API_MIXER_EVENT pCopyEventEntry = NULL;
3871 tPOCT6100_API_MIXER_EVENT pTempEntry;
3872
3873 tPOCT6100_API_CHANNEL pEchoChanEntry;
3874 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
3875
3876 tPOCT6100_SHARED_INFO pSharedInfo;
3877 tOCT6100_WRITE_PARAMS WriteParams;
3878 tOCT6100_READ_PARAMS ReadParams;
3879
3880 UINT32 ulResult;
3881 UINT16 usPreviousEventIndex;
3882 UINT16 usTempEventIndex;
3883 UINT32 ulLoopCount = 0;
3884 UINT16 usReadData;
3885 UINT16 usChannelIndex;
3886 UINT32 i;
3887
3888 BOOL fRemoveSinCopy = FALSE;
3889
3890 /* Obtain local pointer to shared portion of instance. */
3891 pSharedInfo = f_pApiInstance->pSharedInfo;
3892
3893 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
3894
3895 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
3896
3897 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
3898
3899 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
3900 ReadParams.pusReadData = &usReadData;
3901
3902 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usBridgeIndex );
3903
3904 /* If no client on the bridge, and the remove all option is specified, return here. */
3905 if ( ( pBridgeEntry->usNumClients == 0 ) && ( f_pConfBridgeRemove->fRemoveAll == TRUE ) )
3906 return cOCT6100_ERR_OK;
3907
3908 /* Make sure the dominant speaker feature is disabled first. */
3909 if ( pBridgeEntry->fDominantSpeakerSet == TRUE )
3910 {
3911 /* If all channels are to be removed or if the dominant speaker is the current channel to be removed. */
3912 if ( ( f_pConfBridgeRemove->fRemoveAll == TRUE )
3913 || ( ( f_pConfBridgeRemove->fRemoveAll == FALSE ) && ( pBridgeEntry->usDominantSpeakerChanIndex == f_usChanIndex ) ) )
3914 {
3915 /* Disable on all channels part of this conference. */
3916
3917 /* Search through the list of API channel entry for the ones on to this bridge. */
3918 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
3919 {
3920 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
3921
3922 if ( pTempEchoChanEntry->fReserved == TRUE )
3923 {
3924 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3925 {
3926 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED );
3927 if ( ulResult != cOCT6100_ERR_OK )
3928 return ulResult;
3929 }
3930 }
3931 }
3932
3933 /* Save this in the conference bridge structure. */
3934 pBridgeEntry->fDominantSpeakerSet = FALSE;
3935 pBridgeEntry->usDominantSpeakerChanIndex = cOCT6100_INVALID_INDEX;
3936 }
3937 else
3938 {
3939 /* Only disable this current channel. */
3940 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED );
3941 if ( ulResult != cOCT6100_ERR_OK )
3942 return ulResult;
3943 }
3944 }
3945
3946 if ( f_fFlexibleConfBridge == TRUE )
3947 {
3948 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
3949 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
3950 UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ];
3951 UINT32 ulMutePortChannelIndex;
3952
3953 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
3954 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX;
3955
3956 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3957 {
3958 /* The channel index is valid. */
3959 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
3960 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
3961
3962 /* Search through the list of API channel entry for the ones on to this bridge. */
3963 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
3964 {
3965 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
3966
3967 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
3968 {
3969 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3970 {
3971 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
3972
3973 /* Check if we can hear this participant. */
3974 if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
3975 && ( pParticipant->fFlexibleMixerCreated == TRUE )
3976 && ( pTempEchoChanEntry->fMute == FALSE ) )
3977 {
3978 /* First update the current channel's mixer. */
3979 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
3980 f_pApiInstance,
3981 f_usBridgeIndex,
3982 usChannelIndex,
3983 f_usChanIndex,
3984 TRUE );
3985 if ( ulResult != cOCT6100_ERR_OK )
3986 return ulResult;
3987 }
3988
3989 /* Check if this participant can hear us. */
3990 if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
3991 && ( pTempParticipant->fFlexibleMixerCreated == TRUE )
3992 && ( pEchoChanEntry->fMute == FALSE ) )
3993 {
3994 /* Then update this channel's mixer. */
3995 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
3996 f_pApiInstance,
3997 f_usBridgeIndex,
3998 f_usChanIndex,
3999 usChannelIndex,
4000 TRUE );
4001 if ( ulResult != cOCT6100_ERR_OK )
4002 return ulResult;
4003
4004 /* Remember to mute the port on this channel. */
4005 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4006 {
4007 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex )
4008 {
4009 break;
4010 }
4011 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
4012 {
4013 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex;
4014 break;
4015 }
4016 }
4017 }
4018 }
4019 }
4020 }
4021
4022 /* Check if must manually clear the Sin copy event. */
4023 if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
4024 && ( pEchoChanEntry->fCopyEventCreated == TRUE ) )
4025 {
4026 /* Transform event into no-operation. */
4027 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4028 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4029
4030 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4031 if ( ulResult != cOCT6100_ERR_OK )
4032 return ulResult;
4033
4034 /* Now remove the copy event from the event list. */
4035 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4036 if ( ulResult != cOCT6100_ERR_OK )
4037 return ulResult;
4038
4039 pEchoChanEntry->fCopyEventCreated = FALSE;
4040 }
4041
4042 /* Release an entry for the participant. */
4043 ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex );
4044 if ( ulResult != cOCT6100_ERR_OK )
4045 {
4046 return ulResult;
4047 }
4048
4049 /*=======================================================================*/
4050 /* Update the event and channel API structure */
4051 pEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX;
4052 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
4053 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4054 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4055 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4056
4057 /* Indicate that the extra SIN TSI is not needed anymore by the mixer. */
4058 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4059 {
4060 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4061 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4062 }
4063 else
4064 {
4065 /* Decrement the dependency count, but do not clear the mem index. */
4066 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4067 }
4068
4069 /* Indicate that the extra RIN TSI is not needed anymore by the mixer. */
4070 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
4071 {
4072 pEchoChanEntry->usExtraRinTsiDependencyCnt--;
4073 pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX;
4074 }
4075
4076 /* Update the chip stats structure. */
4077 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4078
4079 pBridgeEntry->usNumClients--;
4080
4081 /* For sure we have to mute the ports of this channel to be removed. */
4082 ulResult = Oct6100ApiMutePorts(
4083 f_pApiInstance,
4084 f_usChanIndex,
4085 pEchoChanEntry->usRinTsstIndex,
4086 pEchoChanEntry->usSinTsstIndex,
4087 FALSE );
4088 if ( ulResult != cOCT6100_ERR_OK )
4089 return ulResult;
4090
4091 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
4092 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4093 {
4094 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
4095 {
4096 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
4097
4098 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
4099
4100 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
4101 {
4102 /* Check if the Rin port must be muted on this channel. */
4103 ulResult = Oct6100ApiMutePorts(
4104 f_pApiInstance,
4105 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
4106 pTempEchoChanEntry->usRinTsstIndex,
4107 pTempEchoChanEntry->usSinTsstIndex,
4108 FALSE );
4109 if ( ulResult != cOCT6100_ERR_OK )
4110 return ulResult;
4111 }
4112 }
4113 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
4114 {
4115 /* No more channels to check for muting. */
4116 break;
4117 }
4118 }
4119 }
4120 else /* if ( f_pConfBridgeRemove->fRemoveAll == TRUE ) */
4121 {
4122 UINT16 usMainChannelIndex;
4123
4124 for ( usMainChannelIndex = 0 ; usMainChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ; usMainChannelIndex++ )
4125 {
4126 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usMainChannelIndex );
4127
4128 /* If this channel is on the bridge we are closing all the channels. */
4129 if ( ( pEchoChanEntry->fReserved == TRUE ) && ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) )
4130 {
4131 /* Remember to mute the port on this channel. */
4132 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4133 {
4134 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usMainChannelIndex )
4135 {
4136 break;
4137 }
4138 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
4139 {
4140 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usMainChannelIndex;
4141 break;
4142 }
4143 }
4144
4145 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
4146
4147 /* Search through the list of API channel entry for the ones on to this bridge. */
4148 for ( usChannelIndex = (UINT16)( usMainChannelIndex + 1 ); usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
4149 {
4150 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
4151 if ( pTempEchoChanEntry->fReserved == TRUE )
4152 {
4153 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
4154 {
4155 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
4156
4157 /* Everyone that we can hear must be removed. */
4158 if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
4159 && ( pParticipant->fFlexibleMixerCreated == TRUE )
4160 && ( pTempEchoChanEntry->fMute == FALSE ) )
4161 {
4162 /* First update the current channel's mixer. */
4163 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
4164 f_pApiInstance,
4165 f_usBridgeIndex,
4166 usChannelIndex,
4167 usMainChannelIndex,
4168 TRUE );
4169 if ( ulResult != cOCT6100_ERR_OK )
4170 return ulResult;
4171 }
4172
4173 /* Check if this participant can hear us. */
4174 if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
4175 && ( pTempParticipant->fFlexibleMixerCreated == TRUE )
4176 && ( pEchoChanEntry->fMute == FALSE ) )
4177 {
4178 /* Then update this channel's mixer. */
4179 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
4180 f_pApiInstance,
4181 f_usBridgeIndex,
4182 usMainChannelIndex,
4183 usChannelIndex,
4184 TRUE );
4185 if ( ulResult != cOCT6100_ERR_OK )
4186 return ulResult;
4187 }
4188 }
4189 }
4190 }
4191
4192 /* Check if must manually clear the Sin copy event. */
4193 if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
4194 && ( pEchoChanEntry->fCopyEventCreated == TRUE ) )
4195 {
4196 /* Transform event into no-operation. */
4197 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4198 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4199
4200 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4201 if ( ulResult != cOCT6100_ERR_OK )
4202 return ulResult;
4203
4204 /* Now remove the copy event from the event list. */
4205 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4206 if ( ulResult != cOCT6100_ERR_OK )
4207 return ulResult;
4208
4209 pEchoChanEntry->fCopyEventCreated = FALSE;
4210 }
4211
4212 /* Release an entry for the participant. */
4213 ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex );
4214 if ( ulResult != cOCT6100_ERR_OK )
4215 {
4216 return ulResult;
4217 }
4218
4219 /*=======================================================================*/
4220 /* Update the event and channel API structure */
4221
4222 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
4223
4224 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4225 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4226 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4227
4228 /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */
4229 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4230 {
4231 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4232 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4233 }
4234 else
4235 {
4236 /* Decrement the dependency count, but do not clear the mem index. */
4237 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4238 }
4239
4240 /* Indicate that the Extra RIN TSI is not needed anymore by the mixer. */
4241 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
4242 {
4243 pEchoChanEntry->usExtraRinTsiDependencyCnt--;
4244 pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX;
4245 }
4246
4247 /* Update the chip stats structure. */
4248 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4249 }
4250 }
4251
4252 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
4253 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4254 {
4255 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
4256 {
4257 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
4258
4259 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
4260
4261 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
4262 {
4263 /* Check if the Rin port must be muted on this channel. */
4264 ulResult = Oct6100ApiMutePorts(
4265 f_pApiInstance,
4266 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
4267 pTempEchoChanEntry->usRinTsstIndex,
4268 pTempEchoChanEntry->usSinTsstIndex,
4269 FALSE );
4270 if ( ulResult != cOCT6100_ERR_OK )
4271 return ulResult;
4272 }
4273 }
4274 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
4275 {
4276 /* No more channels to check for muting. */
4277 break;
4278 }
4279
4280 /* Clear the flexible conf bridge participant index. */
4281 pTempEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX;
4282 }
4283
4284 /* No more clients on bridge. */
4285 pBridgeEntry->usNumClients = 0;
4286 }
4287 }
4288 else /* if ( f_fFlexibleConfBridge == FALSE ) */
4289 {
4290 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
4291 {
4292 /* The channel index is valid. */
4293 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
4294
4295 if ( f_fTap == TRUE )
4296 {
4297 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, pEchoChanEntry->usTapBridgeIndex );
4298 }
4299
4300 /* Get a pointer to the event entry. */
4301 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
4302 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex );
4303 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
4304 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex );
4305
4306 /*=======================================================================*/
4307 /* Check if have to modify the silence load event. */
4308
4309 if ( pBridgeEntry->usNumClients != 1 )
4310 {
4311 if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX )
4312 {
4313 if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex )
4314 {
4315 /* Make sure the next event becomes the silence event. */
4316 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadEventEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4317
4318 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
4319 WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */
4320
4321 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4322 if ( ulResult != cOCT6100_ERR_OK )
4323 return ulResult;
4324
4325 /* Update the software model to remember the silence load. */
4326 pBridgeEntry->usSilenceLoadEventPtr = pLoadEventEntry->usNextEventPtr;
4327 }
4328 else
4329 {
4330 /* Somebody else is the silence event, no need to worry. */
4331 }
4332 }
4333 }
4334
4335 /*=======================================================================*/
4336
4337
4338 /*=======================================================================*/
4339 /* Clear the Load event. */
4340
4341 /* First verify if the event to be removed was a load event. */
4342 if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex )
4343 {
4344 /* Change the next entry if one is present to a load event to keep the bridge alive. */
4345 if ( pBridgeEntry->usNumClients == 1 )
4346 {
4347 /* There is no other entry on the bridge, no need to search for an Accumulate event. */
4348 pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX;
4349
4350 /* Clear the silence event, for sure it's invalid. */
4351 pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX;
4352 }
4353 else
4354 {
4355 /* Search for an accumulate event to tranform into a Load event. */
4356 usTempEventIndex = pLoadEventEntry->usNextEventPtr;
4357 ulLoopCount = 0;
4358
4359 /* Find the copy entry before the entry to remove. */
4360 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
4361
4362 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
4363 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
4364 {
4365 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
4366 {
4367 /* Change this entry into a load event. */
4368 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4369 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
4370 if ( ulResult != cOCT6100_ERR_OK )
4371 return ulResult;
4372
4373 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
4374 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD);
4375
4376 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4377 if ( ulResult != cOCT6100_ERR_OK )
4378 return ulResult;
4379
4380 /* Set this entry as the load index. */
4381 pBridgeEntry->usLoadIndex = usTempEventIndex;
4382
4383 /* Update the software model. */
4384 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
4385
4386 /* Stop searching. */
4387 break;
4388 }
4389
4390 /* Go to the next entry into the list. */
4391 usTempEventIndex = pTempEntry->usNextEventPtr;
4392 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
4393
4394 ulLoopCount++;
4395 if ( ulLoopCount == cOCT6100_MAX_LOOP )
4396 return cOCT6100_ERR_FATAL_9B;
4397 }
4398 }
4399 }
4400
4401 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4402 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4403
4404 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4405 if ( ulResult != cOCT6100_ERR_OK )
4406 return ulResult;
4407
4408 /*=======================================================================*/
4409
4410 /*=======================================================================*/
4411 /* Clear the substract and store event. */
4412 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4413 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4414
4415 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4416 if ( ulResult != cOCT6100_ERR_OK )
4417 return ulResult;
4418
4419 /*=======================================================================*/
4420
4421 /*=======================================================================*/
4422 /* Clear the Copy event - if needed. */
4423
4424 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
4425 {
4426 /* Transform event into no-operation. */
4427 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4428 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4429
4430 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4431 if ( ulResult != cOCT6100_ERR_OK )
4432 return ulResult;
4433
4434 if ( f_fTap == FALSE )
4435 {
4436 /* Set remove Sin copy event flag to remove the event from the mixer's list. */
4437 fRemoveSinCopy = TRUE;
4438
4439 /* Clear the copy event created flag. */
4440 pEchoChanEntry->fCopyEventCreated = FALSE;
4441 }
4442 }
4443
4444 /*=======================================================================*/
4445
4446
4447 /*=======================================================================*/
4448 /* Now remove the event from the event list. */
4449
4450 /* Look for the entry that is pointing at the first entry of our bridge. */
4451 if ( f_fTap == FALSE )
4452 {
4453 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex );
4454 }
4455 else
4456 {
4457 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, pEchoChanEntry->usTapBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex );
4458 }
4459
4460 if ( ulResult != cOCT6100_ERR_OK )
4461 {
4462 /* If the entry was not found, we now check for the Sout copy event section/list. */
4463 if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND )
4464 {
4465 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
4466 {
4467 /* No Sout copy, it has to be the head node. */
4468 usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE;
4469 }
4470 else
4471 {
4472 /* Use the last Sout copy event. */
4473 usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
4474 }
4475 }
4476 else
4477 {
4478 return cOCT6100_ERR_FATAL_27;
4479 }
4480 }
4481
4482 if ( pBridgeEntry->usNumClients == 1 )
4483 {
4484 /* An entry was found, now, modify it's value. */
4485 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4486
4487 /* Now modify the previous last Sub Store event from another bridge. */
4488 pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr;
4489
4490 /*=======================================================================*/
4491 /* Modify the last node of the previous bridge to point to the next bridge. */
4492 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4493 WriteParams.ulWriteAddress += 4;
4494
4495 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
4496
4497 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4498 if ( ulResult != cOCT6100_ERR_OK )
4499 return ulResult;
4500
4501 /*=======================================================================*/
4502
4503 /* Set the event pointer info in the bridge stucture. */
4504 pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX;
4505 pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX;
4506 pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX;
4507
4508 /*=======================================================================*/
4509 /* Update the global mixer pointers. */
4510 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex &&
4511 pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex )
4512 {
4513 /* There is no more bridge entry in the mixer link list. */
4514 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX;
4515 pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX;
4516 }
4517 else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex )
4518 {
4519 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pSubStoreEventEntry->usNextEventPtr;
4520 }
4521 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex )
4522 {
4523 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
4524 }
4525 /*=======================================================================*/
4526
4527 if ( f_fTap == TRUE )
4528 {
4529 /* The channel being tapped is not tapped anymore. */
4530 /* There is no direct way of finding the tap, so loop through all channels and find the */
4531 /* tapped channel index. */
4532 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
4533 {
4534 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
4535
4536 if ( pTempEchoChanEntry->usTapChanIndex == f_usChanIndex )
4537 {
4538 tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry;
4539
4540 pTempEchoChanEntry->fBeingTapped = FALSE;
4541 pTempEchoChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX;
4542
4543 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pTempBridgeEntry, f_usBridgeIndex );
4544
4545 pTempBridgeEntry->usNumTappedClients--;
4546
4547 /* Re-assign Rin TSST for tapped channel. */
4548 if ( pTempEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
4549 {
4550 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
4551 pTempEchoChanEntry->usRinTsstIndex,
4552 pTempEchoChanEntry->usRinRoutTsiMemIndex,
4553 pTempEchoChanEntry->TdmConfig.byRinPcmLaw );
4554 if ( ulResult != cOCT6100_ERR_OK )
4555 return ulResult;
4556 }
4557
4558 break;
4559 }
4560 }
4561
4562 /* Check if our model is broken. */
4563 if ( usChannelIndex == pSharedInfo->ChipConfig.usMaxChannels )
4564 return cOCT6100_ERR_FATAL_D3;
4565 }
4566 }
4567 else /* pBridgeEntry->usNumClients > 1 */
4568 {
4569 if ( pBridgeEntry->usFirstLoadEventPtr != f_usLoadEventIndex )
4570 {
4571 /* Now find the load entry of this bridge pointing at this load event */
4572 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usLoadEventIndex, 0, &usPreviousEventIndex );
4573 if ( ulResult != cOCT6100_ERR_OK )
4574 return ulResult;
4575 }
4576
4577 /* Remove the load event to the list. */
4578 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4579
4580 /* Now modify the previous last Sub Store event from another bridge. */
4581 pTempEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr;
4582
4583 /*=======================================================================*/
4584 /* Modify the previous node. */
4585 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4586 WriteParams.ulWriteAddress += 4;
4587
4588 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
4589
4590 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4591 if ( ulResult != cOCT6100_ERR_OK )
4592 return ulResult;
4593
4594 /*=======================================================================*/
4595
4596 /* Now find the last load entry of this bridge ( the one pointing at the first sub-store event ). */
4597 if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex )
4598 {
4599 /* Must start with the first load to get the entry before the first sub store. */
4600 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex );
4601 if ( ulResult != cOCT6100_ERR_OK )
4602 return ulResult;
4603 }
4604 else
4605 {
4606 /* Must start with the first load to get the entry before the first sub store. */
4607 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstSubStoreEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex );
4608 if ( ulResult != cOCT6100_ERR_OK )
4609 return ulResult;
4610 }
4611
4612 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4613 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
4614
4615 /* Now modify the last load event of the bridge. */
4616 pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr;
4617
4618 /*=======================================================================*/
4619 /* Modify the last node of the other bridge. */
4620
4621 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4622 WriteParams.ulWriteAddress += 4;
4623
4624 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
4625
4626 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4627 if ( ulResult != cOCT6100_ERR_OK )
4628 return ulResult;
4629
4630 /*=======================================================================*/
4631
4632 /*=======================================================================*/
4633 /* Update the bridge pointers. */
4634
4635 if ( pBridgeEntry->usFirstLoadEventPtr == f_usLoadEventIndex )
4636 pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr;
4637
4638 if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex )
4639 pBridgeEntry->usFirstSubStoreEventPtr = pSubStoreEventEntry->usNextEventPtr;
4640
4641 if ( pBridgeEntry->usLastSubStoreEventPtr == f_usSubStoreEventIndex )
4642 pBridgeEntry->usLastSubStoreEventPtr = usPreviousEventIndex;
4643
4644 /*=======================================================================*/
4645
4646
4647 /*=======================================================================*/
4648 /* Update the global mixer pointers. */
4649
4650 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex )
4651 {
4652 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr;
4653 }
4654
4655 if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex )
4656 {
4657 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
4658 }
4659 /*=======================================================================*/
4660
4661 }
4662
4663 /* Check if must remove the Sin copy event from the event list. */
4664 if ( fRemoveSinCopy == TRUE )
4665 {
4666 /* Now remove the copy event from the event list. */
4667 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, f_usCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4668 if ( ulResult != cOCT6100_ERR_OK )
4669 return ulResult;
4670 }
4671
4672 /* Get the channel. */
4673 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
4674
4675 /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released. */
4676 if ( ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fTap == FALSE ) )
4677 {
4678 if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
4679 {
4680 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
4681 pEchoChanEntry->usSinTsstIndex,
4682 pEchoChanEntry->usSinSoutTsiMemIndex,
4683 pEchoChanEntry->TdmConfig.bySinPcmLaw );
4684 if ( ulResult != cOCT6100_ERR_OK )
4685 return ulResult;
4686 }
4687
4688 /* If the silence TSI is loaded on this port, update with the original sin TSI. */
4689 if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
4690 {
4691 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4692
4693 WriteParams.ulWriteAddress += 2;
4694 WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex;
4695
4696 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4697 if ( ulResult != cOCT6100_ERR_OK )
4698 return ulResult;
4699 }
4700 }
4701 /* Set the event entries as free. */
4702 pLoadEventEntry->fReserved = FALSE;
4703 pLoadEventEntry->usEventType = cOCT6100_INVALID_INDEX;
4704 pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4705
4706 pSubStoreEventEntry->fReserved = FALSE;
4707 pSubStoreEventEntry->usEventType = cOCT6100_INVALID_INDEX;
4708 pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4709
4710 if ( pCopyEventEntry != NULL )
4711 {
4712 pCopyEventEntry->fReserved = FALSE;
4713 pCopyEventEntry->usEventType = cOCT6100_INVALID_INDEX;
4714 pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4715 }
4716
4717 pBridgeEntry->usNumClients--;
4718
4719 /*=======================================================================*/
4720 /* Update the event and channel API structure */
4721 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
4722 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4723 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4724 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4725
4726 /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */
4727 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4728 {
4729 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4730 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4731 }
4732 else
4733 {
4734 /* Decrement the dependency count, but do not clear the mem index. */
4735 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4736 }
4737
4738 /* Update the chip stats structure. */
4739 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4740
4741 if ( f_fTap == TRUE )
4742 {
4743 /* Can now close the bridge. */
4744 tOCT6100_CONF_BRIDGE_CLOSE BridgeClose;
4745
4746 Oct6100ConfBridgeCloseDef( &BridgeClose );
4747
4748 BridgeClose.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapBridgeIndex;
4749
4750 ulResult = Oct6100ConfBridgeCloseSer( f_pApiInstance, &BridgeClose );
4751 if ( ulResult != cOCT6100_ERR_OK )
4752 return ulResult;
4753
4754 pEchoChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX;
4755 pEchoChanEntry->fTap = FALSE;
4756 }
4757
4758 /* Check if the Rin port must be muted. */
4759 ulResult = Oct6100ApiMutePorts(
4760 f_pApiInstance,
4761 f_usChanIndex,
4762 pEchoChanEntry->usRinTsstIndex,
4763 pEchoChanEntry->usSinTsstIndex,
4764 FALSE );
4765 if ( ulResult != cOCT6100_ERR_OK )
4766 return ulResult;
4767
4768 /*=======================================================================*/
4769 }
4770 else /* f_ulBridgeChanRemove->fRemoveAll == TRUE ) */
4771 {
4772 UINT16 usNextEventPtr;
4773
4774 /* Save the next event pointer before invalidating everything. */
4775 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pBridgeEntry->usLastSubStoreEventPtr );
4776
4777 usNextEventPtr = pSubStoreEventEntry->usNextEventPtr;
4778
4779 /* Search through the list of API channel entry for the ones on to the specified bridge. */
4780 for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ )
4781 {
4782 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
4783
4784 if ( pEchoChanEntry->fReserved == TRUE )
4785 {
4786 if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) )
4787 {
4788 /* Check if we are being tapped. If so, remove the channel that taps us from the conference. */
4789 /* The removal of the channel will make sure the Rin TSST is re-assigned. */
4790 if ( pEchoChanEntry->fBeingTapped == TRUE )
4791 {
4792 tOCT6100_CONF_BRIDGE_CHAN_REMOVE ChanRemove;
4793
4794 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, pEchoChanEntry->usTapChanIndex );
4795
4796 ulResult = Oct6100ConfBridgeChanRemoveDef( &ChanRemove );
4797 if ( ulResult != cOCT6100_ERR_OK )
4798 return ulResult;
4799
4800 ChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pTempEchoChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapChanIndex;
4801
4802 ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &ChanRemove );
4803 if ( ulResult != cOCT6100_ERR_OK )
4804 return ulResult;
4805 }
4806
4807 /*=======================================================================*/
4808 /* Clear the Load event. */
4809 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4810 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4811
4812 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4813 if ( ulResult != cOCT6100_ERR_OK )
4814 return ulResult;
4815
4816 /*=======================================================================*/
4817
4818 /*=======================================================================*/
4819 /* Clear the Substract and store event. */
4820 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4821 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4822
4823 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4824 if ( ulResult != cOCT6100_ERR_OK )
4825 return ulResult;
4826 /*=======================================================================*/
4827
4828 /*=======================================================================*/
4829 /* Clear the SIN copy event.*/
4830
4831 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
4832 {
4833 /* Transform event into no-operation. */
4834 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4835 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4836
4837 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4838 if ( ulResult != cOCT6100_ERR_OK )
4839 return ulResult;
4840
4841 /* Get a pointer to the event entry. */
4842 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pEchoChanEntry->usSinCopyEventIndex );
4843
4844 /* Update the next event pointer if required. */
4845 if ( usNextEventPtr == pEchoChanEntry->usSinCopyEventIndex )
4846 usNextEventPtr = pCopyEventEntry->usNextEventPtr;
4847
4848 /* Now remove the copy event from the event list. */
4849 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4850 if ( ulResult != cOCT6100_ERR_OK )
4851 return ulResult;
4852
4853 /* Clear the copy event created flag. */
4854 pEchoChanEntry->fCopyEventCreated = FALSE;
4855 }
4856
4857 /*=======================================================================*/
4858
4859
4860 /*=======================================================================*/
4861 /* Update the event and channel API structure */
4862
4863 /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released.*/
4864 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4865 {
4866 if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
4867 {
4868 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
4869 pEchoChanEntry->usSinTsstIndex,
4870 pEchoChanEntry->usSinSoutTsiMemIndex,
4871 pEchoChanEntry->TdmConfig.bySinPcmLaw );
4872 if ( ulResult != cOCT6100_ERR_OK )
4873 return ulResult;
4874 }
4875
4876 /* If the silence TSI is loaded on this port, update with the original Sin TSI. */
4877 if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
4878 {
4879 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4880
4881 WriteParams.ulWriteAddress += 2;
4882 WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex;
4883
4884 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4885 if ( ulResult != cOCT6100_ERR_OK )
4886 return ulResult;
4887 }
4888 }
4889
4890 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, pEchoChanEntry->usLoadEventIndex );
4891 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pEchoChanEntry->usSubStoreEventIndex );
4892
4893 /* Set the event entries as free. */
4894 pLoadEventEntry->fReserved = FALSE;
4895 pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT;
4896 pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4897
4898 pSubStoreEventEntry->fReserved = FALSE;
4899 pSubStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT;
4900 pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4901
4902 if ( pCopyEventEntry != NULL )
4903 {
4904 pCopyEventEntry->fReserved = FALSE;
4905 pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT;
4906 pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4907 }
4908
4909 /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */
4910 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4911 {
4912 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4913 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4914 }
4915 else
4916 {
4917 /* Decrement the dependency count, but do not clear the mem index. */
4918 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4919 }
4920
4921 /* Invalidate the channel entry. */
4922 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4923 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4924 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4925
4926 /* Update the chip stats structure. */
4927 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4928
4929 /*=======================================================================*/
4930 }
4931 }
4932 }
4933
4934 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex );
4935 if ( ulResult != cOCT6100_ERR_OK )
4936 {
4937 if ( cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND == ulResult )
4938 {
4939 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
4940 {
4941 usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE;
4942 }
4943 else
4944 {
4945 usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
4946 }
4947 }
4948 else
4949 {
4950 return cOCT6100_ERR_FATAL_28;
4951 }
4952 }
4953
4954 /* An Entry was found, now, modify it's value. */
4955 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4956
4957 /* Now modify the previous last Sub Store event from another bridge.*/
4958 /* It will now point at the next bridge, or copy events. */
4959 pTempEntry->usNextEventPtr = usNextEventPtr;
4960
4961 /*=======================================================================*/
4962 /* Modify the last node of the other bridge. */
4963 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4964 WriteParams.ulWriteAddress += 4;
4965
4966 WriteParams.usWriteData = pTempEntry->usNextEventPtr;
4967
4968 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4969 if ( ulResult != cOCT6100_ERR_OK )
4970 return ulResult;
4971 /*=======================================================================*/
4972
4973 /*=======================================================================*/
4974 /* Update the global mixer pointers. */
4975 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr &&
4976 pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr )
4977 {
4978 /* This bridge was the only one with event in the list. */
4979 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX;
4980 pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX;
4981 }
4982 else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr )
4983 {
4984 /* This bridge was the first bridge. */
4985 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = usNextEventPtr;
4986 }
4987 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr )
4988 {
4989 /* This bridge was the last bridge.*/
4990 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
4991 }
4992 /*=======================================================================*/
4993
4994 /* Set the event pointer info in the bridge stucture. */
4995 pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX;
4996 pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX;
4997 pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX;
4998 pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX;
4999
5000 pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX;
5001
5002 /* Set the number of clients to 0. */
5003 pBridgeEntry->usNumClients = 0;
5004
5005 /* Search through the list of API channel entry for the ones on to the specified bridge. */
5006 for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ )
5007 {
5008 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
5009
5010 if ( pEchoChanEntry->fReserved == TRUE )
5011 {
5012 if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) )
5013 {
5014 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
5015
5016 /* Check if the Rin port must be muted. */
5017 ulResult = Oct6100ApiMutePorts(
5018 f_pApiInstance,
5019 (UINT16)( i & 0xFFFF ),
5020 pEchoChanEntry->usRinTsstIndex,
5021 pEchoChanEntry->usSinTsstIndex,
5022 FALSE );
5023 if ( ulResult != cOCT6100_ERR_OK )
5024 return ulResult;
5025 }
5026 }
5027 }
5028 }
5029 }
5030
5031 return cOCT6100_ERR_OK;
5032 }
5033 #endif
5034
5035
5036 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5037
5038 Function: Oct6100ApiBridgeRemoveParticipantFromChannel
5039
5040 Description: This will remove a flexible conference participant from
5041 a channel.
5042
5043 -------------------------------------------------------------------------------
5044 | Argument | Description
5045 -------------------------------------------------------------------------------
5046 f_pApiInstance Pointer to API instance. This memory is used to keep the
5047 present state of the chip and all its resources.
5048 f_usBridgeIndex Bridge index where this channel is located.
5049 f_usSourceChannelIndex Source channel to copy voice from.
5050 f_usDestinationChannelIndex Destination channel to store resulting voice to.
5051 f_fRemovePermanently Whether to remove permanently this participant.
5052
5053 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5054 #if !SKIP_Oct6100ApiBridgeRemoveParticipantFromChannel
5055 UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
5056 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5057 IN UINT16 f_usBridgeIndex,
5058 IN UINT16 f_usSourceChannelIndex,
5059 IN UINT16 f_usDestinationChannelIndex,
5060 IN UINT8 f_fRemovePermanently )
5061 {
5062 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
5063
5064 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
5065 tPOCT6100_API_MIXER_EVENT pStoreEventEntry;
5066 tPOCT6100_API_MIXER_EVENT pCopyEventEntry;
5067 tPOCT6100_API_MIXER_EVENT pTempEntry;
5068 tPOCT6100_API_MIXER_EVENT pLoadTempEntry;
5069 tPOCT6100_API_MIXER_EVENT pLastEventEntry;
5070
5071 tPOCT6100_API_CHANNEL pDestinationChanEntry;
5072
5073 tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant;
5074
5075 tPOCT6100_SHARED_INFO pSharedInfo;
5076 tOCT6100_WRITE_PARAMS WriteParams;
5077 tOCT6100_READ_PARAMS ReadParams;
5078
5079 UINT32 ulResult;
5080 UINT32 ulLoopCount;
5081 UINT16 usLoadOrAccumulateEventIndex;
5082 UINT16 usTempEventIndex;
5083 UINT16 usPreviousEventIndex;
5084 UINT16 usLastEventIndex;
5085
5086 UINT16 usReadData;
5087 BOOL fLastEvent = FALSE;
5088
5089 /* Obtain local pointer to shared portion of instance. */
5090 pSharedInfo = f_pApiInstance->pSharedInfo;
5091
5092 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
5093
5094 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5095
5096 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
5097
5098 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5099 ReadParams.pusReadData = &usReadData;
5100
5101 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
5102
5103 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex );
5104 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex );
5105
5106 /* Check if the mixer has been created on this channel. */
5107 if ( pDestinationParticipant->fFlexibleMixerCreated == TRUE )
5108 {
5109 /*=======================================================================*/
5110 /* Clear the Load or Accumulate event.*/
5111
5112 usTempEventIndex = pDestinationChanEntry->usLoadEventIndex;
5113 ulLoopCount = 0;
5114
5115 /* Find the Load or Accumulate event entry. */
5116 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usTempEventIndex );
5117 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, pDestinationChanEntry->usSubStoreEventIndex );
5118 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5119
5120 pLastEventEntry = pLoadEventEntry;
5121 usLastEventIndex = usTempEventIndex;
5122
5123 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
5124 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
5125 {
5126 /* If this is the entry we are looking for. */
5127 if ( pTempEntry->usSourceChanIndex == f_usSourceChannelIndex )
5128 {
5129 /* Check if this is a Load or Accumulate event. */
5130 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD )
5131 {
5132 /* This is the first entry. Check if next entry is an accumulate. */
5133 pLoadTempEntry = pTempEntry;
5134 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, pTempEntry->usNextEventPtr );
5135
5136 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
5137 {
5138 /* Change this entry into a Load event. */
5139 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadTempEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5140 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
5141 if ( ulResult != cOCT6100_ERR_OK )
5142 return ulResult;
5143
5144 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
5145 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD);
5146
5147 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5148 if ( ulResult != cOCT6100_ERR_OK )
5149 return ulResult;
5150
5151 /* Update the channel information with this new load event. */
5152 pDestinationChanEntry->usLoadEventIndex = pLoadTempEntry->usNextEventPtr;
5153
5154 /* Update the software model. */
5155 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
5156
5157 /* Get the previous event. */
5158 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex );
5159 if ( ulResult != cOCT6100_ERR_OK )
5160 return ulResult;
5161
5162 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex );
5163 usLastEventIndex = usPreviousEventIndex;
5164
5165 /* Stop searching. */
5166 break;
5167 }
5168 else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE )
5169 {
5170 /* Get back the event to remove. */
5171 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5172
5173 /* This is the only event on this channel so we can clear everything up. */
5174 fLastEvent = TRUE;
5175
5176 /* Get the previous event. */
5177 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex );
5178 if ( ulResult != cOCT6100_ERR_OK )
5179 return ulResult;
5180
5181 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex );
5182 usLastEventIndex = usPreviousEventIndex;
5183
5184 /* Stop searching. */
5185 break;
5186 }
5187 else
5188 {
5189 /* Software model is broken. */
5190 return cOCT6100_ERR_FATAL_C5;
5191 }
5192
5193 }
5194 else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
5195 {
5196 /* Simply remove the entry. */
5197
5198 /* Get the previous event. */
5199 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex );
5200 if ( ulResult != cOCT6100_ERR_OK )
5201 return ulResult;
5202
5203 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex );
5204 usLastEventIndex = usPreviousEventIndex;
5205
5206 /* Stop searching. */
5207 break;
5208 }
5209 else
5210 {
5211 /* Software model is broken. */
5212 return cOCT6100_ERR_FATAL_C6;
5213 }
5214 }
5215
5216 /* Go to the next entry into the list. */
5217 usTempEventIndex = pTempEntry->usNextEventPtr;
5218 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5219
5220 ulLoopCount++;
5221 if ( ulLoopCount == cOCT6100_MAX_LOOP )
5222 return cOCT6100_ERR_FATAL_C8;
5223 }
5224
5225 /* Check if we found what we were looking for. */
5226 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE
5227 || pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE )
5228 {
5229 /* Software model is broken. */
5230 return cOCT6100_ERR_FATAL_C7;
5231 }
5232
5233 /*=======================================================================*/
5234
5235
5236 /*=======================================================================*/
5237 /* Clear the Store event - if needed. */
5238
5239 if ( fLastEvent == TRUE )
5240 {
5241 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5242 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5243
5244 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5245 if ( ulResult != cOCT6100_ERR_OK )
5246 return ulResult;
5247 }
5248
5249 /*=======================================================================*/
5250
5251
5252 /*=======================================================================*/
5253 /* Clear the Load or Accumulate event. */
5254
5255 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5256 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5257
5258 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5259 if ( ulResult != cOCT6100_ERR_OK )
5260 return ulResult;
5261
5262 /* Save this event index. It's the Load or Accumulate we want to remove from the list later. */
5263 usLoadOrAccumulateEventIndex = usTempEventIndex;
5264
5265 /*=======================================================================*/
5266
5267
5268 /*=======================================================================*/
5269 /* Clear the Copy event - if needed. */
5270
5271 if ( ( fLastEvent == TRUE ) && ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) )
5272 {
5273 /* Transform event into no-operation. */
5274 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5275 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5276
5277 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5278 if ( ulResult != cOCT6100_ERR_OK )
5279 return ulResult;
5280
5281 /* The event remove from the list will be done below. */
5282
5283 /* Clear the copy event created flag. */
5284 pDestinationChanEntry->fCopyEventCreated = FALSE;
5285 }
5286
5287 /*=======================================================================*/
5288
5289
5290 /*=======================================================================*/
5291 /*=======================================================================*/
5292 /* Remove the events from the mixer event list.*/
5293 /*=======================================================================*/
5294 /*=======================================================================*/
5295
5296 /*=======================================================================*/
5297 /* Remove the Load or Accumulate event from the event list. */
5298
5299 if ( fLastEvent == FALSE )
5300 {
5301 /*=======================================================================*/
5302 /* Remove the Accumulate event from the event list. */
5303
5304 /* We saved the Load or Accumulate event above. We also saved the previous event. Use those. */
5305 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usLoadOrAccumulateEventIndex );
5306
5307 /* Now modify the previous last event. */
5308 pLastEventEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr;
5309
5310 /* Modify the previous node. */
5311 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5312 WriteParams.ulWriteAddress += 4;
5313
5314 WriteParams.usWriteData = pLastEventEntry->usNextEventPtr;
5315
5316 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5317 if ( ulResult != cOCT6100_ERR_OK )
5318 return ulResult;
5319
5320 /* Check if this is the first load event on the bridge. */
5321 if ( pBridgeEntry->usFirstLoadEventPtr == usLoadOrAccumulateEventIndex )
5322 {
5323 pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr;
5324 }
5325
5326 /* Check if this was the first load of all bridges. */
5327 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex )
5328 {
5329 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr;
5330 }
5331
5332 /*=======================================================================*/
5333 }
5334 else /* if ( fLastEvent == TRUE ) */
5335 {
5336 /*=======================================================================*/
5337 /* Remove the Load event from the event list. */
5338
5339 /* Look for the entry that is pointing at the first entry of our mixer. */
5340 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usLoadOrAccumulateEventIndex, 0, &usPreviousEventIndex );
5341 if ( ulResult != cOCT6100_ERR_OK )
5342 return ulResult;
5343
5344 /* An Entry was found, now, modify it's value. */
5345 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
5346
5347 /* Check if this is a Sout copy event. */
5348 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_COPY )
5349 {
5350 /* No more previous bridges. */
5351 }
5352
5353 /* Now modify the previous last Store or Sub-Store or Head-Node event from another bridge/channel. */
5354 pTempEntry->usNextEventPtr = pStoreEventEntry->usNextEventPtr;
5355
5356 /*=======================================================================*/
5357
5358
5359 /*=======================================================================*/
5360 /* Modify the last node of the previous bridge/channel to point to the next bridge. */
5361
5362 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5363 WriteParams.ulWriteAddress += 4;
5364
5365 WriteParams.usWriteData = pTempEntry->usNextEventPtr;
5366
5367 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5368 if ( ulResult != cOCT6100_ERR_OK )
5369 return ulResult;
5370
5371 /*=======================================================================*/
5372
5373
5374 /*=======================================================================*/
5375 /* Set the event pointer info in the bridge stucture. */
5376
5377 if ( pBridgeEntry->usFirstLoadEventPtr == pDestinationChanEntry->usLoadEventIndex )
5378 {
5379 UINT16 usChannelIndex;
5380 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
5381
5382 pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX;
5383 pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX;
5384
5385 /* Find the next channel in this conference that could give us valid values. */
5386 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
5387 {
5388 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
5389
5390 if ( ( usChannelIndex != f_usDestinationChannelIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
5391 {
5392 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
5393 {
5394 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
5395
5396 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
5397
5398 if ( pTempParticipant->fFlexibleMixerCreated == TRUE )
5399 {
5400 pBridgeEntry->usFirstSubStoreEventPtr = pTempEchoChanEntry->usSubStoreEventIndex;
5401 pBridgeEntry->usFirstLoadEventPtr = pTempEchoChanEntry->usLoadEventIndex;
5402 break;
5403 }
5404 }
5405 }
5406 }
5407 }
5408
5409 /* Reprogram the TSST entry correctly if the extra SIN TSI entry was released. */
5410 if ( ( pDestinationChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) )
5411 {
5412 if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
5413 {
5414 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
5415 pDestinationChanEntry->usSinTsstIndex,
5416 pDestinationChanEntry->usSinSoutTsiMemIndex,
5417 pDestinationChanEntry->TdmConfig.bySinPcmLaw );
5418 if ( ulResult != cOCT6100_ERR_OK )
5419 return ulResult;
5420 }
5421
5422 /* If the silence TSI is loaded on this port, update with the original sin TSI. */
5423 if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
5424 {
5425 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5426
5427 WriteParams.ulWriteAddress += 2;
5428 WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex;
5429
5430 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5431 if ( ulResult != cOCT6100_ERR_OK )
5432 return ulResult;
5433 }
5434 }
5435
5436 /* Reprogram the TSST entry correctly if the extra RIN TSI entry was released. */
5437 if ( ( pDestinationChanEntry->usExtraRinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) )
5438 {
5439 if ( pDestinationChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
5440 {
5441 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
5442 pDestinationChanEntry->usRinTsstIndex,
5443 pDestinationChanEntry->usRinRoutTsiMemIndex,
5444 pDestinationChanEntry->TdmConfig.byRinPcmLaw );
5445 if ( ulResult != cOCT6100_ERR_OK )
5446 return ulResult;
5447 }
5448 }
5449
5450 /*=======================================================================*/
5451 /* Update the global mixer pointers. */
5452
5453 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex &&
5454 pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex )
5455 {
5456 /* There is no more bridge entry in the mixer link list. */
5457 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX;
5458 pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX;
5459 }
5460 else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex )
5461 {
5462 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pStoreEventEntry->usNextEventPtr;
5463 }
5464 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex )
5465 {
5466 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
5467 }
5468
5469 /*=======================================================================*/
5470
5471
5472 /*=======================================================================*/
5473 /* Check if must remove the Sin copy event from the list. */
5474
5475 if ( ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) )
5476 {
5477 /* Now remove the copy event from the event list. */
5478 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pDestinationChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
5479 if ( ulResult != cOCT6100_ERR_OK )
5480 return ulResult;
5481 }
5482
5483 /*=======================================================================*/
5484
5485
5486
5487 /*=======================================================================*/
5488
5489 if ( f_fRemovePermanently == TRUE )
5490 {
5491 /* Set the event entries as free. */
5492 pLoadEventEntry->fReserved = FALSE;
5493 pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT;
5494 pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
5495
5496 pStoreEventEntry->fReserved = FALSE;
5497 pStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT;
5498 pStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
5499
5500 if ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
5501 {
5502 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pDestinationChanEntry->usSinCopyEventIndex );
5503
5504 pCopyEventEntry->fReserved = FALSE;
5505 pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT;
5506 pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
5507 }
5508 }
5509
5510 /* Flexible mixer for this channel not created anymore. */
5511 pDestinationParticipant->fFlexibleMixerCreated = FALSE;
5512
5513 /*=======================================================================*/
5514 }
5515
5516 /*=======================================================================*/
5517 }
5518 else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == FALSE ) */
5519 {
5520 /* This point should never be reached. */
5521 return cOCT6100_ERR_FATAL_C9;
5522 }
5523
5524 return cOCT6100_ERR_OK;
5525 }
5526 #endif
5527
5528
5529 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5530
5531 Function: Oct6100ConfBridgeChanMuteSer
5532
5533 Description: Mute an echo channel present on a conference bridge.
5534
5535 -------------------------------------------------------------------------------
5536 | Argument | Description
5537 -------------------------------------------------------------------------------
5538 f_pApiInstance Pointer to API instance. This memory is used to keep the
5539 present state of the chip and all its resources.
5540
5541 f_pConfBridgeMute Pointer to conference bridge mute structure.
5542
5543 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5544 #if !SKIP_Oct6100ConfBridgeChanMuteSer
5545 UINT32 Oct6100ConfBridgeChanMuteSer(
5546 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5547 IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute )
5548 {
5549 UINT16 usChanIndex;
5550 UINT16 usLoadEventIndex;
5551 UINT16 usSubStoreEventIndex;
5552 UINT32 ulResult;
5553 UINT8 fFlexibleConferencing;
5554
5555 /* Check the validity of the channel and conference bridge given. */
5556 ulResult = Oct6100ApiCheckBridgeMuteParams(
5557 f_pApiInstance,
5558 f_pConfBridgeMute,
5559 &usChanIndex,
5560 &usLoadEventIndex,
5561 &usSubStoreEventIndex,
5562 &fFlexibleConferencing );
5563 if ( ulResult != cOCT6100_ERR_OK )
5564 return ulResult;
5565
5566 /* Modify all resources needed by the conference bridge. */
5567 ulResult = Oct6100ApiUpdateBridgeMuteResources(
5568 f_pApiInstance,
5569 usChanIndex,
5570 usLoadEventIndex,
5571 usSubStoreEventIndex,
5572 fFlexibleConferencing );
5573 if ( ulResult != cOCT6100_ERR_OK )
5574 return ulResult;
5575
5576 return cOCT6100_ERR_OK;
5577 }
5578 #endif
5579
5580
5581 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5582
5583 Function: Oct6100ApiCheckBridgeMuteParams
5584
5585 Description: Check the validity of the channel and conference bridge given.
5586
5587 -------------------------------------------------------------------------------
5588 | Argument | Description
5589 -------------------------------------------------------------------------------
5590 f_pApiInstance Pointer to API instance. This memory is used to keep the
5591 present state of the chip and all its resources.
5592
5593 f_pConfBridgeMute Pointer to conference bridge channel mute structure.
5594 f_pusChannelIndex Pointer to a channel index.
5595 f_pusLoadEventIndex Pointer to a load mixer event index.
5596 f_pusSubStoreEventIndex Pointer to a sub-store mixer event index.
5597 f_pfFlexibleConfBridge If this is a flexible conference bridge.
5598
5599 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5600 #if !SKIP_Oct6100ApiCheckBridgeMuteParams
5601 UINT32 Oct6100ApiCheckBridgeMuteParams(
5602 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5603 IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute,
5604 OUT PUINT16 f_pusChannelIndex,
5605 OUT PUINT16 f_pusLoadEventIndex,
5606 OUT PUINT16 f_pusSubStoreEventIndex,
5607 OUT PUINT8 f_pfFlexibleConfBridge )
5608 {
5609 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
5610 tPOCT6100_API_CHANNEL pEchoChanEntry;
5611 UINT32 ulEntryOpenCnt;
5612
5613 /* Check for errors. */
5614 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
5615 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
5616
5617 if ( f_pConfBridgeMute->ulChannelHndl == cOCT6100_INVALID_HANDLE )
5618 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE;
5619
5620 /*=====================================================================*/
5621 /* Check the channel handle.*/
5622
5623 if ( (f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
5624 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5625
5626 *f_pusChannelIndex = (UINT16)( f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
5627 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
5628 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5629
5630 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
5631
5632 /* Extract the entry open count from the provided handle. */
5633 ulEntryOpenCnt = (f_pConfBridgeMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
5634
5635 /* Check for errors. */
5636 if ( pEchoChanEntry->fReserved != TRUE )
5637 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
5638 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
5639 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5640
5641 /* Check if the channel is bound to a conference bridge. */
5642 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
5643 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
5644
5645 /* Check if channel is already muted. */
5646 if ( pEchoChanEntry->fMute == TRUE )
5647 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_ALREADY_MUTED;
5648
5649 /* Check if this is a tap channel, which is always mute. */
5650 if ( pEchoChanEntry->fTap == TRUE )
5651 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE;
5652
5653 /*=====================================================================*/
5654
5655 /*=====================================================================*/
5656 /* Check the conference bridge handle. */
5657
5658 if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
5659 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5660
5661 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
5662
5663 /* Check for errors. */
5664 if ( pBridgeEntry->fReserved != TRUE )
5665 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
5666
5667 if ( pBridgeEntry->fFlexibleConferencing == FALSE )
5668 {
5669 /* Check the event entries.*/
5670 if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX )
5671 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
5672
5673 if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX )
5674 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
5675 }
5676
5677 /*=====================================================================*/
5678
5679 /* Return the config of the channel and all other important information. */
5680 *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex;
5681 *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex;
5682 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
5683
5684 return cOCT6100_ERR_OK;
5685 }
5686 #endif
5687
5688
5689 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5690
5691 Function: Oct6100ApiUpdateBridgeMuteResources
5692
5693 Description: Modify the conference bridge entry for this channel in order
5694 to mute the specified channel.
5695
5696 -------------------------------------------------------------------------------
5697 | Argument | Description
5698 -------------------------------------------------------------------------------
5699 f_pApiInstance Pointer to API instance. This memory is used to keep the
5700 present state of the chip and all its resources.
5701
5702 f_usChanIndex Index of the channel to be muted.
5703 f_usLoadEventIndex Allocated entry for the Load event of the channel.
5704 f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel.
5705 f_fFlexibleConfBridge If this is a flexible conference bridge.
5706
5707 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5708 #if !SKIP_Oct6100ApiUpdateBridgeMuteResources
5709 UINT32 Oct6100ApiUpdateBridgeMuteResources(
5710 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5711 IN UINT16 f_usChanIndex,
5712 IN UINT16 f_usLoadEventIndex,
5713 IN UINT16 f_usSubStoreEventIndex,
5714 IN UINT8 f_fFlexibleConfBridge )
5715 {
5716 tOCT6100_WRITE_PARAMS WriteParams;
5717 tOCT6100_READ_PARAMS ReadParams;
5718
5719 tPOCT6100_API_CHANNEL pEchoChanEntry;
5720 tPOCT6100_SHARED_INFO pSharedInfo;
5721
5722 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
5723
5724 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
5725 tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry;
5726 tPOCT6100_API_MIXER_EVENT pTempEntry;
5727 UINT32 ulResult;
5728 UINT16 usTempEventIndex;
5729 UINT32 ulLoopCount;
5730 UINT16 usReadData;
5731
5732 BOOL fCreateSilenceLoad = FALSE;
5733
5734 /* Obtain local pointer to shared portion of instance. */
5735 pSharedInfo = f_pApiInstance->pSharedInfo;
5736
5737 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
5738
5739 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5740
5741 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
5742
5743 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5744 ReadParams.pusReadData = &usReadData;
5745
5746 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
5747 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
5748
5749 if ( f_fFlexibleConfBridge == TRUE )
5750 {
5751 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
5752 UINT16 usChannelIndex;
5753 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
5754 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
5755
5756 UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ];
5757 UINT32 ulMutePortChannelIndex;
5758
5759 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
5760 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX;
5761
5762 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
5763
5764 /* Search through the list of API channel entry for the ones on to this bridge. */
5765 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
5766 {
5767 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
5768
5769 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
5770 {
5771 if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex )
5772 {
5773 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
5774
5775 /* Check if this participant can hear us. */
5776 if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
5777 && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) )
5778 {
5779 /* Then update this channel's mixer. */
5780 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
5781 f_pApiInstance,
5782 pEchoChanEntry->usBridgeIndex,
5783 f_usChanIndex,
5784 usChannelIndex,
5785 FALSE );
5786 if ( ulResult != cOCT6100_ERR_OK )
5787 return ulResult;
5788
5789 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
5790 {
5791 /* Remember to mute the port on this channel. */
5792 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
5793 {
5794 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex )
5795 {
5796 break;
5797 }
5798 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
5799 {
5800 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex;
5801 break;
5802 }
5803 }
5804 }
5805 }
5806 }
5807 }
5808 }
5809
5810 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
5811 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
5812 {
5813 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
5814 {
5815 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
5816
5817 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
5818
5819 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
5820 {
5821 /* Check if the Rin port must be muted on this channel. */
5822 ulResult = Oct6100ApiMutePorts(
5823 f_pApiInstance,
5824 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
5825 pTempEchoChanEntry->usRinTsstIndex,
5826 pTempEchoChanEntry->usSinTsstIndex,
5827 FALSE );
5828 if ( ulResult != cOCT6100_ERR_OK )
5829 {
5830 if ( ulResult == cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED )
5831 {
5832 UINT32 ulTempResult;
5833
5834 /* Cleanup resources, unmute channel... */
5835 ulTempResult = Oct6100ApiUpdateBridgeUnMuteResources(
5836 f_pApiInstance,
5837 f_usChanIndex,
5838 f_usLoadEventIndex,
5839 f_usSubStoreEventIndex,
5840 TRUE );
5841 if ( ulTempResult != cOCT6100_ERR_OK )
5842 return ulTempResult;
5843 else
5844 return ulResult;
5845 }
5846 else
5847 {
5848 return ulResult;
5849 }
5850 }
5851 }
5852 }
5853 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
5854 {
5855 /* No more channels to check for muting. */
5856 break;
5857 }
5858 }
5859 }
5860 else /* if ( f_fFlexibleConfBridge == FALSE ) */
5861 {
5862 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex );
5863 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
5864
5865 /*=======================================================================*/
5866 /* Program the Load event. */
5867
5868 /* Create silence load if this is the first event of the bridge. */
5869 if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr )
5870 fCreateSilenceLoad = TRUE;
5871
5872 /* First check if this event was a load or an accumulate event, if it's a load */
5873 /* we need to find a new load. */
5874 if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex )
5875 {
5876 /* Change the next entry if one is present to a load event to keep the bridge alive. */
5877 if ( pBridgeEntry->usNumClients == 1 )
5878 {
5879 /* There is no other entry on the bridge, no need to search for an Accumulate event. */
5880 pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX;
5881 }
5882 else
5883 {
5884 /* Search for an accumulate event to tranform into a Load event. */
5885 usTempEventIndex = pLoadEventEntry->usNextEventPtr;
5886 ulLoopCount = 0;
5887
5888 /* Find the copy entry before the entry to remove. */
5889 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5890
5891 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
5892 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
5893 {
5894 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
5895 {
5896 /* Change this entry into a load event. */
5897 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5898 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
5899 if ( ulResult != cOCT6100_ERR_OK )
5900 return ulResult;
5901
5902 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
5903 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD);
5904
5905 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5906 if ( ulResult != cOCT6100_ERR_OK )
5907 return ulResult;
5908
5909 /* Set this entry as the load index. */
5910 pBridgeEntry->usLoadIndex = usTempEventIndex;
5911
5912 /* Update the software model. */
5913 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
5914
5915 /* Stop searching. */
5916 break;
5917 }
5918
5919 /* Go to the next entry into the list. */
5920 usTempEventIndex = pTempEntry->usNextEventPtr;
5921 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5922
5923 ulLoopCount++;
5924 if ( ulLoopCount == cOCT6100_MAX_LOOP )
5925 return cOCT6100_ERR_FATAL_9B;
5926 }
5927 }
5928 }
5929
5930 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5931
5932 /* Do not load the sample if the channel is muted. */
5933 if ( fCreateSilenceLoad == TRUE )
5934 {
5935 if ( pBridgeEntry->usSilenceLoadEventPtr == cOCT6100_INVALID_INDEX )
5936 {
5937 /* Instead of No-oping, load the silence TSI, to make sure the other conferences before us are not heard. */
5938 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
5939 WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */
5940
5941 /* Remember the silence load event. */
5942 pBridgeEntry->usSilenceLoadEventPtr = f_usLoadEventIndex;
5943 }
5944 else
5945 {
5946 /* Do nothing. */
5947 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5948 }
5949 }
5950 else
5951 {
5952 /* Do nothing. */
5953 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5954 }
5955
5956 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5957 if ( ulResult != cOCT6100_ERR_OK )
5958 return ulResult;
5959
5960 /* Update the software model. */
5961 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5962
5963 /*=======================================================================*/
5964
5965 /*=======================================================================*/
5966 /* Program the Substract and store event. */
5967 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5968
5969 /* Do not load the sample if the channel is muted. */
5970 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE;
5971
5972 /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */
5973 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
5974 {
5975 /* Sout input. */
5976 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
5977 }
5978 else /* if ( pEchoChanEntry->usSinCopyEventIndex == cOCT6100_INVALID_INDEX ) */
5979 {
5980 /* Rin input. */
5981 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
5982 }
5983
5984 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5985 if ( ulResult != cOCT6100_ERR_OK )
5986 return ulResult;
5987
5988 /* Update the software model. */
5989 pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE;
5990
5991 /*=======================================================================*/
5992 }
5993
5994 /* Update the channel entry API structure */
5995 pEchoChanEntry->fMute = TRUE;
5996
5997 return cOCT6100_ERR_OK;
5998 }
5999 #endif
6000
6001
6002 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6003
6004 Function: Oct6100ConfBridgeChanUnMuteSer
6005
6006 Description: UnMute an echo channel present on a conference bridge.
6007
6008 -------------------------------------------------------------------------------
6009 | Argument | Description
6010 -------------------------------------------------------------------------------
6011 f_pApiInstance Pointer to API instance. This memory is used to keep the
6012 present state of the chip and all its resources.
6013
6014 f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure.
6015
6016 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6017 #if !SKIP_Oct6100ConfBridgeChanUnMuteSer
6018 UINT32 Oct6100ConfBridgeChanUnMuteSer(
6019 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6020 IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute )
6021 {
6022 UINT16 usChanIndex;
6023 UINT16 usLoadEventIndex;
6024 UINT16 usSubStoreEventIndex;
6025 UINT8 fFlexibleConfBridge;
6026 UINT32 ulResult;
6027
6028 /* Check the validity of the channel and conference bridge given. */
6029 ulResult = Oct6100ApiCheckBridgeUnMuteParams(
6030 f_pApiInstance,
6031 f_pConfBridgeUnMute,
6032 &usChanIndex,
6033 &usLoadEventIndex,
6034 &usSubStoreEventIndex,
6035 &fFlexibleConfBridge );
6036 if ( ulResult != cOCT6100_ERR_OK )
6037 return ulResult;
6038
6039 /* Modify all resources needed by the conference bridge. */
6040 ulResult = Oct6100ApiUpdateBridgeUnMuteResources(
6041 f_pApiInstance,
6042 usChanIndex,
6043 usLoadEventIndex,
6044 usSubStoreEventIndex,
6045 fFlexibleConfBridge );
6046 if ( ulResult != cOCT6100_ERR_OK )
6047 return ulResult;
6048
6049 return cOCT6100_ERR_OK;
6050 }
6051 #endif
6052
6053
6054 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6055
6056 Function: Oct6100ApiCheckBridgeUnMuteParams
6057
6058 Description: Check the validity of the channel and conference bridge given.
6059
6060 -------------------------------------------------------------------------------
6061 | Argument | Description
6062 -------------------------------------------------------------------------------
6063 f_pApiInstance Pointer to API instance. This memory is used to keep the
6064 present state of the chip and all its resources.
6065
6066 f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure.
6067 f_pusChannelIndex Pointer to the channel index fo the channel to be unmuted.
6068 f_pusLoadEventIndex Pointer to the load index of the channel.
6069 f_pusSubStoreEventIndex Pointer to the sub-store event of the channel.
6070 f_pfFlexibleConfBridge If this is a flexible conference bridge.
6071
6072 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6073 #if !SKIP_Oct6100ApiCheckBridgeUnMuteParams
6074 UINT32 Oct6100ApiCheckBridgeUnMuteParams(
6075 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6076 IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute,
6077 OUT PUINT16 f_pusChannelIndex,
6078 OUT PUINT16 f_pusLoadEventIndex,
6079 OUT PUINT16 f_pusSubStoreEventIndex,
6080 OUT PUINT8 f_pfFlexibleConfBridge )
6081 {
6082 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6083 tPOCT6100_API_CHANNEL pEchoChanEntry;
6084 UINT32 ulEntryOpenCnt;
6085
6086 /* Check for errors. */
6087 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
6088 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
6089
6090 if ( f_pConfBridgeUnMute->ulChannelHndl == cOCT6100_INVALID_HANDLE )
6091 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE;
6092
6093 /*=====================================================================*/
6094 /* Check the channel handle.*/
6095
6096 if ( (f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
6097 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6098
6099 *f_pusChannelIndex = (UINT16)( f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
6100 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
6101 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6102
6103 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
6104
6105 /* Extract the entry open count from the provided handle. */
6106 ulEntryOpenCnt = (f_pConfBridgeUnMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6107
6108 /* Check for errors. */
6109 if ( pEchoChanEntry->fReserved != TRUE )
6110 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6111 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
6112 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6113
6114 /* Check if the channel is bound to a conference bridge.*/
6115 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
6116 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
6117
6118 /* Check if channel is already muted.*/
6119 if ( pEchoChanEntry->fMute == FALSE )
6120 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_NOT_MUTED;
6121
6122 /*=====================================================================*/
6123
6124 /*=====================================================================*/
6125 /* Check the conference bridge handle. */
6126
6127 if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
6128 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6129
6130 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
6131
6132 /* Check for errors. */
6133 if ( pBridgeEntry->fReserved != TRUE )
6134 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6135
6136 /* Check the event entries.*/
6137 if ( pBridgeEntry->fFlexibleConferencing == FALSE )
6138 {
6139 if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX )
6140 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
6141
6142 /* Check the event entries.*/
6143 if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX )
6144 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
6145 }
6146
6147 /*=====================================================================*/
6148
6149 /* Return the config of the channel and all other important information.*/
6150 *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex;
6151 *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex;
6152 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
6153
6154 return cOCT6100_ERR_OK;
6155 }
6156 #endif
6157
6158
6159 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6160
6161 Function: Oct6100ApiUpdateBridgeUnMuteResources
6162
6163 Description: Modify the conference bridge entry for this channel in order
6164 to un-mute the specified channel.
6165
6166 -------------------------------------------------------------------------------
6167 | Argument | Description
6168 -------------------------------------------------------------------------------
6169 f_pApiInstance Pointer to API instance. This memory is used to keep the
6170 present state of the chip and all its resources.
6171
6172 f_usChanIndex Index of the channel to be unmuted.
6173 f_usLoadEventIndex Allocated entry for the Load event of the channel.
6174 f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel.
6175 f_fFlexibleConfBridge If this is a flexible conference bridge.
6176
6177 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6178 #if !SKIP_Oct6100ApiUpdateBridgeUnMuteResources
6179 UINT32 Oct6100ApiUpdateBridgeUnMuteResources(
6180 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6181 IN UINT16 f_usChanIndex,
6182 IN UINT16 f_usLoadEventIndex,
6183 IN UINT16 f_usSubStoreEventIndex,
6184 IN UINT8 f_fFlexibleConfBridge )
6185 {
6186 tOCT6100_WRITE_PARAMS WriteParams;
6187 tOCT6100_READ_PARAMS ReadParams;
6188
6189 tPOCT6100_API_CHANNEL pEchoChanEntry;
6190 tPOCT6100_SHARED_INFO pSharedInfo;
6191
6192 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6193
6194 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
6195 tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry;
6196 tPOCT6100_API_MIXER_EVENT pTempEntry;
6197 UINT32 ulResult;
6198 UINT16 usTempEventIndex;
6199 UINT32 ulLoopCount;
6200 UINT16 usReadData;
6201
6202 UINT16 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
6203 UINT16 usPreviousLoadIndex = cOCT6100_INVALID_INDEX;
6204
6205 /* Obtain local pointer to shared portion of instance. */
6206 pSharedInfo = f_pApiInstance->pSharedInfo;
6207
6208 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
6209
6210 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
6211
6212 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
6213
6214 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
6215 ReadParams.pusReadData = &usReadData;
6216
6217 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
6218 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
6219
6220 if ( f_fFlexibleConfBridge == TRUE )
6221 {
6222 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
6223 UINT16 usChannelIndex;
6224 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
6225 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
6226
6227 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
6228
6229 /* Before doing anything, check if the copy events must be created. */
6230 if ( ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChanEntry->fCopyEventCreated == FALSE ) )
6231 {
6232 /* The copy event has not been created, create it once for the life of the participant on the bridge. */
6233 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6234
6235 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY;
6236 WriteParams.usWriteData |= pEchoChanEntry->usExtraSinTsiMemIndex;
6237 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
6238
6239 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6240 if ( ulResult != cOCT6100_ERR_OK )
6241 return ulResult;
6242
6243 WriteParams.ulWriteAddress += 2;
6244 WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex;
6245
6246 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6247 if ( ulResult != cOCT6100_ERR_OK )
6248 return ulResult;
6249
6250 /* Now insert the Sin copy event into the list. */
6251 ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance,
6252 pEchoChanEntry->usSinCopyEventIndex,
6253 cOCT6100_EVENT_TYPE_SIN_COPY,
6254 f_usChanIndex );
6255 if ( ulResult != cOCT6100_ERR_OK )
6256 return ulResult;
6257
6258 pEchoChanEntry->fCopyEventCreated = TRUE;
6259 }
6260
6261 /* Search through the list of API channel entry for the ones onto this bridge. */
6262 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
6263 {
6264 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
6265
6266 /* Channel reserved? */
6267 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
6268 {
6269 /* On current bridge? */
6270 if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex )
6271 {
6272 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
6273
6274 /* Check if this participant can hear us. */
6275 if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
6276 {
6277 /* Then create/update this channel's mixer. */
6278 ulResult = Oct6100ApiBridgeAddParticipantToChannel(
6279 f_pApiInstance,
6280 pEchoChanEntry->usBridgeIndex,
6281 f_usChanIndex,
6282 usChannelIndex,
6283 pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ],
6284 pTempEchoChanEntry->usSubStoreEventIndex,
6285 pTempEchoChanEntry->usSinCopyEventIndex,
6286 pParticipant->ulInputPort,
6287 pTempParticipant->ulInputPort );
6288 if ( ulResult != cOCT6100_ERR_OK )
6289 return ulResult;
6290
6291 /* Check if the Rin silence event can be cleared now that the */
6292 /* channel has unmuted. */
6293 if ( ( pTempParticipant->fFlexibleMixerCreated == TRUE )
6294 && ( pTempEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) )
6295 {
6296 /* Remove the event from the list. */
6297 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
6298 pTempEchoChanEntry->usRinSilenceEventIndex,
6299 cOCT6100_EVENT_TYPE_SOUT_COPY );
6300 if ( ulResult != cOCT6100_ERR_OK )
6301 return ulResult;
6302
6303 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempEchoChanEntry->usRinSilenceEventIndex );
6304 if ( ulResult != cOCT6100_ERR_OK )
6305 return cOCT6100_ERR_FATAL_DF;
6306
6307 pTempEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX;
6308 }
6309 }
6310 }
6311 }
6312 }
6313 }
6314 else /* if ( f_fFlexibleConfBridge == FALSE ) */
6315 {
6316 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex );
6317 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
6318
6319 /*=======================================================================*/
6320 /* Program the Load event. */
6321
6322 /* Before reactivating this event, check what type of event this event must be. */
6323 if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr ||
6324 pBridgeEntry->usLoadIndex == cOCT6100_INVALID_INDEX )
6325 {
6326 /* This event must become a Load event. */
6327 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
6328 pBridgeEntry->usLoadIndex = f_usLoadEventIndex;
6329 }
6330
6331 usTempEventIndex = pBridgeEntry->usFirstLoadEventPtr;
6332 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
6333
6334 ulLoopCount = 0;
6335
6336 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
6337 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
6338 {
6339 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD )
6340 {
6341 usPreviousLoadIndex = usTempEventIndex;
6342 }
6343
6344 /* Check if the previous load event is before or after the event about to be unmuted. */
6345 if ( pTempEntry->usNextEventPtr == f_usLoadEventIndex )
6346 {
6347 if ( usPreviousLoadIndex == cOCT6100_INVALID_INDEX )
6348 {
6349 /* We did not find a load event before our node, this mean this one */
6350 /* is about to become the new load event. */
6351 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
6352 }
6353 }
6354
6355 /* Go to the next entry into the list. */
6356 usTempEventIndex = pTempEntry->usNextEventPtr;
6357 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
6358
6359 ulLoopCount++;
6360 if ( ulLoopCount == cOCT6100_MAX_LOOP )
6361 return cOCT6100_ERR_FATAL_9B;
6362 }
6363
6364 /* Now program the current event node. */
6365 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6366
6367 WriteParams.usWriteData = usLoadEventType;
6368
6369 /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */
6370 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
6371 {
6372 /* Sout source */
6373 WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex;
6374 }
6375 else
6376 {
6377 /* Rin source */
6378 WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex;
6379 }
6380
6381 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6382 if ( ulResult != cOCT6100_ERR_OK )
6383 return ulResult;
6384
6385 /* Update the software event to reflect the hardware. */
6386 pLoadEventEntry->usEventType = usLoadEventType;
6387
6388 /* Check if we need to change another node. */
6389 if ( usLoadEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD )
6390 {
6391 if ( usPreviousLoadIndex != cOCT6100_INVALID_INDEX )
6392 {
6393 /* Now program the old load event. */
6394 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousLoadIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6395
6396 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
6397 if ( ulResult != cOCT6100_ERR_OK )
6398 return ulResult;
6399
6400 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
6401 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE );
6402
6403 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6404 if ( ulResult != cOCT6100_ERR_OK )
6405 return ulResult;
6406
6407 /* Update the software event to reflect the hardware. */
6408 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousLoadIndex );
6409 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
6410 }
6411 }
6412
6413 /*=======================================================================*/
6414
6415 /*=======================================================================*/
6416 /* Program the Substract and store event. */
6417 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6418
6419 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE;
6420 /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */
6421 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
6422 {
6423 /* Sout port source */
6424 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
6425 WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex;
6426 }
6427 else
6428 {
6429 /* Rin port source */
6430 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
6431 WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex;
6432 }
6433
6434 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6435 if ( ulResult != cOCT6100_ERR_OK )
6436 return ulResult;
6437
6438 WriteParams.ulWriteAddress += 2;
6439 WriteParams.usWriteData = pEchoChanEntry->usRinRoutTsiMemIndex;
6440
6441 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6442 if ( ulResult != cOCT6100_ERR_OK )
6443 return ulResult;
6444
6445 /* Update the software event to reflect the hardware. */
6446 pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE;
6447
6448 /*=======================================================================*/
6449
6450
6451 /*=======================================================================*/
6452 /* Check if have to remove silence load event. */
6453
6454 if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX )
6455 {
6456 if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex )
6457 {
6458 /* Clear the silence load event ptr. */
6459 pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX;
6460 }
6461 }
6462 }
6463
6464 /* Update the channel entry API structure */
6465 pEchoChanEntry->fMute = FALSE;
6466
6467 return cOCT6100_ERR_OK;
6468 }
6469 #endif
6470
6471
6472 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6473
6474 Function: Oct6100ConfBridgeDominantSpeakerSetSer
6475
6476 Description: This function sets the dominant speaker of a bridge.
6477
6478 -------------------------------------------------------------------------------
6479 | Argument | Description
6480 -------------------------------------------------------------------------------
6481 f_pApiInstance Pointer to API instance. This memory is used to
6482 keep the present state of the chip and all its
6483 resources.
6484
6485 f_pConfBridgeDominant Pointer to conference bridge dominant speaker
6486 structure.
6487
6488 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6489 #if !SKIP_Oct6100ConfBridgeDominantSpeakerSetSer
6490 UINT32 Oct6100ConfBridgeDominantSpeakerSetSer(
6491 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6492 IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker )
6493 {
6494 UINT16 usChanIndex;
6495 UINT16 usBridgeIndex;
6496 UINT32 ulResult;
6497
6498 /* Check the validity of the channel handle given. */
6499 ulResult = Oct6100ApiCheckBridgeDominantSpeakerParams( f_pApiInstance, f_pConfBridgeDominantSpeaker, &usChanIndex, &usBridgeIndex );
6500 if ( ulResult != cOCT6100_ERR_OK )
6501 return ulResult;
6502
6503 /* Modify all resources needed by the conference bridge. */
6504 ulResult = Oct6100ApiUpdateBridgeDominantSpeakerResources( f_pApiInstance, usChanIndex, usBridgeIndex );
6505 if ( ulResult != cOCT6100_ERR_OK )
6506 return ulResult;
6507
6508 return cOCT6100_ERR_OK;
6509 }
6510 #endif
6511
6512 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6513
6514 Function: Oct6100ApiCheckBridgeDominantSpeakerParams
6515
6516 Description: Check the validity of the channel given for setting the
6517 dominant speaker.
6518
6519 -------------------------------------------------------------------------------
6520 | Argument | Description
6521 -------------------------------------------------------------------------------
6522 f_pApiInstance Pointer to API instance. This memory is used to keep the
6523 present state of the chip and all its resources.
6524 f_pConfBridgeDominant Pointer to conference bridge channel dominant speaker structure.
6525 f_pusChannelIndex Pointer to a channel index.
6526 f_pusChannelIndex Pointer to a bridge index.
6527 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6528 #if !SKIP_Oct6100ApiCheckBridgeDominantSpeakerParams
6529 UINT32 Oct6100ApiCheckBridgeDominantSpeakerParams(
6530 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6531 IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker,
6532 OUT PUINT16 f_pusChannelIndex,
6533 OUT PUINT16 f_pusBridgeIndex )
6534 {
6535 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6536 tPOCT6100_API_CHANNEL pEchoChanEntry;
6537 UINT32 ulEntryOpenCnt;
6538 BOOL fCheckEntryOpenCnt = FALSE;
6539
6540 /* Check for errors. */
6541 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
6542 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
6543
6544 if ( f_pConfBridgeDominantSpeaker->ulChannelHndl == cOCT6100_INVALID_HANDLE )
6545 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6546
6547 /*=====================================================================*/
6548 /* Check the channel handle. */
6549
6550 if ( f_pConfBridgeDominantSpeaker->ulChannelHndl != cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL )
6551 {
6552 if ( (f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
6553 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6554
6555 *f_pusChannelIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
6556 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
6557 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6558
6559 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
6560
6561 /* Extract the entry open count from the provided handle. */
6562 ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6563
6564 /* Check for errors. */
6565 if ( pEchoChanEntry->fReserved != TRUE )
6566 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6567 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
6568 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6569
6570 /* Check if the channel is bound to a conference bridge. */
6571 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
6572 return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE;
6573
6574 /* Check if the NLP is enabled on this channel. */
6575 if ( pEchoChanEntry->VqeConfig.fEnableNlp == FALSE )
6576 return cOCT6100_ERR_CONF_BRIDGE_NLP_MUST_BE_ENABLED;
6577
6578 /* Check if conferencing noise reduction is enabled on this channel. */
6579 if ( pEchoChanEntry->VqeConfig.fSoutConferencingNoiseReduction == FALSE )
6580 return cOCT6100_ERR_CONF_BRIDGE_CNR_MUST_BE_ENABLED;
6581
6582 /* Check if this is a tap channel. If it is, it will never be the dominant speaker! */
6583 if ( pEchoChanEntry->fTap == TRUE )
6584 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE;
6585
6586 /* Set the bridge index. */
6587 *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex;
6588 }
6589 else
6590 {
6591 /* Set this such that there is no dominant speaker on this conference bridge. */
6592 *f_pusChannelIndex = cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED;
6593
6594 /* Check the conference bridge handle. */
6595 if ( (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
6596 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6597
6598 /* Set the bridge index. */
6599 *f_pusBridgeIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
6600
6601 /* Extract the entry open count from the provided handle. */
6602 ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6603 fCheckEntryOpenCnt = TRUE;
6604 }
6605
6606 /*=====================================================================*/
6607
6608 /*=====================================================================*/
6609
6610 if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
6611 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6612
6613 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
6614
6615 /* Check for errors. */
6616 if ( pBridgeEntry->fReserved != TRUE )
6617 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6618 if ( fCheckEntryOpenCnt == TRUE )
6619 {
6620 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
6621 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6622 }
6623
6624 /*=====================================================================*/
6625 /* Check if dominant speaker is supported in this firmware version. */
6626
6627 if ( f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled == FALSE )
6628 return cOCT6100_ERR_NOT_SUPPORTED_DOMINANT_SPEAKER;
6629
6630 /*=====================================================================*/
6631
6632 return cOCT6100_ERR_OK;
6633 }
6634 #endif
6635
6636
6637 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6638
6639 Function: Oct6100ApiUpdateBridgeDominantSpeakerResources
6640
6641 Description: Modify the conference bridge such that the new dominant
6642 speaker is the one specified by the index.
6643
6644 -------------------------------------------------------------------------------
6645 | Argument | Description
6646 -------------------------------------------------------------------------------
6647 f_pApiInstance Pointer to API instance. This memory is used to keep the
6648 present state of the chip and all its resources.
6649
6650 f_usChanIndex Index of the channel to be set as the dominant speaker.
6651 f_usBridgeIndex Index of the bridge where this channel is on.
6652
6653 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6654 #if !SKIP_Oct6100ApiUpdateBridgeDominantSpeakerResources
6655 UINT32 Oct6100ApiUpdateBridgeDominantSpeakerResources(
6656 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6657 IN UINT16 f_usChanIndex,
6658 IN UINT16 f_usBridgeIndex )
6659 {
6660 tPOCT6100_API_CHANNEL pEchoChanEntry;
6661 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6662 tPOCT6100_SHARED_INFO pSharedInfo;
6663
6664 UINT16 usChannelIndex;
6665 UINT32 ulResult;
6666
6667 /* Obtain local pointer to shared portion of instance. */
6668 pSharedInfo = f_pApiInstance->pSharedInfo;
6669
6670 /* Get the bridge entry for this channel. */
6671 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex )
6672
6673 /* Set the dominant speaker index for all channels in this conference. */
6674
6675 /* Search through the list of API channel entry for the ones on to this bridge.*/
6676 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
6677 {
6678 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usChannelIndex );
6679
6680 if ( pEchoChanEntry->fReserved == TRUE )
6681 {
6682 if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
6683 {
6684 /* If we are unsetting the dominant speaker, of if it is not our channel index. */
6685 if ( ( f_usChanIndex == cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED )
6686 || ( f_usChanIndex != usChannelIndex ) )
6687 {
6688 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, f_usChanIndex );
6689 if ( ulResult != cOCT6100_ERR_OK )
6690 return ulResult;
6691 }
6692 }
6693 }
6694 }
6695
6696 /* Make sure this channel is disabled. */
6697 if ( f_usChanIndex != cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED )
6698 {
6699 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED );
6700 if ( ulResult != cOCT6100_ERR_OK )
6701 return ulResult;
6702 }
6703
6704 /* Save this in the conference bridge structure. */
6705 /* This will be needed later when removing the channel. */
6706 pBridgeEntry->fDominantSpeakerSet = TRUE;
6707 pBridgeEntry->usDominantSpeakerChanIndex = f_usChanIndex;
6708
6709 return cOCT6100_ERR_OK;
6710 }
6711 #endif
6712
6713
6714 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6715
6716 Function: Oct6100ConfBridgeMaskChangeSer
6717
6718 Description: This function changes the mask of flexible bridge
6719 participant.
6720
6721 -------------------------------------------------------------------------------
6722 | Argument | Description
6723 -------------------------------------------------------------------------------
6724 f_pApiInstance Pointer to API instance. This memory is used to
6725 keep the present state of the chip and all its
6726 resources.
6727
6728 f_pConfBridgeMaskChange Pointer to conference bridge participant mask
6729 change structure.
6730
6731 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6732 #if !SKIP_Oct6100ConfBridgeMaskChangeSer
6733 UINT32 Oct6100ConfBridgeMaskChangeSer(
6734 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6735 IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange )
6736 {
6737 UINT16 usChanIndex;
6738 UINT16 usBridgeIndex;
6739 UINT32 ulResult;
6740 UINT32 ulNewParticipantMask;
6741
6742 /* Check the validity of the channel handle given. */
6743 ulResult = Oct6100ApiCheckBridgeMaskChangeParams( f_pApiInstance, f_pConfBridgeMaskChange, &usChanIndex, &usBridgeIndex, &ulNewParticipantMask );
6744 if ( ulResult != cOCT6100_ERR_OK )
6745 return ulResult;
6746
6747 /* Update all resources needed by the new mask. */
6748 ulResult = Oct6100ApiUpdateMaskModifyResources( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask );
6749 if ( ulResult != cOCT6100_ERR_OK )
6750 return ulResult;
6751
6752 /* Commit the changes to the chip's internal memories. */
6753 ulResult = Oct6100ApiBridgeUpdateMask( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask );
6754 if ( ulResult != cOCT6100_ERR_OK )
6755 return ulResult;
6756
6757 return cOCT6100_ERR_OK;
6758 }
6759 #endif
6760
6761
6762 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6763
6764 Function: Oct6100ApiCheckBridgeMaskChangeParams
6765
6766 Description: Check the validity of the channel given for setting the
6767 mask.
6768
6769 -------------------------------------------------------------------------------
6770 | Argument | Description
6771 -------------------------------------------------------------------------------
6772 f_pApiInstance Pointer to API instance. This memory is used to keep the
6773 present state of the chip and all its resources.
6774
6775 f_pConfBridgeMaskChange Pointer to conference bridge channel mask change structure.
6776 f_pusChannelIndex Pointer to a channel index.
6777 f_pusBridgeIndex Pointer to a bridge index.
6778 f_pulNewParticipantMask New mask to apply for this participant.
6779 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6780 #if !SKIP_Oct6100ApiCheckBridgeMaskChangeParams
6781 UINT32 Oct6100ApiCheckBridgeMaskChangeParams(
6782 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6783 IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange,
6784 OUT PUINT16 f_pusChannelIndex,
6785 OUT PUINT16 f_pusBridgeIndex,
6786 OUT PUINT32 f_pulNewParticipantMask )
6787 {
6788 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6789 tPOCT6100_API_CHANNEL pEchoChanEntry;
6790 UINT32 ulEntryOpenCnt;
6791
6792 /* Check for errors. */
6793 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
6794 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
6795
6796 if ( f_pConfBridgeMaskChange->ulChannelHndl == cOCT6100_INVALID_HANDLE )
6797 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6798
6799 /*=====================================================================*/
6800 /* Check the channel handle.*/
6801
6802 if ( (f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
6803 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6804
6805 *f_pusChannelIndex = (UINT16)( f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
6806 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
6807 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6808
6809 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
6810
6811 /* Extract the entry open count from the provided handle. */
6812 ulEntryOpenCnt = (f_pConfBridgeMaskChange->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6813
6814 /* Check for errors. */
6815 if ( pEchoChanEntry->fReserved != TRUE )
6816 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6817 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
6818 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6819
6820 /* Check if the channel is bound to a conference bridge. */
6821 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
6822 return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE;
6823
6824 /* Set the bridge index. */
6825 *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex;
6826
6827 /*=====================================================================*/
6828
6829 /*=====================================================================*/
6830
6831 if ( ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX )
6832 || ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) )
6833 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6834
6835 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
6836
6837 /* Check for errors. */
6838 if ( pBridgeEntry->fReserved != TRUE )
6839 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6840
6841 /* Check if this is bridge is a flexible conference bridge. */
6842 if ( pBridgeEntry->fFlexibleConferencing == FALSE )
6843 return cOCT6100_ERR_CONF_BRIDGE_SIMPLE_BRIDGE;
6844
6845 /*=====================================================================*/
6846
6847 /* Return new mask to apply. */
6848 *f_pulNewParticipantMask = f_pConfBridgeMaskChange->ulNewListenerMask;
6849
6850 return cOCT6100_ERR_OK;
6851 }
6852 #endif
6853
6854
6855 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6856
6857 Function: Oct6100ApiUpdateMaskModifyResources
6858
6859 Description: Modify/reserve all resources needed for the modification of
6860 the participant's mask.
6861
6862 -------------------------------------------------------------------------------
6863 | Argument | Description
6864 -------------------------------------------------------------------------------
6865 f_pApiInstance Pointer to API instance. This memory is used to keep the
6866 present state of the chip and all its resources.
6867
6868 f_usBridgeIndex Bridge index of the bridge where this channel is residing.
6869 f_usChanIndex Channel index of the channel to be modified.
6870 f_ulNewListenerMask New mask to apply to the selected participant.
6871
6872 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6873 #if !SKIP_Oct6100ApiUpdateMaskModifyResources
6874 UINT32 Oct6100ApiUpdateMaskModifyResources(
6875 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6876 IN UINT16 f_usBridgeIndex,
6877 IN UINT16 f_usChanIndex,
6878 IN UINT32 f_ulNewListenerMask )
6879 {
6880 tPOCT6100_API_CHANNEL pChanEntry;
6881 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
6882 tPOCT6100_SHARED_INFO pSharedInfo;
6883 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
6884 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
6885
6886 UINT32 ulResult = cOCT6100_ERR_OK;
6887 UINT32 ulTempVar;
6888 UINT32 ulOldListenerMask;
6889 UINT16 usChannelIndex;
6890
6891 /* Obtain local pointer to shared portion of instance. */
6892 pSharedInfo = f_pApiInstance->pSharedInfo;
6893
6894 /* Get a pointer to the channel's list entry. */
6895 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex )
6896
6897 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex );
6898
6899 /* Must travel all clients of this conference and reserve a load or accumulate event for */
6900 /* all participants which could not hear us but now can. While at it, check for events that */
6901 /* could be released, for example a participant that we cannot hear anymore. */
6902
6903 ulOldListenerMask = pParticipant->ulListenerMask;
6904
6905 /* Search through the list of API channel entry for the ones on to this bridge.*/
6906 for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ )
6907 {
6908 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
6909
6910 /* Channel reserved? */
6911 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
6912 {
6913 /* On current bridge? */
6914 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
6915 {
6916 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
6917
6918 /* Check if we can now hear this participant, but could not before. */
6919 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
6920 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) )
6921 {
6922 /* Must reserve a load or accumulate entry mixer event here! */
6923 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
6924 if ( ulResult != cOCT6100_ERR_OK )
6925 {
6926 /* Most probably, the hardware is out of mixer events. */
6927 break;
6928 }
6929 }
6930
6931 /* Check if we can now NOT hear this participant, but could before. */
6932 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
6933 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) )
6934 {
6935 /* Must release the load or accumulate entry mixer event. */
6936 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
6937 if ( ulResult != cOCT6100_ERR_OK )
6938 {
6939 break;
6940 }
6941 }
6942 }
6943 }
6944 }
6945
6946 /* If an error is returned, make sure everything is cleaned up properly. */
6947 if ( ulResult != cOCT6100_ERR_OK )
6948 {
6949 /* Search through the list of API channel entry for the ones on to this bridge.*/
6950 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
6951 {
6952 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
6953
6954 /* Channel reserved? */
6955 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
6956 {
6957 /* On current bridge? */
6958 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
6959 {
6960 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
6961
6962 /* Check if we can now hear this participant, but could not before. */
6963 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
6964 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) )
6965 {
6966 /* If the load or event entry in the mixer memory was reserved. */
6967 if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX )
6968 {
6969 /* Must release the load or accumulate entry mixer event. */
6970 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
6971 if ( ulTempVar != cOCT6100_ERR_OK )
6972 return ulTempVar;
6973
6974 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
6975 }
6976 }
6977
6978 /* Check if we can now NOT hear this participant, but could before. */
6979 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
6980 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) )
6981 {
6982 /* If the load or event entry in the mixer memory was reserved. */
6983 if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] == cOCT6100_INVALID_INDEX )
6984 {
6985 /* Must release the load or accumulate entry mixer event. */
6986 ulTempVar = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ) );
6987 if ( ulTempVar != cOCT6100_ERR_OK )
6988 return ulTempVar;
6989 }
6990 }
6991 }
6992 }
6993 }
6994
6995 return ulResult;
6996 }
6997
6998 return cOCT6100_ERR_OK;
6999 }
7000 #endif
7001
7002
7003 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7004
7005 Function: Oct6100ApiBridgeUpdateMask
7006
7007 Description: Update the participant's mask.
7008
7009 -------------------------------------------------------------------------------
7010 | Argument | Description
7011 -------------------------------------------------------------------------------
7012 f_pApiInstance Pointer to API instance. This memory is used to keep the
7013 present state of the chip and all its resources.
7014 f_usBridgeIndex Bridge index of the bridge where this channel is residing.
7015 f_usChanIndex Channel index of the channel to be modified.
7016 f_ulNewListenerMask New mask to apply to the selected participant.
7017
7018 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7019 #if !SKIP_Oct6100ApiBridgeUpdateMask
7020 UINT32 Oct6100ApiBridgeUpdateMask(
7021 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7022 IN UINT16 f_usBridgeIndex,
7023 IN UINT16 f_usChanIndex,
7024 IN UINT32 f_ulNewListenerMask )
7025 {
7026 tPOCT6100_API_CHANNEL pChanEntry;
7027 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
7028 tPOCT6100_SHARED_INFO pSharedInfo;
7029 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
7030 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
7031 tOCT6100_WRITE_PARAMS WriteParams;
7032
7033 UINT32 ulResult;
7034 UINT32 ulOldListenerMask;
7035 UINT16 usChannelIndex;
7036
7037 UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ];
7038 UINT32 ulMutePortChannelIndex;
7039
7040 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
7041 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX;
7042
7043 /* Obtain local pointer to shared portion of instance. */
7044 pSharedInfo = f_pApiInstance->pSharedInfo;
7045
7046 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
7047
7048 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
7049
7050 /* Get a pointer to the channel's list entry. */
7051 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex )
7052
7053 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex );
7054
7055 ulOldListenerMask = pParticipant->ulListenerMask;
7056
7057 /* Search through the list of API channel entry for the ones onto this bridge. */
7058 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
7059 {
7060 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
7061
7062 /* Channel reserved? */
7063 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
7064 {
7065 /* On current bridge? */
7066 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
7067 {
7068 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
7069
7070 /* Check if we can now hear this participant, but could not before. */
7071 if ( ( pTempEchoChanEntry->fMute == FALSE )
7072 && ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
7073 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) )
7074 {
7075 /* First create/update the current channel's mixer. */
7076 ulResult = Oct6100ApiBridgeAddParticipantToChannel(
7077 f_pApiInstance,
7078 f_usBridgeIndex,
7079 usChannelIndex,
7080 f_usChanIndex,
7081 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ],
7082 pChanEntry->usSubStoreEventIndex,
7083 pChanEntry->usSinCopyEventIndex,
7084 pTempParticipant->ulInputPort,
7085 pParticipant->ulInputPort );
7086 if ( ulResult != cOCT6100_ERR_OK )
7087 return ulResult;
7088
7089 if ( pParticipant->fFlexibleMixerCreated == TRUE )
7090 {
7091 /* Check if the Rin silence event can be cleared now that the */
7092 /* channel has been added to a conference. */
7093 if ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX )
7094 {
7095 /* Remove the event from the list.*/
7096 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
7097 pChanEntry->usRinSilenceEventIndex,
7098 cOCT6100_EVENT_TYPE_SOUT_COPY );
7099 if ( ulResult != cOCT6100_ERR_OK )
7100 return ulResult;
7101
7102 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex );
7103 if ( ulResult != cOCT6100_ERR_OK )
7104 return cOCT6100_ERR_FATAL_DF;
7105
7106 pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX;
7107 }
7108 }
7109 }
7110
7111 /* Check if we can now NOT hear this participant, but could before. */
7112 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
7113 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
7114 && ( pParticipant->fFlexibleMixerCreated == TRUE )
7115 && ( pTempEchoChanEntry->fMute == FALSE ) )
7116 {
7117 /* First update the current channel's mixer. */
7118 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
7119 f_pApiInstance,
7120 f_usBridgeIndex,
7121 usChannelIndex,
7122 f_usChanIndex,
7123 TRUE );
7124 if ( ulResult != cOCT6100_ERR_OK )
7125 return ulResult;
7126
7127 if ( pParticipant->fFlexibleMixerCreated == FALSE )
7128 {
7129 /* Remember to mute the port on this channel. */
7130 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
7131 {
7132 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == f_usChanIndex )
7133 {
7134 break;
7135 }
7136 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
7137 {
7138 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = f_usChanIndex;
7139 break;
7140 }
7141 }
7142 }
7143 }
7144
7145 /* Clear the load or accumulate event index for this participant. */
7146 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
7147 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) )
7148 {
7149 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
7150 }
7151 }
7152 }
7153
7154 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
7155 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
7156 {
7157 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
7158 {
7159 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
7160
7161 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
7162
7163 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
7164 {
7165 /* Check if the Rin port must be muted on this channel. */
7166 ulResult = Oct6100ApiMutePorts(
7167 f_pApiInstance,
7168 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
7169 pTempEchoChanEntry->usRinTsstIndex,
7170 pTempEchoChanEntry->usSinTsstIndex,
7171 FALSE );
7172 if ( ulResult != cOCT6100_ERR_OK )
7173 return ulResult;
7174 }
7175 }
7176 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
7177 {
7178 /* No more channels to check for muting. */
7179 break;
7180 }
7181 }
7182 }
7183
7184 /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */
7185 if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
7186 {
7187 if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
7188 {
7189 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
7190 pChanEntry->usSinTsstIndex,
7191 pChanEntry->usExtraSinTsiMemIndex,
7192 pChanEntry->TdmConfig.bySinPcmLaw );
7193 if ( ulResult != cOCT6100_ERR_OK )
7194 return ulResult;
7195 }
7196
7197 /* If the silence TSI is loaded on this port, update with the extra sin TSI. */
7198 if ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
7199 {
7200 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
7201
7202 WriteParams.ulWriteAddress += 2;
7203 WriteParams.usWriteData = pChanEntry->usExtraSinTsiMemIndex;
7204
7205 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
7206 if ( ulResult != cOCT6100_ERR_OK )
7207 return ulResult;
7208 }
7209 }
7210
7211 /* Configure the RIN copy mixer entry and memory - if using the RIN port. */
7212 if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_RIN )
7213 {
7214 if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
7215 {
7216 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
7217 pChanEntry->usRinTsstIndex,
7218 pChanEntry->usExtraRinTsiMemIndex,
7219 pChanEntry->TdmConfig.byRinPcmLaw );
7220 if ( ulResult != cOCT6100_ERR_OK )
7221 return ulResult;
7222 }
7223 }
7224
7225 /* Save the new mask permanently in the API instance. */
7226 pParticipant->ulListenerMask = f_ulNewListenerMask;
7227
7228 return cOCT6100_ERR_OK;
7229 }
7230 #endif
7231
7232
7233 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7234
7235 Function: Oct6100ConfBridgeGetStatsSer
7236
7237 Description: This function returns the statistics from the specified bridge.
7238
7239 -------------------------------------------------------------------------------
7240 | Argument | Description
7241 -------------------------------------------------------------------------------
7242 f_pApiInstance Pointer to API instance. This memory is used to keep the
7243 present state of the chip and all its resources.
7244
7245 f_pConfBridgeStats Pointer to conference bridge stats structure.
7246
7247 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7248 #if !SKIP_Oct6100ConfBridgeGetStatsSer
7249 UINT32 Oct6100ConfBridgeGetStatsSer(
7250 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7251 IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats )
7252 {
7253 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
7254 UINT16 usConfBridgeIndex;
7255 UINT32 ulEntryOpenCnt;
7256
7257 /* Check for errors. */
7258 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
7259 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
7260
7261 /*=====================================================================*/
7262 /* Check the conference bridge handle. */
7263
7264 /* Check the provided handle. */
7265 if ( (f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
7266 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
7267
7268 usConfBridgeIndex = (UINT16)( f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
7269 if ( usConfBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
7270 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
7271
7272 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, usConfBridgeIndex )
7273
7274 /* Extract the entry open count from the provided handle. */
7275 ulEntryOpenCnt = (f_pConfBridgeStats->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
7276
7277 /* Check for errors. */
7278 if ( pBridgeEntry->fReserved != TRUE )
7279 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
7280 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
7281 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
7282
7283 /*=====================================================================*/
7284
7285 /* Return the stats.*/
7286 f_pConfBridgeStats->ulNumChannels = pBridgeEntry->usNumClients;
7287 f_pConfBridgeStats->ulNumTappedChannels = pBridgeEntry->usNumTappedClients;
7288 f_pConfBridgeStats->fFlexibleConferencing = pBridgeEntry->fFlexibleConferencing;
7289
7290 return cOCT6100_ERR_OK;
7291 }
7292 #endif
7293
7294
7295 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7296
7297 Function: Oct6100ApiReserveBridgeEntry
7298
7299 Description: Reserves a free entry in the Bridge list.
7300
7301 -------------------------------------------------------------------------------
7302 | Argument | Description
7303 -------------------------------------------------------------------------------
7304 f_pApiInstance Pointer to API instance. This memory is used to keep the
7305 present state of the chip and all its resources.
7306 f_pusBridgeIndex List entry reserved.
7307
7308 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7309 #if !SKIP_Oct6100ApiReserveBridgeEntry
7310 UINT32 Oct6100ApiReserveBridgeEntry(
7311 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7312 OUT PUINT16 f_pusBridgeIndex )
7313 {
7314 PVOID pBridgeAlloc;
7315 UINT32 ulResult;
7316 UINT32 ulBridgeIndex;
7317
7318 mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc )
7319
7320 ulResult = OctapiLlmAllocAlloc( pBridgeAlloc, &ulBridgeIndex );
7321 if ( ulResult != cOCT6100_ERR_OK )
7322 {
7323 if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
7324 return cOCT6100_ERR_CONF_BRIDGE_ALL_BUFFERS_OPEN;
7325 else
7326 return cOCT6100_ERR_FATAL_29;
7327 }
7328
7329 *f_pusBridgeIndex = (UINT16)( ulBridgeIndex & 0xFFFF );
7330
7331 return cOCT6100_ERR_OK;
7332 }
7333 #endif
7334
7335
7336 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7337
7338 Function: Oct6100ApiReleaseBridgeEntry
7339
7340 Description: Release an entry from the bridge list.
7341
7342 -------------------------------------------------------------------------------
7343 | Argument | Description
7344 -------------------------------------------------------------------------------
7345 f_pApiInstance Pointer to API instance. This memory is used to keep the
7346 present state of the chip and all its resources.
7347
7348 f_usBridgeIndex List entry reserved.
7349
7350 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7351 #if !SKIP_Oct6100ApiReleaseBridgeEntry
7352 UINT32 Oct6100ApiReleaseBridgeEntry(
7353 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7354 IN UINT16 f_usBridgeIndex )
7355 {
7356 PVOID pBridgeAlloc;
7357 UINT32 ulResult;
7358
7359 mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc )
7360
7361 ulResult = OctapiLlmAllocDealloc( pBridgeAlloc, f_usBridgeIndex );
7362 if ( ulResult != cOCT6100_ERR_OK )
7363 return cOCT6100_ERR_FATAL_2A;
7364
7365 return cOCT6100_ERR_OK;
7366 }
7367 #endif
7368
7369
7370 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7371
7372 Function: Oct6100ApiGetPrevLastSubStoreEvent
7373
7374 Description: This function will search for the first valid LastSubStoreEvent
7375 in a bridge located before the current bridge in the bridge
7376 link list.
7377
7378 If the function does not find an event before reaching the end
7379 of the mixers list, then the event head node will be used as the
7380 last Store or SubStore event.
7381
7382 -------------------------------------------------------------------------------
7383 | Argument | Description
7384 -------------------------------------------------------------------------------
7385 f_pApiInstance Pointer to API instance. This memory is used to keep the
7386 present state of the chip and all its resources.
7387
7388 f_pusBridgeEntry Bridge entry.
7389 f_usBridgeFirstLoadEventPtr Load index to check against.
7390 First valid sub store index.
7391
7392 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7393 #if !SKIP_Oct6100ApiGetPrevLastSubStoreEvent
7394 UINT32 Oct6100ApiGetPrevLastSubStoreEvent(
7395 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7396 IN UINT16 f_usBridgeIndex,
7397 IN UINT16 f_usBridgeFirstLoadEventPtr,
7398 OUT PUINT16 f_pusLastSubStoreEventIndex )
7399 {
7400 tPOCT6100_API_MIXER_EVENT pTempMixerEntry;
7401 UINT16 usNextEventPtr;
7402 UINT16 usHeadEventPtr;
7403 UINT16 usLastSubStoreEventPtr;
7404 UINT32 ulLoopCount = 0;
7405 UINT16 usCurrentPtr;
7406 UINT32 ulResult = cOCT6100_ERR_OK;
7407
7408 /* Since we have flexible bridges, we have to */
7409 /* run down the list and check for the appropriate event. */
7410
7411 /* Travel down the list for the last Store or Sub/Store event before the bridge. */
7412
7413 if ( f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
7414 {
7415 /* The only node in the list then is the head node.*/
7416 usHeadEventPtr = cOCT6100_MIXER_HEAD_NODE;
7417 }
7418 else
7419 {
7420 usHeadEventPtr = f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
7421 }
7422
7423 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usHeadEventPtr );
7424 usLastSubStoreEventPtr = usHeadEventPtr;
7425 usNextEventPtr = pTempMixerEntry->usNextEventPtr;
7426 usCurrentPtr = usHeadEventPtr;
7427 while( usCurrentPtr != f_usBridgeFirstLoadEventPtr )
7428 {
7429 if ( ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE )
7430 || ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE ) )
7431 {
7432 usLastSubStoreEventPtr = usNextEventPtr;
7433 }
7434
7435 /* Next pointer. */
7436 usCurrentPtr = usNextEventPtr;
7437 usNextEventPtr = pTempMixerEntry->usNextEventPtr;
7438
7439 /* Check if next event pointer is valid. */
7440 if ( ( ( f_usBridgeFirstLoadEventPtr != usCurrentPtr )
7441 && ( pTempMixerEntry->usNextEventPtr == cOCT6100_INVALID_INDEX ) )
7442 || ( pTempMixerEntry->usNextEventPtr == cOCT6100_MIXER_HEAD_NODE ) )
7443 return cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND;
7444
7445 if ( usNextEventPtr != cOCT6100_INVALID_INDEX )
7446 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usNextEventPtr );
7447
7448 ulLoopCount++;
7449 if ( ulLoopCount == cOCT6100_MAX_LOOP )
7450 return cOCT6100_ERR_FATAL_CA;
7451 }
7452
7453 /* Return the result to the user. */
7454 *f_pusLastSubStoreEventIndex = usLastSubStoreEventPtr;
7455
7456 return ulResult;
7457 }
7458 #endif
7459
7460
7461 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7462
7463 Function: Oct6100ApiGetPreviousEvent
7464
7465 Description: This is a recursive function, it requires an entry event index and
7466 will run down the list until it finds the node just before the one
7467 required.
7468
7469 -------------------------------------------------------------------------------
7470 | Argument | Description
7471 -------------------------------------------------------------------------------
7472 f_pApiInstance Pointer to API instance. This memory is used to keep the
7473 present state of the chip and all its resources.
7474
7475 f_usEntryIndex Event entry index.
7476 f_pusBridgeEntry Bridge entry.
7477 f_pusPreviousIndex Previous index.
7478
7479 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7480 #if !SKIP_Oct6100ApiGetPreviousEvent
7481 UINT32 Oct6100ApiGetPreviousEvent(
7482 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7483 IN UINT16 f_usEntryIndex,
7484 IN UINT16 f_usSearchedIndex,
7485 IN UINT16 f_usLoopCnt,
7486 OUT PUINT16 f_pusPreviousIndex )
7487 {
7488 tPOCT6100_API_MIXER_EVENT pCurrentEntry;
7489 UINT32 ulResult;
7490
7491 /* Get current entry to obtain the link to the previous entry. */
7492 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pCurrentEntry, f_usEntryIndex );
7493
7494 /* Avoid stack overflows. */
7495 if ( f_usLoopCnt == cOCT6100_MAX_MIXER_EVENTS )
7496 return cOCT6100_ERR_FATAL_E3;
7497
7498 if ( pCurrentEntry->usNextEventPtr == cOCT6100_INVALID_INDEX )
7499 {
7500 /* Event not found. */
7501 ulResult = cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND;
7502 }
7503 else if ( pCurrentEntry->usNextEventPtr == f_usSearchedIndex )
7504 {
7505 /* We found our node. */
7506 *f_pusPreviousIndex = f_usEntryIndex;
7507 ulResult = cOCT6100_ERR_OK;
7508 }
7509 else
7510 {
7511 /* Keep searching.*/
7512 f_usLoopCnt++;
7513 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pCurrentEntry->usNextEventPtr, f_usSearchedIndex, f_usLoopCnt, f_pusPreviousIndex );
7514 }
7515
7516 return ulResult;
7517 }
7518 #endif
7519
7520
7521 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7522
7523 Function: Oct6100ApiBridgeSetDominantSpeaker
7524
7525 Description: This function will set the index of the dominant speaker
7526 for the channel index specified.
7527
7528 -------------------------------------------------------------------------------
7529 | Argument | Description
7530 -------------------------------------------------------------------------------
7531 f_pApiInstance Pointer to API instance. This memory is used to
7532 keep the present state of the chip and all its
7533 resources.
7534
7535 f_usChannelIndex Index of the channel where the API must set the
7536 current dominant speaker for the conference.
7537 f_usDominantSpeakerIndex Index of the channel which is the dominant
7538 speaker in the conference.
7539
7540 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7541 #if !SKIP_Oct6100ApiBridgeSetDominantSpeaker
7542 UINT32 Oct6100ApiBridgeSetDominantSpeaker(
7543 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7544 IN UINT16 f_usChannelIndex,
7545 IN UINT16 f_usDominantSpeakerIndex )
7546 {
7547 UINT32 ulBaseAddress;
7548 UINT32 ulFeatureBytesOffset;
7549 UINT32 ulFeatureBitOffset;
7550 UINT32 ulFeatureFieldLength;
7551 UINT32 ulResult;
7552 UINT32 ulTempData;
7553 UINT32 ulMask;
7554
7555 tPOCT6100_API_CHANNEL pEchoChanEntry;
7556
7557 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, f_usChannelIndex );
7558
7559 ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst;
7560 ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.usDwordOffset * 4;
7561 ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byBitOffset;
7562 ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byFieldSize;
7563
7564 /* Retrieve the current configuration. */
7565 ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance,
7566 pEchoChanEntry,
7567 ulBaseAddress + ulFeatureBytesOffset,
7568 &ulTempData);
7569 if ( ulResult != cOCT6100_ERR_OK )
7570 return ulResult;
7571
7572 /* Clear previous value set in the feature field.*/
7573 mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask );
7574
7575 ulTempData &= (~ulMask);
7576 ulTempData |= ( ( f_usDominantSpeakerIndex ) << ulFeatureBitOffset );
7577
7578 /* Save the new dominant speaker. */
7579 ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance,
7580 pEchoChanEntry,
7581 ulBaseAddress + ulFeatureBytesOffset,
7582 ulTempData);
7583 if ( ulResult != cOCT6100_ERR_OK )
7584 return ulResult;
7585
7586 return cOCT6100_ERR_OK;
7587 }
7588 #endif
7589
7590
7591 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7592
7593 Function: Oct6100ApiReserveFlexConfParticipantEntry
7594
7595 Description: Reserves a free entry in the participant list.
7596
7597 -------------------------------------------------------------------------------
7598 | Argument | Description
7599 -------------------------------------------------------------------------------
7600 f_pApiInstance Pointer to API instance. This memory is used to keep the
7601 present state of the chip and all its resources.
7602 f_pusParticipantIndex List entry reserved.
7603
7604 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7605 #if !SKIP_Oct6100ApiReserveFlexConfParticipantEntry
7606 UINT32 Oct6100ApiReserveFlexConfParticipantEntry(
7607 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7608 OUT PUINT16 f_pusParticipantIndex )
7609 {
7610 PVOID pParticipantAlloc;
7611 UINT32 ulResult;
7612 UINT32 ulParticipantIndex;
7613
7614 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc )
7615
7616 ulResult = OctapiLlmAllocAlloc( pParticipantAlloc, &ulParticipantIndex );
7617 if ( ulResult != cOCT6100_ERR_OK )
7618 {
7619 if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
7620 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_ALL_BUFFERS_OPEN;
7621 else
7622 return cOCT6100_ERR_FATAL_29;
7623 }
7624
7625 *f_pusParticipantIndex = (UINT16)( ulParticipantIndex & 0xFFFF );
7626
7627 return cOCT6100_ERR_OK;
7628 }
7629 #endif
7630
7631
7632 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7633
7634 Function: Oct6100ApiReleaseFlexConfParticipantEntry
7635
7636 Description: Release an entry from the flexible conferencing participant
7637 list.
7638
7639 -------------------------------------------------------------------------------
7640 | Argument | Description
7641 -------------------------------------------------------------------------------
7642 f_pApiInstance Pointer to API instance. This memory is used to keep the
7643 present state of the chip and all its resources.
7644
7645 f_usParticipantIndex List entry reserved.
7646
7647 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7648 #if !SKIP_Oct6100ApiReleaseFlexConfParticipantEntry
7649 UINT32 Oct6100ApiReleaseFlexConfParticipantEntry(
7650 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7651 IN UINT16 f_usParticipantIndex )
7652 {
7653 PVOID pParticipantAlloc;
7654 UINT32 ulResult;
7655
7656 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc )
7657
7658 ulResult = OctapiLlmAllocDealloc( pParticipantAlloc, f_usParticipantIndex );
7659 if ( ulResult != cOCT6100_ERR_OK )
7660 return cOCT6100_ERR_FATAL_2A;
7661
7662 return cOCT6100_ERR_OK;
7663 }
7664 #endif