source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/astmlib/7552/bastmlib.c @ 27

Last change on this file since 27 was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 17.9 KB
Line 
1/***************************************************************************
2*     Copyright (c) 2004-2010, Broadcom Corporation
3*     All Rights Reserved
4*     Confidential Property of Broadcom Corporation
5*
6*  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7*  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8*  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9*
10* $brcm_Workfile: bastmlib.c $
11* $brcm_Revision: Hydra_Software_Devel/8 $
12* $brcm_Date: 11/2/10 4:54p $
13*
14* Revision History:
15*
16* $brcm_Log: /magnum/syslib/astmlib/noarch/bastmlib.c $
17*
18* Hydra_Software_Devel/8   11/2/10 4:54p bandrews
19* SW3548-1159: updated clock coupling recovery to use a second timeout
20* value
21*
22* Hydra_Software_Devel/7   7/14/10 7:44p bandrews
23* SW3548-1161: expose default configs as public
24*
25* Hydra_Software_Devel/6   7/17/09 6:56p bandrews
26* PR49215: playback support
27*
28* Hydra_Software_Devel/5   11/20/08 6:16p bandrews
29* PR49489: Add debug messages; ensure no events are recorded if stopped;
30* clear event queue on start; only schedule settling timers if started
31*
32* Hydra_Software_Devel/4   11/19/08 7:22p bandrews
33* PR49489: Add state reset on stop; Ensure state reset generates
34* callbacks
35*
36* Hydra_Software_Devel/3   4/3/08 2:33p bandrews
37* PR40090: synclib needs to have different contexts for syslib callbacks
38* and synclib callbacks
39*
40* Hydra_Software_Devel/2   3/27/08 5:48p bandrews
41* PR40090: Fixed display and storage of presenter names for debug
42*
43* Hydra_Software_Devel/1   3/24/08 3:08p bandrews
44* PR40865: Fixed
45*
46* Hydra_Software_Devel/3   2/15/08 10:00p bandrews
47* PR36148: Updated ASTM based on reviews
48*
49* Hydra_Software_Devel/2   1/25/08 9:21p bandrews
50* PR36148: Updated based on simulation
51*
52* Hydra_Software_Devel/1   10/19/07 9:30p bandrews
53* PR36148: Initial implementation
54***************************************************************************/
55
56#include "bstd.h"
57#include "bkni.h"
58#include "bsyslib.h"
59#include "bastmlib.h"
60#include "bastmlib_priv.h"
61#include "bastmlib_clock_reference.h"
62#include "bastmlib_clock_reference_priv.h"
63#include "bastmlib_clock_coupling_task.h"
64#include "bastmlib_presenter.h"
65#include "bastmlib_presenter_priv.h"
66#include "bastmlib_presentation_task.h"
67
68BDBG_MODULE(astmlib);
69
70void BASTMlib_GetDefaultSettings(
71        BASTMlib_Settings * psSettings /* default instance settings [out] */
72)
73{
74        BDBG_ENTER(BASTMlib_GetDefaultSettings);
75       
76        BDBG_ASSERT(psSettings);
77
78        psSettings->cbTimer.pvParm1 = NULL;
79        psSettings->cbTimer.iParm2 = 0;
80        psSettings->cbTimer.pfCreate = NULL;
81        psSettings->cbTimer.pfDestroy = NULL;
82        psSettings->cbTimer.pfStart_isr = NULL;
83        psSettings->cbTimer.pfCancel_isr = NULL;
84        BSYSlib_Callback_Init(&psSettings->sClockCoupling.cbStateChange);
85        BSYSlib_Callback_Init(&psSettings->sPresentation.cbStateChange);
86
87        BDBG_LEAVE(BASTMlib_GetDefaultSettings);
88}
89
90BERR_Code BASTMlib_Create(
91        BASTMlib_Handle * phAstm,
92        const BASTMlib_Settings * psSettings
93)
94{
95        BERR_Code rc = BERR_SUCCESS;
96        BASTMlib_Handle hAstm = NULL;
97
98        BDBG_ENTER(BASTMlib_Create);
99
100        BDBG_ASSERT(phAstm);
101
102        hAstm = (BASTMlib_Handle)BKNI_Malloc(sizeof(struct BASTMlib_Impl));
103        BDBG_ASSERT(hAstm);
104        if (!hAstm)
105        {
106                rc = BERR_OUT_OF_SYSTEM_MEMORY;
107                goto error;
108        }
109
110        BKNI_Memset(hAstm, 0, sizeof(struct BASTMlib_Impl));
111
112        if (psSettings)
113        {
114                hAstm->sSettings = *psSettings;
115        }
116        else
117        {
118                BASTMlib_GetDefaultSettings(&hAstm->sSettings);
119        }
120
121        /* allocate timers */
122        if (hAstm->sSettings.cbTimer.pfCreate)
123        {
124                void * pvParm1 = hAstm->sSettings.cbTimer.pvParm1;
125                int iParm2 = hAstm->sSettings.cbTimer.iParm2;
126
127                rc = hAstm->sSettings.cbTimer.pfCreate(pvParm1, iParm2, &hAstm->sClockCoupling.hTimer);
128                BDBG_ASSERT(hAstm->sClockCoupling.hTimer);
129                if (rc) goto error;
130
131                rc = hAstm->sSettings.cbTimer.pfCreate(pvParm1, iParm2, &hAstm->sPresentation.hTimer);
132                BDBG_ASSERT(hAstm->sPresentation.hTimer);
133                if (rc) goto error;
134
135                rc = hAstm->sSettings.cbTimer.pfCreate(pvParm1, iParm2, &hAstm->sPresentation.hWatchdogTimer);
136                BDBG_ASSERT(hAstm->sPresentation.hWatchdogTimer);
137                if (rc) goto error;
138        }
139
140        /* create clock reference */
141        BASTMlib_ClockReference_Create(&hAstm->sClockCoupling.hReference);
142        hAstm->sClockCoupling.hReference->hAstm = hAstm;
143
144        /* create presenter list */
145        hAstm->sPresentation.hPresenters = BSYSlib_List_Create();
146        BDBG_ASSERT(hAstm->sPresentation.hPresenters);
147        hAstm->sPresentation.uiPresenterCount = 0;
148
149        /* set default config */
150        BASTMlib_P_GetDefaultConfig(&hAstm->sConfig);
151
152        BDBG_MSG(("module initial configuration:"));
153        BDBG_MSG(("  enabled: %s", hAstm->sConfig.bEnabled? "true" : "false"));
154        BDBG_MSG(("  stc rate: %u Hz", hAstm->sConfig.eStcRate));
155        BDBG_MSG(("  clock coupling:"));
156        BDBG_MSG(("    initial acquisition time: %u ms", hAstm->sConfig.sClockCoupling.uiInitialAcquisitionTime));
157        BDBG_MSG(("    processing frequency: %u ms", hAstm->sConfig.sClockCoupling.uiProcessingFrequency));
158        BDBG_MSG(("    settling time: %u ms", hAstm->sConfig.sClockCoupling.uiSettlingTime));
159        BDBG_MSG(("    preferred clock coupling: %u", hAstm->sConfig.sClockCoupling.ePreferredClockCoupling));
160        BDBG_MSG(("  presentation:"));
161        BDBG_MSG(("    preferred stc source: %u", hAstm->sConfig.sPresentation.ePreferredStcSource));
162        BDBG_MSG(("    preferred presenter: %s", hAstm->sConfig.sPresentation.hPreferredPresenter ? hAstm->sConfig.sPresentation.hPreferredPresenter->pcName : "FCFS"));
163        BDBG_MSG(("    initial acquisition time: %u ms", hAstm->sConfig.sPresentation.uiInitialAcquisitionTime));
164        BDBG_MSG(("    processing frequency: %u ms", hAstm->sConfig.sPresentation.uiProcessingFrequency));
165        BDBG_MSG(("    TSM-disabled watchdog timeout: %u ms", hAstm->sConfig.sPresentation.uiTsmDisabledWatchdogTimeout));
166        BDBG_MSG(("    settling time: %u ms", hAstm->sConfig.sPresentation.uiSettlingTime));
167        BDBG_MSG(("    preferred presentation rate control: %u", hAstm->sConfig.sPresentation.ePreferredPresentationRateControl));
168
169        /* create clock reference event queue */
170        BASTMlib_P_ClockCoupling_GetMaxAcquisitionTime(hAstm, &hAstm->sClockCoupling.hReference->uiMaximumAcquisitionTime);
171        BASTMlib_ClockReference_ResizeEventQueue(hAstm->sClockCoupling.hReference);
172
173        *phAstm = hAstm;
174       
175        goto end;
176
177error:
178
179        if (hAstm)
180        {
181                BASTMlib_Destroy(hAstm);
182        }
183
184end:
185        BDBG_LEAVE(BASTMlib_Create);
186        return rc;
187}
188
189
190void BASTMlib_Destroy(
191        BASTMlib_Handle hAstm
192)
193{
194        BDBG_ENTER(BASTMlib_Destroy);
195       
196        BDBG_ASSERT(hAstm);
197
198        BASTMlib_Stop(hAstm);
199
200        /* destroy clock reference */
201        BASTMlib_ClockReference_Destroy(hAstm->sClockCoupling.hReference);
202        hAstm->sClockCoupling.hReference = NULL;
203
204        /* destroy the presenter list */
205        BSYSlib_List_Destroy(hAstm->sPresentation.hPresenters);
206        hAstm->sPresentation.hPresenters = NULL;
207
208        /* deallocate timers */
209        if (hAstm->sSettings.cbTimer.pfDestroy)
210        {
211                void * pvParm1 = hAstm->sSettings.cbTimer.pvParm1;
212                int iParm2 = hAstm->sSettings.cbTimer.iParm2;
213                BSYSlib_Timer_Handle hTimer;
214
215                hTimer = hAstm->sPresentation.hTimer;
216                if (hTimer)
217                {
218                        hAstm->sSettings.cbTimer.pfDestroy(pvParm1, iParm2, hTimer);
219                }
220                hAstm->sPresentation.hTimer = NULL;
221
222                hTimer = hAstm->sPresentation.hWatchdogTimer;
223                if (hTimer)
224                {
225                        hAstm->sSettings.cbTimer.pfDestroy(pvParm1, iParm2, hTimer);
226                }
227                hAstm->sPresentation.hWatchdogTimer = NULL;
228
229                hTimer = hAstm->sClockCoupling.hTimer;
230                if (hTimer)
231                {
232                        hAstm->sSettings.cbTimer.pfDestroy(pvParm1, iParm2, hTimer);
233                }
234                hAstm->sClockCoupling.hTimer = NULL;
235        }
236
237        /* free me */
238        BKNI_Free(hAstm);
239
240        BDBG_LEAVE(BASTMlib_Destroy);
241}
242
243BERR_Code BASTMlib_Start(
244        BASTMlib_Handle hAstm
245)
246{
247        BERR_Code rc = BERR_SUCCESS;
248        BSYSlib_List_IteratorHandle hIterator;
249
250        BDBG_ENTER(BASTMlib_Start);
251       
252        BDBG_ASSERT(hAstm);
253
254        /* resize queues on next start, since we may have tried to resize while
255        already running. If same size as last time, nothing happens. */
256        BASTMlib_ClockReference_ResizeEventQueue(hAstm->sClockCoupling.hReference);
257        hIterator = BSYSlib_List_AcquireIterator(hAstm->sPresentation.hPresenters);
258        while (BSYSlib_List_HasNext(hIterator))
259        {
260                BASTMlib_Presenter_Handle hPresenter = (BASTMlib_Presenter_Handle)BSYSlib_List_Next(hIterator);
261                BASTMlib_Presenter_ResizeEventQueue(hPresenter);
262                /* always clear event queue on start, resize will only clear if resized */
263                BKNI_EnterCriticalSection();
264                BASTMlib_Presenter_Reset_isr(hPresenter);
265                BKNI_LeaveCriticalSection();
266        }
267        BSYSlib_List_ReleaseIterator(hIterator);
268
269        BASTMlib_P_ClockCoupling_StateMachine_SendSignal(hAstm, 
270                BASTMlib_ClockCoupling_StateMachineSignal_eReset);
271
272        /* only schedule clock coupling task if we prefer the input clock */
273        if (hAstm->sConfig.sClockCoupling.ePreferredClockCoupling == BASTMlib_ClockCoupling_eInputClock)
274        {
275                BDBG_MSG(("Scheduling initial clock coupling acquisition timer"));
276                BKNI_EnterCriticalSection();
277                hAstm->sClockCoupling.bAcquire = true;
278                rc = BASTMlib_P_StartTimer_isr(hAstm, 
279                        hAstm->sClockCoupling.hTimer, 
280                        hAstm->sConfig.sClockCoupling.uiInitialAcquisitionTime, 
281                        &BASTMlib_P_ClockCoupling_TimerExpired, hAstm, 0);
282                BKNI_LeaveCriticalSection();
283                if (rc) goto error;
284        }
285        else
286        {
287                /* else disable clock coupling event acquisition */
288                hAstm->sClockCoupling.bAcquire = false;
289        }
290
291        BASTMlib_P_Presentation_RateControlStateMachine_SendSignal(hAstm, 
292                BASTMlib_Presentation_StateMachineSignal_eReset);
293
294        BASTMlib_P_Presentation_StcSourceStateMachine_SendSignal(hAstm, 
295                BASTMlib_Presentation_StateMachineSignal_eReset);
296
297        BDBG_MSG(("Scheduling initial presentation acquisition timer"));
298        BKNI_EnterCriticalSection();
299        hAstm->sPresentation.bAcquire = false; /* initially, we ignore pts errors */
300        rc = BASTMlib_P_StartTimer_isr(hAstm, 
301                hAstm->sPresentation.hTimer, 
302                hAstm->sConfig.sPresentation.uiInitialAcquisitionTime, 
303                &BASTMlib_P_Presentation_TimerExpired, hAstm, 0);
304        BKNI_LeaveCriticalSection();
305        if (rc) goto error;
306
307        hAstm->bStarted = true;
308       
309        goto end;
310
311error:
312
313end:
314        BDBG_LEAVE(BASTMlib_Start);
315        return rc;
316}
317
318BERR_Code BASTMlib_Stop(
319        BASTMlib_Handle hAstm
320)
321{
322        BERR_Code rc = BERR_SUCCESS;
323        void * pvParm1;
324        int iParm2;
325        BSYSlib_Timer_Cancel_isr pfCancel_isr;
326
327        BDBG_ENTER(BASTMlib_Stop);
328       
329        BDBG_ASSERT(hAstm);
330
331        hAstm->bStarted = false;
332       
333        pfCancel_isr = hAstm->sSettings.cbTimer.pfCancel_isr;
334        pvParm1 = hAstm->sSettings.cbTimer.pvParm1;
335        iParm2 = hAstm->sSettings.cbTimer.iParm2;
336
337        if (pfCancel_isr)
338        {
339                BKNI_EnterCriticalSection();
340                hAstm->sClockCoupling.bAcquire = false;
341                rc = pfCancel_isr(pvParm1, iParm2, hAstm->sClockCoupling.hTimer);
342                BKNI_LeaveCriticalSection();
343                if (rc) goto error;
344
345                BKNI_EnterCriticalSection();
346                hAstm->sPresentation.bAcquire = false;
347                rc = pfCancel_isr(pvParm1, iParm2, hAstm->sPresentation.hTimer);
348                BKNI_LeaveCriticalSection();
349                if (rc) goto error;
350
351                /* PR:50051 need to stop watchdog timer, too */
352                BKNI_EnterCriticalSection();
353                rc = pfCancel_isr(pvParm1, iParm2, hAstm->sPresentation.hWatchdogTimer);
354                BKNI_LeaveCriticalSection();
355                if (rc) goto error;
356        }
357
358        BASTMlib_P_ClockCoupling_StateMachine_SendSignal(hAstm, 
359                BASTMlib_ClockCoupling_StateMachineSignal_eReset);
360
361        BASTMlib_P_Presentation_RateControlStateMachine_SendSignal(hAstm, 
362                BASTMlib_Presentation_StateMachineSignal_eReset);
363
364        BASTMlib_P_Presentation_StcSourceStateMachine_SendSignal(hAstm, 
365                BASTMlib_Presentation_StateMachineSignal_eReset);
366
367        goto end;
368
369error:
370
371end:
372        BDBG_LEAVE(BASTMlib_Stop);
373        return rc;
374}
375
376void BASTMlib_GetDefaultConfig(
377        BASTMlib_Config * psConfig
378)
379{
380        BASTMlib_P_GetDefaultConfig(psConfig);
381}
382
383void BASTMlib_GetConfig(
384        const BASTMlib_Handle hAstm, 
385        BASTMlib_Config * psConfig
386)
387{
388        BDBG_ENTER(BASTMlib_GetConfig);
389       
390        BDBG_ASSERT(psConfig);
391
392        *psConfig = hAstm->sConfig;
393       
394        BDBG_LEAVE(BASTMlib_GetConfig);
395}
396
397void BASTMlib_SetConfig(
398        BASTMlib_Handle hAstm,
399        const BASTMlib_Config * psConfig
400)
401{
402        BDBG_ENTER(BASTMlib_SetConfig);
403
404        BDBG_ASSERT(hAstm);
405
406        if (psConfig)
407        {
408                /*
409                        process config changes:
410                        if current state is higher than preferred state, reset to preference
411                        immediately. However, if current state is lower than preferred
412                        state, just save for later
413                */
414                if (hAstm->sConfig.sClockCoupling.ePreferredClockCoupling == BASTMlib_ClockCoupling_eInputClock
415                        && psConfig->sClockCoupling.ePreferredClockCoupling == BASTMlib_ClockCoupling_eInternalClock)
416                {
417                        BASTMlib_P_ClockCoupling_StateMachine_SendSignal(hAstm, 
418                                BASTMlib_ClockCoupling_StateMachineSignal_eReset);
419                }
420               
421                if (hAstm->sConfig.sPresentation.ePreferredStcSource == BASTMlib_StcSource_eClockReference
422                        && psConfig->sPresentation.ePreferredStcSource == BASTMlib_StcSource_ePresenter)
423                {
424                        BASTMlib_P_Presentation_StcSourceStateMachine_SendSignal(hAstm, 
425                                BASTMlib_Presentation_StateMachineSignal_eReset);
426                }
427               
428                if (hAstm->sConfig.sPresentation.ePreferredPresentationRateControl == BASTMlib_PresentationRateControl_eTimeStamp
429                        && psConfig->sPresentation.ePreferredPresentationRateControl == BASTMlib_PresentationRateControl_eOutputClock)
430                {
431                        BASTMlib_P_Presentation_RateControlStateMachine_SendSignal(hAstm, 
432                                BASTMlib_Presentation_StateMachineSignal_eReset);
433                }
434
435                /* copy config */
436                hAstm->sConfig = *psConfig;
437
438                BDBG_MSG(("module reconfigured:"));
439                BDBG_MSG(("  enabled: %s", hAstm->sConfig.bEnabled? "true" : "false"));
440                BDBG_MSG(("  stc rate: %u Hz", hAstm->sConfig.eStcRate));
441                BDBG_MSG(("  clock coupling:"));
442                BDBG_MSG(("    initial acquisition time: %u ms", hAstm->sConfig.sClockCoupling.uiInitialAcquisitionTime));
443                BDBG_MSG(("    processing frequency: %u ms", hAstm->sConfig.sClockCoupling.uiProcessingFrequency));
444                BDBG_MSG(("    ideal processing frequency: %u ms", hAstm->sConfig.sClockCoupling.uiIdealProcessingFrequency));
445                BDBG_MSG(("    settling time: %u ms", hAstm->sConfig.sClockCoupling.uiSettlingTime));
446                BDBG_MSG(("    preferred clock coupling: %u", hAstm->sConfig.sClockCoupling.ePreferredClockCoupling));
447                BDBG_MSG(("  presentation:"));
448                BDBG_MSG(("    preferred stc source: %u", hAstm->sConfig.sPresentation.ePreferredStcSource));
449                BDBG_MSG(("    preferred presenter: %s", hAstm->sConfig.sPresentation.hPreferredPresenter ? hAstm->sConfig.sPresentation.hPreferredPresenter->pcName : "FCFS"));
450                BDBG_MSG(("    initial acquisition time: %u ms", hAstm->sConfig.sPresentation.uiInitialAcquisitionTime));
451                BDBG_MSG(("    processing frequency: %u ms", hAstm->sConfig.sPresentation.uiProcessingFrequency));
452                BDBG_MSG(("    TSM-disabled watchdog timeout: %u ms", hAstm->sConfig.sPresentation.uiTsmDisabledWatchdogTimeout));
453                BDBG_MSG(("    settling time: %u ms", hAstm->sConfig.sPresentation.uiSettlingTime));
454                BDBG_MSG(("    preferred presentation rate control: %u", hAstm->sConfig.sPresentation.ePreferredPresentationRateControl));
455
456                if (hAstm->sClockCoupling.hReference)
457                {
458                        BASTMlib_ClockReference_Config sReferenceConfig;
459
460                        sReferenceConfig.uiMinimumTimeBetweenEvents = psConfig->sClockCoupling.uiMinimumTimeBetweenEvents;
461                        sReferenceConfig.eClockReferenceDomain = psConfig->sClockCoupling.eClockReferenceDomain;
462                        sReferenceConfig.uiDeviationThreshold = psConfig->sClockCoupling.uiDeviationThreshold;
463                        sReferenceConfig.uiDeviantCountThreshold = psConfig->sClockCoupling.uiDeviantCountThreshold;
464                        sReferenceConfig.uiIdealCountThreshold = psConfig->sClockCoupling.uiIdealCountThreshold;
465
466                        BASTMlib_P_ClockCoupling_GetMaxAcquisitionTime(hAstm, &hAstm->sClockCoupling.hReference->uiMaximumAcquisitionTime);
467                        BASTMlib_ClockReference_SetConfig(hAstm->sClockCoupling.hReference, 
468                                &sReferenceConfig);
469                }
470        }
471
472        BDBG_LEAVE(BASTMlib_SetConfig);
473}
474
475void BASTMlib_GetStatus(
476        BASTMlib_Handle hAstm,
477        BASTMlib_Status * psStatus /* [out] */
478)
479{
480        BDBG_ENTER(BASTMlib_GetStatus);
481       
482        BDBG_ASSERT(psStatus);
483
484        *psStatus = hAstm->sStatus;
485
486        BDBG_LEAVE(BASTMlib_GetStatus);
487}
488
489BERR_Code BASTMlib_AddPresenter(
490        BASTMlib_Handle hAstm,
491        BASTMlib_Presenter_Handle hPresenter
492)
493{
494        BERR_Code rc = BERR_SUCCESS;
495        BSYSlib_List_IteratorHandle hIterator;
496        bool bFound = false;
497
498        BDBG_ENTER(BASTMlib_AddPresenter);
499
500        BDBG_ASSERT(hAstm);
501        BDBG_ASSERT(hPresenter);
502
503        /* look for presenter already added to list */
504        hIterator = BSYSlib_List_AcquireIterator(hAstm->sPresentation.hPresenters);
505
506        while (BSYSlib_List_HasNext(hIterator))
507        {
508                BASTMlib_Presenter_Handle hTemp;
509
510                hTemp = (BASTMlib_Presenter_Handle)BSYSlib_List_Next(hIterator);
511
512                if (hTemp == hPresenter)
513                {
514                        bFound = true;
515                        break;
516                }
517        }
518
519        BSYSlib_List_ReleaseIterator(hIterator);
520
521        if (!bFound)
522        {
523                BSYSlib_List_AddElement(hAstm->sPresentation.hPresenters, hPresenter);
524                hPresenter->hAstm = hAstm;
525                hAstm->sPresentation.uiPresenterCount++;
526
527                BASTMlib_P_Presentation_GetMaxAcquisitionTime(hAstm, &hPresenter->uiMaximumAcquisitionTime);
528
529                /* create queue */
530                BASTMlib_Presenter_ResizeEventQueue(hPresenter);
531        }
532        else
533        {
534                /* already added */
535                BDBG_WRN(("Presenter %p already added to ASTM instance %p", hPresenter, hAstm));
536                rc = BERR_INVALID_PARAMETER;
537                goto error;
538        }
539
540        goto end;
541
542error:
543
544end:
545
546        BDBG_LEAVE(BASTMlib_AddPresenter);
547        return rc;
548}
549
550void BASTMlib_RemovePresenter(
551        BASTMlib_Handle hAstm,
552        BASTMlib_Presenter_Handle hPresenter
553)
554{
555        BSYSlib_List_IteratorHandle hIterator;
556        bool bFound = false;
557
558        BDBG_ENTER(BASTMlib_RemovePresenter);
559
560        BDBG_ASSERT(hAstm);
561        BDBG_ASSERT(hPresenter);
562
563        /* look for presenter in list */
564        hIterator = BSYSlib_List_AcquireIterator(hAstm->sPresentation.hPresenters);
565
566        while (BSYSlib_List_HasNext(hIterator))
567        {
568                BASTMlib_Presenter_Handle hTemp;
569
570                hTemp = (BASTMlib_Presenter_Handle)BSYSlib_List_Next(hIterator);
571
572                if (hTemp == hPresenter)
573                {
574                        bFound = true;
575                        break;
576                }
577        }
578
579        BSYSlib_List_ReleaseIterator(hIterator);
580
581        if (bFound)
582        {
583                hAstm->sPresentation.uiPresenterCount--;
584                hPresenter->hAstm = hAstm;
585                BSYSlib_List_RemoveElement(hAstm->sPresentation.hPresenters, hPresenter);
586        }
587        else
588        {
589                /* already added */
590                BDBG_MSG(("Presenter %p wasn't added to ASTM instance %p, so not removed", hPresenter, hAstm));
591        }
592
593        BDBG_LEAVE(BASTMlib_RemovePresenter);
594}
595
596void BASTMlib_ClockReferenceEventHandler_isr(
597        BASTMlib_Handle hAstm,
598        const BASTMlib_ClockReference_Event * psEvent
599       
600)
601{
602        BASTMlib_ClockReference_Handle hReference;
603
604        BDBG_ENTER(BASTMlib_ClockReferenceEventHandler_isr);
605
606        BDBG_ASSERT(hAstm);
607        BDBG_ASSERT(psEvent);
608
609        hReference = hAstm->sClockCoupling.hReference;
610
611        BASTMlib_ClockReference_EventHandler_isr(hReference, psEvent);
612
613        BDBG_LEAVE(BASTMlib_ClockReferenceEventHandler_isr);
614}
615
Note: See TracBrowser for help on using the repository browser.