| 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_task.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/13 $ |
|---|
| 12 | * $brcm_Date: 2/22/12 7:21p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Host DSP Task Interface |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/dsp/common/bdsp_task.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/13 2/22/12 7:21p ashoky |
|---|
| 21 | * SW7231-585: Adding APIs to expose interrupt bits to interrupt DSP. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/12 1/27/12 1:02p ashoky |
|---|
| 24 | * FWRAA-377: Merging h264 soft dsp video encoder to mainline. |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/11 8/19/11 4:02p ashoky |
|---|
| 27 | * SWDTV-8271: [35233] Adding low delay support. |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/10 6/24/11 1:50p gautamk |
|---|
| 30 | * SW7425-499: [7425] Merging to mainline. |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/NRT_XCODE_DEVEL/2 6/22/11 6:21p gautamk |
|---|
| 33 | * SW7425-499: [7425] Adding bdsp suport for non-real time transcode |
|---|
| 34 | * cases. |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/NRT_XCODE_DEVEL/1 6/17/11 6:15p gautamk |
|---|
| 37 | * SW7425-499: [7425] Adding bdsp suport for non-real time transcode |
|---|
| 38 | * cases. |
|---|
| 39 | * |
|---|
| 40 | * Hydra_Software_Devel/9 6/16/11 1:53p gautamk |
|---|
| 41 | * SW7422-357 : [7425] rehsuffling the defenitions |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/8 6/15/11 4:21p gautamk |
|---|
| 44 | * SW7422-357 : [7425] Adding support for new API for getStageInputIndex |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/7 6/14/11 3:13p gautamk |
|---|
| 47 | * SW7422-357 : [7425] Merging to mainline |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/6 6/3/11 11:59a srajapur |
|---|
| 50 | * SW7422-357 : [7425] Added support for MS11 |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/5 6/2/11 7:56p srajapur |
|---|
| 53 | * SW7422-358 : [7425] Added support for MS11 |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/4 5/31/11 5:39p srajapur |
|---|
| 56 | * SW7422-358 : [7425] Added support for MS11 |
|---|
| 57 | * |
|---|
| 58 | * Hydra_Software_Devel/3 5/25/11 5:24p srajapur |
|---|
| 59 | * SW7422-358: [7425] Adding support for MS11 in BDSP |
|---|
| 60 | * |
|---|
| 61 | * Hydra_Software_Devel/2 5/16/11 10:07p srajapur |
|---|
| 62 | * SW7425-572: [7425] Adding VP6 support in basemodules |
|---|
| 63 | * |
|---|
| 64 | * Hydra_Software_Devel/1 4/6/11 2:16p srajapur |
|---|
| 65 | * SW7425-291: [7425]BDSP directory structure changes |
|---|
| 66 | * |
|---|
| 67 | * Hydra_Software_Devel/3 1/13/11 6:00a gautamk |
|---|
| 68 | * SW7422-191:[7422]Adding DSP support for Audio decode in Basemodule It |
|---|
| 69 | * includes - DSP Booting - Open time Download : - Start Time Audio |
|---|
| 70 | * Decode algorithm download - Message buffer interaction with DSP: - |
|---|
| 71 | * Synchronized Interrupt: - Async interrupts: - Config Commands for |
|---|
| 72 | * Decode/TSM/IDS: - Status Buffer for Decode/TSM/IDS: - Start AC3 Audio |
|---|
| 73 | * Decode: - Pause/Resume Command: - Frame Advance command: - Device |
|---|
| 74 | * level interrupt |
|---|
| 75 | * |
|---|
| 76 | * Hydra_Software_Devel/2 12/15/10 6:47p jgarrett |
|---|
| 77 | * SW7422-146: Initial compileable prototype |
|---|
| 78 | * |
|---|
| 79 | * Hydra_Software_Devel/1 12/14/10 2:17p jgarrett |
|---|
| 80 | * SW7422-146: Adding initial API for APE/DSP |
|---|
| 81 | * |
|---|
| 82 | ***************************************************************************/ |
|---|
| 83 | |
|---|
| 84 | #ifndef BDSP_TASK_H_ |
|---|
| 85 | #define BDSP_TASK_H_ |
|---|
| 86 | |
|---|
| 87 | #include "bchp.h" |
|---|
| 88 | #include "bint.h" |
|---|
| 89 | #include "bmem.h" |
|---|
| 90 | #include "breg_mem.h" |
|---|
| 91 | #include "btmr.h" |
|---|
| 92 | #include "bimg.h" |
|---|
| 93 | #include "bdsp_context.h" |
|---|
| 94 | #include "bdsp_raaga_cit_priv.h" |
|---|
| 95 | #include "bdsp_raaga_fwstatus.h" |
|---|
| 96 | #include "bdsp_raaga_fwstatus.h" |
|---|
| 97 | |
|---|
| 98 | /* Kept as 2 keeping in mind the ping-pong type of arrangement for video encoder */ |
|---|
| 99 | #define BDSP_MAX_EXT_INTERRUPT_PER_TASK 2 |
|---|
| 100 | #define BDSP_MAX_METADATA_REGISTERS_PER_TASK 2 |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | /*************************************************************************** |
|---|
| 104 | Summary: |
|---|
| 105 | Task Scheduling mode |
|---|
| 106 | ***************************************************************************/ |
|---|
| 107 | typedef enum BDSP_TaskSchedulingMode |
|---|
| 108 | { |
|---|
| 109 | BDSP_TaskSchedulingMode_eStandalone, /* Default. Standalone task */ |
|---|
| 110 | BDSP_TaskSchedulingMode_eMaster, /* Master task in a master/slave relationship */ |
|---|
| 111 | BDSP_TaskSchedulingMode_eSlave, /* Slave task in a master/slave relationship */ |
|---|
| 112 | BDSP_TaskSchedulingMode_eMax |
|---|
| 113 | } BDSP_TaskSchedulingMode; |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | /*************************************************************************** |
|---|
| 117 | Summary: |
|---|
| 118 | Task Realtime mode |
|---|
| 119 | ***************************************************************************/ |
|---|
| 120 | typedef enum BDSP_TaskRealtimeMode |
|---|
| 121 | { |
|---|
| 122 | BDSP_TaskRealtimeMode_eRealTime, /* Realtime */ |
|---|
| 123 | BDSP_TaskRealtimeMode_eNonRealTime, /* Non-Realtime */ |
|---|
| 124 | BDSP_TaskRealtimeMode_eSoftRealTime, /* Soft-Realtime */ |
|---|
| 125 | BDSP_TaskRealtimeMode_eMax |
|---|
| 126 | } BDSP_TaskRealtimeMode; |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | /*************************************************************************** |
|---|
| 130 | Summary: |
|---|
| 131 | Audio Task Low delay mode |
|---|
| 132 | ***************************************************************************/ |
|---|
| 133 | typedef enum BDSP_AudioTaskDelayMode |
|---|
| 134 | { |
|---|
| 135 | BDSP_AudioTaskDelayMode_eDefault, /* Fixed path delay of 128ms is used for all audio processing */ |
|---|
| 136 | BDSP_AudioTaskDelayMode_eLow, /* Variable path delay depending on decode algorithm. */ |
|---|
| 137 | BDSP_AudioTaskDelayMode_eMax |
|---|
| 138 | }BDSP_AudioTaskDelayMode; |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | /*************************************************************************** |
|---|
| 142 | Summary: |
|---|
| 143 | The structure contains all information regarding soft increment of STC |
|---|
| 144 | |
|---|
| 145 | Description: |
|---|
| 146 | This structure contains configuration info of soft STC increment. |
|---|
| 147 | |
|---|
| 148 | See Also: |
|---|
| 149 | None. |
|---|
| 150 | ****************************************************************************/ |
|---|
| 151 | |
|---|
| 152 | typedef struct BDSP_STCIncrementConfig |
|---|
| 153 | { |
|---|
| 154 | /* If soft triggering is required. Default = BDSP_AF_P_eDisable */ |
|---|
| 155 | bool enableStcTrigger; |
|---|
| 156 | /* High and Low part of registers to tell the amount of STC increment. */ |
|---|
| 157 | uint32_t stcIncHiAddr; |
|---|
| 158 | uint32_t stcIncLowAddr; |
|---|
| 159 | /* Address of register to send trigger for incrementing STC */ |
|---|
| 160 | uint32_t stcIncTrigAddr; |
|---|
| 161 | /* Trigger bit in the above register. Bit count [031]*/ |
|---|
| 162 | uint32_t triggerBit; |
|---|
| 163 | |
|---|
| 164 | }BDSP_STCIncrementConfig; |
|---|
| 165 | |
|---|
| 166 | /*************************************************************************** |
|---|
| 167 | Summary: |
|---|
| 168 | The structure contains all information regarding soft external interrupts to DSP |
|---|
| 169 | |
|---|
| 170 | Description: |
|---|
| 171 | This structure contains configuration info of soft external interrupts to DSP. |
|---|
| 172 | |
|---|
| 173 | See Also: |
|---|
| 174 | None. |
|---|
| 175 | ****************************************************************************/ |
|---|
| 176 | typedef struct BDSP_ExtInterruptConfig |
|---|
| 177 | { |
|---|
| 178 | /* If the dsp task will be interrupted by external client */ |
|---|
| 179 | bool enableInterrupts; |
|---|
| 180 | uint32_t numInterrupts; |
|---|
| 181 | /* only numInterrupts of following struct will be valid */ |
|---|
| 182 | struct |
|---|
| 183 | { |
|---|
| 184 | /* ESR_SI register address. Full 32bit address */ |
|---|
| 185 | uint32_t interruptRegAddr; |
|---|
| 186 | /* Trigger bit in the above register. Bit count [0...31]*/ |
|---|
| 187 | uint32_t interruptBit; |
|---|
| 188 | }interruptInfo[BDSP_MAX_EXT_INTERRUPT_PER_TASK]; |
|---|
| 189 | |
|---|
| 190 | }BDSP_ExtInterruptConfig; |
|---|
| 191 | |
|---|
| 192 | /*************************************************************************** |
|---|
| 193 | Summary: |
|---|
| 194 | The structure contains all information regarding RDB registers that will be used to |
|---|
| 195 | communicate between dsp and some other clients. |
|---|
| 196 | |
|---|
| 197 | Description: |
|---|
| 198 | This structure contains configuration info of RDB registers that will be used to |
|---|
| 199 | communicate between dsp and some other clients. |
|---|
| 200 | |
|---|
| 201 | See Also: |
|---|
| 202 | None. |
|---|
| 203 | ****************************************************************************/ |
|---|
| 204 | typedef struct BDSP_VideoEncRdbRegisterConfig |
|---|
| 205 | { |
|---|
| 206 | /* Full 32 bit RDB address for STC to take snapshot for generating ESCR/PTS */ |
|---|
| 207 | uint32_t stcAddress; |
|---|
| 208 | /* Full 32 bit RDB address of DSP page registers where metadata will be written */ |
|---|
| 209 | uint32_t metadataRdbAddress[BDSP_MAX_METADATA_REGISTERS_PER_TASK]; |
|---|
| 210 | }BDSP_VideoEncRdbRegisterConfig; |
|---|
| 211 | |
|---|
| 212 | /*************************************************************************** |
|---|
| 213 | Summary: |
|---|
| 214 | Create A DSP Task |
|---|
| 215 | ***************************************************************************/ |
|---|
| 216 | typedef struct BDSP_TaskCreateSettings |
|---|
| 217 | { |
|---|
| 218 | unsigned dspIndex; /* Which DSP to create this task on */ |
|---|
| 219 | BDSP_TaskSchedulingMode schedulingMode; |
|---|
| 220 | BDSP_TaskRealtimeMode realtimeMode; |
|---|
| 221 | BDSP_TaskHandle masterTask; |
|---|
| 222 | |
|---|
| 223 | unsigned numBranches; |
|---|
| 224 | BDSP_CIT_P_FwBranchInfo *pBranchInfo[BDSP_P_MAX_FW_BRANCH_PER_FW_TASK]; /* Information of FW branches in a FW task */ |
|---|
| 225 | |
|---|
| 226 | /* TODO: Should probably be a union based on context/task type - revisit with video encoding */ |
|---|
| 227 | BDSP_VF_P_sVDecodeBuffCfg *psVDecodeBuffCfg; |
|---|
| 228 | BDSP_VF_P_sVEncoderConfig *psVEncoderConfig; |
|---|
| 229 | BDSP_AudioTaskDelayMode audioTaskDelayMode; |
|---|
| 230 | |
|---|
| 231 | BDSP_AF_P_TimeBaseType timeBaseType; /* Time base type for a task 45Khz or 27 Mhz (Direct TV)*/ |
|---|
| 232 | bool ppmCorrection; /*Enable/Disable 2ms tight lypsinc*/ |
|---|
| 233 | BDSP_STCIncrementConfig stcIncrementConfig; /* Soft increment of STC*/ |
|---|
| 234 | BDSP_ExtInterruptConfig extInterruptConfig; /* External interrupt to DSP configuration */ |
|---|
| 235 | BDSP_VideoEncRdbRegisterConfig videoEncRdbConfig; /* RDB of DSP page configuration */ |
|---|
| 236 | } BDSP_TaskCreateSettings; |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | /*************************************************************************** |
|---|
| 241 | Summary: |
|---|
| 242 | Get Default DSP Task Settings |
|---|
| 243 | ***************************************************************************/ |
|---|
| 244 | void BDSP_Task_GetDefaultCreateSettings( |
|---|
| 245 | BDSP_ContextHandle context, |
|---|
| 246 | BDSP_TaskCreateSettings *pSettings /* [out] */ |
|---|
| 247 | ); |
|---|
| 248 | |
|---|
| 249 | /*************************************************************************** |
|---|
| 250 | Summary: |
|---|
| 251 | Create a DSP task |
|---|
| 252 | ***************************************************************************/ |
|---|
| 253 | BERR_Code BDSP_Task_Create( |
|---|
| 254 | BDSP_ContextHandle context, |
|---|
| 255 | const BDSP_TaskCreateSettings *pSettings, |
|---|
| 256 | BDSP_TaskHandle *pTask /* [out] */ |
|---|
| 257 | ); |
|---|
| 258 | |
|---|
| 259 | /*************************************************************************** |
|---|
| 260 | Summary: |
|---|
| 261 | Destroy a DSP task |
|---|
| 262 | ***************************************************************************/ |
|---|
| 263 | void BDSP_Task_Destroy( |
|---|
| 264 | BDSP_TaskHandle task |
|---|
| 265 | ); |
|---|
| 266 | |
|---|
| 267 | /*************************************************************************** |
|---|
| 268 | Summary: |
|---|
| 269 | Start a DSP task |
|---|
| 270 | ***************************************************************************/ |
|---|
| 271 | BERR_Code BDSP_Task_Start( |
|---|
| 272 | BDSP_TaskHandle task |
|---|
| 273 | ); |
|---|
| 274 | |
|---|
| 275 | /*************************************************************************** |
|---|
| 276 | Summary: |
|---|
| 277 | Stop a DSP task |
|---|
| 278 | ***************************************************************************/ |
|---|
| 279 | BERR_Code BDSP_Task_Stop( |
|---|
| 280 | BDSP_TaskHandle task |
|---|
| 281 | ); |
|---|
| 282 | |
|---|
| 283 | /*************************************************************************** |
|---|
| 284 | Summary: |
|---|
| 285 | Get settings for a particular task stage |
|---|
| 286 | ***************************************************************************/ |
|---|
| 287 | BERR_Code BDSP_Task_GetStageSettings( |
|---|
| 288 | BDSP_TaskHandle task, |
|---|
| 289 | unsigned branchId, |
|---|
| 290 | unsigned stageId, |
|---|
| 291 | void *pSettingsBuffer, /* [out] */ |
|---|
| 292 | size_t settingsBufferSize |
|---|
| 293 | ); |
|---|
| 294 | |
|---|
| 295 | /*************************************************************************** |
|---|
| 296 | Summary: |
|---|
| 297 | Set settings for a particular task stage |
|---|
| 298 | ***************************************************************************/ |
|---|
| 299 | BERR_Code BDSP_Task_SetStageSettings( |
|---|
| 300 | BDSP_TaskHandle task, |
|---|
| 301 | unsigned branchId, |
|---|
| 302 | unsigned stageId, |
|---|
| 303 | const void *pSettingsBuffer, |
|---|
| 304 | size_t settingsBufferSize |
|---|
| 305 | ); |
|---|
| 306 | |
|---|
| 307 | /*************************************************************************** |
|---|
| 308 | Summary: |
|---|
| 309 | Get status from a particular task stage |
|---|
| 310 | ***************************************************************************/ |
|---|
| 311 | BERR_Code BDSP_Task_GetStageStatus( |
|---|
| 312 | BDSP_TaskHandle task, |
|---|
| 313 | unsigned branchId, |
|---|
| 314 | unsigned stageId, |
|---|
| 315 | void *pStatusBuffer, /* [out] */ |
|---|
| 316 | size_t statusBufferSize |
|---|
| 317 | ); |
|---|
| 318 | |
|---|
| 319 | /*************************************************************************** |
|---|
| 320 | Summary: |
|---|
| 321 | Add Stage Input settings |
|---|
| 322 | ***************************************************************************/ |
|---|
| 323 | typedef struct BDSP_TaskAddStageInputSettings |
|---|
| 324 | { |
|---|
| 325 | unsigned branchId; |
|---|
| 326 | unsigned stageId; |
|---|
| 327 | BDSP_CIT_P_FwStgSrcDstDetails sourceDetails; |
|---|
| 328 | } BDSP_TaskAddStageInputSettings; |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | /*************************************************************************** |
|---|
| 332 | Summary: |
|---|
| 333 | Get default add Stage Input settings |
|---|
| 334 | ***************************************************************************/ |
|---|
| 335 | void BDSP_Task_GetDefaultAddStageInputSettings( |
|---|
| 336 | BDSP_CIT_P_FwStgSrcDstType inputType, |
|---|
| 337 | BDSP_TaskAddStageInputSettings *pSettings /*[out] */ |
|---|
| 338 | ); |
|---|
| 339 | |
|---|
| 340 | |
|---|
| 341 | /*************************************************************************** |
|---|
| 342 | Summary: |
|---|
| 343 | Add input to a task stage |
|---|
| 344 | ***************************************************************************/ |
|---|
| 345 | BERR_Code BDSP_Task_AddStageInput( |
|---|
| 346 | BDSP_TaskHandle task, |
|---|
| 347 | const BDSP_TaskAddStageInputSettings *pSettings, |
|---|
| 348 | BDSP_TaskStageInputHandle *pHandle /* [out] */ |
|---|
| 349 | ); |
|---|
| 350 | |
|---|
| 351 | |
|---|
| 352 | /*************************************************************************** |
|---|
| 353 | Summary: |
|---|
| 354 | remove input from a task stage |
|---|
| 355 | ***************************************************************************/ |
|---|
| 356 | BERR_Code BDSP_Task_RemoveStageInput( |
|---|
| 357 | BDSP_TaskStageInputHandle input |
|---|
| 358 | ); |
|---|
| 359 | |
|---|
| 360 | /*************************************************************************** |
|---|
| 361 | Summary: |
|---|
| 362 | Get input index of a task stage |
|---|
| 363 | ***************************************************************************/ |
|---|
| 364 | BERR_Code BDSP_Task_GetStageInputIndex( |
|---|
| 365 | BDSP_TaskStageInputHandle input, |
|---|
| 366 | unsigned *inputIndex |
|---|
| 367 | ); |
|---|
| 368 | #endif |
|---|
| 369 | |
|---|