source: svn/trunk/newcon3bcm2_21bu/magnum/basemodules/dsp/common/bdsp_context.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.9 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2006-2011, 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: bdsp_context.c $
11 * $brcm_Revision: Hydra_Software_Devel/1 $
12 * $brcm_Date: 4/6/11 2:16p $
13 *
14 * Module Description: Host DSP Interface
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/basemodules/dsp/common/bdsp_context.c $
19 *
20 * Hydra_Software_Devel/1   4/6/11 2:16p srajapur
21 * SW7425-291: [7425]BDSP directory structure changes
22 *
23 * Hydra_Software_Devel/3   1/13/11 5:57a gautamk
24 * SW7422-191:[7422]Adding DSP support for Audio decode in Basemodule  It
25 * includes - DSP Booting - Open time Download :  - Start Time Audio
26 * Decode algorithm download  - Message buffer interaction with DSP:  -
27 * Synchronized Interrupt:  - Async interrupts:  - Config Commands for
28 * Decode/TSM/IDS: - Status Buffer for Decode/TSM/IDS:  - Start AC3 Audio
29 * Decode:  - Pause/Resume Command:  - Frame Advance command:  - Device
30 * level interrupt
31 *
32 * Hydra_Software_Devel/2   12/15/10 6:47p jgarrett
33 * SW7422-146: Initial compileable prototype
34 *
35 * Hydra_Software_Devel/1   12/15/10 2:00p jgarrett
36 * SW7422-146: Adding initial BDSP files
37 *
38 ***************************************************************************/
39
40#include "bdsp.h"
41#include "bdsp_priv.h"
42
43BDBG_MODULE(bdsp_context);
44
45void BDSP_Context_GetDefaultCreateSettings(
46    BDSP_Handle dsp,
47    BDSP_ContextType contextType,           
48    BDSP_ContextCreateSettings *pSettings     /* [out] */
49    )
50{
51    BDBG_OBJECT_ASSERT(dsp, BDSP_Device);
52
53    BDBG_ASSERT(contextType < BDSP_ContextType_eMax);
54   
55    BDBG_ASSERT(NULL != pSettings);
56    if ( dsp->getDefaultContextSettings ) 
57    {
58        dsp->getDefaultContextSettings(dsp->pDeviceHandle,contextType, pSettings);
59    }
60    else
61    {
62        BKNI_Memset(pSettings, 0, sizeof(*pSettings));
63    }
64}
65
66BERR_Code BDSP_Context_Create(
67    BDSP_Handle dsp,
68    const BDSP_ContextCreateSettings *pSettings,
69    BDSP_ContextHandle *pContext    /* [out] */
70    )
71{
72    BDBG_OBJECT_ASSERT(dsp, BDSP_Device);
73    BDBG_ASSERT(NULL != pSettings);
74    BDBG_ASSERT(NULL != pContext);
75
76    if ( dsp->createContext ) 
77    {
78        return dsp->createContext(dsp->pDeviceHandle, pSettings, pContext);
79    }
80    else
81    {
82        *pContext = NULL;
83        return BERR_TRACE(BERR_NOT_SUPPORTED);
84    }
85}
86
87void BDSP_Context_Destroy(
88    BDSP_ContextHandle context
89    )
90{
91    BDBG_OBJECT_ASSERT(context, BDSP_Context);
92    BDBG_ASSERT(NULL != context->destroy);
93    context->destroy(context->pContextHandle);
94}
95
96void BDSP_Context_GetInterruptHandlers(
97    BDSP_ContextHandle context,
98    BDSP_ContextInterruptHandlers *pInterrupts     /* [out] */
99    )
100{
101    BDBG_OBJECT_ASSERT(context, BDSP_Context);
102    BDBG_ASSERT(NULL != pInterrupts);
103    if ( context->getInterruptHandlers ) 
104    {
105        context->getInterruptHandlers(context->pContextHandle, pInterrupts);
106    }
107}
108
109BERR_Code BDSP_Context_SetInterruptHandlers(
110    BDSP_ContextHandle context,
111    const BDSP_ContextInterruptHandlers *pInterrupts
112    )
113{
114    BDBG_OBJECT_ASSERT(context, BDSP_Context);
115    BDBG_ASSERT(NULL != pInterrupts);
116    if ( context->setInterruptHandlers ) 
117    {
118        return context->setInterruptHandlers(context->pContextHandle, pInterrupts);
119    }
120    else
121    {
122        return BERR_TRACE(BERR_NOT_SUPPORTED);
123    }
124}
125
126BERR_Code BDSP_Context_ProcessWatchdogInterrupt(
127    BDSP_ContextHandle context
128    )
129{
130    BDBG_OBJECT_ASSERT(context, BDSP_Context);
131    if ( context->processWatchdogInterrupt ) 
132    {
133        return context->processWatchdogInterrupt(context->pContextHandle);
134    }
135    else
136    {
137        return BERR_TRACE(BERR_NOT_SUPPORTED);
138    }
139}
140
Note: See TracBrowser for help on using the repository browser.