| 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: bape_output_capture.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/4 $ |
|---|
| 12 | * $brcm_Date: 2/22/11 5:43p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Audio Output Capture Interface |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/ape/7422/bape_output_capture.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/4 2/22/11 5:43p jgarrett |
|---|
| 21 | * SW7422-146: Implemented type renaming based on filter graph review |
|---|
| 22 | * comments |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/3 12/16/10 4:04p jgarrett |
|---|
| 25 | * SW7422-146: Initial compilable APE for 7422 |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/2 12/14/10 2:39p jgarrett |
|---|
| 28 | * SW7422-146: Renaming MixerOutput to OutputPort |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/1 12/14/10 2:16p jgarrett |
|---|
| 31 | * SW7422-146: Adding initial API for APE/DSP |
|---|
| 32 | * |
|---|
| 33 | ***************************************************************************/ |
|---|
| 34 | |
|---|
| 35 | #ifndef BAPE_OUTPUT_CAPTURE_H_ |
|---|
| 36 | #define BAPE_OUTPUT_CAPTURE_H_ |
|---|
| 37 | |
|---|
| 38 | /*************************************************************************** |
|---|
| 39 | Summary: |
|---|
| 40 | Output Capture Handle |
|---|
| 41 | ***************************************************************************/ |
|---|
| 42 | typedef struct BAPE_OutputCapture *BAPE_OutputCaptureHandle; |
|---|
| 43 | |
|---|
| 44 | /*************************************************************************** |
|---|
| 45 | Summary: |
|---|
| 46 | Output Capture Open Settings |
|---|
| 47 | ***************************************************************************/ |
|---|
| 48 | typedef struct BAPE_OutputCaptureOpenSettings |
|---|
| 49 | { |
|---|
| 50 | unsigned numBuffers; /* Number of buffers to allocate. For mono or interleaved stereo, |
|---|
| 51 | one buffer is required. For non-interleaved 7.1 data 8 buffers |
|---|
| 52 | are required. For interleaved 7.1 data, 4 buffers are required. */ |
|---|
| 53 | unsigned bufferSize; /* Buffer size in bytes, must be a multiple of 256. If more than one |
|---|
| 54 | buffer is allocated, all buffers will be this size. If this size |
|---|
| 55 | is 0, buffers will be allocated from the internal buffer pool. */ |
|---|
| 56 | unsigned watermarkThreshold; /* FIFO interrupt threshold in bytes. |
|---|
| 57 | When an amuont >= this threshold is available, |
|---|
| 58 | an interrupt will be raised. This value should |
|---|
| 59 | be a multiple of 256. */ |
|---|
| 60 | } BAPE_OutputCaptureOpenSettings; |
|---|
| 61 | |
|---|
| 62 | /*************************************************************************** |
|---|
| 63 | Summary: |
|---|
| 64 | Get Default Output Capture Open Settings |
|---|
| 65 | ***************************************************************************/ |
|---|
| 66 | void BAPE_OutputCapture_GetDefaultOpenSettings( |
|---|
| 67 | BAPE_OutputCaptureOpenSettings *pSettings /* [out] */ |
|---|
| 68 | ); |
|---|
| 69 | |
|---|
| 70 | /*************************************************************************** |
|---|
| 71 | Summary: |
|---|
| 72 | Open a capture output |
|---|
| 73 | ***************************************************************************/ |
|---|
| 74 | BERR_Code BAPE_OutputCapture_Open( |
|---|
| 75 | BAPE_Handle deviceHandle, |
|---|
| 76 | unsigned index, |
|---|
| 77 | const BAPE_OutputCaptureOpenSettings *pSettings, |
|---|
| 78 | BAPE_OutputCaptureHandle *pHandle /* [out] */ |
|---|
| 79 | ); |
|---|
| 80 | |
|---|
| 81 | /*************************************************************************** |
|---|
| 82 | Summary: |
|---|
| 83 | Close a capture output |
|---|
| 84 | ***************************************************************************/ |
|---|
| 85 | void BAPE_OutputCapture_Close( |
|---|
| 86 | BAPE_OutputCaptureHandle handle |
|---|
| 87 | ); |
|---|
| 88 | |
|---|
| 89 | /*************************************************************************** |
|---|
| 90 | Summary: |
|---|
| 91 | OutputCapture Settings |
|---|
| 92 | ***************************************************************************/ |
|---|
| 93 | typedef struct BAPE_OutputCaptureSettings |
|---|
| 94 | { |
|---|
| 95 | unsigned bitsPerSample; /* Currently, only 32-bit PCM capture is supported. */ |
|---|
| 96 | bool interleaveData; /* If true, PCM data for a stereo pair will be interleaved |
|---|
| 97 | into a single buffer. False will use a separate buffer |
|---|
| 98 | for each channel. */ |
|---|
| 99 | } BAPE_OutputCaptureSettings; |
|---|
| 100 | |
|---|
| 101 | /*************************************************************************** |
|---|
| 102 | Summary: |
|---|
| 103 | Get OutputCapture Settings |
|---|
| 104 | ***************************************************************************/ |
|---|
| 105 | void BAPE_OutputCapture_GetSettings( |
|---|
| 106 | BAPE_OutputCaptureHandle handle, |
|---|
| 107 | BAPE_OutputCaptureSettings *pSettings /* [out] */ |
|---|
| 108 | ); |
|---|
| 109 | |
|---|
| 110 | /*************************************************************************** |
|---|
| 111 | Summary: |
|---|
| 112 | Set OutputCapture Settings |
|---|
| 113 | ***************************************************************************/ |
|---|
| 114 | BERR_Code BAPE_OutputCapture_SetSettings( |
|---|
| 115 | BAPE_OutputCaptureHandle handle, |
|---|
| 116 | const BAPE_OutputCaptureSettings *pSettings |
|---|
| 117 | ); |
|---|
| 118 | |
|---|
| 119 | /*************************************************************************** |
|---|
| 120 | Summary: |
|---|
| 121 | Flush OutputCapture Buffer |
|---|
| 122 | ***************************************************************************/ |
|---|
| 123 | void BAPE_OutputCapture_Flush( |
|---|
| 124 | BAPE_OutputCaptureHandle handle |
|---|
| 125 | ); |
|---|
| 126 | |
|---|
| 127 | /*************************************************************************** |
|---|
| 128 | Summary: |
|---|
| 129 | Flush OutputCapture Buffer from interrupt context |
|---|
| 130 | ***************************************************************************/ |
|---|
| 131 | void BAPE_OutputCapture_Flush_isr( |
|---|
| 132 | BAPE_OutputCaptureHandle handle |
|---|
| 133 | ); |
|---|
| 134 | |
|---|
| 135 | /*************************************************************************** |
|---|
| 136 | Summary: |
|---|
| 137 | Get Capture Buffer |
|---|
| 138 | |
|---|
| 139 | Description: |
|---|
| 140 | This routine will return the next contiguous buffer address and size. If |
|---|
| 141 | interrupts are enabled, the caller should call this routine and commit data |
|---|
| 142 | until the size returned from this function is zero. |
|---|
| 143 | ***************************************************************************/ |
|---|
| 144 | BERR_Code BAPE_OutputCapture_GetBuffer( |
|---|
| 145 | BAPE_OutputCaptureHandle handle, |
|---|
| 146 | BAPE_BufferDescriptor *pBuffers /* [out] */ |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /*************************************************************************** |
|---|
| 150 | Summary: |
|---|
| 151 | Mark data as consumed from the OutputCapture hardware |
|---|
| 152 | ***************************************************************************/ |
|---|
| 153 | BERR_Code BAPE_OutputCapture_ConsumeData( |
|---|
| 154 | BAPE_OutputCaptureHandle handle, |
|---|
| 155 | unsigned numBytes /* Number of bytes read from the buffer */ |
|---|
| 156 | ); |
|---|
| 157 | |
|---|
| 158 | /*************************************************************************** |
|---|
| 159 | Summary: |
|---|
| 160 | Get Audio Output Connector |
|---|
| 161 | ***************************************************************************/ |
|---|
| 162 | void BAPE_OutputCapture_GetOutputPort( |
|---|
| 163 | BAPE_OutputCaptureHandle handle, |
|---|
| 164 | BAPE_OutputPort *pConnector |
|---|
| 165 | ); |
|---|
| 166 | |
|---|
| 167 | /*************************************************************************** |
|---|
| 168 | Summary: |
|---|
| 169 | Audio Output Capture Interrupts |
|---|
| 170 | ***************************************************************************/ |
|---|
| 171 | typedef struct BAPE_OutputCaptureInterruptHandlers |
|---|
| 172 | { |
|---|
| 173 | struct |
|---|
| 174 | { |
|---|
| 175 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 176 | void *pParam1; |
|---|
| 177 | int param2; |
|---|
| 178 | } watermark; |
|---|
| 179 | struct |
|---|
| 180 | { |
|---|
| 181 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 182 | void *pParam1; |
|---|
| 183 | int param2; |
|---|
| 184 | } overflow; |
|---|
| 185 | struct |
|---|
| 186 | { |
|---|
| 187 | void (*pCallback_isr)(void *pParam1, int param2, unsigned sampleRate); |
|---|
| 188 | void *pParam1; |
|---|
| 189 | int param2; |
|---|
| 190 | } sampleRate; |
|---|
| 191 | } BAPE_OutputCaptureInterruptHandlers; |
|---|
| 192 | |
|---|
| 193 | /*************************************************************************** |
|---|
| 194 | Summary: |
|---|
| 195 | Get Audio Output Capture Interrupts |
|---|
| 196 | ***************************************************************************/ |
|---|
| 197 | void BAPE_OutputCapture_GetInterruptHandlers( |
|---|
| 198 | BAPE_OutputCaptureHandle handle, |
|---|
| 199 | BAPE_OutputCaptureInterruptHandlers *pInterrupts /* [out] */ |
|---|
| 200 | ); |
|---|
| 201 | |
|---|
| 202 | /*************************************************************************** |
|---|
| 203 | Summary: |
|---|
| 204 | Set Audio Output Capture Interrupts |
|---|
| 205 | ***************************************************************************/ |
|---|
| 206 | BERR_Code BAPE_OutputCapture_SetInterruptHandlers( |
|---|
| 207 | BAPE_OutputCaptureHandle handle, |
|---|
| 208 | const BAPE_OutputCaptureInterruptHandlers *pInterrupts |
|---|
| 209 | ); |
|---|
| 210 | |
|---|
| 211 | #endif /* #ifndef BAPE_OUTPUT_CAPTURE_H_ */ |
|---|
| 212 | |
|---|