Debian Codegraph @

drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c

raw symbols SCIP
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 pSourceParticipant;
2897 tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant;
2898
2899 tPOCT6100_SHARED_INFO pSharedInfo;
2900 tOCT6100_WRITE_PARAMS WriteParams;
2901
2902 UINT32 ulResult;
2903 UINT16 usLastSubStoreEventIndex;
2904 UINT16 usLastLoadEventIndex;
2905 BOOL fInsertCopy = FALSE;
2906
2907 /* Obtain local pointer to shared portion of instance. */
2908 pSharedInfo = f_pApiInstance->pSharedInfo;
2909
2910 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
2911
2912 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
2913
2914 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
2915
2916 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex );
2917 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex );
2918 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex );
2919 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex );
2920
2921 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadOrAccumulateEventIndex );
2922 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, f_usStoreEventIndex );
2923
2924 /* Check if we are creating the first event for this channel. */
2925 if ( pDestinationParticipant->fFlexibleMixerCreated == FALSE )
2926 {
2927 /*=======================================================================*/
2928 /* Before creating the participant's flexible mixer, make sure the extra Sin */
2929 /* mixer event is programmed correctly for sending the voice stream to the right place. */
2930
2931 /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */
2932 if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2933 {
2934 if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
2935 {
2936 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
2937 pDestinationChanEntry->usSinTsstIndex,
2938 pDestinationChanEntry->usExtraSinTsiMemIndex,
2939 pDestinationChanEntry->TdmConfig.bySinPcmLaw );
2940 if ( ulResult != cOCT6100_ERR_OK )
2941 return ulResult;
2942 }
2943
2944 /* If the silence TSI is loaded on this port, update with the extra sin TSI. */
2945 if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
2946 {
2947 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2948
2949 WriteParams.ulWriteAddress += 2;
2950 WriteParams.usWriteData = pDestinationChanEntry->usExtraSinTsiMemIndex;
2951
2952 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2953 if ( ulResult != cOCT6100_ERR_OK )
2954 return ulResult;
2955 }
2956 }
2957 /*=======================================================================*/
2958
2959
2960 /*=======================================================================*/
2961 /* Program the load event. This is the first event for this new destination channel. */
2962
2963 /* First set the TSI buffer where the resulting stream should be written to. */
2964 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2965
2966 /* For sure, we are loading. */
2967 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
2968
2969 /* Select the TSI memory index according to the source port. */
2970 if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT )
2971 {
2972 WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex;
2973 }
2974 else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
2975 {
2976 WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex;
2977 }
2978
2979 /* Set the event type. */
2980 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
2981
2982 /* Set the source channel index. */
2983 pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex;
2984
2985 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
2986 if ( ulResult != cOCT6100_ERR_OK )
2987 return ulResult;
2988
2989 /*=======================================================================*/
2990
2991
2992
2993 /*=======================================================================*/
2994 /* Program the store event. */
2995
2996 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
2997
2998 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE;
2999
3000 /* Select the TSI memory index and PCM law according to the source port. */
3001 if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT )
3002 {
3003 WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
3004 WriteParams.usWriteData |= pDestinationChanEntry->usSinSoutTsiMemIndex;
3005 }
3006 else /* if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
3007 {
3008 WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
3009 WriteParams.usWriteData |= pDestinationChanEntry->usRinRoutTsiMemIndex;
3010 }
3011
3012 /* Set the event type. */
3013 pStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE;
3014
3015 /* Set the destination channel index. */
3016 pStoreEventEntry->usDestinationChanIndex = f_usDestinationChannelIndex;
3017
3018 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3019 if ( ulResult != cOCT6100_ERR_OK )
3020 return ulResult;
3021
3022 WriteParams.ulWriteAddress += 2;
3023 WriteParams.usWriteData = pDestinationChanEntry->usRinRoutTsiMemIndex;
3024
3025 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3026 if ( ulResult != cOCT6100_ERR_OK )
3027 return ulResult;
3028
3029 /*=======================================================================*/
3030
3031
3032
3033 /*=======================================================================*/
3034 /* Program the Copy event - if using the SOUT port */
3035
3036 if ( ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pDestinationChanEntry->fCopyEventCreated == FALSE ) )
3037 {
3038 /* The copy event has not been created, create it once for the life of the participant on the bridge. */
3039 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3040
3041 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY;
3042 WriteParams.usWriteData |= pDestinationChanEntry->usExtraSinTsiMemIndex;
3043 WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
3044
3045 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3046 if ( ulResult != cOCT6100_ERR_OK )
3047 return ulResult;
3048
3049 WriteParams.ulWriteAddress += 2;
3050 WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex;
3051
3052 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3053 if ( ulResult != cOCT6100_ERR_OK )
3054 return ulResult;
3055
3056 pDestinationChanEntry->fCopyEventCreated = TRUE;
3057
3058 /* Set insert copy flag. */
3059 fInsertCopy = TRUE;
3060 }
3061
3062 /*=======================================================================*/
3063
3064
3065
3066 /*=======================================================================*/
3067 /*=======================================================================*/
3068 /* Now, insert the events into the current list. */
3069 /*=======================================================================*/
3070 /*=======================================================================*/
3071
3072 /* This is the first entry for this channel. Insert the two events at the head */
3073 /* of the list just after the last Sub-Store or Store event. */
3074 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, f_usLoadOrAccumulateEventIndex, &usLastSubStoreEventIndex );
3075 if ( ulResult != cOCT6100_ERR_OK )
3076 {
3077 if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND )
3078 {
3079 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
3080 {
3081 usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE;
3082 }
3083 else
3084 {
3085 usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
3086 }
3087 }
3088 else
3089 {
3090 return cOCT6100_ERR_FATAL_26;
3091 }
3092 }
3093
3094 /* An entry was found, now, modify it's value. */
3095 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex );
3096
3097 /*=======================================================================*/
3098
3099
3100 /*=======================================================================*/
3101 /* Link the store event first. */
3102
3103 pStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr;
3104
3105 /* Link the store event. */
3106 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3107 WriteParams.ulWriteAddress += 4;
3108 WriteParams.usWriteData = (UINT16)( pStoreEventEntry->usNextEventPtr );
3109
3110 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3111 if ( ulResult != cOCT6100_ERR_OK )
3112 return ulResult;
3113
3114 /*=======================================================================*/
3115
3116
3117 /*=======================================================================*/
3118 /* Link the load event now.*/
3119
3120 pLoadEventEntry->usNextEventPtr = f_usStoreEventIndex;
3121
3122 /* Link the load event.*/
3123 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3124 WriteParams.ulWriteAddress += 4;
3125
3126 WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr );
3127
3128 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3129 if ( ulResult != cOCT6100_ERR_OK )
3130 return ulResult;
3131
3132 /*=======================================================================*/
3133
3134
3135 /*=======================================================================*/
3136 /* Now modify the previous last Sub-Store or Store event from another bridge, */
3137 /* such that it links to us. */
3138
3139 pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex;
3140
3141 /* Modify the last node of the other bridge. */
3142 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3143 WriteParams.ulWriteAddress += 4;
3144
3145 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
3146
3147 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3148 if ( ulResult != cOCT6100_ERR_OK )
3149 return ulResult;
3150
3151 /*=======================================================================*/
3152
3153
3154 /*=======================================================================*/
3155 /* Set the event pointer info in the bridge stucture. */
3156
3157 if ( pBridgeEntry->usFirstLoadEventPtr == cOCT6100_INVALID_INDEX )
3158 {
3159 /* We only do this once in case of the flexible conference bridges. */
3160 pBridgeEntry->usFirstLoadEventPtr = f_usLoadOrAccumulateEventIndex;
3161 pBridgeEntry->usFirstSubStoreEventPtr = f_usStoreEventIndex;
3162 }
3163
3164 pBridgeEntry->usLastSubStoreEventPtr = f_usStoreEventIndex;
3165
3166 /* Update the global mixer pointers. */
3167 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == cOCT6100_INVALID_INDEX )
3168 {
3169 /* This bridge is the first to generate mixer event. */
3170 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex;
3171 pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex;
3172 }
3173 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex )
3174 {
3175 /* The two entries were added at the end of the bridge section, */
3176 /* change only the last pointer. */
3177 pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex;
3178 }
3179 else if ( usLastSubStoreEventIndex == cOCT6100_MIXER_HEAD_NODE ||
3180 usLastSubStoreEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr )
3181 {
3182 /* The two entries were added at the start of the bridge section, */
3183 /* change only the first pointer.*/
3184 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex;
3185 }
3186
3187 /*=======================================================================*/
3188
3189
3190 /*=======================================================================*/
3191 /* Insert the copy event if needed in the mixer's list. */
3192
3193 if ( fInsertCopy == TRUE )
3194 {
3195 /* Now insert the Sin copy event into the list. */
3196 ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance,
3197 f_usCopyEventIndex,
3198 cOCT6100_EVENT_TYPE_SIN_COPY,
3199 f_usDestinationChannelIndex );
3200 if ( ulResult != cOCT6100_ERR_OK )
3201 return ulResult;
3202 }
3203
3204 /*=======================================================================*/
3205
3206
3207 /*=======================================================================*/
3208 /* Update the status of the instance structures. */
3209
3210 pDestinationParticipant->fFlexibleMixerCreated = TRUE;
3211
3212 /* Set the event entries as reserved. */
3213 pLoadEventEntry->fReserved = TRUE;
3214 pStoreEventEntry->fReserved = TRUE;
3215
3216 /* Store the event indexes into the channel structure. */
3217 pDestinationChanEntry->usLoadEventIndex = f_usLoadOrAccumulateEventIndex;
3218 pDestinationChanEntry->usSubStoreEventIndex = f_usStoreEventIndex;
3219
3220 /*=======================================================================*/
3221 }
3222 else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == TRUE ) */
3223 {
3224 /*=======================================================================*/
3225 /* Program the Accumulate event. */
3226
3227 /* First set the TSI buffer where the resulting stream should be written to. */
3228 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3229
3230 /* For sure, we are accumulating. */
3231 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
3232
3233 /* Select the TSI memory index according to the source port. */
3234 if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT )
3235 {
3236 WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex;
3237 }
3238 else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */
3239 {
3240 WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex;
3241 }
3242
3243 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3244 if ( ulResult != cOCT6100_ERR_OK )
3245 return ulResult;
3246
3247 /*=======================================================================*/
3248
3249
3250
3251 /*=======================================================================*/
3252 /*=======================================================================*/
3253 /* Now, insert the Accumulate event into the current list. */
3254 /*=======================================================================*/
3255 /*=======================================================================*/
3256
3257 /* Use the Load entry of this channel. */
3258 usLastLoadEventIndex = pDestinationChanEntry->usLoadEventIndex;
3259
3260 /* Add the Accumulate event to the list. */
3261 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastLoadEventIndex );
3262
3263 /* Set the accumulate event now. */
3264 pLoadEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr;
3265
3266 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3267 WriteParams.ulWriteAddress += 4;
3268
3269 WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr );
3270
3271 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3272 if ( ulResult != cOCT6100_ERR_OK )
3273 return ulResult;
3274
3275 /*=======================================================================*/
3276
3277
3278
3279 /*=======================================================================*/
3280 /* Modify the previous Load event. */
3281
3282 /* Now modify the previous Load event. */
3283 pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex;
3284
3285 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
3286 WriteParams.ulWriteAddress += 4;
3287
3288 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
3289
3290 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
3291 if ( ulResult != cOCT6100_ERR_OK )
3292 return ulResult;
3293
3294 /*=======================================================================*/
3295
3296
3297
3298 /*=======================================================================*/
3299 /* Update the status of the instance structures. */
3300
3301 /* Set the Accumulate event entry as reserved. */
3302 pLoadEventEntry->fReserved = TRUE;
3303 /* Set the Event type. */
3304 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
3305 /* Set the source channel index. */
3306 pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex;
3307
3308 /*=======================================================================*/
3309 }
3310
3311 return cOCT6100_ERR_OK;
3312 }
3313 #endif
3314
3315
3316 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3317
3318 Function: Oct6100ConfBridgeChanRemoveSer
3319
3320 Description: Removes an echo channel from a conference bridge.
3321
3322 -------------------------------------------------------------------------------
3323 | Argument | Description
3324 -------------------------------------------------------------------------------
3325 f_pApiInstance Pointer to API instance. This memory is used to keep the
3326 present state of the chip and all its resources.
3327
3328 f_pConfBridgeRemove Pointer to conference bridge channel remove structure.
3329
3330 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3331 #if !SKIP_Oct6100ConfBridgeChanRemoveSer
3332 UINT32 Oct6100ConfBridgeChanRemoveSer(
3333 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3334 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove )
3335 {
3336 UINT16 usBridgeIndex;
3337 UINT16 usChanIndex = 0;
3338 UINT16 usLoadEventIndex;
3339 UINT16 usSubStoreEventIndex;
3340 UINT16 usCopyEventIndex;
3341 UINT32 ulResult;
3342 UINT8 fFlexibleConfBridge;
3343 UINT8 fTap;
3344
3345 /* Check the validity of the channel and conference bridge given. */
3346 ulResult = Oct6100ApiCheckChanRemoveParams(
3347 f_pApiInstance,
3348 f_pConfBridgeRemove,
3349 &usBridgeIndex,
3350 &usChanIndex,
3351 &fFlexibleConfBridge,
3352 &fTap,
3353 &usLoadEventIndex,
3354 &usSubStoreEventIndex,
3355 &usCopyEventIndex );
3356 if ( ulResult != cOCT6100_ERR_OK )
3357 return ulResult;
3358
3359 /* Release all resources reserved for the conference bridge. */
3360 ulResult = Oct6100ApiReleaseChanEventResources(
3361 f_pApiInstance,
3362 f_pConfBridgeRemove,
3363 usBridgeIndex,
3364 usChanIndex,
3365 fFlexibleConfBridge,
3366 usLoadEventIndex,
3367 usSubStoreEventIndex,
3368 usCopyEventIndex );
3369 if ( ulResult != cOCT6100_ERR_OK )
3370 return ulResult;
3371
3372 /* Clear the memory entry for this channel within the bridge. */
3373 ulResult = Oct6100ApiBridgeEventRemove(
3374 f_pApiInstance,
3375 f_pConfBridgeRemove,
3376 usBridgeIndex,
3377 usChanIndex,
3378 fFlexibleConfBridge,
3379 usLoadEventIndex,
3380 usSubStoreEventIndex,
3381 usCopyEventIndex,
3382 fTap );
3383 if ( ulResult != cOCT6100_ERR_OK )
3384 return ulResult;
3385
3386 return cOCT6100_ERR_OK;
3387 }
3388 #endif
3389
3390
3391 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3392
3393 Function: Oct6100ApiCheckChanRemoveParams
3394
3395 Description: Check the validity of the channel and conference bridge given.
3396
3397 -------------------------------------------------------------------------------
3398 | Argument | Description
3399 -------------------------------------------------------------------------------
3400 f_pApiInstance Pointer to API instance. This memory is used to keep the
3401 present state of the chip and all its resources.
3402 f_pConfBridgeRemove Pointer to conference bridge channenl add structure.
3403 f_pusBridgeIndex Pointer to the bridge index.
3404 f_pfFlexibleConfBridge If this is a flexible conference bridge
3405 f_pusChannelIndex Pointer to the channel index to be added to the bridge.
3406 f_pusLoadEventIndex Pointer to the load mixer event.
3407 f_pusSubStoreEventIndex Pointer to the sub-store mixer event.
3408 f_pusCopyEventIndex Pointer to the copy mixer event.
3409
3410 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3411 #if !SKIP_Oct6100ApiCheckChanRemoveParams
3412 UINT32 Oct6100ApiCheckChanRemoveParams(
3413 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3414 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove,
3415 OUT PUINT16 f_pusBridgeIndex,
3416 OUT PUINT16 f_pusChannelIndex,
3417 OUT PUINT8 f_pfFlexibleConfBridge,
3418 OUT PUINT8 f_pfTap,
3419 OUT PUINT16 f_pusLoadEventIndex,
3420 OUT PUINT16 f_pusSubStoreEventIndex,
3421 OUT PUINT16 f_pusCopyEventIndex )
3422 {
3423 UINT32 ulEntryOpenCnt;
3424 tPOCT6100_API_CHANNEL pEchoChanEntry;
3425 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
3426
3427 /* Verify if the remove all flag is valid. */
3428 if ( f_pConfBridgeRemove->fRemoveAll != TRUE &&
3429 f_pConfBridgeRemove->fRemoveAll != FALSE )
3430 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_ALL;
3431
3432 /* Check the channel handle only if the remove all flag is set to FALSE. */
3433 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3434 {
3435 /*=====================================================================*/
3436 /* Check the channel handle. */
3437
3438 if ( (f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
3439 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3440
3441 *f_pusChannelIndex = (UINT16)( f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
3442 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
3443 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3444
3445 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
3446
3447 /* Extract the entry open count from the provided handle. */
3448 ulEntryOpenCnt = (f_pConfBridgeRemove->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
3449
3450 /* Check for errors. */
3451 if ( pEchoChanEntry->fReserved != TRUE )
3452 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
3453 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
3454 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3455 if ( pEchoChanEntry->fBeingTapped == TRUE )
3456 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY;
3457
3458 /*=====================================================================*/
3459
3460 *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex;
3461 *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex;
3462 *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex;
3463 *f_pusCopyEventIndex = pEchoChanEntry->usSinCopyEventIndex;
3464
3465 /* Check if the channel is really part of the bridge. */
3466 if ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX )
3467 return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE;
3468
3469 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
3470
3471 /* Return whether this is a flexible bridge or not. */
3472 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
3473
3474 /* Return whether this is a tap or not. */
3475 *f_pfTap = pEchoChanEntry->fTap;
3476 }
3477 else /* f_pConfBridgeRemove->fRemoveAll == TRUE */
3478 {
3479 /* Check the provided handle. */
3480 if ( (f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
3481 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3482
3483 *f_pusBridgeIndex = (UINT16)( f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
3484 if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
3485 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3486
3487 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
3488
3489 /* Extract the entry open count from the provided handle. */
3490 ulEntryOpenCnt = (f_pConfBridgeRemove->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
3491
3492 /* Check for errors. */
3493 if ( pBridgeEntry->fReserved != TRUE )
3494 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
3495 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
3496 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
3497
3498 /* This information is not currently available. */
3499 *f_pusLoadEventIndex = cOCT6100_INVALID_INDEX;
3500 *f_pusSubStoreEventIndex = cOCT6100_INVALID_INDEX;
3501 *f_pusCopyEventIndex = cOCT6100_INVALID_INDEX;
3502
3503 /* Return whether this is a flexible bridge or not. */
3504 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
3505
3506 *f_pfTap = FALSE;
3507 }
3508
3509 return cOCT6100_ERR_OK;
3510 }
3511 #endif
3512
3513
3514 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3515
3516 Function: Oct6100ApiReleaseChanEventResources
3517
3518 Description: Release all resources reserved to the channel part of the
3519 conference bridge.
3520
3521 -------------------------------------------------------------------------------
3522 | Argument | Description
3523 -------------------------------------------------------------------------------
3524 f_pApiInstance Pointer to API instance. This memory is used to keep the
3525 present state of the chip and all its resources.
3526 f_pConfBridgeRemove Pointer to conference bridge channel add structure.
3527 f_usBridgeIndex Index of the bridge structure within the API's bridge list.
3528 f_usChanIndex Index of the channel structure within the API's channel list
3529 f_fFlexibleConfBridge If this is a flexible conference bridge.
3530 f_usLoadEventIndex Index of the load mixer event.
3531 f_usSubStoreEventIndex Index of the sub-store mixer event.
3532 f_usCopyEventIndex Index of the copy mixer event.
3533
3534 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3535 #if !SKIP_Oct6100ApiReleaseChanEventResources
3536 UINT32 Oct6100ApiReleaseChanEventResources(
3537 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3538 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove,
3539 IN UINT16 f_usBridgeIndex,
3540 IN UINT16 f_usChanIndex,
3541 IN UINT8 f_fFlexibleConfBridge,
3542 IN UINT16 f_usLoadEventIndex,
3543 IN UINT16 f_usSubStoreEventIndex,
3544 IN UINT16 f_usCopyEventIndex )
3545 {
3546 tPOCT6100_SHARED_INFO pSharedInfo;
3547 tPOCT6100_API_CHANNEL pEchoChanEntry;
3548 UINT32 ulResult;
3549 UINT32 i;
3550
3551 /* Obtain local pointer to shared portion of instance. */
3552 pSharedInfo = f_pApiInstance->pSharedInfo;
3553
3554 if ( f_fFlexibleConfBridge == TRUE )
3555 {
3556 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
3557 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
3558
3559 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3560 {
3561 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
3562
3563 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
3564 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
3565
3566 /* Release an entry for the store event in the mixer memory. */
3567 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex );
3568 if ( ulResult != cOCT6100_ERR_OK )
3569 {
3570 return ulResult;
3571 }
3572
3573 /* Release an entry for the Sin copy event in the mixer memory. */
3574 /* This value can be invalid if the Rin port was used - no need to release. */
3575 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
3576 {
3577 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex );
3578 if ( ulResult != cOCT6100_ERR_OK )
3579 {
3580 return ulResult;
3581 }
3582 }
3583
3584 /* This value can be 0 if the Rin port was used - no need to release. */
3585 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3586 {
3587 /* Release the extra TSI entry.*/
3588 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3589 if ( ulResult != cOCT6100_ERR_OK )
3590 {
3591 return ulResult;
3592 }
3593 }
3594
3595 /* This value can be 0 if the Sout port was used - no need to release. */
3596 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
3597 {
3598 /* Release the extra TSI entry.*/
3599 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex );
3600 if ( ulResult != cOCT6100_ERR_OK )
3601 {
3602 return ulResult;
3603 }
3604 }
3605
3606 /* Must travel all clients of this conference and release the load or accumulate events for */
3607 /* all participants which can hear us and vice versa. */
3608
3609 /* Search through the list of API channel entry for the ones on to this bridge. */
3610 for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ )
3611 {
3612 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, i );
3613
3614 /* Channel reserved? */
3615 if ( ( i != f_usChanIndex ) && pTempEchoChanEntry->fReserved == TRUE )
3616 {
3617 /* On current bridge? */
3618 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3619 {
3620 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
3621
3622 /* Check if we can hear this participant. */
3623 if ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
3624 {
3625 /* Must release the allocated mixer event. */
3626 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
3627 if ( ulResult != cOCT6100_ERR_OK )
3628 {
3629 return ulResult;
3630 }
3631
3632 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
3633 }
3634
3635 /* Check if this participant can hear us. */
3636 if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
3637 {
3638 /* Must release the allocated mixer event. */
3639 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] );
3640 if ( ulResult != cOCT6100_ERR_OK )
3641 {
3642 return ulResult;
3643 }
3644
3645 pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
3646 }
3647 }
3648 }
3649 }
3650 }
3651 else /* f_pConfBridgeRemove->fRemoveAll == TRUE */
3652 {
3653 UINT32 ulListenerMaskIndex;
3654
3655 ulResult = cOCT6100_ERR_OK;
3656
3657 /* Search through the list of API channel entry for the ones on to this bridge.*/
3658 for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ )
3659 {
3660 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
3661
3662 /* Channel reserved? */
3663 if ( pEchoChanEntry->fReserved == TRUE )
3664 {
3665 /* On current bridge? */
3666 if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3667 {
3668 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
3669
3670 /* Release an entry for the Store event in the Mixer memory. */
3671 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSubStoreEventIndex );
3672 if ( ulResult != cOCT6100_ERR_OK )
3673 {
3674 return ulResult;
3675 }
3676
3677 /* Release an entry for the Sin copy event in the Mixer memory. */
3678 /* This value can be invalid if the Rin port was used - no need to release. */
3679 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
3680 {
3681 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex );
3682 if ( ulResult != cOCT6100_ERR_OK )
3683 {
3684 return ulResult;
3685 }
3686 }
3687
3688 /* This value can be 0 if the Rin port was used - no need to release. */
3689 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3690 {
3691 /* Release the extra TSI entry.*/
3692 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3693 if ( ulResult != cOCT6100_ERR_OK )
3694 {
3695 return ulResult;
3696 }
3697 }
3698
3699 /* This value can be 0 if the Sout port was used - no need to release. */
3700 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
3701 {
3702 /* Release the extra TSI entry.*/
3703 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex );
3704 if ( ulResult != cOCT6100_ERR_OK )
3705 {
3706 return ulResult;
3707 }
3708 }
3709
3710 /* Check if something can be freed. */
3711 for ( ulListenerMaskIndex = 0; ulListenerMaskIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulListenerMaskIndex ++ )
3712 {
3713 if ( pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX )
3714 {
3715 /* Must release the allocated mixer event. */
3716 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] );
3717 if ( ulResult != cOCT6100_ERR_OK )
3718 {
3719 return ulResult;
3720 }
3721
3722 pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
3723 }
3724 }
3725 }
3726 }
3727 }
3728
3729 if ( ulResult != cOCT6100_ERR_OK )
3730 return ulResult;
3731 }
3732 }
3733 else /* if ( f_fFlexibleConfBridge == FALSE ) */
3734 {
3735 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3736 {
3737 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
3738
3739 /* Release the entry for the load event in the mixer memory. */
3740 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usLoadEventIndex );
3741 if ( ulResult != cOCT6100_ERR_OK )
3742 {
3743 return ulResult;
3744 }
3745
3746 /* Release an entry for the substract and store event in the mixer memory. */
3747 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex );
3748 if ( ulResult != cOCT6100_ERR_OK )
3749 {
3750 return ulResult;
3751 }
3752
3753 /* Release an entry for the Sin copy event in the Mixer memory. */
3754 /* This value can be invalid if the Rin port was used - no need to release. */
3755 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
3756 {
3757 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex );
3758 if ( ulResult != cOCT6100_ERR_OK )
3759 {
3760 return ulResult;
3761 }
3762 }
3763
3764 /* This value can be 0 if the Rin port was used - no need to release. */
3765 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3766 {
3767 /* Release the extra TSI entry. */
3768 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3769 if ( ulResult != cOCT6100_ERR_OK )
3770 {
3771 return ulResult;
3772 }
3773 }
3774 }
3775 else /* f_pConfBridgeRemove->fRemoveAll == TRUE */
3776 {
3777 /* Search through the list of API channel entry for the ones on to the specified bridge.*/
3778 for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ )
3779 {
3780 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
3781
3782 if ( pEchoChanEntry->fReserved == TRUE )
3783 {
3784 if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) )
3785 {
3786 /* Release the entry for the load event in the mixer memory. */
3787 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance,
3788 pEchoChanEntry->usLoadEventIndex );
3789 if ( ulResult != cOCT6100_ERR_OK )
3790 {
3791 return ulResult;
3792 }
3793
3794 /* Release an entry for the substract and store event in the Mixer memory. */
3795 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance,
3796 pEchoChanEntry->usSubStoreEventIndex );
3797 if ( ulResult != cOCT6100_ERR_OK )
3798 {
3799 return ulResult;
3800 }
3801
3802 /* Release an entry for the Sin copy event in the Mixer memory. */
3803 /* This value can be invalid if the Rin port was used - no need to release. */
3804 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
3805 {
3806 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance,
3807 pEchoChanEntry->usSinCopyEventIndex );
3808 if ( ulResult != cOCT6100_ERR_OK )
3809 {
3810 return ulResult;
3811 }
3812 }
3813
3814 /* This value can be 0 if the Rin port was used - no need to release. */
3815 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
3816 {
3817 /* Release the extra TSI entry.*/
3818 ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex );
3819 if ( ulResult != cOCT6100_ERR_OK )
3820 {
3821 return ulResult;
3822 }
3823 }
3824 }
3825 }
3826 }
3827 }
3828 }
3829
3830 return cOCT6100_ERR_OK;
3831 }
3832 #endif
3833
3834
3835 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
3836
3837 Function: Oct6100ApiBridgeEventRemove
3838
3839 Description: Remove the event from the global event list of the chip and
3840 update the bridge and channel structures.
3841
3842 -------------------------------------------------------------------------------
3843 | Argument | Description
3844 -------------------------------------------------------------------------------
3845 f_pApiInstance Pointer to API instance. This memory is used to keep the
3846 present state of the chip and all its resources.
3847 f_pConfBridgeRemove Pointer to a conference bridge channel remove structure.
3848 f_usBridgeIndex Index of the current bridge in the API list.
3849 f_usChanIndex Index of the current channel in the API list.
3850 f_fFlexibleConfBridge If this is a flexible conference bridge.
3851 f_usLoadEventIndex Allocated entry for the Load event of the channel.
3852 f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel.
3853 f_usCopyEventIndex Allocated entry for the copy event of the channel.
3854
3855 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
3856 #if !SKIP_Oct6100ApiBridgeEventRemove
3857 UINT32 Oct6100ApiBridgeEventRemove (
3858 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
3859 IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove,
3860 IN UINT16 f_usBridgeIndex,
3861 IN UINT16 f_usChanIndex,
3862 IN UINT8 f_fFlexibleConfBridge,
3863 IN UINT16 f_usLoadEventIndex,
3864 IN UINT16 f_usSubStoreEventIndex,
3865 IN UINT16 f_usCopyEventIndex,
3866 IN UINT8 f_fTap )
3867 {
3868 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
3869
3870 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
3871 tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry;
3872 tPOCT6100_API_MIXER_EVENT pCopyEventEntry = NULL;
3873 tPOCT6100_API_MIXER_EVENT pTempEntry;
3874
3875 tPOCT6100_API_CHANNEL pEchoChanEntry;
3876 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
3877
3878 tPOCT6100_SHARED_INFO pSharedInfo;
3879 tOCT6100_WRITE_PARAMS WriteParams;
3880 tOCT6100_READ_PARAMS ReadParams;
3881
3882 UINT32 ulResult;
3883 UINT16 usPreviousEventIndex;
3884 UINT16 usTempEventIndex;
3885 UINT32 ulLoopCount = 0;
3886 UINT16 usReadData;
3887 UINT16 usChannelIndex;
3888 UINT32 i;
3889
3890 BOOL fRemoveSinCopy = FALSE;
3891
3892 /* Obtain local pointer to shared portion of instance. */
3893 pSharedInfo = f_pApiInstance->pSharedInfo;
3894
3895 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
3896
3897 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
3898
3899 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
3900
3901 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
3902 ReadParams.pusReadData = &usReadData;
3903
3904 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usBridgeIndex );
3905
3906 /* If no client on the bridge, and the remove all option is specified, return here. */
3907 if ( ( pBridgeEntry->usNumClients == 0 ) && ( f_pConfBridgeRemove->fRemoveAll == TRUE ) )
3908 return cOCT6100_ERR_OK;
3909
3910 /* Make sure the dominant speaker feature is disabled first. */
3911 if ( pBridgeEntry->fDominantSpeakerSet == TRUE )
3912 {
3913 /* If all channels are to be removed or if the dominant speaker is the current channel to be removed. */
3914 if ( ( f_pConfBridgeRemove->fRemoveAll == TRUE )
3915 || ( ( f_pConfBridgeRemove->fRemoveAll == FALSE ) && ( pBridgeEntry->usDominantSpeakerChanIndex == f_usChanIndex ) ) )
3916 {
3917 /* Disable on all channels part of this conference. */
3918
3919 /* Search through the list of API channel entry for the ones on to this bridge. */
3920 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
3921 {
3922 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
3923
3924 if ( pTempEchoChanEntry->fReserved == TRUE )
3925 {
3926 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3927 {
3928 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED );
3929 if ( ulResult != cOCT6100_ERR_OK )
3930 return ulResult;
3931 }
3932 }
3933 }
3934
3935 /* Save this in the conference bridge structure. */
3936 pBridgeEntry->fDominantSpeakerSet = FALSE;
3937 pBridgeEntry->usDominantSpeakerChanIndex = cOCT6100_INVALID_INDEX;
3938 }
3939 else
3940 {
3941 /* Only disable this current channel. */
3942 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED );
3943 if ( ulResult != cOCT6100_ERR_OK )
3944 return ulResult;
3945 }
3946 }
3947
3948 if ( f_fFlexibleConfBridge == TRUE )
3949 {
3950 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
3951 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
3952 UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ];
3953 UINT32 ulMutePortChannelIndex;
3954
3955 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
3956 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX;
3957
3958 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
3959 {
3960 /* The channel index is valid. */
3961 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
3962 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
3963
3964 /* Search through the list of API channel entry for the ones on to this bridge. */
3965 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
3966 {
3967 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
3968
3969 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
3970 {
3971 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
3972 {
3973 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
3974
3975 /* Check if we can hear this participant. */
3976 if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
3977 && ( pParticipant->fFlexibleMixerCreated == TRUE )
3978 && ( pTempEchoChanEntry->fMute == FALSE ) )
3979 {
3980 /* First update the current channel's mixer. */
3981 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
3982 f_pApiInstance,
3983 f_usBridgeIndex,
3984 usChannelIndex,
3985 f_usChanIndex,
3986 TRUE );
3987 if ( ulResult != cOCT6100_ERR_OK )
3988 return ulResult;
3989 }
3990
3991 /* Check if this participant can hear us. */
3992 if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
3993 && ( pTempParticipant->fFlexibleMixerCreated == TRUE )
3994 && ( pEchoChanEntry->fMute == FALSE ) )
3995 {
3996 /* Then update this channel's mixer. */
3997 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
3998 f_pApiInstance,
3999 f_usBridgeIndex,
4000 f_usChanIndex,
4001 usChannelIndex,
4002 TRUE );
4003 if ( ulResult != cOCT6100_ERR_OK )
4004 return ulResult;
4005
4006 /* Remember to mute the port on this channel. */
4007 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4008 {
4009 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex )
4010 {
4011 break;
4012 }
4013 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
4014 {
4015 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex;
4016 break;
4017 }
4018 }
4019 }
4020 }
4021 }
4022 }
4023
4024 /* Check if must manually clear the Sin copy event. */
4025 if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
4026 && ( pEchoChanEntry->fCopyEventCreated == TRUE ) )
4027 {
4028 /* Transform event into no-operation. */
4029 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4030 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4031
4032 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4033 if ( ulResult != cOCT6100_ERR_OK )
4034 return ulResult;
4035
4036 /* Now remove the copy event from the event list. */
4037 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4038 if ( ulResult != cOCT6100_ERR_OK )
4039 return ulResult;
4040
4041 pEchoChanEntry->fCopyEventCreated = FALSE;
4042 }
4043
4044 /* Release an entry for the participant. */
4045 ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex );
4046 if ( ulResult != cOCT6100_ERR_OK )
4047 {
4048 return ulResult;
4049 }
4050
4051 /*=======================================================================*/
4052 /* Update the event and channel API structure */
4053 pEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX;
4054 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
4055 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4056 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4057 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4058
4059 /* Indicate that the extra SIN TSI is not needed anymore by the mixer. */
4060 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4061 {
4062 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4063 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4064 }
4065 else
4066 {
4067 /* Decrement the dependency count, but do not clear the mem index. */
4068 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4069 }
4070
4071 /* Indicate that the extra RIN TSI is not needed anymore by the mixer. */
4072 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
4073 {
4074 pEchoChanEntry->usExtraRinTsiDependencyCnt--;
4075 pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX;
4076 }
4077
4078 /* Update the chip stats structure. */
4079 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4080
4081 pBridgeEntry->usNumClients--;
4082
4083 /* For sure we have to mute the ports of this channel to be removed. */
4084 ulResult = Oct6100ApiMutePorts(
4085 f_pApiInstance,
4086 f_usChanIndex,
4087 pEchoChanEntry->usRinTsstIndex,
4088 pEchoChanEntry->usSinTsstIndex,
4089 FALSE );
4090 if ( ulResult != cOCT6100_ERR_OK )
4091 return ulResult;
4092
4093 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
4094 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4095 {
4096 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
4097 {
4098 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
4099
4100 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
4101
4102 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
4103 {
4104 /* Check if the Rin port must be muted on this channel. */
4105 ulResult = Oct6100ApiMutePorts(
4106 f_pApiInstance,
4107 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
4108 pTempEchoChanEntry->usRinTsstIndex,
4109 pTempEchoChanEntry->usSinTsstIndex,
4110 FALSE );
4111 if ( ulResult != cOCT6100_ERR_OK )
4112 return ulResult;
4113 }
4114 }
4115 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
4116 {
4117 /* No more channels to check for muting. */
4118 break;
4119 }
4120 }
4121 }
4122 else /* if ( f_pConfBridgeRemove->fRemoveAll == TRUE ) */
4123 {
4124 UINT16 usMainChannelIndex;
4125
4126 for ( usMainChannelIndex = 0 ; usMainChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ; usMainChannelIndex++ )
4127 {
4128 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usMainChannelIndex );
4129
4130 /* If this channel is on the bridge we are closing all the channels. */
4131 if ( ( pEchoChanEntry->fReserved == TRUE ) && ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) )
4132 {
4133 /* Remember to mute the port on this channel. */
4134 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4135 {
4136 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usMainChannelIndex )
4137 {
4138 break;
4139 }
4140 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
4141 {
4142 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usMainChannelIndex;
4143 break;
4144 }
4145 }
4146
4147 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
4148
4149 /* Search through the list of API channel entry for the ones on to this bridge. */
4150 for ( usChannelIndex = (UINT16)( usMainChannelIndex + 1 ); usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
4151 {
4152 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
4153 if ( pTempEchoChanEntry->fReserved == TRUE )
4154 {
4155 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
4156 {
4157 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
4158
4159 /* Everyone that we can hear must be removed. */
4160 if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
4161 && ( pParticipant->fFlexibleMixerCreated == TRUE )
4162 && ( pTempEchoChanEntry->fMute == FALSE ) )
4163 {
4164 /* First update the current channel's mixer. */
4165 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
4166 f_pApiInstance,
4167 f_usBridgeIndex,
4168 usChannelIndex,
4169 usMainChannelIndex,
4170 TRUE );
4171 if ( ulResult != cOCT6100_ERR_OK )
4172 return ulResult;
4173 }
4174
4175 /* Check if this participant can hear us. */
4176 if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
4177 && ( pTempParticipant->fFlexibleMixerCreated == TRUE )
4178 && ( pEchoChanEntry->fMute == FALSE ) )
4179 {
4180 /* Then update this channel's mixer. */
4181 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
4182 f_pApiInstance,
4183 f_usBridgeIndex,
4184 usMainChannelIndex,
4185 usChannelIndex,
4186 TRUE );
4187 if ( ulResult != cOCT6100_ERR_OK )
4188 return ulResult;
4189 }
4190 }
4191 }
4192 }
4193
4194 /* Check if must manually clear the Sin copy event. */
4195 if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
4196 && ( pEchoChanEntry->fCopyEventCreated == TRUE ) )
4197 {
4198 /* Transform event into no-operation. */
4199 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4200 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4201
4202 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4203 if ( ulResult != cOCT6100_ERR_OK )
4204 return ulResult;
4205
4206 /* Now remove the copy event from the event list. */
4207 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4208 if ( ulResult != cOCT6100_ERR_OK )
4209 return ulResult;
4210
4211 pEchoChanEntry->fCopyEventCreated = FALSE;
4212 }
4213
4214 /* Release an entry for the participant. */
4215 ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex );
4216 if ( ulResult != cOCT6100_ERR_OK )
4217 {
4218 return ulResult;
4219 }
4220
4221 /*=======================================================================*/
4222 /* Update the event and channel API structure */
4223
4224 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
4225
4226 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4227 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4228 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4229
4230 /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */
4231 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4232 {
4233 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4234 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4235 }
4236 else
4237 {
4238 /* Decrement the dependency count, but do not clear the mem index. */
4239 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4240 }
4241
4242 /* Indicate that the Extra RIN TSI is not needed anymore by the mixer. */
4243 if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 )
4244 {
4245 pEchoChanEntry->usExtraRinTsiDependencyCnt--;
4246 pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX;
4247 }
4248
4249 /* Update the chip stats structure. */
4250 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4251 }
4252 }
4253
4254 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
4255 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
4256 {
4257 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
4258 {
4259 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
4260
4261 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
4262
4263 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
4264 {
4265 /* Check if the Rin port must be muted on this channel. */
4266 ulResult = Oct6100ApiMutePorts(
4267 f_pApiInstance,
4268 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
4269 pTempEchoChanEntry->usRinTsstIndex,
4270 pTempEchoChanEntry->usSinTsstIndex,
4271 FALSE );
4272 if ( ulResult != cOCT6100_ERR_OK )
4273 return ulResult;
4274 }
4275 }
4276 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
4277 {
4278 /* No more channels to check for muting. */
4279 break;
4280 }
4281
4282 /* Clear the flexible conf bridge participant index. */
4283 pTempEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX;
4284 }
4285
4286 /* No more clients on bridge. */
4287 pBridgeEntry->usNumClients = 0;
4288 }
4289 }
4290 else /* if ( f_fFlexibleConfBridge == FALSE ) */
4291 {
4292 if ( f_pConfBridgeRemove->fRemoveAll == FALSE )
4293 {
4294 /* The channel index is valid. */
4295 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
4296
4297 if ( f_fTap == TRUE )
4298 {
4299 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, pEchoChanEntry->usTapBridgeIndex );
4300 }
4301
4302 /* Get a pointer to the event entry. */
4303 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
4304 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex );
4305 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
4306 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex );
4307
4308 /*=======================================================================*/
4309 /* Check if have to modify the silence load event. */
4310
4311 if ( pBridgeEntry->usNumClients != 1 )
4312 {
4313 if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX )
4314 {
4315 if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex )
4316 {
4317 /* Make sure the next event becomes the silence event. */
4318 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadEventEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4319
4320 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
4321 WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */
4322
4323 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4324 if ( ulResult != cOCT6100_ERR_OK )
4325 return ulResult;
4326
4327 /* Update the software model to remember the silence load. */
4328 pBridgeEntry->usSilenceLoadEventPtr = pLoadEventEntry->usNextEventPtr;
4329 }
4330 else
4331 {
4332 /* Somebody else is the silence event, no need to worry. */
4333 }
4334 }
4335 }
4336
4337 /*=======================================================================*/
4338
4339
4340 /*=======================================================================*/
4341 /* Clear the Load event. */
4342
4343 /* First verify if the event to be removed was a load event. */
4344 if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex )
4345 {
4346 /* Change the next entry if one is present to a load event to keep the bridge alive. */
4347 if ( pBridgeEntry->usNumClients == 1 )
4348 {
4349 /* There is no other entry on the bridge, no need to search for an Accumulate event. */
4350 pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX;
4351
4352 /* Clear the silence event, for sure it's invalid. */
4353 pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX;
4354 }
4355 else
4356 {
4357 /* Search for an accumulate event to tranform into a Load event. */
4358 usTempEventIndex = pLoadEventEntry->usNextEventPtr;
4359 ulLoopCount = 0;
4360
4361 /* Find the copy entry before the entry to remove. */
4362 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
4363
4364 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
4365 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
4366 {
4367 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
4368 {
4369 /* Change this entry into a load event. */
4370 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4371 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
4372 if ( ulResult != cOCT6100_ERR_OK )
4373 return ulResult;
4374
4375 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
4376 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD);
4377
4378 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4379 if ( ulResult != cOCT6100_ERR_OK )
4380 return ulResult;
4381
4382 /* Set this entry as the load index. */
4383 pBridgeEntry->usLoadIndex = usTempEventIndex;
4384
4385 /* Update the software model. */
4386 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
4387
4388 /* Stop searching. */
4389 break;
4390 }
4391
4392 /* Go to the next entry into the list. */
4393 usTempEventIndex = pTempEntry->usNextEventPtr;
4394 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
4395
4396 ulLoopCount++;
4397 if ( ulLoopCount == cOCT6100_MAX_LOOP )
4398 return cOCT6100_ERR_FATAL_9B;
4399 }
4400 }
4401 }
4402
4403 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4404 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4405
4406 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4407 if ( ulResult != cOCT6100_ERR_OK )
4408 return ulResult;
4409
4410 /*=======================================================================*/
4411
4412 /*=======================================================================*/
4413 /* Clear the substract and store event. */
4414 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4415 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4416
4417 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4418 if ( ulResult != cOCT6100_ERR_OK )
4419 return ulResult;
4420
4421 /*=======================================================================*/
4422
4423 /*=======================================================================*/
4424 /* Clear the Copy event - if needed. */
4425
4426 if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX )
4427 {
4428 /* Transform event into no-operation. */
4429 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4430 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4431
4432 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4433 if ( ulResult != cOCT6100_ERR_OK )
4434 return ulResult;
4435
4436 if ( f_fTap == FALSE )
4437 {
4438 /* Set remove Sin copy event flag to remove the event from the mixer's list. */
4439 fRemoveSinCopy = TRUE;
4440
4441 /* Clear the copy event created flag. */
4442 pEchoChanEntry->fCopyEventCreated = FALSE;
4443 }
4444 }
4445
4446 /*=======================================================================*/
4447
4448
4449 /*=======================================================================*/
4450 /* Now remove the event from the event list. */
4451
4452 /* Look for the entry that is pointing at the first entry of our bridge. */
4453 if ( f_fTap == FALSE )
4454 {
4455 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex );
4456 }
4457 else
4458 {
4459 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, pEchoChanEntry->usTapBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex );
4460 }
4461
4462 if ( ulResult != cOCT6100_ERR_OK )
4463 {
4464 /* If the entry was not found, we now check for the Sout copy event section/list. */
4465 if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND )
4466 {
4467 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
4468 {
4469 /* No Sout copy, it has to be the head node. */
4470 usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE;
4471 }
4472 else
4473 {
4474 /* Use the last Sout copy event. */
4475 usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
4476 }
4477 }
4478 else
4479 {
4480 return cOCT6100_ERR_FATAL_27;
4481 }
4482 }
4483
4484 if ( pBridgeEntry->usNumClients == 1 )
4485 {
4486 /* An entry was found, now, modify it's value. */
4487 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4488
4489 /* Now modify the previous last Sub Store event from another bridge. */
4490 pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr;
4491
4492 /*=======================================================================*/
4493 /* Modify the last node of the previous bridge to point to the next bridge. */
4494 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4495 WriteParams.ulWriteAddress += 4;
4496
4497 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
4498
4499 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4500 if ( ulResult != cOCT6100_ERR_OK )
4501 return ulResult;
4502
4503 /*=======================================================================*/
4504
4505 /* Set the event pointer info in the bridge stucture. */
4506 pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX;
4507 pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX;
4508 pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX;
4509
4510 /*=======================================================================*/
4511 /* Update the global mixer pointers. */
4512 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex &&
4513 pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex )
4514 {
4515 /* There is no more bridge entry in the mixer link list. */
4516 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX;
4517 pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX;
4518 }
4519 else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex )
4520 {
4521 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pSubStoreEventEntry->usNextEventPtr;
4522 }
4523 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex )
4524 {
4525 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
4526 }
4527 /*=======================================================================*/
4528
4529 if ( f_fTap == TRUE )
4530 {
4531 /* The channel being tapped is not tapped anymore. */
4532 /* There is no direct way of finding the tap, so loop through all channels and find the */
4533 /* tapped channel index. */
4534 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
4535 {
4536 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
4537
4538 if ( pTempEchoChanEntry->usTapChanIndex == f_usChanIndex )
4539 {
4540 tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry;
4541
4542 pTempEchoChanEntry->fBeingTapped = FALSE;
4543 pTempEchoChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX;
4544
4545 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pTempBridgeEntry, f_usBridgeIndex );
4546
4547 pTempBridgeEntry->usNumTappedClients--;
4548
4549 /* Re-assign Rin TSST for tapped channel. */
4550 if ( pTempEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
4551 {
4552 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
4553 pTempEchoChanEntry->usRinTsstIndex,
4554 pTempEchoChanEntry->usRinRoutTsiMemIndex,
4555 pTempEchoChanEntry->TdmConfig.byRinPcmLaw );
4556 if ( ulResult != cOCT6100_ERR_OK )
4557 return ulResult;
4558 }
4559
4560 break;
4561 }
4562 }
4563
4564 /* Check if our model is broken. */
4565 if ( usChannelIndex == pSharedInfo->ChipConfig.usMaxChannels )
4566 return cOCT6100_ERR_FATAL_D3;
4567 }
4568 }
4569 else /* pBridgeEntry->usNumClients > 1 */
4570 {
4571 if ( pBridgeEntry->usFirstLoadEventPtr != f_usLoadEventIndex )
4572 {
4573 /* Now find the load entry of this bridge pointing at this load event */
4574 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usLoadEventIndex, 0, &usPreviousEventIndex );
4575 if ( ulResult != cOCT6100_ERR_OK )
4576 return ulResult;
4577 }
4578
4579 /* Remove the load event to the list. */
4580 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4581
4582 /* Now modify the previous last Sub Store event from another bridge. */
4583 pTempEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr;
4584
4585 /*=======================================================================*/
4586 /* Modify the previous node. */
4587 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4588 WriteParams.ulWriteAddress += 4;
4589
4590 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
4591
4592 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4593 if ( ulResult != cOCT6100_ERR_OK )
4594 return ulResult;
4595
4596 /*=======================================================================*/
4597
4598 /* Now find the last load entry of this bridge ( the one pointing at the first sub-store event ). */
4599 if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex )
4600 {
4601 /* Must start with the first load to get the entry before the first sub store. */
4602 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex );
4603 if ( ulResult != cOCT6100_ERR_OK )
4604 return ulResult;
4605 }
4606 else
4607 {
4608 /* Must start with the first load to get the entry before the first sub store. */
4609 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstSubStoreEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex );
4610 if ( ulResult != cOCT6100_ERR_OK )
4611 return ulResult;
4612 }
4613
4614 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4615 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
4616
4617 /* Now modify the last load event of the bridge. */
4618 pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr;
4619
4620 /*=======================================================================*/
4621 /* Modify the last node of the other bridge. */
4622
4623 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4624 WriteParams.ulWriteAddress += 4;
4625
4626 WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr );
4627
4628 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4629 if ( ulResult != cOCT6100_ERR_OK )
4630 return ulResult;
4631
4632 /*=======================================================================*/
4633
4634 /*=======================================================================*/
4635 /* Update the bridge pointers. */
4636
4637 if ( pBridgeEntry->usFirstLoadEventPtr == f_usLoadEventIndex )
4638 pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr;
4639
4640 if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex )
4641 pBridgeEntry->usFirstSubStoreEventPtr = pSubStoreEventEntry->usNextEventPtr;
4642
4643 if ( pBridgeEntry->usLastSubStoreEventPtr == f_usSubStoreEventIndex )
4644 pBridgeEntry->usLastSubStoreEventPtr = usPreviousEventIndex;
4645
4646 /*=======================================================================*/
4647
4648
4649 /*=======================================================================*/
4650 /* Update the global mixer pointers. */
4651
4652 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex )
4653 {
4654 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr;
4655 }
4656
4657 if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex )
4658 {
4659 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
4660 }
4661 /*=======================================================================*/
4662
4663 }
4664
4665 /* Check if must remove the Sin copy event from the event list. */
4666 if ( fRemoveSinCopy == TRUE )
4667 {
4668 /* Now remove the copy event from the event list. */
4669 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, f_usCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4670 if ( ulResult != cOCT6100_ERR_OK )
4671 return ulResult;
4672 }
4673
4674 /* Get the channel. */
4675 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
4676
4677 /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released. */
4678 if ( ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fTap == FALSE ) )
4679 {
4680 if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
4681 {
4682 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
4683 pEchoChanEntry->usSinTsstIndex,
4684 pEchoChanEntry->usSinSoutTsiMemIndex,
4685 pEchoChanEntry->TdmConfig.bySinPcmLaw );
4686 if ( ulResult != cOCT6100_ERR_OK )
4687 return ulResult;
4688 }
4689
4690 /* If the silence TSI is loaded on this port, update with the original sin TSI. */
4691 if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
4692 {
4693 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4694
4695 WriteParams.ulWriteAddress += 2;
4696 WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex;
4697
4698 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4699 if ( ulResult != cOCT6100_ERR_OK )
4700 return ulResult;
4701 }
4702 }
4703 /* Set the event entries as free. */
4704 pLoadEventEntry->fReserved = FALSE;
4705 pLoadEventEntry->usEventType = cOCT6100_INVALID_INDEX;
4706 pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4707
4708 pSubStoreEventEntry->fReserved = FALSE;
4709 pSubStoreEventEntry->usEventType = cOCT6100_INVALID_INDEX;
4710 pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4711
4712 if ( pCopyEventEntry != NULL )
4713 {
4714 pCopyEventEntry->fReserved = FALSE;
4715 pCopyEventEntry->usEventType = cOCT6100_INVALID_INDEX;
4716 pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4717 }
4718
4719 pBridgeEntry->usNumClients--;
4720
4721 /*=======================================================================*/
4722 /* Update the event and channel API structure */
4723 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
4724 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4725 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4726 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4727
4728 /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */
4729 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4730 {
4731 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4732 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4733 }
4734 else
4735 {
4736 /* Decrement the dependency count, but do not clear the mem index. */
4737 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4738 }
4739
4740 /* Update the chip stats structure. */
4741 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4742
4743 if ( f_fTap == TRUE )
4744 {
4745 /* Can now close the bridge. */
4746 tOCT6100_CONF_BRIDGE_CLOSE BridgeClose;
4747
4748 Oct6100ConfBridgeCloseDef( &BridgeClose );
4749
4750 BridgeClose.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapBridgeIndex;
4751
4752 ulResult = Oct6100ConfBridgeCloseSer( f_pApiInstance, &BridgeClose );
4753 if ( ulResult != cOCT6100_ERR_OK )
4754 return ulResult;
4755
4756 pEchoChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX;
4757 pEchoChanEntry->fTap = FALSE;
4758 }
4759
4760 /* Check if the Rin port must be muted. */
4761 ulResult = Oct6100ApiMutePorts(
4762 f_pApiInstance,
4763 f_usChanIndex,
4764 pEchoChanEntry->usRinTsstIndex,
4765 pEchoChanEntry->usSinTsstIndex,
4766 FALSE );
4767 if ( ulResult != cOCT6100_ERR_OK )
4768 return ulResult;
4769
4770 /*=======================================================================*/
4771 }
4772 else /* f_ulBridgeChanRemove->fRemoveAll == TRUE ) */
4773 {
4774 UINT16 usNextEventPtr;
4775
4776 /* Save the next event pointer before invalidating everything. */
4777 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pBridgeEntry->usLastSubStoreEventPtr );
4778
4779 usNextEventPtr = pSubStoreEventEntry->usNextEventPtr;
4780
4781 /* Search through the list of API channel entry for the ones on to the specified bridge. */
4782 for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ )
4783 {
4784 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
4785
4786 if ( pEchoChanEntry->fReserved == TRUE )
4787 {
4788 if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) )
4789 {
4790 /* Check if we are being tapped. If so, remove the channel that taps us from the conference. */
4791 /* The removal of the channel will make sure the Rin TSST is re-assigned. */
4792 if ( pEchoChanEntry->fBeingTapped == TRUE )
4793 {
4794 tOCT6100_CONF_BRIDGE_CHAN_REMOVE ChanRemove;
4795
4796 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, pEchoChanEntry->usTapChanIndex );
4797
4798 ulResult = Oct6100ConfBridgeChanRemoveDef( &ChanRemove );
4799 if ( ulResult != cOCT6100_ERR_OK )
4800 return ulResult;
4801
4802 ChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pTempEchoChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapChanIndex;
4803
4804 ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &ChanRemove );
4805 if ( ulResult != cOCT6100_ERR_OK )
4806 return ulResult;
4807 }
4808
4809 /*=======================================================================*/
4810 /* Clear the Load event. */
4811 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4812 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4813
4814 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4815 if ( ulResult != cOCT6100_ERR_OK )
4816 return ulResult;
4817
4818 /*=======================================================================*/
4819
4820 /*=======================================================================*/
4821 /* Clear the Substract and store event. */
4822 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4823 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4824
4825 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4826 if ( ulResult != cOCT6100_ERR_OK )
4827 return ulResult;
4828 /*=======================================================================*/
4829
4830 /*=======================================================================*/
4831 /* Clear the SIN copy event.*/
4832
4833 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
4834 {
4835 /* Transform event into no-operation. */
4836 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4837 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
4838
4839 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4840 if ( ulResult != cOCT6100_ERR_OK )
4841 return ulResult;
4842
4843 /* Get a pointer to the event entry. */
4844 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pEchoChanEntry->usSinCopyEventIndex );
4845
4846 /* Update the next event pointer if required. */
4847 if ( usNextEventPtr == pEchoChanEntry->usSinCopyEventIndex )
4848 usNextEventPtr = pCopyEventEntry->usNextEventPtr;
4849
4850 /* Now remove the copy event from the event list. */
4851 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
4852 if ( ulResult != cOCT6100_ERR_OK )
4853 return ulResult;
4854
4855 /* Clear the copy event created flag. */
4856 pEchoChanEntry->fCopyEventCreated = FALSE;
4857 }
4858
4859 /*=======================================================================*/
4860
4861
4862 /*=======================================================================*/
4863 /* Update the event and channel API structure */
4864
4865 /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released.*/
4866 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4867 {
4868 if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
4869 {
4870 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
4871 pEchoChanEntry->usSinTsstIndex,
4872 pEchoChanEntry->usSinSoutTsiMemIndex,
4873 pEchoChanEntry->TdmConfig.bySinPcmLaw );
4874 if ( ulResult != cOCT6100_ERR_OK )
4875 return ulResult;
4876 }
4877
4878 /* If the silence TSI is loaded on this port, update with the original Sin TSI. */
4879 if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
4880 {
4881 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4882
4883 WriteParams.ulWriteAddress += 2;
4884 WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex;
4885
4886 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4887 if ( ulResult != cOCT6100_ERR_OK )
4888 return ulResult;
4889 }
4890 }
4891
4892 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, pEchoChanEntry->usLoadEventIndex );
4893 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pEchoChanEntry->usSubStoreEventIndex );
4894
4895 /* Set the event entries as free. */
4896 pLoadEventEntry->fReserved = FALSE;
4897 pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT;
4898 pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4899
4900 pSubStoreEventEntry->fReserved = FALSE;
4901 pSubStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT;
4902 pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4903
4904 if ( pCopyEventEntry != NULL )
4905 {
4906 pCopyEventEntry->fReserved = FALSE;
4907 pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT;
4908 pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
4909 }
4910
4911 /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */
4912 if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 )
4913 {
4914 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4915 pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX;
4916 }
4917 else
4918 {
4919 /* Decrement the dependency count, but do not clear the mem index. */
4920 pEchoChanEntry->usExtraSinTsiDependencyCnt--;
4921 }
4922
4923 /* Invalidate the channel entry. */
4924 pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX;
4925 pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX;
4926 pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX;
4927
4928 /* Update the chip stats structure. */
4929 pSharedInfo->ChipStats.usNumEcChanUsingMixer--;
4930
4931 /*=======================================================================*/
4932 }
4933 }
4934 }
4935
4936 ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex );
4937 if ( ulResult != cOCT6100_ERR_OK )
4938 {
4939 if ( cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND == ulResult )
4940 {
4941 if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
4942 {
4943 usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE;
4944 }
4945 else
4946 {
4947 usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
4948 }
4949 }
4950 else
4951 {
4952 return cOCT6100_ERR_FATAL_28;
4953 }
4954 }
4955
4956 /* An Entry was found, now, modify it's value. */
4957 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
4958
4959 /* Now modify the previous last Sub Store event from another bridge.*/
4960 /* It will now point at the next bridge, or copy events. */
4961 pTempEntry->usNextEventPtr = usNextEventPtr;
4962
4963 /*=======================================================================*/
4964 /* Modify the last node of the other bridge. */
4965 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
4966 WriteParams.ulWriteAddress += 4;
4967
4968 WriteParams.usWriteData = pTempEntry->usNextEventPtr;
4969
4970 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
4971 if ( ulResult != cOCT6100_ERR_OK )
4972 return ulResult;
4973 /*=======================================================================*/
4974
4975 /*=======================================================================*/
4976 /* Update the global mixer pointers. */
4977 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr &&
4978 pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr )
4979 {
4980 /* This bridge was the only one with event in the list. */
4981 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX;
4982 pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX;
4983 }
4984 else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr )
4985 {
4986 /* This bridge was the first bridge. */
4987 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = usNextEventPtr;
4988 }
4989 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr )
4990 {
4991 /* This bridge was the last bridge.*/
4992 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
4993 }
4994 /*=======================================================================*/
4995
4996 /* Set the event pointer info in the bridge stucture. */
4997 pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX;
4998 pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX;
4999 pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX;
5000 pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX;
5001
5002 pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX;
5003
5004 /* Set the number of clients to 0. */
5005 pBridgeEntry->usNumClients = 0;
5006
5007 /* Search through the list of API channel entry for the ones on to the specified bridge. */
5008 for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ )
5009 {
5010 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i );
5011
5012 if ( pEchoChanEntry->fReserved == TRUE )
5013 {
5014 if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) )
5015 {
5016 pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX;
5017
5018 /* Check if the Rin port must be muted. */
5019 ulResult = Oct6100ApiMutePorts(
5020 f_pApiInstance,
5021 (UINT16)( i & 0xFFFF ),
5022 pEchoChanEntry->usRinTsstIndex,
5023 pEchoChanEntry->usSinTsstIndex,
5024 FALSE );
5025 if ( ulResult != cOCT6100_ERR_OK )
5026 return ulResult;
5027 }
5028 }
5029 }
5030 }
5031 }
5032
5033 return cOCT6100_ERR_OK;
5034 }
5035 #endif
5036
5037
5038 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5039
5040 Function: Oct6100ApiBridgeRemoveParticipantFromChannel
5041
5042 Description: This will remove a flexible conference participant from
5043 a channel.
5044
5045 -------------------------------------------------------------------------------
5046 | Argument | Description
5047 -------------------------------------------------------------------------------
5048 f_pApiInstance Pointer to API instance. This memory is used to keep the
5049 present state of the chip and all its resources.
5050 f_usBridgeIndex Bridge index where this channel is located.
5051 f_usSourceChannelIndex Source channel to copy voice from.
5052 f_usDestinationChannelIndex Destination channel to store resulting voice to.
5053 f_fRemovePermanently Whether to remove permanently this participant.
5054
5055 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5056 #if !SKIP_Oct6100ApiBridgeRemoveParticipantFromChannel
5057 UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
5058 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5059 IN UINT16 f_usBridgeIndex,
5060 IN UINT16 f_usSourceChannelIndex,
5061 IN UINT16 f_usDestinationChannelIndex,
5062 IN UINT8 f_fRemovePermanently )
5063 {
5064 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
5065
5066 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
5067 tPOCT6100_API_MIXER_EVENT pStoreEventEntry;
5068 tPOCT6100_API_MIXER_EVENT pCopyEventEntry;
5069 tPOCT6100_API_MIXER_EVENT pTempEntry;
5070 tPOCT6100_API_MIXER_EVENT pLoadTempEntry;
5071 tPOCT6100_API_MIXER_EVENT pLastEventEntry;
5072 tPOCT6100_API_MIXER_EVENT pLastLoadOrAccumulateEventEntry;
5073
5074 tPOCT6100_API_CHANNEL pSourceChanEntry;
5075 tPOCT6100_API_CHANNEL pDestinationChanEntry;
5076
5077 tPOCT6100_API_FLEX_CONF_PARTICIPANT pSourceParticipant;
5078 tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant;
5079
5080 tPOCT6100_SHARED_INFO pSharedInfo;
5081 tOCT6100_WRITE_PARAMS WriteParams;
5082 tOCT6100_READ_PARAMS ReadParams;
5083
5084 UINT32 ulResult;
5085 UINT32 ulLoopCount;
5086 UINT16 usLastLoadEventIndex;
5087 UINT16 usLoadOrAccumulateEventIndex;
5088 UINT16 usTempEventIndex;
5089 UINT16 usPreviousEventIndex;
5090 UINT16 usLastEventIndex;
5091
5092 UINT16 usReadData;
5093 BOOL fLastEvent = FALSE;
5094 BOOL fSoutCopyEvent = FALSE;
5095
5096 /* Obtain local pointer to shared portion of instance. */
5097 pSharedInfo = f_pApiInstance->pSharedInfo;
5098
5099 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
5100
5101 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5102
5103 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
5104
5105 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5106 ReadParams.pusReadData = &usReadData;
5107
5108 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
5109
5110 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex );
5111 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex );
5112 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex );
5113 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex );
5114
5115 /* Check if the mixer has been created on this channel. */
5116 if ( pDestinationParticipant->fFlexibleMixerCreated == TRUE )
5117 {
5118 /*=======================================================================*/
5119 /* Clear the Load or Accumulate event.*/
5120
5121 usTempEventIndex = pDestinationChanEntry->usLoadEventIndex;
5122 ulLoopCount = 0;
5123
5124 /* Find the Load or Accumulate event entry. */
5125 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usTempEventIndex );
5126 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, pDestinationChanEntry->usSubStoreEventIndex );
5127 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5128
5129 pLastEventEntry = pLoadEventEntry;
5130 pLastLoadOrAccumulateEventEntry = pLoadEventEntry;
5131 usLastLoadEventIndex = usTempEventIndex;
5132 usLastEventIndex = usTempEventIndex;
5133
5134 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
5135 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
5136 {
5137 /* If this is the entry we are looking for. */
5138 if ( pTempEntry->usSourceChanIndex == f_usSourceChannelIndex )
5139 {
5140 /* Check if this is a Load or Accumulate event. */
5141 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD )
5142 {
5143 /* This is the first entry. Check if next entry is an accumulate. */
5144 pLoadTempEntry = pTempEntry;
5145 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, pTempEntry->usNextEventPtr );
5146
5147 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
5148 {
5149 /* Change this entry into a Load event. */
5150 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadTempEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5151 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
5152 if ( ulResult != cOCT6100_ERR_OK )
5153 return ulResult;
5154
5155 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
5156 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD);
5157
5158 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5159 if ( ulResult != cOCT6100_ERR_OK )
5160 return ulResult;
5161
5162 /* Update the channel information with this new load event. */
5163 pDestinationChanEntry->usLoadEventIndex = pLoadTempEntry->usNextEventPtr;
5164
5165 /* Update the software model. */
5166 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
5167
5168 /* Get the previous event. */
5169 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex );
5170 if ( ulResult != cOCT6100_ERR_OK )
5171 return ulResult;
5172
5173 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex );
5174 usLastEventIndex = usPreviousEventIndex;
5175
5176 /* Stop searching. */
5177 break;
5178 }
5179 else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE )
5180 {
5181 /* Get back the event to remove. */
5182 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5183
5184 /* This is the only event on this channel so we can clear everything up. */
5185 fLastEvent = TRUE;
5186
5187 /* Get the previous event. */
5188 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex );
5189 if ( ulResult != cOCT6100_ERR_OK )
5190 return ulResult;
5191
5192 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex );
5193 usLastEventIndex = usPreviousEventIndex;
5194
5195 /* Stop searching. */
5196 break;
5197 }
5198 else
5199 {
5200 /* Software model is broken. */
5201 return cOCT6100_ERR_FATAL_C5;
5202 }
5203
5204 }
5205 else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
5206 {
5207 /* Simply remove the entry. */
5208
5209 /* Get the previous event. */
5210 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex );
5211 if ( ulResult != cOCT6100_ERR_OK )
5212 return ulResult;
5213
5214 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex );
5215 usLastEventIndex = usPreviousEventIndex;
5216
5217 /* Stop searching. */
5218 break;
5219 }
5220 else
5221 {
5222 /* Software model is broken. */
5223 return cOCT6100_ERR_FATAL_C6;
5224 }
5225 }
5226
5227 pLastLoadOrAccumulateEventEntry = pTempEntry;
5228 usLastLoadEventIndex = usTempEventIndex;
5229
5230 /* Go to the next entry into the list. */
5231 usTempEventIndex = pTempEntry->usNextEventPtr;
5232 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5233
5234 ulLoopCount++;
5235 if ( ulLoopCount == cOCT6100_MAX_LOOP )
5236 return cOCT6100_ERR_FATAL_C8;
5237 }
5238
5239 /* Check if we found what we were looking for. */
5240 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE
5241 || pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE )
5242 {
5243 /* Software model is broken. */
5244 return cOCT6100_ERR_FATAL_C7;
5245 }
5246
5247 /*=======================================================================*/
5248
5249
5250 /*=======================================================================*/
5251 /* Clear the Store event - if needed. */
5252
5253 if ( fLastEvent == TRUE )
5254 {
5255 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSubStoreEventIndex * 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
5263 /*=======================================================================*/
5264
5265
5266 /*=======================================================================*/
5267 /* Clear the Load or Accumulate event. */
5268
5269 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5270 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5271
5272 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5273 if ( ulResult != cOCT6100_ERR_OK )
5274 return ulResult;
5275
5276 /* Save this event index. It's the Load or Accumulate we want to remove from the list later. */
5277 usLoadOrAccumulateEventIndex = usTempEventIndex;
5278
5279 /*=======================================================================*/
5280
5281
5282 /*=======================================================================*/
5283 /* Clear the Copy event - if needed. */
5284
5285 if ( ( fLastEvent == TRUE ) && ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) )
5286 {
5287 /* Transform event into no-operation. */
5288 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5289 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5290
5291 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5292 if ( ulResult != cOCT6100_ERR_OK )
5293 return ulResult;
5294
5295 /* The event remove from the list will be done below. */
5296
5297 /* Clear the copy event created flag. */
5298 pDestinationChanEntry->fCopyEventCreated = FALSE;
5299 }
5300
5301 /*=======================================================================*/
5302
5303
5304 /*=======================================================================*/
5305 /*=======================================================================*/
5306 /* Remove the events from the mixer event list.*/
5307 /*=======================================================================*/
5308 /*=======================================================================*/
5309
5310 /*=======================================================================*/
5311 /* Remove the Load or Accumulate event from the event list. */
5312
5313 if ( fLastEvent == FALSE )
5314 {
5315 /*=======================================================================*/
5316 /* Remove the Accumulate event from the event list. */
5317
5318 /* We saved the Load or Accumulate event above. We also saved the previous event. Use those. */
5319 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usLoadOrAccumulateEventIndex );
5320
5321 /* Now modify the previous last event. */
5322 pLastEventEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr;
5323
5324 /* Modify the previous node. */
5325 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5326 WriteParams.ulWriteAddress += 4;
5327
5328 WriteParams.usWriteData = pLastEventEntry->usNextEventPtr;
5329
5330 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5331 if ( ulResult != cOCT6100_ERR_OK )
5332 return ulResult;
5333
5334 /* Check if this is the first load event on the bridge. */
5335 if ( pBridgeEntry->usFirstLoadEventPtr == usLoadOrAccumulateEventIndex )
5336 {
5337 pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr;
5338 }
5339
5340 /* Check if this was the first load of all bridges. */
5341 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex )
5342 {
5343 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr;
5344 }
5345
5346 /*=======================================================================*/
5347 }
5348 else /* if ( fLastEvent == TRUE ) */
5349 {
5350 /*=======================================================================*/
5351 /* Remove the Load event from the event list. */
5352
5353 /* Look for the entry that is pointing at the first entry of our mixer. */
5354 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usLoadOrAccumulateEventIndex, 0, &usPreviousEventIndex );
5355 if ( ulResult != cOCT6100_ERR_OK )
5356 return ulResult;
5357
5358 /* An Entry was found, now, modify it's value. */
5359 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex );
5360
5361 /* Check if this is a Sout copy event. */
5362 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_COPY )
5363 {
5364 /* No more previous bridges. */
5365 fSoutCopyEvent = TRUE;
5366 }
5367
5368 /* Now modify the previous last Store or Sub-Store or Head-Node event from another bridge/channel. */
5369 pTempEntry->usNextEventPtr = pStoreEventEntry->usNextEventPtr;
5370
5371 /*=======================================================================*/
5372
5373
5374 /*=======================================================================*/
5375 /* Modify the last node of the previous bridge/channel to point to the next bridge. */
5376
5377 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5378 WriteParams.ulWriteAddress += 4;
5379
5380 WriteParams.usWriteData = pTempEntry->usNextEventPtr;
5381
5382 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5383 if ( ulResult != cOCT6100_ERR_OK )
5384 return ulResult;
5385
5386 /*=======================================================================*/
5387
5388
5389 /*=======================================================================*/
5390 /* Set the event pointer info in the bridge stucture. */
5391
5392 if ( pBridgeEntry->usFirstLoadEventPtr == pDestinationChanEntry->usLoadEventIndex )
5393 {
5394 UINT16 usChannelIndex;
5395 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
5396
5397 pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX;
5398 pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX;
5399
5400 /* Find the next channel in this conference that could give us valid values. */
5401 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
5402 {
5403 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
5404
5405 if ( ( usChannelIndex != f_usDestinationChannelIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
5406 {
5407 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
5408 {
5409 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
5410
5411 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
5412
5413 if ( pTempParticipant->fFlexibleMixerCreated == TRUE )
5414 {
5415 pBridgeEntry->usFirstSubStoreEventPtr = pTempEchoChanEntry->usSubStoreEventIndex;
5416 pBridgeEntry->usFirstLoadEventPtr = pTempEchoChanEntry->usLoadEventIndex;
5417 break;
5418 }
5419 }
5420 }
5421 }
5422 }
5423
5424 /* Reprogram the TSST entry correctly if the extra SIN TSI entry was released. */
5425 if ( ( pDestinationChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) )
5426 {
5427 if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
5428 {
5429 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
5430 pDestinationChanEntry->usSinTsstIndex,
5431 pDestinationChanEntry->usSinSoutTsiMemIndex,
5432 pDestinationChanEntry->TdmConfig.bySinPcmLaw );
5433 if ( ulResult != cOCT6100_ERR_OK )
5434 return ulResult;
5435 }
5436
5437 /* If the silence TSI is loaded on this port, update with the original sin TSI. */
5438 if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
5439 {
5440 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5441
5442 WriteParams.ulWriteAddress += 2;
5443 WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex;
5444
5445 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5446 if ( ulResult != cOCT6100_ERR_OK )
5447 return ulResult;
5448 }
5449 }
5450
5451 /* Reprogram the TSST entry correctly if the extra RIN TSI entry was released. */
5452 if ( ( pDestinationChanEntry->usExtraRinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) )
5453 {
5454 if ( pDestinationChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
5455 {
5456 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
5457 pDestinationChanEntry->usRinTsstIndex,
5458 pDestinationChanEntry->usRinRoutTsiMemIndex,
5459 pDestinationChanEntry->TdmConfig.byRinPcmLaw );
5460 if ( ulResult != cOCT6100_ERR_OK )
5461 return ulResult;
5462 }
5463 }
5464
5465 /*=======================================================================*/
5466 /* Update the global mixer pointers. */
5467
5468 if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex &&
5469 pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex )
5470 {
5471 /* There is no more bridge entry in the mixer link list. */
5472 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX;
5473 pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX;
5474 }
5475 else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex )
5476 {
5477 pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pStoreEventEntry->usNextEventPtr;
5478 }
5479 else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex )
5480 {
5481 pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex;
5482 }
5483
5484 /*=======================================================================*/
5485
5486
5487 /*=======================================================================*/
5488 /* Check if must remove the Sin copy event from the list. */
5489
5490 if ( ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) )
5491 {
5492 /* Now remove the copy event from the event list. */
5493 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pDestinationChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY );
5494 if ( ulResult != cOCT6100_ERR_OK )
5495 return ulResult;
5496 }
5497
5498 /*=======================================================================*/
5499
5500
5501
5502 /*=======================================================================*/
5503
5504 if ( f_fRemovePermanently == TRUE )
5505 {
5506 /* Set the event entries as free. */
5507 pLoadEventEntry->fReserved = FALSE;
5508 pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT;
5509 pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
5510
5511 pStoreEventEntry->fReserved = FALSE;
5512 pStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT;
5513 pStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
5514
5515 if ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
5516 {
5517 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pDestinationChanEntry->usSinCopyEventIndex );
5518
5519 pCopyEventEntry->fReserved = FALSE;
5520 pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT;
5521 pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
5522 }
5523 }
5524
5525 /* Flexible mixer for this channel not created anymore. */
5526 pDestinationParticipant->fFlexibleMixerCreated = FALSE;
5527
5528 /*=======================================================================*/
5529 }
5530
5531 /*=======================================================================*/
5532 }
5533 else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == FALSE ) */
5534 {
5535 /* This point should never be reached. */
5536 return cOCT6100_ERR_FATAL_C9;
5537 }
5538
5539 return cOCT6100_ERR_OK;
5540 }
5541 #endif
5542
5543
5544 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5545
5546 Function: Oct6100ConfBridgeChanMuteSer
5547
5548 Description: Mute an echo channel present on a conference bridge.
5549
5550 -------------------------------------------------------------------------------
5551 | Argument | Description
5552 -------------------------------------------------------------------------------
5553 f_pApiInstance Pointer to API instance. This memory is used to keep the
5554 present state of the chip and all its resources.
5555
5556 f_pConfBridgeMute Pointer to conference bridge mute structure.
5557
5558 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5559 #if !SKIP_Oct6100ConfBridgeChanMuteSer
5560 UINT32 Oct6100ConfBridgeChanMuteSer(
5561 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5562 IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute )
5563 {
5564 UINT16 usChanIndex;
5565 UINT16 usLoadEventIndex;
5566 UINT16 usSubStoreEventIndex;
5567 UINT32 ulResult;
5568 UINT8 fFlexibleConferencing;
5569
5570 /* Check the validity of the channel and conference bridge given. */
5571 ulResult = Oct6100ApiCheckBridgeMuteParams(
5572 f_pApiInstance,
5573 f_pConfBridgeMute,
5574 &usChanIndex,
5575 &usLoadEventIndex,
5576 &usSubStoreEventIndex,
5577 &fFlexibleConferencing );
5578 if ( ulResult != cOCT6100_ERR_OK )
5579 return ulResult;
5580
5581 /* Modify all resources needed by the conference bridge. */
5582 ulResult = Oct6100ApiUpdateBridgeMuteResources(
5583 f_pApiInstance,
5584 usChanIndex,
5585 usLoadEventIndex,
5586 usSubStoreEventIndex,
5587 fFlexibleConferencing );
5588 if ( ulResult != cOCT6100_ERR_OK )
5589 return ulResult;
5590
5591 return cOCT6100_ERR_OK;
5592 }
5593 #endif
5594
5595
5596 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5597
5598 Function: Oct6100ApiCheckBridgeMuteParams
5599
5600 Description: Check the validity of the channel and conference bridge given.
5601
5602 -------------------------------------------------------------------------------
5603 | Argument | Description
5604 -------------------------------------------------------------------------------
5605 f_pApiInstance Pointer to API instance. This memory is used to keep the
5606 present state of the chip and all its resources.
5607
5608 f_pConfBridgeMute Pointer to conference bridge channel mute structure.
5609 f_pusChannelIndex Pointer to a channel index.
5610 f_pusLoadEventIndex Pointer to a load mixer event index.
5611 f_pusSubStoreEventIndex Pointer to a sub-store mixer event index.
5612 f_pfFlexibleConfBridge If this is a flexible conference bridge.
5613
5614 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5615 #if !SKIP_Oct6100ApiCheckBridgeMuteParams
5616 UINT32 Oct6100ApiCheckBridgeMuteParams(
5617 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5618 IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute,
5619 OUT PUINT16 f_pusChannelIndex,
5620 OUT PUINT16 f_pusLoadEventIndex,
5621 OUT PUINT16 f_pusSubStoreEventIndex,
5622 OUT PUINT8 f_pfFlexibleConfBridge )
5623 {
5624 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
5625 tPOCT6100_API_CHANNEL pEchoChanEntry;
5626 UINT32 ulEntryOpenCnt;
5627
5628 /* Check for errors. */
5629 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
5630 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
5631
5632 if ( f_pConfBridgeMute->ulChannelHndl == cOCT6100_INVALID_HANDLE )
5633 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE;
5634
5635 /*=====================================================================*/
5636 /* Check the channel handle.*/
5637
5638 if ( (f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
5639 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5640
5641 *f_pusChannelIndex = (UINT16)( f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
5642 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
5643 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5644
5645 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
5646
5647 /* Extract the entry open count from the provided handle. */
5648 ulEntryOpenCnt = (f_pConfBridgeMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
5649
5650 /* Check for errors. */
5651 if ( pEchoChanEntry->fReserved != TRUE )
5652 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
5653 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
5654 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5655
5656 /* Check if the channel is bound to a conference bridge. */
5657 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
5658 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
5659
5660 /* Check if channel is already muted. */
5661 if ( pEchoChanEntry->fMute == TRUE )
5662 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_ALREADY_MUTED;
5663
5664 /* Check if this is a tap channel, which is always mute. */
5665 if ( pEchoChanEntry->fTap == TRUE )
5666 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE;
5667
5668 /*=====================================================================*/
5669
5670 /*=====================================================================*/
5671 /* Check the conference bridge handle. */
5672
5673 if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
5674 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
5675
5676 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
5677
5678 /* Check for errors. */
5679 if ( pBridgeEntry->fReserved != TRUE )
5680 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
5681
5682 if ( pBridgeEntry->fFlexibleConferencing == FALSE )
5683 {
5684 /* Check the event entries.*/
5685 if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX )
5686 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
5687
5688 if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX )
5689 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
5690 }
5691
5692 /*=====================================================================*/
5693
5694 /* Return the config of the channel and all other important information. */
5695 *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex;
5696 *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex;
5697 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
5698
5699 return cOCT6100_ERR_OK;
5700 }
5701 #endif
5702
5703
5704 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
5705
5706 Function: Oct6100ApiUpdateBridgeMuteResources
5707
5708 Description: Modify the conference bridge entry for this channel in order
5709 to mute the specified channel.
5710
5711 -------------------------------------------------------------------------------
5712 | Argument | Description
5713 -------------------------------------------------------------------------------
5714 f_pApiInstance Pointer to API instance. This memory is used to keep the
5715 present state of the chip and all its resources.
5716
5717 f_usChanIndex Index of the channel to be muted.
5718 f_usLoadEventIndex Allocated entry for the Load event of the channel.
5719 f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel.
5720 f_fFlexibleConfBridge If this is a flexible conference bridge.
5721
5722 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
5723 #if !SKIP_Oct6100ApiUpdateBridgeMuteResources
5724 UINT32 Oct6100ApiUpdateBridgeMuteResources(
5725 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
5726 IN UINT16 f_usChanIndex,
5727 IN UINT16 f_usLoadEventIndex,
5728 IN UINT16 f_usSubStoreEventIndex,
5729 IN UINT8 f_fFlexibleConfBridge )
5730 {
5731 tOCT6100_WRITE_PARAMS WriteParams;
5732 tOCT6100_READ_PARAMS ReadParams;
5733
5734 tPOCT6100_API_CHANNEL pEchoChanEntry;
5735 tPOCT6100_SHARED_INFO pSharedInfo;
5736
5737 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
5738
5739 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
5740 tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry;
5741 tPOCT6100_API_MIXER_EVENT pTempEntry;
5742 UINT32 ulResult;
5743 UINT16 usTempEventIndex;
5744 UINT32 ulLoopCount;
5745 UINT16 usReadData;
5746
5747 BOOL fCreateSilenceLoad = FALSE;
5748
5749 /* Obtain local pointer to shared portion of instance. */
5750 pSharedInfo = f_pApiInstance->pSharedInfo;
5751
5752 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
5753
5754 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5755
5756 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
5757
5758 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
5759 ReadParams.pusReadData = &usReadData;
5760
5761 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
5762 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
5763
5764 if ( f_fFlexibleConfBridge == TRUE )
5765 {
5766 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
5767 UINT16 usChannelIndex;
5768 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
5769 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
5770
5771 UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ];
5772 UINT32 ulMutePortChannelIndex;
5773
5774 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
5775 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX;
5776
5777 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
5778
5779 /* Search through the list of API channel entry for the ones on to this bridge. */
5780 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
5781 {
5782 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
5783
5784 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
5785 {
5786 if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex )
5787 {
5788 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
5789
5790 /* Check if this participant can hear us. */
5791 if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
5792 && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) )
5793 {
5794 /* Then update this channel's mixer. */
5795 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
5796 f_pApiInstance,
5797 pEchoChanEntry->usBridgeIndex,
5798 f_usChanIndex,
5799 usChannelIndex,
5800 FALSE );
5801 if ( ulResult != cOCT6100_ERR_OK )
5802 return ulResult;
5803
5804 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
5805 {
5806 /* Remember to mute the port on this channel. */
5807 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
5808 {
5809 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex )
5810 {
5811 break;
5812 }
5813 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
5814 {
5815 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex;
5816 break;
5817 }
5818 }
5819 }
5820 }
5821 }
5822 }
5823 }
5824
5825 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
5826 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
5827 {
5828 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
5829 {
5830 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
5831
5832 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
5833
5834 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
5835 {
5836 /* Check if the Rin port must be muted on this channel. */
5837 ulResult = Oct6100ApiMutePorts(
5838 f_pApiInstance,
5839 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
5840 pTempEchoChanEntry->usRinTsstIndex,
5841 pTempEchoChanEntry->usSinTsstIndex,
5842 FALSE );
5843 if ( ulResult != cOCT6100_ERR_OK )
5844 {
5845 if ( ulResult == cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED )
5846 {
5847 UINT32 ulTempResult;
5848
5849 /* Cleanup resources, unmute channel... */
5850 ulTempResult = Oct6100ApiUpdateBridgeUnMuteResources(
5851 f_pApiInstance,
5852 f_usChanIndex,
5853 f_usLoadEventIndex,
5854 f_usSubStoreEventIndex,
5855 TRUE );
5856 if ( ulTempResult != cOCT6100_ERR_OK )
5857 return ulTempResult;
5858 else
5859 return ulResult;
5860 }
5861 else
5862 {
5863 return ulResult;
5864 }
5865 }
5866 }
5867 }
5868 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
5869 {
5870 /* No more channels to check for muting. */
5871 break;
5872 }
5873 }
5874 }
5875 else /* if ( f_fFlexibleConfBridge == FALSE ) */
5876 {
5877 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex );
5878 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
5879
5880 /*=======================================================================*/
5881 /* Program the Load event. */
5882
5883 /* Create silence load if this is the first event of the bridge. */
5884 if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr )
5885 fCreateSilenceLoad = TRUE;
5886
5887 /* First check if this event was a load or an accumulate event, if it's a load */
5888 /* we need to find a new load. */
5889 if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex )
5890 {
5891 /* Change the next entry if one is present to a load event to keep the bridge alive. */
5892 if ( pBridgeEntry->usNumClients == 1 )
5893 {
5894 /* There is no other entry on the bridge, no need to search for an Accumulate event. */
5895 pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX;
5896 }
5897 else
5898 {
5899 /* Search for an accumulate event to tranform into a Load event. */
5900 usTempEventIndex = pLoadEventEntry->usNextEventPtr;
5901 ulLoopCount = 0;
5902
5903 /* Find the copy entry before the entry to remove. */
5904 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5905
5906 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
5907 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
5908 {
5909 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE )
5910 {
5911 /* Change this entry into a load event. */
5912 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5913 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
5914 if ( ulResult != cOCT6100_ERR_OK )
5915 return ulResult;
5916
5917 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
5918 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD);
5919
5920 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5921 if ( ulResult != cOCT6100_ERR_OK )
5922 return ulResult;
5923
5924 /* Set this entry as the load index. */
5925 pBridgeEntry->usLoadIndex = usTempEventIndex;
5926
5927 /* Update the software model. */
5928 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
5929
5930 /* Stop searching. */
5931 break;
5932 }
5933
5934 /* Go to the next entry into the list. */
5935 usTempEventIndex = pTempEntry->usNextEventPtr;
5936 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
5937
5938 ulLoopCount++;
5939 if ( ulLoopCount == cOCT6100_MAX_LOOP )
5940 return cOCT6100_ERR_FATAL_9B;
5941 }
5942 }
5943 }
5944
5945 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5946
5947 /* Do not load the sample if the channel is muted. */
5948 if ( fCreateSilenceLoad == TRUE )
5949 {
5950 if ( pBridgeEntry->usSilenceLoadEventPtr == cOCT6100_INVALID_INDEX )
5951 {
5952 /* Instead of No-oping, load the silence TSI, to make sure the other conferences before us are not heard. */
5953 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD;
5954 WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */
5955
5956 /* Remember the silence load event. */
5957 pBridgeEntry->usSilenceLoadEventPtr = f_usLoadEventIndex;
5958 }
5959 else
5960 {
5961 /* Do nothing. */
5962 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5963 }
5964 }
5965 else
5966 {
5967 /* Do nothing. */
5968 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5969 }
5970
5971 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
5972 if ( ulResult != cOCT6100_ERR_OK )
5973 return ulResult;
5974
5975 /* Update the software model. */
5976 pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
5977
5978 /*=======================================================================*/
5979
5980 /*=======================================================================*/
5981 /* Program the Substract and store event. */
5982 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
5983
5984 /* Do not load the sample if the channel is muted. */
5985 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE;
5986
5987 /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */
5988 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
5989 {
5990 /* Sout input. */
5991 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
5992 }
5993 else /* if ( pEchoChanEntry->usSinCopyEventIndex == cOCT6100_INVALID_INDEX ) */
5994 {
5995 /* Rin input. */
5996 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
5997 }
5998
5999 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6000 if ( ulResult != cOCT6100_ERR_OK )
6001 return ulResult;
6002
6003 /* Update the software model. */
6004 pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE;
6005
6006 /*=======================================================================*/
6007 }
6008
6009 /* Update the channel entry API structure */
6010 pEchoChanEntry->fMute = TRUE;
6011
6012 return cOCT6100_ERR_OK;
6013 }
6014 #endif
6015
6016
6017 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6018
6019 Function: Oct6100ConfBridgeChanUnMuteSer
6020
6021 Description: UnMute an echo channel present on a conference bridge.
6022
6023 -------------------------------------------------------------------------------
6024 | Argument | Description
6025 -------------------------------------------------------------------------------
6026 f_pApiInstance Pointer to API instance. This memory is used to keep the
6027 present state of the chip and all its resources.
6028
6029 f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure.
6030
6031 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6032 #if !SKIP_Oct6100ConfBridgeChanUnMuteSer
6033 UINT32 Oct6100ConfBridgeChanUnMuteSer(
6034 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6035 IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute )
6036 {
6037 UINT16 usChanIndex;
6038 UINT16 usLoadEventIndex;
6039 UINT16 usSubStoreEventIndex;
6040 UINT8 fFlexibleConfBridge;
6041 UINT32 ulResult;
6042
6043 /* Check the validity of the channel and conference bridge given. */
6044 ulResult = Oct6100ApiCheckBridgeUnMuteParams(
6045 f_pApiInstance,
6046 f_pConfBridgeUnMute,
6047 &usChanIndex,
6048 &usLoadEventIndex,
6049 &usSubStoreEventIndex,
6050 &fFlexibleConfBridge );
6051 if ( ulResult != cOCT6100_ERR_OK )
6052 return ulResult;
6053
6054 /* Modify all resources needed by the conference bridge. */
6055 ulResult = Oct6100ApiUpdateBridgeUnMuteResources(
6056 f_pApiInstance,
6057 usChanIndex,
6058 usLoadEventIndex,
6059 usSubStoreEventIndex,
6060 fFlexibleConfBridge );
6061 if ( ulResult != cOCT6100_ERR_OK )
6062 return ulResult;
6063
6064 return cOCT6100_ERR_OK;
6065 }
6066 #endif
6067
6068
6069 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6070
6071 Function: Oct6100ApiCheckBridgeUnMuteParams
6072
6073 Description: Check the validity of the channel and conference bridge given.
6074
6075 -------------------------------------------------------------------------------
6076 | Argument | Description
6077 -------------------------------------------------------------------------------
6078 f_pApiInstance Pointer to API instance. This memory is used to keep the
6079 present state of the chip and all its resources.
6080
6081 f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure.
6082 f_pusChannelIndex Pointer to the channel index fo the channel to be unmuted.
6083 f_pusLoadEventIndex Pointer to the load index of the channel.
6084 f_pusSubStoreEventIndex Pointer to the sub-store event of the channel.
6085 f_pfFlexibleConfBridge If this is a flexible conference bridge.
6086
6087 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6088 #if !SKIP_Oct6100ApiCheckBridgeUnMuteParams
6089 UINT32 Oct6100ApiCheckBridgeUnMuteParams(
6090 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6091 IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute,
6092 OUT PUINT16 f_pusChannelIndex,
6093 OUT PUINT16 f_pusLoadEventIndex,
6094 OUT PUINT16 f_pusSubStoreEventIndex,
6095 OUT PUINT8 f_pfFlexibleConfBridge )
6096 {
6097 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6098 tPOCT6100_API_CHANNEL pEchoChanEntry;
6099 UINT32 ulEntryOpenCnt;
6100
6101 /* Check for errors. */
6102 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
6103 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
6104
6105 if ( f_pConfBridgeUnMute->ulChannelHndl == cOCT6100_INVALID_HANDLE )
6106 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE;
6107
6108 /*=====================================================================*/
6109 /* Check the channel handle.*/
6110
6111 if ( (f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
6112 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6113
6114 *f_pusChannelIndex = (UINT16)( f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
6115 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
6116 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6117
6118 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
6119
6120 /* Extract the entry open count from the provided handle. */
6121 ulEntryOpenCnt = (f_pConfBridgeUnMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6122
6123 /* Check for errors. */
6124 if ( pEchoChanEntry->fReserved != TRUE )
6125 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6126 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
6127 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6128
6129 /* Check if the channel is bound to a conference bridge.*/
6130 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
6131 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
6132
6133 /* Check if channel is already muted.*/
6134 if ( pEchoChanEntry->fMute == FALSE )
6135 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_NOT_MUTED;
6136
6137 /*=====================================================================*/
6138
6139 /*=====================================================================*/
6140 /* Check the conference bridge handle. */
6141
6142 if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
6143 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6144
6145 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
6146
6147 /* Check for errors. */
6148 if ( pBridgeEntry->fReserved != TRUE )
6149 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6150
6151 /* Check the event entries.*/
6152 if ( pBridgeEntry->fFlexibleConferencing == FALSE )
6153 {
6154 if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX )
6155 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
6156
6157 /* Check the event entries.*/
6158 if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX )
6159 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE;
6160 }
6161
6162 /*=====================================================================*/
6163
6164 /* Return the config of the channel and all other important information.*/
6165 *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex;
6166 *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex;
6167 *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing;
6168
6169 return cOCT6100_ERR_OK;
6170 }
6171 #endif
6172
6173
6174 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6175
6176 Function: Oct6100ApiUpdateBridgeUnMuteResources
6177
6178 Description: Modify the conference bridge entry for this channel in order
6179 to un-mute the specified channel.
6180
6181 -------------------------------------------------------------------------------
6182 | Argument | Description
6183 -------------------------------------------------------------------------------
6184 f_pApiInstance Pointer to API instance. This memory is used to keep the
6185 present state of the chip and all its resources.
6186
6187 f_usChanIndex Index of the channel to be unmuted.
6188 f_usLoadEventIndex Allocated entry for the Load event of the channel.
6189 f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel.
6190 f_fFlexibleConfBridge If this is a flexible conference bridge.
6191
6192 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6193 #if !SKIP_Oct6100ApiUpdateBridgeUnMuteResources
6194 UINT32 Oct6100ApiUpdateBridgeUnMuteResources(
6195 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6196 IN UINT16 f_usChanIndex,
6197 IN UINT16 f_usLoadEventIndex,
6198 IN UINT16 f_usSubStoreEventIndex,
6199 IN UINT8 f_fFlexibleConfBridge )
6200 {
6201 tOCT6100_WRITE_PARAMS WriteParams;
6202 tOCT6100_READ_PARAMS ReadParams;
6203
6204 tPOCT6100_API_CHANNEL pEchoChanEntry;
6205 tPOCT6100_SHARED_INFO pSharedInfo;
6206
6207 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6208
6209 tPOCT6100_API_MIXER_EVENT pLoadEventEntry;
6210 tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry;
6211 tPOCT6100_API_MIXER_EVENT pTempEntry;
6212 UINT32 ulResult;
6213 UINT16 usTempEventIndex;
6214 UINT32 ulLoopCount;
6215 UINT16 usReadData;
6216
6217 UINT16 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
6218 UINT16 usPreviousLoadIndex = cOCT6100_INVALID_INDEX;
6219
6220 /* Obtain local pointer to shared portion of instance. */
6221 pSharedInfo = f_pApiInstance->pSharedInfo;
6222
6223 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
6224
6225 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
6226
6227 ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
6228
6229 ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
6230 ReadParams.pusReadData = &usReadData;
6231
6232 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex );
6233 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex )
6234
6235 if ( f_fFlexibleConfBridge == TRUE )
6236 {
6237 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
6238 UINT16 usChannelIndex;
6239 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
6240 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
6241
6242 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex );
6243
6244 /* Before doing anything, check if the copy events must be created. */
6245 if ( ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChanEntry->fCopyEventCreated == FALSE ) )
6246 {
6247 /* The copy event has not been created, create it once for the life of the participant on the bridge. */
6248 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6249
6250 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY;
6251 WriteParams.usWriteData |= pEchoChanEntry->usExtraSinTsiMemIndex;
6252 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
6253
6254 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6255 if ( ulResult != cOCT6100_ERR_OK )
6256 return ulResult;
6257
6258 WriteParams.ulWriteAddress += 2;
6259 WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex;
6260
6261 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6262 if ( ulResult != cOCT6100_ERR_OK )
6263 return ulResult;
6264
6265 /* Now insert the Sin copy event into the list. */
6266 ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance,
6267 pEchoChanEntry->usSinCopyEventIndex,
6268 cOCT6100_EVENT_TYPE_SIN_COPY,
6269 f_usChanIndex );
6270 if ( ulResult != cOCT6100_ERR_OK )
6271 return ulResult;
6272
6273 pEchoChanEntry->fCopyEventCreated = TRUE;
6274 }
6275
6276 /* Search through the list of API channel entry for the ones onto this bridge. */
6277 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
6278 {
6279 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
6280
6281 /* Channel reserved? */
6282 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
6283 {
6284 /* On current bridge? */
6285 if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex )
6286 {
6287 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
6288
6289 /* Check if this participant can hear us. */
6290 if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 )
6291 {
6292 /* Then create/update this channel's mixer. */
6293 ulResult = Oct6100ApiBridgeAddParticipantToChannel(
6294 f_pApiInstance,
6295 pEchoChanEntry->usBridgeIndex,
6296 f_usChanIndex,
6297 usChannelIndex,
6298 pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ],
6299 pTempEchoChanEntry->usSubStoreEventIndex,
6300 pTempEchoChanEntry->usSinCopyEventIndex,
6301 pParticipant->ulInputPort,
6302 pTempParticipant->ulInputPort );
6303 if ( ulResult != cOCT6100_ERR_OK )
6304 return ulResult;
6305
6306 /* Check if the Rin silence event can be cleared now that the */
6307 /* channel has unmuted. */
6308 if ( ( pTempParticipant->fFlexibleMixerCreated == TRUE )
6309 && ( pTempEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) )
6310 {
6311 /* Remove the event from the list. */
6312 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
6313 pTempEchoChanEntry->usRinSilenceEventIndex,
6314 cOCT6100_EVENT_TYPE_SOUT_COPY );
6315 if ( ulResult != cOCT6100_ERR_OK )
6316 return ulResult;
6317
6318 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempEchoChanEntry->usRinSilenceEventIndex );
6319 if ( ulResult != cOCT6100_ERR_OK )
6320 return cOCT6100_ERR_FATAL_DF;
6321
6322 pTempEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX;
6323 }
6324 }
6325 }
6326 }
6327 }
6328 }
6329 else /* if ( f_fFlexibleConfBridge == FALSE ) */
6330 {
6331 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex );
6332 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex );
6333
6334 /*=======================================================================*/
6335 /* Program the Load event. */
6336
6337 /* Before reactivating this event, check what type of event this event must be. */
6338 if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr ||
6339 pBridgeEntry->usLoadIndex == cOCT6100_INVALID_INDEX )
6340 {
6341 /* This event must become a Load event. */
6342 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
6343 pBridgeEntry->usLoadIndex = f_usLoadEventIndex;
6344 }
6345
6346 usTempEventIndex = pBridgeEntry->usFirstLoadEventPtr;
6347 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
6348
6349 ulLoopCount = 0;
6350
6351 while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE &&
6352 pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE )
6353 {
6354 if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD )
6355 {
6356 usPreviousLoadIndex = usTempEventIndex;
6357 }
6358
6359 /* Check if the previous load event is before or after the event about to be unmuted. */
6360 if ( pTempEntry->usNextEventPtr == f_usLoadEventIndex )
6361 {
6362 if ( usPreviousLoadIndex == cOCT6100_INVALID_INDEX )
6363 {
6364 /* We did not find a load event before our node, this mean this one */
6365 /* is about to become the new load event. */
6366 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD;
6367 }
6368 }
6369
6370 /* Go to the next entry into the list. */
6371 usTempEventIndex = pTempEntry->usNextEventPtr;
6372 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
6373
6374 ulLoopCount++;
6375 if ( ulLoopCount == cOCT6100_MAX_LOOP )
6376 return cOCT6100_ERR_FATAL_9B;
6377 }
6378
6379 /* Now program the current event node. */
6380 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6381
6382 WriteParams.usWriteData = usLoadEventType;
6383
6384 /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */
6385 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
6386 {
6387 /* Sout source */
6388 WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex;
6389 }
6390 else
6391 {
6392 /* Rin source */
6393 WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex;
6394 }
6395
6396 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6397 if ( ulResult != cOCT6100_ERR_OK )
6398 return ulResult;
6399
6400 /* Update the software event to reflect the hardware. */
6401 pLoadEventEntry->usEventType = usLoadEventType;
6402
6403 /* Check if we need to change another node. */
6404 if ( usLoadEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD )
6405 {
6406 if ( usPreviousLoadIndex != cOCT6100_INVALID_INDEX )
6407 {
6408 /* Now program the old load event. */
6409 ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousLoadIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6410
6411 mOCT6100_DRIVER_READ_API( ReadParams, ulResult );
6412 if ( ulResult != cOCT6100_ERR_OK )
6413 return ulResult;
6414
6415 WriteParams.ulWriteAddress = ReadParams.ulReadAddress;
6416 WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE );
6417
6418 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6419 if ( ulResult != cOCT6100_ERR_OK )
6420 return ulResult;
6421
6422 /* Update the software event to reflect the hardware. */
6423 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousLoadIndex );
6424 pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE;
6425 }
6426 }
6427
6428 /*=======================================================================*/
6429
6430 /*=======================================================================*/
6431 /* Program the Substract and store event. */
6432 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
6433
6434 WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE;
6435 /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */
6436 if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX )
6437 {
6438 /* Sout port source */
6439 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
6440 WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex;
6441 }
6442 else
6443 {
6444 /* Rin port source */
6445 WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
6446 WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex;
6447 }
6448
6449 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6450 if ( ulResult != cOCT6100_ERR_OK )
6451 return ulResult;
6452
6453 WriteParams.ulWriteAddress += 2;
6454 WriteParams.usWriteData = pEchoChanEntry->usRinRoutTsiMemIndex;
6455
6456 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
6457 if ( ulResult != cOCT6100_ERR_OK )
6458 return ulResult;
6459
6460 /* Update the software event to reflect the hardware. */
6461 pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE;
6462
6463 /*=======================================================================*/
6464
6465
6466 /*=======================================================================*/
6467 /* Check if have to remove silence load event. */
6468
6469 if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX )
6470 {
6471 if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex )
6472 {
6473 /* Clear the silence load event ptr. */
6474 pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX;
6475 }
6476 }
6477 }
6478
6479 /* Update the channel entry API structure */
6480 pEchoChanEntry->fMute = FALSE;
6481
6482 return cOCT6100_ERR_OK;
6483 }
6484 #endif
6485
6486
6487 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6488
6489 Function: Oct6100ConfBridgeDominantSpeakerSetSer
6490
6491 Description: This function sets the dominant speaker of a bridge.
6492
6493 -------------------------------------------------------------------------------
6494 | Argument | Description
6495 -------------------------------------------------------------------------------
6496 f_pApiInstance Pointer to API instance. This memory is used to
6497 keep the present state of the chip and all its
6498 resources.
6499
6500 f_pConfBridgeDominant Pointer to conference bridge dominant speaker
6501 structure.
6502
6503 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6504 #if !SKIP_Oct6100ConfBridgeDominantSpeakerSetSer
6505 UINT32 Oct6100ConfBridgeDominantSpeakerSetSer(
6506 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6507 IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker )
6508 {
6509 UINT16 usChanIndex;
6510 UINT16 usBridgeIndex;
6511 UINT32 ulResult;
6512
6513 /* Check the validity of the channel handle given. */
6514 ulResult = Oct6100ApiCheckBridgeDominantSpeakerParams( f_pApiInstance, f_pConfBridgeDominantSpeaker, &usChanIndex, &usBridgeIndex );
6515 if ( ulResult != cOCT6100_ERR_OK )
6516 return ulResult;
6517
6518 /* Modify all resources needed by the conference bridge. */
6519 ulResult = Oct6100ApiUpdateBridgeDominantSpeakerResources( f_pApiInstance, usChanIndex, usBridgeIndex );
6520 if ( ulResult != cOCT6100_ERR_OK )
6521 return ulResult;
6522
6523 return cOCT6100_ERR_OK;
6524 }
6525 #endif
6526
6527 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6528
6529 Function: Oct6100ApiCheckBridgeDominantSpeakerParams
6530
6531 Description: Check the validity of the channel given for setting the
6532 dominant speaker.
6533
6534 -------------------------------------------------------------------------------
6535 | Argument | Description
6536 -------------------------------------------------------------------------------
6537 f_pApiInstance Pointer to API instance. This memory is used to keep the
6538 present state of the chip and all its resources.
6539 f_pConfBridgeDominant Pointer to conference bridge channel dominant speaker structure.
6540 f_pusChannelIndex Pointer to a channel index.
6541 f_pusChannelIndex Pointer to a bridge index.
6542 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6543 #if !SKIP_Oct6100ApiCheckBridgeDominantSpeakerParams
6544 UINT32 Oct6100ApiCheckBridgeDominantSpeakerParams(
6545 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6546 IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker,
6547 OUT PUINT16 f_pusChannelIndex,
6548 OUT PUINT16 f_pusBridgeIndex )
6549 {
6550 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6551 tPOCT6100_API_CHANNEL pEchoChanEntry;
6552 UINT32 ulEntryOpenCnt;
6553 BOOL fCheckEntryOpenCnt = FALSE;
6554
6555 /* Check for errors. */
6556 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
6557 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
6558
6559 if ( f_pConfBridgeDominantSpeaker->ulChannelHndl == cOCT6100_INVALID_HANDLE )
6560 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6561
6562 /*=====================================================================*/
6563 /* Check the channel handle. */
6564
6565 if ( f_pConfBridgeDominantSpeaker->ulChannelHndl != cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL )
6566 {
6567 if ( (f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
6568 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6569
6570 *f_pusChannelIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
6571 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
6572 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6573
6574 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
6575
6576 /* Extract the entry open count from the provided handle. */
6577 ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6578
6579 /* Check for errors. */
6580 if ( pEchoChanEntry->fReserved != TRUE )
6581 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6582 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
6583 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6584
6585 /* Check if the channel is bound to a conference bridge. */
6586 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
6587 return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE;
6588
6589 /* Check if the NLP is enabled on this channel. */
6590 if ( pEchoChanEntry->VqeConfig.fEnableNlp == FALSE )
6591 return cOCT6100_ERR_CONF_BRIDGE_NLP_MUST_BE_ENABLED;
6592
6593 /* Check if conferencing noise reduction is enabled on this channel. */
6594 if ( pEchoChanEntry->VqeConfig.fSoutConferencingNoiseReduction == FALSE )
6595 return cOCT6100_ERR_CONF_BRIDGE_CNR_MUST_BE_ENABLED;
6596
6597 /* Check if this is a tap channel. If it is, it will never be the dominant speaker! */
6598 if ( pEchoChanEntry->fTap == TRUE )
6599 return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE;
6600
6601 /* Set the bridge index. */
6602 *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex;
6603 }
6604 else
6605 {
6606 /* Set this such that there is no dominant speaker on this conference bridge. */
6607 *f_pusChannelIndex = cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED;
6608
6609 /* Check the conference bridge handle. */
6610 if ( (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
6611 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6612
6613 /* Set the bridge index. */
6614 *f_pusBridgeIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
6615
6616 /* Extract the entry open count from the provided handle. */
6617 ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6618 fCheckEntryOpenCnt = TRUE;
6619 }
6620
6621 /*=====================================================================*/
6622
6623 /*=====================================================================*/
6624
6625 if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
6626 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6627
6628 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
6629
6630 /* Check for errors. */
6631 if ( pBridgeEntry->fReserved != TRUE )
6632 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6633 if ( fCheckEntryOpenCnt == TRUE )
6634 {
6635 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
6636 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6637 }
6638
6639 /*=====================================================================*/
6640 /* Check if dominant speaker is supported in this firmware version. */
6641
6642 if ( f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled == FALSE )
6643 return cOCT6100_ERR_NOT_SUPPORTED_DOMINANT_SPEAKER;
6644
6645 /*=====================================================================*/
6646
6647 return cOCT6100_ERR_OK;
6648 }
6649 #endif
6650
6651
6652 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6653
6654 Function: Oct6100ApiUpdateBridgeDominantSpeakerResources
6655
6656 Description: Modify the conference bridge such that the new dominant
6657 speaker is the one specified by the index.
6658
6659 -------------------------------------------------------------------------------
6660 | Argument | Description
6661 -------------------------------------------------------------------------------
6662 f_pApiInstance Pointer to API instance. This memory is used to keep the
6663 present state of the chip and all its resources.
6664
6665 f_usChanIndex Index of the channel to be set as the dominant speaker.
6666 f_usBridgeIndex Index of the bridge where this channel is on.
6667
6668 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6669 #if !SKIP_Oct6100ApiUpdateBridgeDominantSpeakerResources
6670 UINT32 Oct6100ApiUpdateBridgeDominantSpeakerResources(
6671 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6672 IN UINT16 f_usChanIndex,
6673 IN UINT16 f_usBridgeIndex )
6674 {
6675 tPOCT6100_API_CHANNEL pEchoChanEntry;
6676 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6677 tPOCT6100_SHARED_INFO pSharedInfo;
6678
6679 UINT16 usChannelIndex;
6680 UINT32 ulResult;
6681
6682 /* Obtain local pointer to shared portion of instance. */
6683 pSharedInfo = f_pApiInstance->pSharedInfo;
6684
6685 /* Get the bridge entry for this channel. */
6686 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex )
6687
6688 /* Set the dominant speaker index for all channels in this conference. */
6689
6690 /* Search through the list of API channel entry for the ones on to this bridge.*/
6691 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
6692 {
6693 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usChannelIndex );
6694
6695 if ( pEchoChanEntry->fReserved == TRUE )
6696 {
6697 if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
6698 {
6699 /* If we are unsetting the dominant speaker, of if it is not our channel index. */
6700 if ( ( f_usChanIndex == cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED )
6701 || ( f_usChanIndex != usChannelIndex ) )
6702 {
6703 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, f_usChanIndex );
6704 if ( ulResult != cOCT6100_ERR_OK )
6705 return ulResult;
6706 }
6707 }
6708 }
6709 }
6710
6711 /* Make sure this channel is disabled. */
6712 if ( f_usChanIndex != cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED )
6713 {
6714 ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED );
6715 if ( ulResult != cOCT6100_ERR_OK )
6716 return ulResult;
6717 }
6718
6719 /* Save this in the conference bridge structure. */
6720 /* This will be needed later when removing the channel. */
6721 pBridgeEntry->fDominantSpeakerSet = TRUE;
6722 pBridgeEntry->usDominantSpeakerChanIndex = f_usChanIndex;
6723
6724 return cOCT6100_ERR_OK;
6725 }
6726 #endif
6727
6728
6729 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6730
6731 Function: Oct6100ConfBridgeMaskChangeSer
6732
6733 Description: This function changes the mask of flexible bridge
6734 participant.
6735
6736 -------------------------------------------------------------------------------
6737 | Argument | Description
6738 -------------------------------------------------------------------------------
6739 f_pApiInstance Pointer to API instance. This memory is used to
6740 keep the present state of the chip and all its
6741 resources.
6742
6743 f_pConfBridgeMaskChange Pointer to conference bridge participant mask
6744 change structure.
6745
6746 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6747 #if !SKIP_Oct6100ConfBridgeMaskChangeSer
6748 UINT32 Oct6100ConfBridgeMaskChangeSer(
6749 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6750 IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange )
6751 {
6752 UINT16 usChanIndex;
6753 UINT16 usBridgeIndex;
6754 UINT32 ulResult;
6755 UINT32 ulNewParticipantMask;
6756
6757 /* Check the validity of the channel handle given. */
6758 ulResult = Oct6100ApiCheckBridgeMaskChangeParams( f_pApiInstance, f_pConfBridgeMaskChange, &usChanIndex, &usBridgeIndex, &ulNewParticipantMask );
6759 if ( ulResult != cOCT6100_ERR_OK )
6760 return ulResult;
6761
6762 /* Update all resources needed by the new mask. */
6763 ulResult = Oct6100ApiUpdateMaskModifyResources( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask );
6764 if ( ulResult != cOCT6100_ERR_OK )
6765 return ulResult;
6766
6767 /* Commit the changes to the chip's internal memories. */
6768 ulResult = Oct6100ApiBridgeUpdateMask( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask );
6769 if ( ulResult != cOCT6100_ERR_OK )
6770 return ulResult;
6771
6772 return cOCT6100_ERR_OK;
6773 }
6774 #endif
6775
6776
6777 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6778
6779 Function: Oct6100ApiCheckBridgeMaskChangeParams
6780
6781 Description: Check the validity of the channel given for setting the
6782 mask.
6783
6784 -------------------------------------------------------------------------------
6785 | Argument | Description
6786 -------------------------------------------------------------------------------
6787 f_pApiInstance Pointer to API instance. This memory is used to keep the
6788 present state of the chip and all its resources.
6789
6790 f_pConfBridgeMaskChange Pointer to conference bridge channel mask change structure.
6791 f_pusChannelIndex Pointer to a channel index.
6792 f_pusBridgeIndex Pointer to a bridge index.
6793 f_pulNewParticipantMask New mask to apply for this participant.
6794 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6795 #if !SKIP_Oct6100ApiCheckBridgeMaskChangeParams
6796 UINT32 Oct6100ApiCheckBridgeMaskChangeParams(
6797 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6798 IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange,
6799 OUT PUINT16 f_pusChannelIndex,
6800 OUT PUINT16 f_pusBridgeIndex,
6801 OUT PUINT32 f_pulNewParticipantMask )
6802 {
6803 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
6804 tPOCT6100_API_CHANNEL pEchoChanEntry;
6805 UINT32 ulEntryOpenCnt;
6806
6807 /* Check for errors. */
6808 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
6809 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
6810
6811 if ( f_pConfBridgeMaskChange->ulChannelHndl == cOCT6100_INVALID_HANDLE )
6812 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6813
6814 /*=====================================================================*/
6815 /* Check the channel handle.*/
6816
6817 if ( (f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
6818 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6819
6820 *f_pusChannelIndex = (UINT16)( f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK );
6821 if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels )
6822 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6823
6824 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex )
6825
6826 /* Extract the entry open count from the provided handle. */
6827 ulEntryOpenCnt = (f_pConfBridgeMaskChange->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
6828
6829 /* Check for errors. */
6830 if ( pEchoChanEntry->fReserved != TRUE )
6831 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6832 if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt )
6833 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6834
6835 /* Check if the channel is bound to a conference bridge. */
6836 if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX )
6837 return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE;
6838
6839 /* Set the bridge index. */
6840 *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex;
6841
6842 /*=====================================================================*/
6843
6844 /*=====================================================================*/
6845
6846 if ( ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX )
6847 || ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) )
6848 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
6849
6850 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex )
6851
6852 /* Check for errors. */
6853 if ( pBridgeEntry->fReserved != TRUE )
6854 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
6855
6856 /* Check if this is bridge is a flexible conference bridge. */
6857 if ( pBridgeEntry->fFlexibleConferencing == FALSE )
6858 return cOCT6100_ERR_CONF_BRIDGE_SIMPLE_BRIDGE;
6859
6860 /*=====================================================================*/
6861
6862 /* Return new mask to apply. */
6863 *f_pulNewParticipantMask = f_pConfBridgeMaskChange->ulNewListenerMask;
6864
6865 return cOCT6100_ERR_OK;
6866 }
6867 #endif
6868
6869
6870 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
6871
6872 Function: Oct6100ApiUpdateMaskModifyResources
6873
6874 Description: Modify/reserve all resources needed for the modification of
6875 the participant's mask.
6876
6877 -------------------------------------------------------------------------------
6878 | Argument | Description
6879 -------------------------------------------------------------------------------
6880 f_pApiInstance Pointer to API instance. This memory is used to keep the
6881 present state of the chip and all its resources.
6882
6883 f_usBridgeIndex Bridge index of the bridge where this channel is residing.
6884 f_usChanIndex Channel index of the channel to be modified.
6885 f_ulNewListenerMask New mask to apply to the selected participant.
6886
6887 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
6888 #if !SKIP_Oct6100ApiUpdateMaskModifyResources
6889 UINT32 Oct6100ApiUpdateMaskModifyResources(
6890 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
6891 IN UINT16 f_usBridgeIndex,
6892 IN UINT16 f_usChanIndex,
6893 IN UINT32 f_ulNewListenerMask )
6894 {
6895 tPOCT6100_API_CHANNEL pChanEntry;
6896 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
6897 tPOCT6100_SHARED_INFO pSharedInfo;
6898 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
6899 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
6900
6901 UINT32 ulResult = cOCT6100_ERR_OK;
6902 UINT32 ulTempVar;
6903 UINT32 ulOldListenerMask;
6904 UINT16 usChannelIndex;
6905
6906 /* Obtain local pointer to shared portion of instance. */
6907 pSharedInfo = f_pApiInstance->pSharedInfo;
6908
6909 /* Get a pointer to the channel's list entry. */
6910 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex )
6911
6912 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex );
6913
6914 /* Must travel all clients of this conference and reserve a load or accumulate event for */
6915 /* all participants which could not hear us but now can. While at it, check for events that */
6916 /* could be released, for example a participant that we cannot hear anymore. */
6917
6918 ulOldListenerMask = pParticipant->ulListenerMask;
6919
6920 /* Search through the list of API channel entry for the ones on to this bridge.*/
6921 for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ )
6922 {
6923 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
6924
6925 /* Channel reserved? */
6926 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
6927 {
6928 /* On current bridge? */
6929 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
6930 {
6931 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
6932
6933 /* Check if we can now hear this participant, but could not before. */
6934 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
6935 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) )
6936 {
6937 /* Must reserve a load or accumulate entry mixer event here! */
6938 ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
6939 if ( ulResult != cOCT6100_ERR_OK )
6940 {
6941 /* Most probably, the hardware is out of mixer events. */
6942 break;
6943 }
6944 }
6945
6946 /* Check if we can now NOT hear this participant, but could before. */
6947 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
6948 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) )
6949 {
6950 /* Must release the load or accumulate entry mixer event. */
6951 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
6952 if ( ulResult != cOCT6100_ERR_OK )
6953 {
6954 break;
6955 }
6956 }
6957 }
6958 }
6959 }
6960
6961 /* If an error is returned, make sure everything is cleaned up properly. */
6962 if ( ulResult != cOCT6100_ERR_OK )
6963 {
6964 /* Search through the list of API channel entry for the ones on to this bridge.*/
6965 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
6966 {
6967 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
6968
6969 /* Channel reserved? */
6970 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
6971 {
6972 /* On current bridge? */
6973 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
6974 {
6975 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
6976
6977 /* Check if we can now hear this participant, but could not before. */
6978 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
6979 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) )
6980 {
6981 /* If the load or event entry in the mixer memory was reserved. */
6982 if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX )
6983 {
6984 /* Must release the load or accumulate entry mixer event. */
6985 ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] );
6986 if ( ulTempVar != cOCT6100_ERR_OK )
6987 return ulTempVar;
6988
6989 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
6990 }
6991 }
6992
6993 /* Check if we can now NOT hear this participant, but could before. */
6994 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
6995 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) )
6996 {
6997 /* If the load or event entry in the mixer memory was reserved. */
6998 if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] == cOCT6100_INVALID_INDEX )
6999 {
7000 /* Must release the load or accumulate entry mixer event. */
7001 ulTempVar = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ) );
7002 if ( ulTempVar != cOCT6100_ERR_OK )
7003 return ulTempVar;
7004 }
7005 }
7006 }
7007 }
7008 }
7009
7010 return ulResult;
7011 }
7012
7013 return cOCT6100_ERR_OK;
7014 }
7015 #endif
7016
7017
7018 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7019
7020 Function: Oct6100ApiBridgeUpdateMask
7021
7022 Description: Update the participant's mask.
7023
7024 -------------------------------------------------------------------------------
7025 | Argument | Description
7026 -------------------------------------------------------------------------------
7027 f_pApiInstance Pointer to API instance. This memory is used to keep the
7028 present state of the chip and all its resources.
7029 f_usBridgeIndex Bridge index of the bridge where this channel is residing.
7030 f_usChanIndex Channel index of the channel to be modified.
7031 f_ulNewListenerMask New mask to apply to the selected participant.
7032
7033 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7034 #if !SKIP_Oct6100ApiBridgeUpdateMask
7035 UINT32 Oct6100ApiBridgeUpdateMask(
7036 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7037 IN UINT16 f_usBridgeIndex,
7038 IN UINT16 f_usChanIndex,
7039 IN UINT32 f_ulNewListenerMask )
7040 {
7041 tPOCT6100_API_CHANNEL pChanEntry;
7042 tPOCT6100_API_CHANNEL pTempEchoChanEntry;
7043 tPOCT6100_SHARED_INFO pSharedInfo;
7044 tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant;
7045 tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant;
7046 tOCT6100_WRITE_PARAMS WriteParams;
7047
7048 UINT32 ulResult;
7049 UINT32 ulOldListenerMask;
7050 UINT16 usChannelIndex;
7051
7052 UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ];
7053 UINT32 ulMutePortChannelIndex;
7054
7055 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
7056 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX;
7057
7058 /* Obtain local pointer to shared portion of instance. */
7059 pSharedInfo = f_pApiInstance->pSharedInfo;
7060
7061 WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
7062
7063 WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
7064
7065 /* Get a pointer to the channel's list entry. */
7066 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex )
7067
7068 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex );
7069
7070 ulOldListenerMask = pParticipant->ulListenerMask;
7071
7072 /* Search through the list of API channel entry for the ones onto this bridge. */
7073 for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ )
7074 {
7075 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex );
7076
7077 /* Channel reserved? */
7078 if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) )
7079 {
7080 /* On current bridge? */
7081 if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex )
7082 {
7083 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
7084
7085 /* Check if we can now hear this participant, but could not before. */
7086 if ( ( pTempEchoChanEntry->fMute == FALSE )
7087 && ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
7088 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) )
7089 {
7090 /* First create/update the current channel's mixer. */
7091 ulResult = Oct6100ApiBridgeAddParticipantToChannel(
7092 f_pApiInstance,
7093 f_usBridgeIndex,
7094 usChannelIndex,
7095 f_usChanIndex,
7096 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ],
7097 pChanEntry->usSubStoreEventIndex,
7098 pChanEntry->usSinCopyEventIndex,
7099 pTempParticipant->ulInputPort,
7100 pParticipant->ulInputPort );
7101 if ( ulResult != cOCT6100_ERR_OK )
7102 return ulResult;
7103
7104 if ( pParticipant->fFlexibleMixerCreated == TRUE )
7105 {
7106 /* Check if the Rin silence event can be cleared now that the */
7107 /* channel has been added to a conference. */
7108 if ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX )
7109 {
7110 /* Remove the event from the list.*/
7111 ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
7112 pChanEntry->usRinSilenceEventIndex,
7113 cOCT6100_EVENT_TYPE_SOUT_COPY );
7114 if ( ulResult != cOCT6100_ERR_OK )
7115 return ulResult;
7116
7117 ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex );
7118 if ( ulResult != cOCT6100_ERR_OK )
7119 return cOCT6100_ERR_FATAL_DF;
7120
7121 pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX;
7122 }
7123 }
7124 }
7125
7126 /* Check if we can now NOT hear this participant, but could before. */
7127 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
7128 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 )
7129 && ( pParticipant->fFlexibleMixerCreated == TRUE )
7130 && ( pTempEchoChanEntry->fMute == FALSE ) )
7131 {
7132 /* First update the current channel's mixer. */
7133 ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel(
7134 f_pApiInstance,
7135 f_usBridgeIndex,
7136 usChannelIndex,
7137 f_usChanIndex,
7138 TRUE );
7139 if ( ulResult != cOCT6100_ERR_OK )
7140 return ulResult;
7141
7142 if ( pParticipant->fFlexibleMixerCreated == FALSE )
7143 {
7144 /* Remember to mute the port on this channel. */
7145 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
7146 {
7147 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == f_usChanIndex )
7148 {
7149 break;
7150 }
7151 else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX )
7152 {
7153 ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = f_usChanIndex;
7154 break;
7155 }
7156 }
7157 }
7158 }
7159
7160 /* Clear the load or accumulate event index for this participant. */
7161 if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 )
7162 && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) )
7163 {
7164 pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX;
7165 }
7166 }
7167 }
7168
7169 /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */
7170 for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ )
7171 {
7172 if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX )
7173 {
7174 mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] );
7175
7176 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex );
7177
7178 if ( pTempParticipant->fFlexibleMixerCreated == FALSE )
7179 {
7180 /* Check if the Rin port must be muted on this channel. */
7181 ulResult = Oct6100ApiMutePorts(
7182 f_pApiInstance,
7183 ausMutePortChannelIndexes[ ulMutePortChannelIndex ],
7184 pTempEchoChanEntry->usRinTsstIndex,
7185 pTempEchoChanEntry->usSinTsstIndex,
7186 FALSE );
7187 if ( ulResult != cOCT6100_ERR_OK )
7188 return ulResult;
7189 }
7190 }
7191 else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */
7192 {
7193 /* No more channels to check for muting. */
7194 break;
7195 }
7196 }
7197 }
7198
7199 /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */
7200 if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT )
7201 {
7202 if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX )
7203 {
7204 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
7205 pChanEntry->usSinTsstIndex,
7206 pChanEntry->usExtraSinTsiMemIndex,
7207 pChanEntry->TdmConfig.bySinPcmLaw );
7208 if ( ulResult != cOCT6100_ERR_OK )
7209 return ulResult;
7210 }
7211
7212 /* If the silence TSI is loaded on this port, update with the extra sin TSI. */
7213 if ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX )
7214 {
7215 WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
7216
7217 WriteParams.ulWriteAddress += 2;
7218 WriteParams.usWriteData = pChanEntry->usExtraSinTsiMemIndex;
7219
7220 mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
7221 if ( ulResult != cOCT6100_ERR_OK )
7222 return ulResult;
7223 }
7224 }
7225
7226 /* Configure the RIN copy mixer entry and memory - if using the RIN port. */
7227 if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_RIN )
7228 {
7229 if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX )
7230 {
7231 ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
7232 pChanEntry->usRinTsstIndex,
7233 pChanEntry->usExtraRinTsiMemIndex,
7234 pChanEntry->TdmConfig.byRinPcmLaw );
7235 if ( ulResult != cOCT6100_ERR_OK )
7236 return ulResult;
7237 }
7238 }
7239
7240 /* Save the new mask permanently in the API instance. */
7241 pParticipant->ulListenerMask = f_ulNewListenerMask;
7242
7243 return cOCT6100_ERR_OK;
7244 }
7245 #endif
7246
7247
7248 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7249
7250 Function: Oct6100ConfBridgeGetStatsSer
7251
7252 Description: This function returns the statistics from the specified bridge.
7253
7254 -------------------------------------------------------------------------------
7255 | Argument | Description
7256 -------------------------------------------------------------------------------
7257 f_pApiInstance Pointer to API instance. This memory is used to keep the
7258 present state of the chip and all its resources.
7259
7260 f_pConfBridgeStats Pointer to conference bridge stats structure.
7261
7262 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7263 #if !SKIP_Oct6100ConfBridgeGetStatsSer
7264 UINT32 Oct6100ConfBridgeGetStatsSer(
7265 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7266 IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats )
7267 {
7268 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
7269 UINT16 usConfBridgeIndex;
7270 UINT32 ulEntryOpenCnt;
7271
7272 /* Check for errors. */
7273 if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 )
7274 return cOCT6100_ERR_CONF_BRIDGE_DISABLED;
7275
7276 /*=====================================================================*/
7277 /* Check the conference bridge handle. */
7278
7279 /* Check the provided handle. */
7280 if ( (f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE )
7281 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
7282
7283 usConfBridgeIndex = (UINT16)( f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK );
7284 if ( usConfBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges )
7285 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
7286
7287 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, usConfBridgeIndex )
7288
7289 /* Extract the entry open count from the provided handle. */
7290 ulEntryOpenCnt = (f_pConfBridgeStats->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
7291
7292 /* Check for errors. */
7293 if ( pBridgeEntry->fReserved != TRUE )
7294 return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN;
7295 if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt )
7296 return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE;
7297
7298 /*=====================================================================*/
7299
7300 /* Return the stats.*/
7301 f_pConfBridgeStats->ulNumChannels = pBridgeEntry->usNumClients;
7302 f_pConfBridgeStats->ulNumTappedChannels = pBridgeEntry->usNumTappedClients;
7303 f_pConfBridgeStats->fFlexibleConferencing = pBridgeEntry->fFlexibleConferencing;
7304
7305 return cOCT6100_ERR_OK;
7306 }
7307 #endif
7308
7309
7310 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7311
7312 Function: Oct6100ApiReserveBridgeEntry
7313
7314 Description: Reserves a free entry in the Bridge list.
7315
7316 -------------------------------------------------------------------------------
7317 | Argument | Description
7318 -------------------------------------------------------------------------------
7319 f_pApiInstance Pointer to API instance. This memory is used to keep the
7320 present state of the chip and all its resources.
7321 f_pusBridgeIndex List entry reserved.
7322
7323 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7324 #if !SKIP_Oct6100ApiReserveBridgeEntry
7325 UINT32 Oct6100ApiReserveBridgeEntry(
7326 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7327 OUT PUINT16 f_pusBridgeIndex )
7328 {
7329 PVOID pBridgeAlloc;
7330 UINT32 ulResult;
7331 UINT32 ulBridgeIndex;
7332
7333 mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc )
7334
7335 ulResult = OctapiLlmAllocAlloc( pBridgeAlloc, &ulBridgeIndex );
7336 if ( ulResult != cOCT6100_ERR_OK )
7337 {
7338 if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
7339 return cOCT6100_ERR_CONF_BRIDGE_ALL_BUFFERS_OPEN;
7340 else
7341 return cOCT6100_ERR_FATAL_29;
7342 }
7343
7344 *f_pusBridgeIndex = (UINT16)( ulBridgeIndex & 0xFFFF );
7345
7346 return cOCT6100_ERR_OK;
7347 }
7348 #endif
7349
7350
7351 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7352
7353 Function: Oct6100ApiReleaseBridgeEntry
7354
7355 Description: Release an entry from the bridge list.
7356
7357 -------------------------------------------------------------------------------
7358 | Argument | Description
7359 -------------------------------------------------------------------------------
7360 f_pApiInstance Pointer to API instance. This memory is used to keep the
7361 present state of the chip and all its resources.
7362
7363 f_usBridgeIndex List entry reserved.
7364
7365 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7366 #if !SKIP_Oct6100ApiReleaseBridgeEntry
7367 UINT32 Oct6100ApiReleaseBridgeEntry(
7368 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7369 IN UINT16 f_usBridgeIndex )
7370 {
7371 PVOID pBridgeAlloc;
7372 UINT32 ulResult;
7373
7374 mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc )
7375
7376 ulResult = OctapiLlmAllocDealloc( pBridgeAlloc, f_usBridgeIndex );
7377 if ( ulResult != cOCT6100_ERR_OK )
7378 return cOCT6100_ERR_FATAL_2A;
7379
7380 return cOCT6100_ERR_OK;
7381 }
7382 #endif
7383
7384
7385 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7386
7387 Function: Oct6100ApiGetPrevLastSubStoreEvent
7388
7389 Description: This function will search for the first valid LastSubStoreEvent
7390 in a bridge located before the current bridge in the bridge
7391 link list.
7392
7393 If the function does not find an event before reaching the end
7394 of the mixers list, then the event head node will be used as the
7395 last Store or SubStore event.
7396
7397 -------------------------------------------------------------------------------
7398 | Argument | Description
7399 -------------------------------------------------------------------------------
7400 f_pApiInstance Pointer to API instance. This memory is used to keep the
7401 present state of the chip and all its resources.
7402
7403 f_pusBridgeEntry Bridge entry.
7404 f_usBridgeFirstLoadEventPtr Load index to check against.
7405 First valid sub store index.
7406
7407 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7408 #if !SKIP_Oct6100ApiGetPrevLastSubStoreEvent
7409 UINT32 Oct6100ApiGetPrevLastSubStoreEvent(
7410 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7411 IN UINT16 f_usBridgeIndex,
7412 IN UINT16 f_usBridgeFirstLoadEventPtr,
7413 OUT PUINT16 f_pusLastSubStoreEventIndex )
7414 {
7415 tPOCT6100_API_CONF_BRIDGE pBridgeEntry;
7416 tPOCT6100_API_MIXER_EVENT pTempMixerEntry;
7417 UINT16 usNextEventPtr;
7418 UINT16 usHeadEventPtr;
7419 UINT16 usLastSubStoreEventPtr;
7420 UINT32 ulLoopCount = 0;
7421 UINT16 usCurrentPtr;
7422 UINT32 ulResult = cOCT6100_ERR_OK;
7423
7424 /* Get current entry to obtain the link to the previous entry.*/
7425 mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
7426
7427 /* Since we have flexible bridges, we have to */
7428 /* run down the list and check for the appropriate event. */
7429
7430 /* Travel down the list for the last Store or Sub/Store event before the bridge. */
7431
7432 if ( f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
7433 {
7434 /* The only node in the list then is the head node.*/
7435 usHeadEventPtr = cOCT6100_MIXER_HEAD_NODE;
7436 }
7437 else
7438 {
7439 usHeadEventPtr = f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
7440 }
7441
7442 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usHeadEventPtr );
7443 usLastSubStoreEventPtr = usHeadEventPtr;
7444 usNextEventPtr = pTempMixerEntry->usNextEventPtr;
7445 usCurrentPtr = usHeadEventPtr;
7446 while( usCurrentPtr != f_usBridgeFirstLoadEventPtr )
7447 {
7448 if ( ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE )
7449 || ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE ) )
7450 {
7451 usLastSubStoreEventPtr = usNextEventPtr;
7452 }
7453
7454 /* Next pointer. */
7455 usCurrentPtr = usNextEventPtr;
7456 usNextEventPtr = pTempMixerEntry->usNextEventPtr;
7457
7458 /* Check if next event pointer is valid. */
7459 if ( ( ( f_usBridgeFirstLoadEventPtr != usCurrentPtr )
7460 && ( pTempMixerEntry->usNextEventPtr == cOCT6100_INVALID_INDEX ) )
7461 || ( pTempMixerEntry->usNextEventPtr == cOCT6100_MIXER_HEAD_NODE ) )
7462 return cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND;
7463
7464 if ( usNextEventPtr != cOCT6100_INVALID_INDEX )
7465 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usNextEventPtr );
7466
7467 ulLoopCount++;
7468 if ( ulLoopCount == cOCT6100_MAX_LOOP )
7469 return cOCT6100_ERR_FATAL_CA;
7470 }
7471
7472 /* Return the result to the user. */
7473 *f_pusLastSubStoreEventIndex = usLastSubStoreEventPtr;
7474
7475 return ulResult;
7476 }
7477 #endif
7478
7479
7480 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7481
7482 Function: Oct6100ApiGetPreviousEvent
7483
7484 Description: This is a recursive function, it requires an entry event index and
7485 will run down the list until it finds the node just before the one
7486 required.
7487
7488 -------------------------------------------------------------------------------
7489 | Argument | Description
7490 -------------------------------------------------------------------------------
7491 f_pApiInstance Pointer to API instance. This memory is used to keep the
7492 present state of the chip and all its resources.
7493
7494 f_usEntryIndex Event entry index.
7495 f_pusBridgeEntry Bridge entry.
7496 f_pusPreviousIndex Previous index.
7497
7498 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7499 #if !SKIP_Oct6100ApiGetPreviousEvent
7500 UINT32 Oct6100ApiGetPreviousEvent(
7501 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7502 IN UINT16 f_usEntryIndex,
7503 IN UINT16 f_usSearchedIndex,
7504 IN UINT16 f_usLoopCnt,
7505 OUT PUINT16 f_pusPreviousIndex )
7506 {
7507 tPOCT6100_API_MIXER_EVENT pCurrentEntry;
7508 UINT32 ulResult;
7509
7510 /* Get current entry to obtain the link to the previous entry. */
7511 mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pCurrentEntry, f_usEntryIndex );
7512
7513 /* Avoid stack overflows. */
7514 if ( f_usLoopCnt == cOCT6100_MAX_MIXER_EVENTS )
7515 return cOCT6100_ERR_FATAL_E3;
7516
7517 if ( pCurrentEntry->usNextEventPtr == cOCT6100_INVALID_INDEX )
7518 {
7519 /* Event not found. */
7520 ulResult = cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND;
7521 }
7522 else if ( pCurrentEntry->usNextEventPtr == f_usSearchedIndex )
7523 {
7524 /* We found our node. */
7525 *f_pusPreviousIndex = f_usEntryIndex;
7526 ulResult = cOCT6100_ERR_OK;
7527 }
7528 else
7529 {
7530 /* Keep searching.*/
7531 f_usLoopCnt++;
7532 ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pCurrentEntry->usNextEventPtr, f_usSearchedIndex, f_usLoopCnt, f_pusPreviousIndex );
7533 }
7534
7535 return ulResult;
7536 }
7537 #endif
7538
7539
7540 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7541
7542 Function: Oct6100ApiBridgeSetDominantSpeaker
7543
7544 Description: This function will set the index of the dominant speaker
7545 for the channel index specified.
7546
7547 -------------------------------------------------------------------------------
7548 | Argument | Description
7549 -------------------------------------------------------------------------------
7550 f_pApiInstance Pointer to API instance. This memory is used to
7551 keep the present state of the chip and all its
7552 resources.
7553
7554 f_usChannelIndex Index of the channel where the API must set the
7555 current dominant speaker for the conference.
7556 f_usDominantSpeakerIndex Index of the channel which is the dominant
7557 speaker in the conference.
7558
7559 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7560 #if !SKIP_Oct6100ApiBridgeSetDominantSpeaker
7561 UINT32 Oct6100ApiBridgeSetDominantSpeaker(
7562 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7563 IN UINT16 f_usChannelIndex,
7564 IN UINT16 f_usDominantSpeakerIndex )
7565 {
7566 UINT32 ulBaseAddress;
7567 UINT32 ulFeatureBytesOffset;
7568 UINT32 ulFeatureBitOffset;
7569 UINT32 ulFeatureFieldLength;
7570 UINT32 ulResult;
7571 UINT32 ulTempData;
7572 UINT32 ulMask;
7573
7574 tPOCT6100_API_CHANNEL pEchoChanEntry;
7575
7576 mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, f_usChannelIndex );
7577
7578 ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst;
7579 ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.usDwordOffset * 4;
7580 ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byBitOffset;
7581 ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byFieldSize;
7582
7583 /* Retrieve the current configuration. */
7584 ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance,
7585 pEchoChanEntry,
7586 ulBaseAddress + ulFeatureBytesOffset,
7587 &ulTempData);
7588 if ( ulResult != cOCT6100_ERR_OK )
7589 return ulResult;
7590
7591 /* Clear previous value set in the feature field.*/
7592 mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask );
7593
7594 ulTempData &= (~ulMask);
7595 ulTempData |= ( ( f_usDominantSpeakerIndex ) << ulFeatureBitOffset );
7596
7597 /* Save the new dominant speaker. */
7598 ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance,
7599 pEchoChanEntry,
7600 ulBaseAddress + ulFeatureBytesOffset,
7601 ulTempData);
7602 if ( ulResult != cOCT6100_ERR_OK )
7603 return ulResult;
7604
7605 return cOCT6100_ERR_OK;
7606 }
7607 #endif
7608
7609
7610 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7611
7612 Function: Oct6100ApiReserveFlexConfParticipantEntry
7613
7614 Description: Reserves a free entry in the participant list.
7615
7616 -------------------------------------------------------------------------------
7617 | Argument | Description
7618 -------------------------------------------------------------------------------
7619 f_pApiInstance Pointer to API instance. This memory is used to keep the
7620 present state of the chip and all its resources.
7621 f_pusParticipantIndex List entry reserved.
7622
7623 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7624 #if !SKIP_Oct6100ApiReserveFlexConfParticipantEntry
7625 UINT32 Oct6100ApiReserveFlexConfParticipantEntry(
7626 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7627 OUT PUINT16 f_pusParticipantIndex )
7628 {
7629 PVOID pParticipantAlloc;
7630 UINT32 ulResult;
7631 UINT32 ulParticipantIndex;
7632
7633 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc )
7634
7635 ulResult = OctapiLlmAllocAlloc( pParticipantAlloc, &ulParticipantIndex );
7636 if ( ulResult != cOCT6100_ERR_OK )
7637 {
7638 if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
7639 return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_ALL_BUFFERS_OPEN;
7640 else
7641 return cOCT6100_ERR_FATAL_29;
7642 }
7643
7644 *f_pusParticipantIndex = (UINT16)( ulParticipantIndex & 0xFFFF );
7645
7646 return cOCT6100_ERR_OK;
7647 }
7648 #endif
7649
7650
7651 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
7652
7653 Function: Oct6100ApiReleaseFlexConfParticipantEntry
7654
7655 Description: Release an entry from the flexible conferencing participant
7656 list.
7657
7658 -------------------------------------------------------------------------------
7659 | Argument | Description
7660 -------------------------------------------------------------------------------
7661 f_pApiInstance Pointer to API instance. This memory is used to keep the
7662 present state of the chip and all its resources.
7663
7664 f_usParticipantIndex List entry reserved.
7665
7666 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
7667 #if !SKIP_Oct6100ApiReleaseFlexConfParticipantEntry
7668 UINT32 Oct6100ApiReleaseFlexConfParticipantEntry(
7669 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
7670 IN UINT16 f_usParticipantIndex )
7671 {
7672 PVOID pParticipantAlloc;
7673 UINT32 ulResult;
7674
7675 mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc )
7676
7677 ulResult = OctapiLlmAllocDealloc( pParticipantAlloc, f_usParticipantIndex );
7678 if ( ulResult != cOCT6100_ERR_OK )
7679 return cOCT6100_ERR_FATAL_2A;
7680
7681 return cOCT6100_ERR_OK;
7682 }
7683 #endif