| 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_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/11 $ |
|---|
| 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_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/11 2/22/12 7:21p ashoky |
|---|
| 21 | * SW7231-585: Adding APIs to expose interrupt bits to interrupt DSP. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/10 2/15/12 3:02p ashoky |
|---|
| 24 | * SW7425-2308: Adding interface to put audio firmware in audio gap fill |
|---|
| 25 | * mode. |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/9 1/27/12 1:02p ashoky |
|---|
| 28 | * FWRAA-377: Merging h264 soft dsp video encoder to mainline. |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/8 7/4/11 6:35p gprasad |
|---|
| 31 | * SW7422-373: Add GetInfo routines for AudioType, AudioProcessing, and |
|---|
| 32 | * AudioEncode in BDSP |
|---|
| 33 | * |
|---|
| 34 | * Hydra_Software_Devel/7 6/17/11 3:50p gautamk |
|---|
| 35 | * SW7422-373: [7422] Adding GetInfo routines for AudioType, |
|---|
| 36 | * AudioProcessing, and AudioEncode support in BDSP |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/6 6/15/11 5:47p gautamk |
|---|
| 39 | * SW7425-683: [7425] Adding support for Power management in BDSP |
|---|
| 40 | * |
|---|
| 41 | * Hydra_Software_Devel/5 6/15/11 4:20p gautamk |
|---|
| 42 | * SW7422-357 : [7425] Adding support for new API for getStageInputIndex |
|---|
| 43 | * |
|---|
| 44 | * Hydra_Software_Devel/4 6/14/11 3:09p gautamk |
|---|
| 45 | * SW7422-357 : [7425] Merging to mainline |
|---|
| 46 | * |
|---|
| 47 | * Hydra_Software_Devel/MS11_DEVEL_BRANCH/1 6/10/11 6:20p gautamk |
|---|
| 48 | * SW7422-357 : [7425] Modifying API prtotype for Add/Remove stage input |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/3 6/9/11 8:12p gautamk |
|---|
| 51 | * SW7422-357 : [7425] Modifying API prtotype for Add/Remove stage input |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/2 6/8/11 4:50p gautamk |
|---|
| 54 | * SW7425-572: [7425] Adding DM related API support for VP6 in BDSP |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/1 4/6/11 2:16p srajapur |
|---|
| 57 | * SW7425-291: [7425]BDSP directory structure changes |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/6 1/26/11 12:58a gautamk |
|---|
| 60 | * SW7422-191: reomving redundant parameter. |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/5 1/20/11 8:13a gautamk |
|---|
| 63 | * SW7422-191: Implementing code review comments |
|---|
| 64 | * |
|---|
| 65 | * Hydra_Software_Devel/4 1/18/11 4:58a gautamk |
|---|
| 66 | * SW7422-191: Implementing review comments. |
|---|
| 67 | * |
|---|
| 68 | * Hydra_Software_Devel/3 1/13/11 5:59a gautamk |
|---|
| 69 | * SW7422-191:[7422]Adding DSP support for Audio decode in Basemodule It |
|---|
| 70 | * includes - DSP Booting - Open time Download : - Start Time Audio |
|---|
| 71 | * Decode algorithm download - Message buffer interaction with DSP: - |
|---|
| 72 | * Synchronized Interrupt: - Async interrupts: - Config Commands for |
|---|
| 73 | * Decode/TSM/IDS: - Status Buffer for Decode/TSM/IDS: - Start AC3 Audio |
|---|
| 74 | * Decode: - Pause/Resume Command: - Frame Advance command: - Device |
|---|
| 75 | * level interrupt |
|---|
| 76 | * |
|---|
| 77 | * Hydra_Software_Devel/2 12/15/10 6:47p jgarrett |
|---|
| 78 | * SW7422-146: Initial compileable prototype |
|---|
| 79 | * |
|---|
| 80 | * Hydra_Software_Devel/1 12/15/10 2:31p jgarrett |
|---|
| 81 | * SW7422-146: Adding initial BDSP files |
|---|
| 82 | * |
|---|
| 83 | ***************************************************************************/ |
|---|
| 84 | |
|---|
| 85 | #ifndef BDSP_PRIV_H_ |
|---|
| 86 | #define BDSP_PRIV_H_ |
|---|
| 87 | |
|---|
| 88 | #include "bkni.h" |
|---|
| 89 | #include "bkni_multi.h" |
|---|
| 90 | #include "bdbg.h" |
|---|
| 91 | |
|---|
| 92 | BDBG_OBJECT_ID_DECLARE(BDSP_Device); |
|---|
| 93 | |
|---|
| 94 | #define BDSP_INVALID_INDEX (unsigned int)-1 |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | typedef struct BDSP_Device |
|---|
| 98 | { |
|---|
| 99 | BDBG_OBJECT(BDSP_Device) |
|---|
| 100 | void *pDeviceHandle; |
|---|
| 101 | /* Device-level Function table */ |
|---|
| 102 | void (*close)(void *pDeviceHandle); |
|---|
| 103 | void (*initialize)(void *pDeviceHandle); |
|---|
| 104 | void (*getStatus)(void *pDeviceHandle, BDSP_Status *pStatus); |
|---|
| 105 | BERR_Code (*getDebugLog)(void *pDeviceHandle, char *pBuffer, size_t bufferLength); |
|---|
| 106 | void (*getDefaultContextSettings)(void *pDeviceHandle,BDSP_ContextType contextType, BDSP_ContextCreateSettings *pSettings); |
|---|
| 107 | BERR_Code (*createContext)(void *pDeviceHandle, const BDSP_ContextCreateSettings *pSettings, BDSP_ContextHandle *pContext); |
|---|
| 108 | BERR_Code (*powerStandby)(void *pDeviceHandle, BDSP_StandbySettings *pSettings); |
|---|
| 109 | BERR_Code (*powerResume)(void *pDeviceHandle); |
|---|
| 110 | void (*getAudioTypeInfo)(BDSP_AudioType type, const BDSP_AudioTypeInfo **pInfo); |
|---|
| 111 | void (*getAudioProcessingInfo)(BDSP_AudioProcessing type, const BDSP_AudioProcessingInfo **pInfo); |
|---|
| 112 | void (*getAudioEncodeInfo)(BDSP_AudioEncode type, const BDSP_AudioEncodeInfo **pInfo); |
|---|
| 113 | /* Below functions provide external interrupt handles to SW */ |
|---|
| 114 | BERR_Code (*allocateExternalInterrupt)(void *pDeviceHandle, uint32_t dspIndex, BDSP_ExternalInterruptHandle *pInterruptHandle); |
|---|
| 115 | BERR_Code (*freeExternalInterrupt)(void *pInterruptHandle); |
|---|
| 116 | BERR_Code (*getExternalInterruptInfo)(void *pInterruptHandle, BDSP_ExternalInterruptInfo **pInfo); |
|---|
| 117 | /* Below functions provide RDB register handles to SW */ |
|---|
| 118 | BERR_Code (*allocateRdbRegister)(void *pDeviceHandle, uint32_t dspIndex, uint32_t numRegs, BDSP_RdbRegisterHandle *pRdbRegisterHandle); |
|---|
| 119 | BERR_Code (*freeRdbRegister)(void *pRdbRegisterHandle); |
|---|
| 120 | BERR_Code (*getRdbRegisterInfo)(void *pRdbRegisterHandle, BDSP_RdbRegisterInfo **pInfo); |
|---|
| 121 | |
|---|
| 122 | }BDSP_Device; |
|---|
| 123 | |
|---|
| 124 | void BDSP_P_InitDevice( |
|---|
| 125 | BDSP_Device *pDevice, |
|---|
| 126 | void *pDeviceHandle |
|---|
| 127 | ); |
|---|
| 128 | |
|---|
| 129 | BDBG_OBJECT_ID_DECLARE(BDSP_Context); |
|---|
| 130 | |
|---|
| 131 | typedef struct BDSP_Context |
|---|
| 132 | { |
|---|
| 133 | BDBG_OBJECT(BDSP_Context) |
|---|
| 134 | void *pContextHandle; |
|---|
| 135 | /* Context-level Function table */ |
|---|
| 136 | void (*destroy)(void *pContextHandle); |
|---|
| 137 | void (*getInterruptHandlers)(void *pContextHandle, BDSP_ContextInterruptHandlers *pInterrupts); |
|---|
| 138 | BERR_Code (*setInterruptHandlers)(void *pContextHandle, const BDSP_ContextInterruptHandlers *pInterrupts); |
|---|
| 139 | BERR_Code (*processWatchdogInterrupt)(void *pContextHandle); |
|---|
| 140 | void (*getDefaultTaskSettings)(void *pContextHandle, BDSP_TaskCreateSettings *pSettings); |
|---|
| 141 | BERR_Code (*createTask)(void *pContextHandle, const BDSP_TaskCreateSettings *pSettings, BDSP_TaskHandle *pTask); |
|---|
| 142 | }BDSP_Context; |
|---|
| 143 | |
|---|
| 144 | void BDSP_P_InitContext( |
|---|
| 145 | BDSP_Context *pContext, |
|---|
| 146 | void *pContextHandle |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | BDBG_OBJECT_ID_DECLARE(BDSP_Task); |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | typedef struct BDSP_Task |
|---|
| 153 | { |
|---|
| 154 | BDBG_OBJECT(BDSP_Task) |
|---|
| 155 | void *pTaskHandle; |
|---|
| 156 | /* Task-level Function table */ |
|---|
| 157 | void (*destroy)(void *pTaskHandle); |
|---|
| 158 | BERR_Code (*start)(void *pTaskHandle); |
|---|
| 159 | BERR_Code (*stop)(void *pTaskHandle); |
|---|
| 160 | BERR_Code (*getStageSettings)(void *pTaskHandle, unsigned branchId, unsigned stageId, void *pSettingsBuffer, size_t settingsSize); |
|---|
| 161 | BERR_Code (*setStageSettings)(void *pTaskHandle, unsigned branchId, unsigned stageId, const void *pSettingsBuffer, size_t settingsSize); |
|---|
| 162 | BERR_Code (*getStageStatus)(void *pTaskHandle, unsigned branchId, unsigned stageId, void *pStatusBuffer, size_t statusSize); |
|---|
| 163 | /* Audio task Function table */ |
|---|
| 164 | BERR_Code (*pause)(void *pTaskHandle); |
|---|
| 165 | BERR_Code (*resume)(void *pTaskHandle); |
|---|
| 166 | BERR_Code (*advance)(void *pTaskHandle, unsigned ms); |
|---|
| 167 | BERR_Code (*getTsmSettings_isr)(void *pTaskHandle, unsigned branchId, unsigned stageId, BDSP_AudioTaskTsmSettings *pTsmSettings); |
|---|
| 168 | BERR_Code (*setTsmSettings_isr)(void *pTaskHandle, unsigned branchId, unsigned stageId, const BDSP_AudioTaskTsmSettings *pTsmSettings); |
|---|
| 169 | BERR_Code (*getTsmStatus_isr)(void *pTaskHandle, unsigned branchId, unsigned stageId, BDSP_AudioTaskTsmStatus *pTsmStatus); |
|---|
| 170 | BERR_Code (*getDatasyncSettings)(void *pTaskHandle, unsigned branchId, unsigned stageId, BDSP_AudioTaskDatasyncSettings *pSettings); |
|---|
| 171 | BERR_Code (*setDatasyncSettings)(void *pTaskHandle, unsigned branchId, unsigned stageId, const BDSP_AudioTaskDatasyncSettings *pSettings); |
|---|
| 172 | BERR_Code (*getDatasyncStatus)(void *pTaskHandle, unsigned branchId, unsigned stageId, BDSP_AudioTaskDatasyncStatus *pStatus); |
|---|
| 173 | BERR_Code (*addStageInput)(void *pTaskHandle,const BDSP_TaskAddStageInputSettings *pSettings,BDSP_TaskStageInputHandle *pHandle); |
|---|
| 174 | BERR_Code (*removeStageInput)(void *pStageInputHandle); |
|---|
| 175 | BERR_Code (*getStageInputIndex)(void *pStageInputHandle,unsigned *inputIndex); |
|---|
| 176 | BERR_Code (*addStageOutput)(void *pTaskHandle, unsigned branchId, unsigned stageId, const BDSP_CIT_P_FwStgSrcDstDetails *pOutputInfo); |
|---|
| 177 | BERR_Code (*removeStageOutput)(void *pTaskHandle, unsigned branchId, unsigned stageId, const BDSP_CIT_P_FwStgSrcDstDetails *pOutputInfo); |
|---|
| 178 | void (*getAudioInterruptHandlers_isr)(void *pTaskHandle, BDSP_AudioInterruptHandlers *pHandlers); |
|---|
| 179 | BERR_Code (*setAudioInterruptHandlers_isr)(void *pTaskHandle, const BDSP_AudioInterruptHandlers *pHandlers); |
|---|
| 180 | BERR_Code (*audioGapFill)(void *pTaskHandle); |
|---|
| 181 | |
|---|
| 182 | /* Video task Function table */ |
|---|
| 183 | BERR_Code (*getPictureCount_isr)(void *pTaskHandle,unsigned *pPictureCount); |
|---|
| 184 | BERR_Code (*peekAtPicture_isr)(void *pTaskHandle, unsigned index,BXDM_Picture **pUnifiedPicture); |
|---|
| 185 | BERR_Code (*getNextPicture_isr)(void *pTaskHandle,BXDM_Picture **pUnifiedPicture); |
|---|
| 186 | BERR_Code (*releasePicture_isr)(void *pTaskHandle,BXDM_Picture *pUnifiedPicture); |
|---|
| 187 | BERR_Code (*getPictureDropPendingCount_isr)(void *pTaskHandle, unsigned *pPictureDropPendingCount); |
|---|
| 188 | BERR_Code (*requestPictureDrop_isr)(void *pTaskHandle,unsigned *pPictureDropRequestCount); |
|---|
| 189 | BERR_Code (*displayInterruptEvent_isr)(void *pTaskHandle); |
|---|
| 190 | |
|---|
| 191 | /* Video Encode task Function table */ |
|---|
| 192 | BERR_Code (*getVideoEncodeDatasyncSettings)(void *pTaskHandle, unsigned branchId, unsigned stageId, BDSP_VideoEncodeTaskDatasyncSettings *pSettings); |
|---|
| 193 | BERR_Code (*setVideoEncodeDatasyncSettings)(void *pTaskHandle, unsigned branchId, unsigned stageId, const BDSP_VideoEncodeTaskDatasyncSettings *pSettings); |
|---|
| 194 | BERR_Code (*getPictureBuffer_isr)(void *pTaskHandle, BVENC_VF_sPicParamBuff **pPpBuf); |
|---|
| 195 | BERR_Code (*putPicture_isr)(void *pTaskHandle, uint32_t ui32PictureParamBufAddress); |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | }BDSP_Task; |
|---|
| 199 | |
|---|
| 200 | BDBG_OBJECT_ID_DECLARE(BDSP_ExternalInterrupt); |
|---|
| 201 | |
|---|
| 202 | /* Handle for External interrupt to DSP */ |
|---|
| 203 | typedef struct BDSP_ExternalInterrupt |
|---|
| 204 | { |
|---|
| 205 | BDBG_OBJECT(BDSP_ExternalInterrupt) |
|---|
| 206 | BDSP_Handle hDsp; |
|---|
| 207 | void * pExtInterruptHandle; |
|---|
| 208 | |
|---|
| 209 | }BDSP_ExternalInterrupt; |
|---|
| 210 | |
|---|
| 211 | BDBG_OBJECT_ID_DECLARE(BDSP_RdbRegister); |
|---|
| 212 | |
|---|
| 213 | /* Handle for a RDB register */ |
|---|
| 214 | typedef struct BDSP_RdbRegister |
|---|
| 215 | { |
|---|
| 216 | BDBG_OBJECT(BDSP_RdbRegister) |
|---|
| 217 | BDSP_Handle hDsp; |
|---|
| 218 | void * pRdbRegisterHandle; |
|---|
| 219 | }BDSP_RdbRegister; |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | BDBG_OBJECT_ID_DECLARE(BDSP_TaskStageInput); |
|---|
| 223 | |
|---|
| 224 | |
|---|
| 225 | typedef struct BDSP_TaskStageInput |
|---|
| 226 | { |
|---|
| 227 | BDBG_OBJECT(BDSP_TaskStageInput) |
|---|
| 228 | BDSP_TaskHandle task; |
|---|
| 229 | void *pStageInputHandle; |
|---|
| 230 | }BDSP_TaskStageInput; |
|---|
| 231 | |
|---|
| 232 | void BDSP_P_InitTask( |
|---|
| 233 | BDSP_Task *pTask, |
|---|
| 234 | void *pTaskHandle |
|---|
| 235 | ); |
|---|
| 236 | |
|---|
| 237 | #define BDSP_Read32(hReg, addr) BREG_Read32(hReg, addr) |
|---|
| 238 | #define BDSP_Write32(hReg, addr, data) BREG_Write32(hReg, addr, data) |
|---|
| 239 | #define BDSP_Read32_isr(hReg, addr) BREG_Read32_isr(hReg, addr) |
|---|
| 240 | #define BDSP_Write32_isr(hReg, addr, data) BREG_Write32_isr(hReg, addr, data) |
|---|
| 241 | |
|---|
| 242 | #endif /* #ifndef BDSP_PRIV_H_ */ |
|---|
| 243 | |
|---|