source: svn/trunk/newcon3bcm2_21bu/magnum/basemodules/dsp/common/bdsp.h @ 2

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

first commit

  • Property svn:executable set to *
File size: 13.7 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2006-2012, 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.h $
11 * $brcm_Revision: Hydra_Software_Devel/9 $
12 * $brcm_Date: 2/22/12 7:21p $
13 *
14 * Module Description: Host DSP Interface
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/basemodules/dsp/common/bdsp.h $
19 *
20 * Hydra_Software_Devel/9   2/22/12 7:21p ashoky
21 * SW7231-585: Adding APIs to expose interrupt bits to interrupt DSP.
22 *
23 * Hydra_Software_Devel/8   1/27/12 12:59p ashoky
24 * FWRAA-377: Merging h264 soft dsp video encoder to mainline.
25 *
26 * Hydra_Software_Devel/7   7/4/11 6:35p gprasad
27 * SW7422-373: Add GetInfo routines for AudioType, AudioProcessing, and
28 * AudioEncode in BDSP
29 *
30 * Hydra_Software_Devel/6   6/17/11 6:09p gautamk
31 * SW7422-373: [7422] Fixing compilation
32 *
33 * Hydra_Software_Devel/5   6/17/11 5:56p gautamk
34 * SW7422-373: [7422] Adding comment for APIS
35 *
36 * Hydra_Software_Devel/4   6/17/11 3:50p gautamk
37 * SW7422-373: [7422] Adding GetInfo routines for AudioType,
38 * AudioProcessing, and AudioEncode support in BDSP
39 *
40 * Hydra_Software_Devel/3   6/15/11 5:47p gautamk
41 * SW7425-683: [7425] Adding support for Power management  in BDSP
42 *
43 * Hydra_Software_Devel/2   6/8/11 4:49p gautamk
44 * SW7425-572: [7425] Adding DM related API support for VP6  in BDSP
45 *
46 * Hydra_Software_Devel/1   4/6/11 2:15p srajapur
47 * SW7425-291: [7425]BDSP directory structure changes
48 *
49 * Hydra_Software_Devel/5   1/19/11 7:22a gautamk
50 * SW7422-191:Adding API for Default settings.
51 *
52 * Hydra_Software_Devel/4   1/18/11 4:25a gautamk
53 * SW7422-191: Implementing review comments.
54 *
55 * Hydra_Software_Devel/3   1/13/11 5:56a gautamk
56 * SW7422-191:[7422]Adding DSP support for Audio decode in Basemodule  It
57 * includes - DSP Booting - Open time Download :  - Start Time Audio
58 * Decode algorithm download  - Message buffer interaction with DSP:  -
59 * Synchronized Interrupt:  - Async interrupts:  - Config Commands for
60 * Decode/TSM/IDS: - Status Buffer for Decode/TSM/IDS:  - Start AC3 Audio
61 * Decode:  - Pause/Resume Command:  - Frame Advance command:  - Device
62 * level interrupt
63 *
64 * Hydra_Software_Devel/2   12/15/10 6:47p jgarrett
65 * SW7422-146: Initial compileable prototype
66 *
67 * Hydra_Software_Devel/1   12/14/10 2:16p jgarrett
68 * SW7422-146: Adding initial API for APE/DSP
69 *
70 ***************************************************************************/
71
72#ifndef BDSP_H_
73#define BDSP_H_
74#include "bdsp_types.h"
75#include "bdsp_context.h"
76#include "bdsp_task.h"
77#include "bdsp_audio_task.h"
78#include "bdsp_video_task.h"
79#include "bdsp_video_encode_task.h"
80
81/*------------------------- ERROR CODES---------------------------------------*/
82#define BDSP_ERR_DEVICE_UNINTIALIZED        BERR_MAKE_CODE(BERR_DSP_ID, 1)
83#define BDSP_ERR_BAD_DEVICE_STATE               BERR_MAKE_CODE(BERR_DSP_ID, 2)
84#define BDSP_ERR_RESOURCE_EXHAUSTED                     BERR_MAKE_CODE(BERR_DSP_ID, 3)
85#define BDSP_ERR_CHANNEL_ALREADY_OPENED         BERR_MAKE_CODE(BERR_DSP_ID, 4)
86#define BDSP_ERR_CHANNEL_ALREADY_STARTED    BERR_MAKE_CODE(BERR_DSP_ID, 5)
87#define BDSP_ERR_BUFFER_FULL                BERR_MAKE_CODE(BERR_DSP_ID, 6)
88#define BDSP_ERR_BUFFER_EMPTY                   BERR_MAKE_CODE(BERR_DSP_ID, 7)
89#define BDSP_ERR_BUFFER_INVALID             BERR_MAKE_CODE(BERR_DSP_ID, 8)
90#define BDSP_ERR_INVALID_TASK                   BERR_MAKE_CODE(BERR_DSP_ID, 9)
91#define BDSP_ERR_DOWNLOAD_FAILED                        BERR_MAKE_CODE(BERR_DSP_ID, 10)
92
93/*=************************ Module Overview ********************************
94BDSP is a magnum basemodule interface to a DSP.  The DSP interface can be
95used by one or more porting interface (PI) modules in order to access
96services available on the DSP.
97 
98In order to use a DSP device, you must open the DSP device handle that
99you wish to use.  For example, on a Raaga-based system you need to call
100BDSP_Raaga_GetDefaultSettings() and BDSP_Raaga_Open().   
101***************************************************************************/
102
103/***************************************************************************
104Summary:
105Close a DSP device
106***************************************************************************/
107void BDSP_Close(
108    BDSP_Handle handle      /* Handle to be closed */
109    );
110
111/***************************************************************************
112Summary:
113DSP Status
114***************************************************************************/
115typedef struct BDSP_Status
116{
117    unsigned numDsp;                    /* Number of DSPs available, typically one on DTV/STB systems */
118    unsigned numWatchdogEvents;         /* Number of watchdog events since the DSP handle was opened */
119}BDSP_Status;
120
121/***************************************************************************
122Summary:
123Standby settings
124***************************************************************************/
125typedef struct BDSP_StandbySettings
126{
127    bool dummy; /* placeholder to avoid compiler warning */
128}BDSP_StandbySettings;
129
130/***************************************************************************
131Summary:
132Get DSP Status
133***************************************************************************/
134void BDSP_GetStatus(
135    BDSP_Handle handle,
136    BDSP_Status *pStatus             /* [out] Current Status */
137    );
138
139/***************************************************************************
140Summary:
141Returns single null terminated line from the debug log
142***************************************************************************/
143BERR_Code BDSP_GetDebugLog(
144    BDSP_Handle handle,
145    char *pBuffer,
146    size_t bufferLength
147    );
148
149/***************************************************************************
150Summary:
151        Enter standby mode with  DSP.
152
153Description:
154        This function puts the  DSP into standby mode,
155        if supported. All DSP tasks must be in a stopped state
156        in order to successfully enter standby mode.
157        If standby mode is not supported, calling this function has no effect.
158
159        When in standby mode, the device clocks are turned off,
160        resulting in a minimal power state.
161
162        No BDSP_* calls should be made until standby mode exitted by calling
163        BDSP_Resume().
164
165Returns:
166        BERR_SUCCESS - If standby is successful, otherwise error
167
168See Also:
169        BDSP_Resume
170***************************************************************************/
171BERR_Code BDSP_Standby(
172        BDSP_Handle                     handle,                 /* [in] DSP device handle */
173        BDSP_StandbySettings    *pSettings      /* [in] standby settings */
174);
175
176/***************************************************************************
177Summary:
178        Exit standby mode with the  DSP
179
180Description:
181        This function exits the DSP from standby mode.
182        After exitting standby mode, upper-level SW is free to call
183        BDSP_* functions.
184
185Returns:
186        BERR_SUCCESS - If resume is successful, otherwise error
187
188See Also:
189        BDSP_Standby
190***************************************************************************/
191
192BERR_Code BDSP_Resume(
193        BDSP_Handle                     handle          /* [in] DSP device handle */
194    );
195
196/***************************************************************************
197Summary:
198        Audio type info
199***************************************************************************/
200typedef struct BDSP_AudioTypeInfo
201{
202        bool supported;    /* true if this audio type is supported, false otherwise */
203        bool supportsLsf; /* If true, SRC should be added to support low/quarter sampling rate content */
204        const char *pName;
205        bool outputTypeValid[BDSP_AF_P_DistinctOpType_eMax];   
206} BDSP_AudioTypeInfo;
207
208/***************************************************************************
209Summary:
210        Audio Processing info
211***************************************************************************/
212typedef struct BDSP_AudioProcessingInfo
213{
214        bool supported;    /* true if this audio post-processing type is supported, false otherwise */
215        const char *pName;
216        bool inputTypeValid[BDSP_AF_P_DistinctOpType_eMax];   
217        bool outputTypeValid[BDSP_AF_P_DistinctOpType_eMax];   
218        BDSP_AF_P_OutModeType outputMode;
219        /* TODO: Sample Rate mapping */
220} BDSP_AudioProcessingInfo;
221
222/***************************************************************************
223Summary:
224        Audio Encode info
225***************************************************************************/
226typedef struct BDSP_AudioEncodeInfo
227{
228        bool supported;    /* true if this audio encode type is supported, false otherwise */
229        const char *pName;
230        bool inputTypeValid[BDSP_AF_P_DistinctOpType_eMax];   
231        /* TODO: Sample Rate mapping */
232} BDSP_AudioEncodeInfo;
233
234/***************************************************************************
235Summary:
236        Description of an external interrupt to the DSP
237***************************************************************************/
238typedef struct BDSP_ExternalInterruptInfo
239{
240        /* BCHP address. CHIP Offset to be added to get full 32 bit address */
241    uint32_t address;
242        /* Bit number starts with 0 as LSB and goes upwards */
243    uint32_t bitNum;
244} BDSP_ExternalInterruptInfo;
245
246/***************************************************************************
247Summary:
248        Description of RDB registers from DSP page
249***************************************************************************/
250typedef struct BDSP_RdbRegisterInfo
251{
252        /* BCHP address. CHIP Offset to be added to get full 32 bit address */
253    uint32_t addressOfBaseRdb;
254} BDSP_RdbRegisterInfo;
255
256/***************************************************************************
257Summary:
258        Get Audio Type info
259***************************************************************************/
260BERR_Code BDSP_GetAudioTypeInfo(
261BDSP_Handle handle,
262BDSP_AudioType type, /* [in] */
263const BDSP_AudioTypeInfo **pInfo /* [out] */
264);
265
266/***************************************************************************
267Summary:
268        Get Audio Processing info
269***************************************************************************/
270BERR_Code BDSP_GetAudioProcessingInfo(
271BDSP_Handle handle,
272BDSP_AudioProcessing type, /* [in] */
273const BDSP_AudioProcessingInfo **pInfo /* [out] */
274);
275
276/***************************************************************************
277Summary:
278        Get Audio Encode info
279***************************************************************************/
280BERR_Code BDSP_GetAudioEncodeInfo(
281BDSP_Handle handle,
282BDSP_AudioEncode type, /* [in] */
283const BDSP_AudioEncodeInfo **pInfo /* [out] */
284);
285
286/***************************************************************************
287Summary:
288        Allocate an external interrupt.
289
290Description:
291        This function allocates one interrupt handle that can be used to interrupt DSP.
292
293Returns:
294        BERR_SUCCESS - If allocation is successful, otherwise error
295
296See Also:
297        BDSP_FreeExternalInterrupt
298        BDSP_GetExternalInterruptInfo
299***************************************************************************/
300BERR_Code BDSP_AllocateExternalInterrupt(
301    BDSP_Handle hDsp,
302    uint32_t    dspIndex,
303    BDSP_ExternalInterruptHandle *pInterruptHandle /* [out] */
304    );
305
306/***************************************************************************
307Summary:
308        Frees an allocated external interrupt.
309
310Description:
311        This function frees one interrupt handle that was already allocated.
312
313Returns:
314        BERR_SUCCESS if sucessful else error
315
316See Also:
317        BDSP_AllocateExternalInterrupt
318        BDSP_GetExternalInterruptInfo
319***************************************************************************/
320BERR_Code BDSP_FreeExternalInterrupt(
321        BDSP_ExternalInterruptHandle    hInterrupt
322        );
323
324/***************************************************************************
325Summary:
326        Retrieve external interrupt information.
327
328Description:
329        This function provides the interrupt register and the bit that can be used to interrupt DSP.
330
331Returns:
332        BERR_SUCCESS - If successful, otherwise error
333
334See Also:
335        BDSP_FreeExternalInterrupt
336        BDSP_AllocateExternalInterrupt
337***************************************************************************/
338BERR_Code BDSP_GetExternalInterruptInfo(
339    BDSP_ExternalInterruptHandle hInterrupt,
340    BDSP_ExternalInterruptInfo **pInfo /* [out] */
341    );
342
343/***************************************************************************
344Summary:
345        Allocate RDB registers from dsp page for upper SW layer
346
347Description:
348        This function allocates RDB registers handle that can be used to send msg etc to DSP.
349
350Returns:
351        BERR_SUCCESS - If allocation is successful, otherwise error
352
353See Also:
354        BDSP_FreeRdbRegisters
355        BDSP_GetRdbRegistersInfo
356***************************************************************************/
357
358BERR_Code BDSP_AllocateRdbRegisters(
359    BDSP_Handle hDsp,
360    uint32_t    dspIndex,
361    uint32_t    numRdbToAllocate,
362    BDSP_RdbRegisterHandle *pRdbRegisterHandle /* [out] */
363    );
364
365/***************************************************************************
366Summary:
367        Frees an allocated Rdb Registers handle.
368
369Description:
370        This function frees an Rdb Registers handle that was already allocated.
371
372Returns:
373        BERR_SUCCESS if sucessful else error
374
375See Also:
376        BDSP_AllocateRdbRegisters
377        BDSP_GetRdbRegistersInfo
378***************************************************************************/
379BERR_Code BDSP_FreeRdbRegisters(
380                        BDSP_RdbRegisterHandle  hRdbRegister
381                        );
382
383/***************************************************************************
384Summary:
385        Retrieve Rdb Registers information.
386
387Description:
388        This function provides the address (offset) of base RDB register.
389
390Returns:
391        BERR_SUCCESS - If successful, otherwise error
392
393See Also:
394        BDSP_FreeRdbRegisters
395        BDSP_AllocateRdbRegisters
396***************************************************************************/
397BERR_Code BDSP_GetRdbRegistersInfo(
398    BDSP_RdbRegisterHandle hRdbRegister,
399    BDSP_RdbRegisterInfo **pInfo /* [out] */
400    );
401
402#endif
403
Note: See TracBrowser for help on using the repository browser.