source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/ape/7552/bape_playback.h

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

first commit

  • Property svn:executable set to *
File size: 10.8 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: bape_playback.h $
11 * $brcm_Revision: Hydra_Software_Devel/5 $
12 * $brcm_Date: 2/8/12 11:52a $
13 *
14 * Module Description: Audio Playback Interface
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/ape/7422/bape_playback.h $
19 *
20 * Hydra_Software_Devel/5   2/8/12 11:52a jgarrett
21 * SW7346-672: Adding support for changing the playback sample rate on the
22 * fly
23 *
24 * Hydra_Software_Devel/4   5/12/11 4:39p piyushg
25 * SW7425-401: Added PCM playback support for non-interleaved and
26 * multichannel data
27 *
28 * Hydra_Software_Devel/3   2/22/11 5:43p jgarrett
29 * SW7422-146: Implemented type renaming based on filter graph review
30 * comments
31 *
32 * Hydra_Software_Devel/2   12/17/10 3:58p jgarrett
33 * SW7422-146: Nexus APE integration on 7422
34 *
35 * Hydra_Software_Devel/1   12/14/10 2:16p jgarrett
36 * SW7422-146: Adding initial API for APE/DSP
37 *
38 ***************************************************************************/
39
40#ifndef BAPE_PLAYBACK_H_
41#define BAPE_PLAYBACK_H_
42
43/***************************************************************************
44Summary:
45Playback Handle
46***************************************************************************/
47typedef struct BAPE_Playback *BAPE_PlaybackHandle;
48
49/***************************************************************************
50Summary:
51Playback Open settings
52***************************************************************************/
53typedef struct BAPE_PlaybackOpenSettings
54{
55    unsigned numBuffers;            /* Number of buffers to allocate.  For mono or interleaved stereo,
56                                       one buffer is required.  For non-interleaved 7.1 data 8 buffers
57                                       are required.  For interleaved 7.1 data, 4 buffers are required. */
58    unsigned bufferSize;            /* Buffer size in bytes, must be a multiple of 256.  If more than one
59                                       buffer is allocated, all buffers will be this size.  If this size
60                                       is 0, buffers will be allocated from the internal buffer pool. */
61    unsigned watermarkThreshold;    /* FIFO interrupt threshold in bytes. 
62                                       When an amuont <= this threshold is available,
63                                       an interrupt will be raised. This value should
64                                       be a multiple of 256. */   
65} BAPE_PlaybackOpenSettings;
66
67/***************************************************************************
68Summary:
69Get Default Playback Open Settings
70***************************************************************************/
71void BAPE_Playback_GetDefaultOpenSettings(
72    BAPE_PlaybackOpenSettings *pSettings
73    );
74
75/***************************************************************************
76Summary:
77Open a playback channel
78***************************************************************************/
79BERR_Code BAPE_Playback_Open(
80    BAPE_Handle deviceHandle,
81    unsigned index,
82    const BAPE_PlaybackOpenSettings *pSettings,
83    BAPE_PlaybackHandle *pHandle                    /* [out] */
84    );
85
86/***************************************************************************
87Summary:
88Close a playback channel
89***************************************************************************/
90void BAPE_Playback_Close(
91    BAPE_PlaybackHandle handle
92    );
93
94/***************************************************************************
95Summary:
96Audio playback settings
97***************************************************************************/
98typedef struct BAPE_PlaybackSettings
99{
100    BAPE_MultichannelFormat multichannelFormat;     /* Controls whether the playback channel outputs 2.0, 5.1, or 7.1 data.
101                                                       This is not changeable on the fly. */
102    bool compressedData;                            /* If true, compressed data will be fed in IEC61937 format. 
103                                                       This is not changeable on the fly.  Compressed data should be
104                                                       fed as 16-bit stereo interleaved data. */
105    unsigned sampleRate;                            /* Sample Rate in Hz.  This is only used if BAPE_PlaybackStartSettings.sampleRate is
106                                                       set to 0 and allows changing of the sampleRate on the fly to permit pitch-shifting,
107                                                       or similar effects. */
108} BAPE_PlaybackSettings;
109
110/***************************************************************************
111Summary:
112Get current audio playback settings
113***************************************************************************/
114void BAPE_Playback_GetSettings(
115    BAPE_PlaybackHandle handle,
116    BAPE_PlaybackSettings *pSettings    /* [out] */
117    );
118
119/***************************************************************************
120Summary:
121Set current audio playback settings
122***************************************************************************/
123BERR_Code BAPE_Playback_SetSettings(
124    BAPE_PlaybackHandle handle,
125    const BAPE_PlaybackSettings *pSettings
126    );
127
128/***************************************************************************
129Summary:
130Playback Start Settings
131***************************************************************************/
132typedef struct BAPE_PlaybackStartSettings
133{
134    unsigned sampleRate;                    /* Sample Rate in Hz.  If set to 0, the value from BAPE_PlaybackSettings.sampleRate will be used instead. */
135    unsigned bitsPerSample;                 /* Supports 8, 16, or 32 */
136    bool isStereo;                          /* If true, data will be treated as stereo.  If false, data will be treated as mono. */
137    bool isSigned;                          /* If true, data will be treated as signed.  If false, data will be treated as unsigned. */
138    bool reverseEndian;                     /* If true, data will be endian-swapped in hardware.  Otherwise, data should match host endian mode. */
139    bool loopEnabled;                       /* If true, data will loop continuously without requiring host intervention. */
140    bool interleaved;                       /* If true, data for a channel pair is interleaved into a single buffer */
141    unsigned startThreshold;                /* Size in bytes that must be committed to the hardware before data will flow into the mixer. 
142                                               Must be a multiple of 256. */   
143} BAPE_PlaybackStartSettings;
144
145/***************************************************************************
146Summary:
147Get Default Playback Start Settings
148***************************************************************************/
149void BAPE_Playback_GetDefaultStartSettings(
150    BAPE_PlaybackStartSettings *pSettings       /* [out] */
151    );
152
153/***************************************************************************
154Summary:
155Start Playback
156***************************************************************************/
157BERR_Code BAPE_Playback_Start(
158    BAPE_PlaybackHandle handle,
159    const BAPE_PlaybackStartSettings *pSettings
160    );
161
162/***************************************************************************
163Summary:
164Stop Playback
165***************************************************************************/
166void BAPE_Playback_Stop(
167    BAPE_PlaybackHandle handle
168    );
169
170/***************************************************************************
171Summary:
172Flush Playback Buffer
173***************************************************************************/
174void BAPE_Playback_Flush(
175    BAPE_PlaybackHandle handle
176    );
177
178/***************************************************************************
179Summary:
180Get Playback Buffer
181 
182Description:
183This routine will return the next contiguous buffer address and size.  If
184interrupts are enabled, the caller should call this routine and commit data
185until the size returned from this function is zero.
186***************************************************************************/
187BERR_Code BAPE_Playback_GetBuffer(
188    BAPE_PlaybackHandle handle,
189    BAPE_BufferDescriptor *pBuffers      /* [out] */
190    );
191
192/***************************************************************************
193Summary:
194Commit Data to the playback hardware
195***************************************************************************/
196BERR_Code BAPE_Playback_CommitData(
197    BAPE_PlaybackHandle handle,
198    unsigned numBytes                   /* Number of bytes written into the buffer */
199    );
200
201/***************************************************************************
202Summary:
203Playback Status
204***************************************************************************/
205typedef struct BAPE_PlaybackStatus
206{
207    unsigned queuedBytes;
208    unsigned fifoSize;
209} BAPE_PlaybackStatus;
210
211/***************************************************************************
212Summary:
213Get Playback Status
214***************************************************************************/
215void BAPE_Playback_GetStatus(
216    BAPE_PlaybackHandle handle,
217    BAPE_PlaybackStatus *pStatus    /* [out] */
218    );
219
220/***************************************************************************
221Summary:
222Get Audio Source Connector for output data
223***************************************************************************/
224void BAPE_Playback_GetConnector(
225    BAPE_PlaybackHandle handle,
226    BAPE_Connector *pConnector /* [out] */
227    );
228
229/***************************************************************************
230Summary:
231Playback Interrupt Handlers
232***************************************************************************/
233typedef struct BAPE_PlaybackInterruptHandlers
234{
235    struct
236    {
237        void (*pCallback_isr)(void *pParam1, int param2);
238        void *pParam1;
239        int param2;
240    } watermark;
241} BAPE_PlaybackInterruptHandlers;
242
243/***************************************************************************
244Summary:
245Get Playback Interrupt Handlers
246***************************************************************************/
247void BAPE_Playback_GetInterruptHandlers(
248    BAPE_PlaybackHandle handle,
249    BAPE_PlaybackInterruptHandlers *pInterrupts     /* [out] */
250    );
251
252/***************************************************************************
253Summary:
254Set Playback Interrupt Handlers
255***************************************************************************/
256BERR_Code BAPE_Playback_SetInterruptHandlers(
257    BAPE_PlaybackHandle handle,
258    const BAPE_PlaybackInterruptHandlers *pInterrupts
259    );
260
261#endif /* #ifndef BAPE_PLAYBACK_H_ */
262
Note: See TracBrowser for help on using the repository browser.