| 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: bdsp_raaga.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/9 $ |
|---|
| 12 | * $brcm_Date: 12/5/11 5:41p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Raaga DSP Interface |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/dsp/7425/raaga/api/bdsp_raaga.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/9 12/5/11 5:41p rshijith |
|---|
| 21 | * FWRAA-365 : Adding Target print support to raaga subsystem. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/8 11/10/11 11:05a gprasad |
|---|
| 24 | * SW7422-400: Please add hooks to support dumping the UART debug buffer |
|---|
| 25 | * into DRAM |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/7 8/25/11 4:05p gprasad |
|---|
| 28 | * SW7422-400: Updating the APIs with review comments |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/6 8/18/11 12:53p gprasad |
|---|
| 31 | * SW7422-400: Updating the APIs with review comments |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/5 7/4/11 6:35p gprasad |
|---|
| 34 | * SW7422-400: Please add hooks to support dumping the UART debug buffer |
|---|
| 35 | * into DRAM |
|---|
| 36 | * |
|---|
| 37 | * Hydra_Software_Devel/4 4/29/11 11:45a srajapur |
|---|
| 38 | * SW7422-368 : [7422] BDSP_AudioTask_GetDefaultXxxSettings is Raaga- |
|---|
| 39 | * specific ---------> Moved raaga specific API from common files to |
|---|
| 40 | * raaga files and renamed the API's accordingly. |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/3 4/27/11 5:08p srajapur |
|---|
| 43 | * SW7422-419 : [7425] Added BDSP_Raaga_GetDownloadStatus and |
|---|
| 44 | * BDSP_Raaga_Initialize API to support authentication |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/2 4/12/11 2:24p srajapur |
|---|
| 47 | * SW7422-419:[7425]Adding BDSP_Raaga_GetFwDwnldInfo and |
|---|
| 48 | * BDSP_Raaga_StartDsp API to support authentication |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/1 4/6/11 2:27p srajapur |
|---|
| 51 | * SW7425-291: [7425]BDSP directory structure changes |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/4 1/19/11 7:14a gautamk |
|---|
| 54 | * SW7422-191: Various DSP Basmodules features and review comment |
|---|
| 55 | * implementation |
|---|
| 56 | * |
|---|
| 57 | * Hydra_Software_Devel/3 1/18/11 4:22a gautamk |
|---|
| 58 | * SW7125-766: Added code for review comments. |
|---|
| 59 | * |
|---|
| 60 | * Hydra_Software_Devel/2 12/15/10 6:47p jgarrett |
|---|
| 61 | * SW7422-146: Initial compileable prototype |
|---|
| 62 | * |
|---|
| 63 | * Hydra_Software_Devel/1 12/14/10 2:17p jgarrett |
|---|
| 64 | * SW7422-146: Adding initial API for APE/DSP |
|---|
| 65 | * |
|---|
| 66 | ***************************************************************************/ |
|---|
| 67 | |
|---|
| 68 | #ifndef BDSP_RAAGA_H_ |
|---|
| 69 | #define BDSP_RAAGA_H_ |
|---|
| 70 | |
|---|
| 71 | #include "bchp.h" |
|---|
| 72 | #include "bint.h" |
|---|
| 73 | #include "bmem.h" |
|---|
| 74 | #include "breg_mem.h" |
|---|
| 75 | #include "btmr.h" |
|---|
| 76 | #include "bimg.h" |
|---|
| 77 | #include "bdsp_types.h" |
|---|
| 78 | #include "bdsp.h" |
|---|
| 79 | |
|---|
| 80 | /*************************************************************************** |
|---|
| 81 | Summary: |
|---|
| 82 | This enumeration defines various debug features that can be enabled in the firmware. |
|---|
| 83 | |
|---|
| 84 | ***************************************************************************/ |
|---|
| 85 | typedef enum BDSP_Raaga_DebugType |
|---|
| 86 | { |
|---|
| 87 | BDSP_Raaga_DebugType_eDramMsg = 0, |
|---|
| 88 | BDSP_Raaga_DebugType_eUart, |
|---|
| 89 | BDSP_Raaga_DebugType_eCoreDump, |
|---|
| 90 | BDSP_Raaga_DebugType_eTargetPrintf, |
|---|
| 91 | BDSP_Raaga_DebugType_eLast, |
|---|
| 92 | BDSP_Raaga_DebugType_eInvalid = 0xFF |
|---|
| 93 | } BDSP_Raaga_DebugType; |
|---|
| 94 | |
|---|
| 95 | /*************************************************************************** |
|---|
| 96 | Summary: |
|---|
| 97 | Raaga Debug Type Settings |
|---|
| 98 | ***************************************************************************/ |
|---|
| 99 | typedef struct BDSP_Raaga_DebugTypeSettings |
|---|
| 100 | { |
|---|
| 101 | bool enabled; /* If true, debug of this type is enabled. */ |
|---|
| 102 | uint32_t bufferSize; /* Size of debug buffer (in bytes) for a particular type of debug. |
|---|
| 103 | Only required if you want to override the default value. */ |
|---|
| 104 | } BDSP_Raaga_DebugTypeSettings; |
|---|
| 105 | |
|---|
| 106 | /*************************************************************************** |
|---|
| 107 | Summary: |
|---|
| 108 | Raaga DSP Status |
|---|
| 109 | ***************************************************************************/ |
|---|
| 110 | typedef enum BDSP_Raaga_FwStatus |
|---|
| 111 | { |
|---|
| 112 | BDSP_Raaga_FwStatus_eRunnning = 0, |
|---|
| 113 | BDSP_Raaga_FwStatus_eCoreDumpInProgress, |
|---|
| 114 | BDSP_Raaga_FwStatus_eCoreDumpComplete, |
|---|
| 115 | BDSP_Raaga_FwStatus_eInvalid = 0xFF |
|---|
| 116 | } BDSP_Raaga_FwStatus; |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | /*************************************************************************** |
|---|
| 120 | Summary: |
|---|
| 121 | Raaga DSP Settings |
|---|
| 122 | ***************************************************************************/ |
|---|
| 123 | typedef struct BDSP_RaagaSettings |
|---|
| 124 | { |
|---|
| 125 | bool authenticationEnabled; /* If authentication is enabled, all the firmware execs needs to be downloaded at open time and |
|---|
| 126 | the DSP must be booted via a separate call to BDSP_Raaga_Boot() after HSM has been authenticated. */ |
|---|
| 127 | |
|---|
| 128 | bool preloadImages; /* If true, all firmware images will be loaded on startup. Default=false. */ |
|---|
| 129 | |
|---|
| 130 | BDSP_Raaga_DebugTypeSettings debugSettings[BDSP_Raaga_DebugType_eLast]; /* Debug information for the different types of debug logs */ |
|---|
| 131 | |
|---|
| 132 | BMEM_Heap_Handle firmwareHeap; /* Optional, this is the heap handle the firmware itself will be loaded into if |
|---|
| 133 | specified otherwise the heap specified in the open call will be used */ |
|---|
| 134 | |
|---|
| 135 | const BIMG_Interface *pImageInterface; /* Interface to access firmware image. This interface must be |
|---|
| 136 | implemented and the function pointers must be stored here. */ |
|---|
| 137 | |
|---|
| 138 | void **pImageContext; /* Context for the Image Interface. This is also provided by |
|---|
| 139 | the implementation of the Image interface */ |
|---|
| 140 | } BDSP_RaagaSettings; |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | /*************************************************************************** |
|---|
| 144 | Summary: |
|---|
| 145 | Firmware download status. |
|---|
| 146 | ***************************************************************************/ |
|---|
| 147 | typedef struct BDSP_Raaga_DownloadStatus |
|---|
| 148 | { |
|---|
| 149 | void *pBaseAddress; /* Pointer to base of downloaded firmware executables */ |
|---|
| 150 | uint32_t physicalAddress; /* Physical memory offset of downloaded firmware executables */ |
|---|
| 151 | size_t length; /* Length of executables in bytes */ |
|---|
| 152 | } BDSP_Raaga_DownloadStatus; |
|---|
| 153 | |
|---|
| 154 | /*************************************************************************** |
|---|
| 155 | Summary: |
|---|
| 156 | Get Default DSP Context Settings |
|---|
| 157 | ***************************************************************************/ |
|---|
| 158 | void BDSP_Raaga_GetDefaultSettings( |
|---|
| 159 | BDSP_RaagaSettings *pSettings /* [out] */ |
|---|
| 160 | ); |
|---|
| 161 | |
|---|
| 162 | /*************************************************************************** |
|---|
| 163 | Summary: |
|---|
| 164 | Open a Raaga DSP |
|---|
| 165 | |
|---|
| 166 | Description: |
|---|
| 167 | Opens a Raaga DSP device |
|---|
| 168 | |
|---|
| 169 | See Also: |
|---|
| 170 | BDSP_Close |
|---|
| 171 | ***************************************************************************/ |
|---|
| 172 | BERR_Code BDSP_Raaga_Open( |
|---|
| 173 | BDSP_Handle *pDsp, /* [out] */ |
|---|
| 174 | BCHP_Handle chpHandle, |
|---|
| 175 | BREG_Handle regHandle, |
|---|
| 176 | BMEM_Handle memHandle, |
|---|
| 177 | BINT_Handle intHandle, |
|---|
| 178 | BTMR_Handle tmrHandle, |
|---|
| 179 | const BDSP_RaagaSettings *pSettings |
|---|
| 180 | ); |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | /*************************************************************************** |
|---|
| 184 | Summary: |
|---|
| 185 | Returns physical memory offset and size of firmware executables. |
|---|
| 186 | |
|---|
| 187 | Description: |
|---|
| 188 | Returns the physical memory offset where firmware executables of all the |
|---|
| 189 | supported algorithms are downloaded in contiguous memory. It |
|---|
| 190 | also returns the total size of the downloaded firmware executables. This |
|---|
| 191 | function is supported only when firmware authentication is enabled. |
|---|
| 192 | |
|---|
| 193 | See also: |
|---|
| 194 | BDSP_Raaga_Initialize |
|---|
| 195 | ***************************************************************************/ |
|---|
| 196 | BERR_Code BDSP_Raaga_GetDownloadStatus( |
|---|
| 197 | BDSP_Handle handle, |
|---|
| 198 | BDSP_Raaga_DownloadStatus *pStatus /* [out] */ |
|---|
| 199 | ); |
|---|
| 200 | |
|---|
| 201 | /*************************************************************************** |
|---|
| 202 | Summary: |
|---|
| 203 | Initialize (Boot) the DSP |
|---|
| 204 | |
|---|
| 205 | Description: |
|---|
| 206 | This call will boot the DSP. Normally, the DSP is booted on initialization, |
|---|
| 207 | but if the DSP was opened with authenticationEnabled = true, this call |
|---|
| 208 | is required to initialize the DSP. |
|---|
| 209 | |
|---|
| 210 | See Also: |
|---|
| 211 | BDSP_Raaga_Open |
|---|
| 212 | ***************************************************************************/ |
|---|
| 213 | BERR_Code BDSP_Raaga_Initialize( |
|---|
| 214 | BDSP_Handle handle |
|---|
| 215 | ); |
|---|
| 216 | |
|---|
| 217 | /****************************************************************************** |
|---|
| 218 | Summary: |
|---|
| 219 | This Function returns true, If the decode algorithm having AlgoId passed as |
|---|
| 220 | argument is supported or not. |
|---|
| 221 | *******************************************************************************/ |
|---|
| 222 | bool BDSP_Raaga_IsAudioTypeSupported( |
|---|
| 223 | BDSP_AudioType audioType); |
|---|
| 224 | |
|---|
| 225 | /****************************************************************************** |
|---|
| 226 | Summary: |
|---|
| 227 | This Function returns true, If the audio processing algorithm having AlgoId |
|---|
| 228 | passed as argument is supported or not. |
|---|
| 229 | *******************************************************************************/ |
|---|
| 230 | bool BDSP_Raaga_IsAudioProcessingSupported( |
|---|
| 231 | BDSP_AudioProcessing audioProcessing); |
|---|
| 232 | |
|---|
| 233 | /****************************************************************************** |
|---|
| 234 | Summary: |
|---|
| 235 | This Function returns true, If the Encode algorithm having AlgoId passed as |
|---|
| 236 | argument is supported or not. |
|---|
| 237 | *******************************************************************************/ |
|---|
| 238 | bool BDSP_Raaga_IsAudioEncodeSupported( |
|---|
| 239 | BDSP_AudioEncode audioEncode); |
|---|
| 240 | |
|---|
| 241 | |
|---|
| 242 | /*************************************************************************** |
|---|
| 243 | Summary: |
|---|
| 244 | Get default Audio codec settings. |
|---|
| 245 | ***************************************************************************/ |
|---|
| 246 | BERR_Code BDSP_Raaga_GetDefaultAudioTypeSettings( |
|---|
| 247 | BDSP_AudioType audioType, |
|---|
| 248 | void *pSettingsBuffer, /* [out] */ |
|---|
| 249 | size_t settingsBufferSize /*[In]*/ |
|---|
| 250 | ); |
|---|
| 251 | |
|---|
| 252 | /*************************************************************************** |
|---|
| 253 | Summary: |
|---|
| 254 | Get default Audio Processing settings. |
|---|
| 255 | ***************************************************************************/ |
|---|
| 256 | |
|---|
| 257 | BERR_Code BDSP_Raaga_GetDefaultAudioProcessingSettings( |
|---|
| 258 | BDSP_AudioProcessing audioProcessingType, |
|---|
| 259 | void *pSettingsBuffer, /* [out] */ |
|---|
| 260 | size_t settingsBufferSize /*[In]*/ |
|---|
| 261 | ); |
|---|
| 262 | |
|---|
| 263 | /*************************************************************************** |
|---|
| 264 | Summary: |
|---|
| 265 | Get default Audio Encode settings. |
|---|
| 266 | ***************************************************************************/ |
|---|
| 267 | BERR_Code BDSP_Raaga_GetDefaultAudioEncodeSettings( |
|---|
| 268 | BDSP_AudioEncode audioEncode, |
|---|
| 269 | void *pSettingsBuffer, /* [out] */ |
|---|
| 270 | size_t settingsBufferSize /*[In]*/ |
|---|
| 271 | ); |
|---|
| 272 | |
|---|
| 273 | /*************************************************************************** |
|---|
| 274 | Summary: |
|---|
| 275 | Get Raaga Firmware Debug Data |
|---|
| 276 | ***************************************************************************/ |
|---|
| 277 | BERR_Code BDSP_Raaga_GetDebugBuffer( |
|---|
| 278 | BDSP_Handle handle, |
|---|
| 279 | BDSP_Raaga_DebugType debugType, /* [in] Gives the type of debug buffer for which the Base address is required ... UART, DRAM, CoreDump ... */ |
|---|
| 280 | uint32_t dspIndex, /* [in] Gives the DSP Id for which the debug buffer info is required */ |
|---|
| 281 | void **pBuffer, /* [out] Base address of the debug buffer data */ |
|---|
| 282 | size_t *pSize /* [out] Contiguous length of the debug buffer data in bytes */ |
|---|
| 283 | ); |
|---|
| 284 | |
|---|
| 285 | /*************************************************************************** |
|---|
| 286 | Summary: |
|---|
| 287 | Consume debug data from the debug ringbuffer. |
|---|
| 288 | ***************************************************************************/ |
|---|
| 289 | BERR_Code BDSP_Raaga_ConsumeDebugData( |
|---|
| 290 | BDSP_Handle handle, |
|---|
| 291 | BDSP_Raaga_DebugType debugType, /* [in] Gives the type of debug buffer for which the Base address is required ... UART, DRAM, CoreDump ... */ |
|---|
| 292 | uint32_t dspIndex, /* [in] Gives the DSP Id for which the debug data needs to be consumed */ |
|---|
| 293 | size_t bytesConsumed /* [in] Number of bytes consumed from the debug buffer */ |
|---|
| 294 | ); |
|---|
| 295 | |
|---|
| 296 | /*************************************************************************** |
|---|
| 297 | Summary: |
|---|
| 298 | Returns the Status of the DSP |
|---|
| 299 | ***************************************************************************/ |
|---|
| 300 | BDSP_Raaga_FwStatus BDSP_Raaga_GetCoreDumpStatus ( |
|---|
| 301 | BDSP_Handle handle, |
|---|
| 302 | uint32_t dspIndex); /* [in] Gives the DSP Id for which the core dump status is required */ |
|---|
| 303 | |
|---|
| 304 | #endif |
|---|
| 305 | |
|---|