| 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_audio_task.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/5 $ |
|---|
| 12 | * $brcm_Date: 2/15/12 3:02p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Audio DSP Interface |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/dsp/common/bdsp_audio_task.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/5 2/15/12 3:02p ashoky |
|---|
| 21 | * SW7425-2308: Adding interface to put audio firmware in audio gap fill |
|---|
| 22 | * mode. |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/4 7/8/11 4:38p gprasad |
|---|
| 25 | * SW7552-64: Changes to provide stream sample rate along wityh base rate |
|---|
| 26 | * to APE |
|---|
| 27 | * |
|---|
| 28 | * Hydra_Software_Devel/3 6/9/11 8:11p gautamk |
|---|
| 29 | * SW7422-357 : [7425] Modifying API prtotype for Add/Remove stage input |
|---|
| 30 | * |
|---|
| 31 | * Hydra_Software_Devel/2 4/29/11 11:42a srajapur |
|---|
| 32 | * SW7422-368 : [7422] BDSP_AudioTask_GetDefaultXxxSettings is Raaga- |
|---|
| 33 | * specific ---------> Moved raaga specific API from common files to |
|---|
| 34 | * raaga files and renamed the API's accordingly. |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/1 4/6/11 2:15p srajapur |
|---|
| 37 | * SW7425-291: [7425]BDSP directory structure changes |
|---|
| 38 | * |
|---|
| 39 | * Hydra_Software_Devel/10 2/16/11 5:37a srajapur |
|---|
| 40 | * SW7422-247 : [7422] Adding all audio post processing algorithms. |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/9 2/5/11 4:08a srajapur |
|---|
| 43 | * SW7422-247 : [7422] Adding Generic passthrul audio processing support. |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/8 2/3/11 3:11a srajapur |
|---|
| 46 | * SW7422-229 : Adding support for MPEG algorithm. --> Passing the |
|---|
| 47 | * correct modevalue to application. |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/7 1/19/11 6:13p jgarrett |
|---|
| 50 | * SW7422-146: Enabling TSM |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/6 1/19/11 7:23a gautamk |
|---|
| 53 | * SW7422-191:Adding API for Default settings. |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/5 1/18/11 4:57a gautamk |
|---|
| 56 | * SW7422-191: Implementing review comments. |
|---|
| 57 | * |
|---|
| 58 | * Hydra_Software_Devel/4 1/18/11 4:26a gautamk |
|---|
| 59 | * SW7422-191: Implementing review comments. |
|---|
| 60 | * |
|---|
| 61 | * Hydra_Software_Devel/3 1/13/11 5:57a gautamk |
|---|
| 62 | * SW7422-191:[7422]Adding DSP support for Audio decode in Basemodule It |
|---|
| 63 | * includes - DSP Booting - Open time Download : - Start Time Audio |
|---|
| 64 | * Decode algorithm download - Message buffer interaction with DSP: - |
|---|
| 65 | * Synchronized Interrupt: - Async interrupts: - Config Commands for |
|---|
| 66 | * Decode/TSM/IDS: - Status Buffer for Decode/TSM/IDS: - Start AC3 Audio |
|---|
| 67 | * Decode: - Pause/Resume Command: - Frame Advance command: - Device |
|---|
| 68 | * level interrupt |
|---|
| 69 | * |
|---|
| 70 | * Hydra_Software_Devel/2 12/15/10 6:47p jgarrett |
|---|
| 71 | * SW7422-146: Initial compileable prototype |
|---|
| 72 | * |
|---|
| 73 | * Hydra_Software_Devel/1 12/14/10 2:17p jgarrett |
|---|
| 74 | * SW7422-146: Adding initial API for APE/DSP |
|---|
| 75 | * |
|---|
| 76 | ***************************************************************************/ |
|---|
| 77 | |
|---|
| 78 | #ifndef BDSP_AUDIO_TASK_H_ |
|---|
| 79 | #define BDSP_AUDIO_TASK_H_ |
|---|
| 80 | |
|---|
| 81 | #include "bchp.h" |
|---|
| 82 | #include "bint.h" |
|---|
| 83 | #include "bmem.h" |
|---|
| 84 | #include "breg_mem.h" |
|---|
| 85 | #include "btmr.h" |
|---|
| 86 | #include "bimg.h" |
|---|
| 87 | #include "bdsp_task.h" |
|---|
| 88 | #include "bdsp_raaga_fwuserconfig_priv.h" |
|---|
| 89 | #include "bdsp_raaga_fwstatus.h" |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | /*************************************************************************** |
|---|
| 94 | Summary: |
|---|
| 95 | This structure returns information of bit rate change in stream |
|---|
| 96 | |
|---|
| 97 | Notes: |
|---|
| 98 | This structure will be passed on to application callback function |
|---|
| 99 | on bit rate change interrupt |
|---|
| 100 | ***************************************************************************/ |
|---|
| 101 | typedef struct BDSP_AudioBitRateChangeInfo |
|---|
| 102 | { |
|---|
| 103 | BDSP_AudioType eType; /* audio type */ |
|---|
| 104 | uint32_t ui32BitRate; /* New Bit Rate value*/ |
|---|
| 105 | /* If eType = DTS or DTS-HD and |
|---|
| 106 | ui32BitRateIndex = 29,30 or 31 |
|---|
| 107 | ui32BitRate = 0 */ |
|---|
| 108 | uint32_t ui32BitRateIndex; /* This has the Bit rate index |
|---|
| 109 | as given in the standard. This value |
|---|
| 110 | is zero for audio type AAC-HE*/ |
|---|
| 111 | } BDSP_AudioBitRateChangeInfo; |
|---|
| 112 | |
|---|
| 113 | /*************************************************************************** |
|---|
| 114 | Summary: |
|---|
| 115 | Pause an audio DSP task |
|---|
| 116 | ***************************************************************************/ |
|---|
| 117 | BERR_Code BDSP_AudioTask_Pause( |
|---|
| 118 | BDSP_TaskHandle task |
|---|
| 119 | ); |
|---|
| 120 | |
|---|
| 121 | /*************************************************************************** |
|---|
| 122 | Summary: |
|---|
| 123 | Resume an audio DSP task |
|---|
| 124 | ***************************************************************************/ |
|---|
| 125 | BERR_Code BDSP_AudioTask_Resume( |
|---|
| 126 | BDSP_TaskHandle task |
|---|
| 127 | ); |
|---|
| 128 | |
|---|
| 129 | /*************************************************************************** |
|---|
| 130 | Summary: |
|---|
| 131 | Advance an audio DSP task |
|---|
| 132 | ***************************************************************************/ |
|---|
| 133 | BERR_Code BDSP_AudioTask_Advance( |
|---|
| 134 | BDSP_TaskHandle task, |
|---|
| 135 | unsigned ms |
|---|
| 136 | ); |
|---|
| 137 | |
|---|
| 138 | /*************************************************************************** |
|---|
| 139 | Summary: |
|---|
| 140 | Get TSM settings for a particular task stage |
|---|
| 141 | ***************************************************************************/ |
|---|
| 142 | BERR_Code BDSP_AudioTask_GetTsmSettings_isr( |
|---|
| 143 | BDSP_TaskHandle task, |
|---|
| 144 | unsigned branchId, |
|---|
| 145 | unsigned stageId, |
|---|
| 146 | BDSP_AudioTaskTsmSettings *pTsmSettings /* [out] */ |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /*************************************************************************** |
|---|
| 150 | Summary: |
|---|
| 151 | Set TSM settings for a particular task stage |
|---|
| 152 | ***************************************************************************/ |
|---|
| 153 | BERR_Code BDSP_AudioTask_SetTsmSettings_isr( |
|---|
| 154 | BDSP_TaskHandle task, |
|---|
| 155 | unsigned branchId, |
|---|
| 156 | unsigned stageId, |
|---|
| 157 | const BDSP_AudioTaskTsmSettings *pTsmSettings |
|---|
| 158 | ); |
|---|
| 159 | |
|---|
| 160 | /*************************************************************************** |
|---|
| 161 | Summary: |
|---|
| 162 | Get TSM status from a particular task stage |
|---|
| 163 | ***************************************************************************/ |
|---|
| 164 | BERR_Code BDSP_AudioTask_GetTsmStatus_isr( |
|---|
| 165 | BDSP_TaskHandle task, |
|---|
| 166 | unsigned branchId, |
|---|
| 167 | unsigned stageId, |
|---|
| 168 | BDSP_AudioTaskTsmStatus *pTsmStatus /* [out] */ |
|---|
| 169 | ); |
|---|
| 170 | |
|---|
| 171 | /*************************************************************************** |
|---|
| 172 | Summary: |
|---|
| 173 | Get Datasync settings for a particular task stage |
|---|
| 174 | ***************************************************************************/ |
|---|
| 175 | BERR_Code BDSP_AudioTask_GetDatasyncSettings( |
|---|
| 176 | BDSP_TaskHandle task, |
|---|
| 177 | unsigned branchId, |
|---|
| 178 | unsigned stageId, |
|---|
| 179 | BDSP_AudioTaskDatasyncSettings *pTsmSettings /* [out] */ |
|---|
| 180 | ); |
|---|
| 181 | |
|---|
| 182 | /*************************************************************************** |
|---|
| 183 | Summary: |
|---|
| 184 | Set Datasync settings for a particular task stage |
|---|
| 185 | ***************************************************************************/ |
|---|
| 186 | BERR_Code BDSP_AudioTask_SetDatasyncSettings( |
|---|
| 187 | BDSP_TaskHandle task, |
|---|
| 188 | unsigned branchId, |
|---|
| 189 | unsigned stageId, |
|---|
| 190 | const BDSP_AudioTaskDatasyncSettings *pTsmSettings |
|---|
| 191 | ); |
|---|
| 192 | |
|---|
| 193 | /*************************************************************************** |
|---|
| 194 | Summary: |
|---|
| 195 | Get Datasync status from a particular task stage |
|---|
| 196 | ***************************************************************************/ |
|---|
| 197 | BERR_Code BDSP_AudioTask_GetDatasyncStatus( |
|---|
| 198 | BDSP_TaskHandle task, |
|---|
| 199 | unsigned branchId, |
|---|
| 200 | unsigned stageId, |
|---|
| 201 | BDSP_AudioTaskDatasyncStatus *pTsmStatus /* [out] */ |
|---|
| 202 | ); |
|---|
| 203 | |
|---|
| 204 | #if 0 |
|---|
| 205 | |
|---|
| 206 | /*************************************************************************** |
|---|
| 207 | Summary: |
|---|
| 208 | Add input to a stage |
|---|
| 209 | ***************************************************************************/ |
|---|
| 210 | BERR_Code BDSP_AudioTask_AddStageInput( |
|---|
| 211 | BDSP_TaskHandle task, |
|---|
| 212 | unsigned branchId, |
|---|
| 213 | unsigned stageId, |
|---|
| 214 | const BDSP_CIT_P_FwStgSrcDstDetails *pInputInfo |
|---|
| 215 | ); |
|---|
| 216 | |
|---|
| 217 | /*************************************************************************** |
|---|
| 218 | Summary: |
|---|
| 219 | Remove input from a stage |
|---|
| 220 | ***************************************************************************/ |
|---|
| 221 | BERR_Code BDSP_AudioTask_RemoveStageInput( |
|---|
| 222 | BDSP_TaskHandle task, |
|---|
| 223 | unsigned branchId, |
|---|
| 224 | unsigned stageId, |
|---|
| 225 | const BDSP_CIT_P_FwStgSrcDstDetails *pInputInfo |
|---|
| 226 | ); |
|---|
| 227 | |
|---|
| 228 | /*************************************************************************** |
|---|
| 229 | Summary: |
|---|
| 230 | Add output to a stage |
|---|
| 231 | ***************************************************************************/ |
|---|
| 232 | BERR_Code BDSP_AudioTask_AddStageOutput( |
|---|
| 233 | BDSP_TaskHandle task, |
|---|
| 234 | unsigned branchId, |
|---|
| 235 | unsigned stageId, |
|---|
| 236 | const BDSP_CIT_P_FwStgSrcDstDetails *pOutputInfo |
|---|
| 237 | ); |
|---|
| 238 | |
|---|
| 239 | /*************************************************************************** |
|---|
| 240 | Summary: |
|---|
| 241 | Remove output from a stage |
|---|
| 242 | ***************************************************************************/ |
|---|
| 243 | BERR_Code BDSP_AudioTask_RemoveStageOutput( |
|---|
| 244 | BDSP_TaskHandle task, |
|---|
| 245 | unsigned branchId, |
|---|
| 246 | unsigned stageId, |
|---|
| 247 | const BDSP_CIT_P_FwStgSrcDstDetails *pOutputInfo |
|---|
| 248 | ); |
|---|
| 249 | #endif |
|---|
| 250 | /*************************************************************************** |
|---|
| 251 | Summary: |
|---|
| 252 | Audio Interrupt Handlers for a task |
|---|
| 253 | ***************************************************************************/ |
|---|
| 254 | typedef struct BDSP_AudioInterruptHandlers |
|---|
| 255 | { |
|---|
| 256 | /* Interrupt fires when first PTS is received */ |
|---|
| 257 | struct |
|---|
| 258 | { |
|---|
| 259 | void (*pCallback_isr)(void *pParam1, int param2, const BDSP_AudioTaskTsmStatus *pTsmStatus); |
|---|
| 260 | void *pParam1; |
|---|
| 261 | int param2; |
|---|
| 262 | } firstPts; |
|---|
| 263 | /* Interrupt fires when TSM Fail (PTS Error) occurs */ |
|---|
| 264 | struct |
|---|
| 265 | { |
|---|
| 266 | void (*pCallback_isr)(void *pParam1, int param2, const BDSP_AudioTaskTsmStatus *pTsmStatus); |
|---|
| 267 | void *pParam1; |
|---|
| 268 | int param2; |
|---|
| 269 | } tsmFail; |
|---|
| 270 | /* Interrupt fires when TSM transitions from fail -> pass in ASTM mode */ |
|---|
| 271 | struct |
|---|
| 272 | { |
|---|
| 273 | void (*pCallback_isr)(void *pParam1, int param2, const BDSP_AudioTaskTsmStatus *pTsmStatus); |
|---|
| 274 | void *pParam1; |
|---|
| 275 | int param2; |
|---|
| 276 | } tsmPass; |
|---|
| 277 | /* Interrupt fires when the decoder receives the first or any new sample rate in the stream */ |
|---|
| 278 | struct |
|---|
| 279 | { |
|---|
| 280 | void (*pCallback_isr)(void *pParam1, int param2, unsigned streamSampleRate, unsigned baseSampleRate); |
|---|
| 281 | void *pParam1; |
|---|
| 282 | int param2; |
|---|
| 283 | } sampleRateChange; |
|---|
| 284 | /* Interrupt fires when the decoder achieves frame lock */ |
|---|
| 285 | struct |
|---|
| 286 | { |
|---|
| 287 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 288 | void *pParam1; |
|---|
| 289 | int param2; |
|---|
| 290 | } lock; |
|---|
| 291 | /* Interrupt fires when the decoder loses frame lock */ |
|---|
| 292 | struct |
|---|
| 293 | { |
|---|
| 294 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 295 | void *pParam1; |
|---|
| 296 | int param2; |
|---|
| 297 | } unlock; |
|---|
| 298 | /* Interrupt fires when the status buffer is valid */ |
|---|
| 299 | struct |
|---|
| 300 | { |
|---|
| 301 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 302 | void *pParam1; |
|---|
| 303 | int param2; |
|---|
| 304 | } statusReady; |
|---|
| 305 | /* Interrupt fires when the mode change happens */ |
|---|
| 306 | struct |
|---|
| 307 | { |
|---|
| 308 | void (*pCallback_isr)(void *pParam1, int param2,const uint32_t ui32ModeValue); |
|---|
| 309 | void *pParam1; |
|---|
| 310 | int param2; |
|---|
| 311 | } modeChange; |
|---|
| 312 | |
|---|
| 313 | /* Interrupt fires when the bitrate change happens */ |
|---|
| 314 | struct |
|---|
| 315 | { |
|---|
| 316 | void (*pCallback_isr)(void *pParam1, int param2,const BDSP_AudioBitRateChangeInfo *bitrateChangeInfo); |
|---|
| 317 | void *pParam1; |
|---|
| 318 | int param2; |
|---|
| 319 | } bitrateChange; |
|---|
| 320 | struct |
|---|
| 321 | { |
|---|
| 322 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 323 | void *pParam1; |
|---|
| 324 | int param2; |
|---|
| 325 | } cdbItbOverflow; |
|---|
| 326 | struct |
|---|
| 327 | { |
|---|
| 328 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 329 | void *pParam1; |
|---|
| 330 | int param2; |
|---|
| 331 | } cdbItbUnderflow; |
|---|
| 332 | struct |
|---|
| 333 | { |
|---|
| 334 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 335 | void *pParam1; |
|---|
| 336 | int param2; |
|---|
| 337 | } startPtsReached; |
|---|
| 338 | struct |
|---|
| 339 | { |
|---|
| 340 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 341 | void *pParam1; |
|---|
| 342 | int param2; |
|---|
| 343 | } stopPtsReached; |
|---|
| 344 | struct |
|---|
| 345 | { |
|---|
| 346 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 347 | void *pParam1; |
|---|
| 348 | int param2; |
|---|
| 349 | } unlicensedAlgo; |
|---|
| 350 | struct |
|---|
| 351 | { |
|---|
| 352 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 353 | void *pParam1; |
|---|
| 354 | int param2; |
|---|
| 355 | } rampEnable; |
|---|
| 356 | |
|---|
| 357 | |
|---|
| 358 | } BDSP_AudioInterruptHandlers; |
|---|
| 359 | |
|---|
| 360 | /*************************************************************************** |
|---|
| 361 | Summary: |
|---|
| 362 | Get Current Interrupt Handlers for a task |
|---|
| 363 | ***************************************************************************/ |
|---|
| 364 | void BDSP_AudioTask_GetInterruptHandlers_isr( |
|---|
| 365 | BDSP_TaskHandle task, |
|---|
| 366 | BDSP_AudioInterruptHandlers *pHandlers /* [out] */ |
|---|
| 367 | ); |
|---|
| 368 | |
|---|
| 369 | /*************************************************************************** |
|---|
| 370 | Summary: |
|---|
| 371 | Set Current Interrupt Handlers for a task |
|---|
| 372 | ***************************************************************************/ |
|---|
| 373 | BERR_Code BDSP_AudioTask_SetInterruptHandlers_isr( |
|---|
| 374 | BDSP_TaskHandle task, |
|---|
| 375 | const BDSP_AudioInterruptHandlers *pHandlers |
|---|
| 376 | ); |
|---|
| 377 | |
|---|
| 378 | |
|---|
| 379 | /*************************************************************************** |
|---|
| 380 | Summary: |
|---|
| 381 | Get default Datasync settings. |
|---|
| 382 | ***************************************************************************/ |
|---|
| 383 | BERR_Code BDSP_AudioTask_GetDefaultDatasyncSettings( |
|---|
| 384 | void *pSettingsBuffer, /* [out] */ |
|---|
| 385 | size_t settingsBufferSize /*[In]*/ |
|---|
| 386 | ); |
|---|
| 387 | |
|---|
| 388 | /*************************************************************************** |
|---|
| 389 | Summary: |
|---|
| 390 | Get default Tsm settings. |
|---|
| 391 | ***************************************************************************/ |
|---|
| 392 | BERR_Code BDSP_AudioTask_GetDefaultTsmSettings( |
|---|
| 393 | void *pSettingsBuffer, /* [out] */ |
|---|
| 394 | size_t settingsBufferSize /*[In]*/ |
|---|
| 395 | ); |
|---|
| 396 | |
|---|
| 397 | /*************************************************************************** |
|---|
| 398 | Summary: |
|---|
| 399 | Command to put an audio task in zero fill mode. Required for NRT xcode case, where incase |
|---|
| 400 | of audio gaps, audio stalls video too. This command avoids this deadlock. |
|---|
| 401 | ***************************************************************************/ |
|---|
| 402 | BERR_Code BDSP_AudioTask_AudioGapFill( |
|---|
| 403 | BDSP_TaskHandle task |
|---|
| 404 | ); |
|---|
| 405 | |
|---|
| 406 | #endif |
|---|
| 407 | |
|---|