source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/astmlib/7552/bastmlib_priv.c

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

first commit

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1/***************************************************************************
2*     Copyright (c) 2004-2009, 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_priv.c $
11* $brcm_Revision: Hydra_Software_Devel/6 $
12* $brcm_Date: 7/17/09 6:56p $
13*
14* Revision History:
15*
16* $brcm_Log: /magnum/syslib/astmlib/noarch/bastmlib_priv.c $
17*
18* Hydra_Software_Devel/6   7/17/09 6:56p bandrews
19* PR49215: playback support
20*
21* Hydra_Software_Devel/5   11/20/08 6:16p bandrews
22* PR49489: Add debug messages; ensure no events are recorded if stopped;
23* clear event queue on start; only schedule settling timers if started
24*
25* Hydra_Software_Devel/4   11/14/08 6:03p bandrews
26* PR49056: Only reschedule TSM-disabled watchdog timer on presentation
27* control change
28*
29* Hydra_Software_Devel/3   4/3/08 2:33p bandrews
30* PR40090: synclib needs to have different contexts for syslib callbacks
31* and synclib callbacks
32*
33* Hydra_Software_Devel/2   3/27/08 5:48p bandrews
34* PR40090: Fixed display and storage of presenter names for debug
35*
36* Hydra_Software_Devel/1   3/24/08 3:08p bandrews
37* PR40865: Fixed
38*
39* Hydra_Software_Devel/2   2/15/08 10:00p bandrews
40* PR36148: Updated ASTM based on reviews
41*
42* Hydra_Software_Devel/1   1/25/08 9:21p bandrews
43* PR36148: Updated based on simulation
44***************************************************************************/
45
46#include "bstd.h"
47#include "bkni.h"
48#include "bsyslib.h"
49#include "bastmlib.h"
50#include "bastmlib_priv.h"
51
52BDBG_MODULE(astmlib);
53
54BERR_Code BASTMlib_P_StartTimer_isr(
55        BASTMlib_Handle hAstm,
56        BSYSlib_Timer_Handle hTimer, 
57        unsigned long ulTimeout,
58        BSYSlib_Timer_ExpiryHandler pfTimerExpired,
59        void * pvParm1,
60        int iParm2
61)
62{
63        BERR_Code rc = BERR_SUCCESS;
64        BSYSlib_Timer_Start_isr pfStart_isr;
65        BSYSlib_Timer_Cancel_isr pfCancel_isr;
66       
67        BDBG_ENTER(BASTMlib_P_StartTimer_isr);
68       
69        if (hAstm->sSettings.cbTimer.pfStart_isr)
70        {
71                BSYSlib_Timer_Settings sTimer;
72
73                sTimer.ulTimeout = ulTimeout;
74                sTimer.pvParm1 = pvParm1;
75                sTimer.iParm2 = iParm2;
76                sTimer.pfTimerExpired = pfTimerExpired;
77
78                pfStart_isr = hAstm->sSettings.cbTimer.pfStart_isr;
79                pfCancel_isr = hAstm->sSettings.cbTimer.pfCancel_isr;
80                pvParm1 = hAstm->sSettings.cbTimer.pvParm1;
81                iParm2 = hAstm->sSettings.cbTimer.iParm2;
82
83                /* clean up old timer if any */
84                if (pfCancel_isr)
85                {
86                        pfCancel_isr(pvParm1, iParm2, hTimer);
87                }
88
89                /* (re)schedule timer */
90                rc = pfStart_isr(pvParm1, iParm2, hTimer, &sTimer);
91                if (rc) goto error;
92        }
93
94        goto end;
95
96error:
97
98end:
99
100        BDBG_LEAVE(BASTMlib_P_StartTimer_isr);
101        return rc;
102}
103
104void BASTMlib_P_GetDefaultConfig(
105        BASTMlib_Config * psConfig
106)
107{
108        BDBG_ENTER(BASTMlib_P_GetDefaultConfig);
109
110        BDBG_ASSERT(psConfig);
111
112        psConfig->bEnabled = true;
113        psConfig->eStcRate = BASTMlib_ClockRate_e45Khz;
114
115        BASTMlib_P_Presentation_GetDefaultConfig(psConfig);
116        BASTMlib_P_ClockCoupling_GetDefaultConfig(psConfig);
117
118        BDBG_LEAVE(BASTMlib_P_GetDefaultConfig);
119}
120
121bool BASTMlib_P_Enabled(
122        BASTMlib_Handle hAstm
123)
124{
125        bool bEnabled = false;
126       
127        BDBG_ENTER(BASTMlib_P_Enabled);
128
129        BDBG_ASSERT(hAstm);
130
131        BKNI_EnterCriticalSection();
132        bEnabled = BASTMlib_P_Enabled_isr(hAstm);
133        BKNI_LeaveCriticalSection();
134
135        BDBG_LEAVE(BASTMlib_P_Enabled);
136        return bEnabled;
137}
138
139bool BASTMlib_P_Enabled_isr(
140        BASTMlib_Handle hAstm
141)
142{
143        bool bEnabled = false;
144       
145        BDBG_ENTER(BASTMlib_P_Enabled_isr);
146
147        BDBG_ASSERT(hAstm);
148
149        bEnabled = hAstm->bEnabled;
150
151        BDBG_LEAVE(BASTMlib_P_Enabled_isr);
152        return bEnabled;
153}
154
Note: See TracBrowser for help on using the repository browser.