| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-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: bxvd_intr.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/79 $ |
|---|
| 12 | * $brcm_Date: 10/20/11 4:30p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * See code |
|---|
| 16 | * |
|---|
| 17 | * Revision History: |
|---|
| 18 | * |
|---|
| 19 | * $brcm_Log: /magnum/portinginterface/xvd/7401/bxvd_intr.c $ |
|---|
| 20 | * |
|---|
| 21 | * Hydra_Software_Devel/79 10/20/11 4:30p davidp |
|---|
| 22 | * SW7335-1364: Add bDecodeError to BXVD_StillPictureBuffers, set true if |
|---|
| 23 | * error occured during still decode. |
|---|
| 24 | * |
|---|
| 25 | * Hydra_Software_Devel/78 6/8/11 1:04p btosi |
|---|
| 26 | * SW7425-542: moved the delivery/release queue management macros to the |
|---|
| 27 | * platform files |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/77 7/13/10 4:25p davidp |
|---|
| 30 | * SW7405-4628: Remove seq header callback support, add stereo seq error |
|---|
| 31 | * callback support. |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/76 2/25/10 4:24p nilesh |
|---|
| 34 | * SW7405-2993: XDM Merge |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/75 1/6/10 2:28p btosi |
|---|
| 37 | * SW7405-3137: merged branch into mainline |
|---|
| 38 | * |
|---|
| 39 | * Hydra_Software_Devel/74 11/30/09 4:41p btosi |
|---|
| 40 | * SW7405-3245: added BXVD_DBG_* macros. Map to either BDBG_INSTANCE_* or |
|---|
| 41 | * BDBG_* at compile. |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/73 10/7/09 10:28a nilesh |
|---|
| 44 | * SW7405-2991: Added VC1 source size --> display size SAR-based scaling |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/72 9/30/09 3:15p nilesh |
|---|
| 47 | * SW7405-3085: Target source polarity synchronization now only occurs if |
|---|
| 48 | * there are multiple active decodes targeted for the same display |
|---|
| 49 | * interrupt. |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/71 9/29/09 2:11p nilesh |
|---|
| 52 | * SW7405-3085: The target source polarity for interlaced mosaic channels |
|---|
| 53 | * on a progressive display is now synchronized |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/70 9/3/09 3:04p davidp |
|---|
| 56 | * SW7405-2929: Remove debug printf. |
|---|
| 57 | * |
|---|
| 58 | * Hydra_Software_Devel/69 9/3/09 12:22p davidp |
|---|
| 59 | * SW7405-2929: Return aspect ratio related data in |
|---|
| 60 | * BXVD_StillPictureBuffers. |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/68 9/1/09 4:47p davidp |
|---|
| 63 | * SW7405-2963: Add support to printout AVD FW log in PDR_isr. |
|---|
| 64 | * |
|---|
| 65 | * Hydra_Software_Devel/67 6/25/09 6:05p davidp |
|---|
| 66 | * PR56375: Remove unneeded callback for AVD FW command processing. This |
|---|
| 67 | * fixes the polled debug method of cmd acknowledgement. |
|---|
| 68 | * |
|---|
| 69 | * Hydra_Software_Devel/66 3/26/09 6:13p nilesh |
|---|
| 70 | * PR53580: Cleaned up DM structs |
|---|
| 71 | * |
|---|
| 72 | * Hydra_Software_Devel/65 1/27/09 1:48p nilesh |
|---|
| 73 | * PR51621: Resolved possible global variable naming conflict by either |
|---|
| 74 | * explicitly declaring globals as static (where possible) or adding |
|---|
| 75 | * BXVD_P_ prefix |
|---|
| 76 | * |
|---|
| 77 | * Hydra_Software_Devel/64 1/21/09 3:11p nilesh |
|---|
| 78 | * PR45052: Converted BDBG_xxx to BDBG_INSTANCE_xxx calls to support |
|---|
| 79 | * multiple channels |
|---|
| 80 | * |
|---|
| 81 | * Hydra_Software_Devel/63 12/19/08 12:04p btosi |
|---|
| 82 | * PR50241: added support for "OpenChannel" initialization, cleaned up DM |
|---|
| 83 | * API |
|---|
| 84 | * |
|---|
| 85 | * Hydra_Software_Devel/62 12/17/08 2:33p btosi |
|---|
| 86 | * PR50241: removed the extraneous DM function declarations |
|---|
| 87 | * |
|---|
| 88 | * Hydra_Software_Devel/61 8/20/08 4:24p davidp |
|---|
| 89 | * PR45783: Set VDC picture parameter ChannelId to VDCRectangleNum after |
|---|
| 90 | * calling DM. |
|---|
| 91 | * |
|---|
| 92 | * Hydra_Software_Devel/60 6/25/08 2:57p davidp |
|---|
| 93 | * PR42177: Remove reset740x call in watchdog isr. |
|---|
| 94 | * |
|---|
| 95 | * Hydra_Software_Devel/59 5/14/08 12:31p davidp |
|---|
| 96 | * PR21390: Add support for Aegis VICH interrupts. |
|---|
| 97 | * |
|---|
| 98 | * Hydra_Software_Devel/58 3/25/08 5:20p davidp |
|---|
| 99 | * PR40316: Merge branch PR40316 changes to mainline, update CABAC bin |
|---|
| 100 | * sizes per FW doc. |
|---|
| 101 | * |
|---|
| 102 | * Hydra_Software_Devel/PR40316/1 3/18/08 6:12p davidp |
|---|
| 103 | * PR40316: FW now quietly stops after each still picture is decoded. |
|---|
| 104 | * Remove explicit stop, release PPB in DecodeStillPicture routine. |
|---|
| 105 | * |
|---|
| 106 | * Hydra_Software_Devel/57 3/17/08 5:30p davidp |
|---|
| 107 | * PR40316: Add still picture source type and buffer type to |
|---|
| 108 | * BXVD_StillPictureBuffers data being returned in callback. |
|---|
| 109 | * |
|---|
| 110 | * Hydra_Software_Devel/56 1/15/08 5:21p davidp |
|---|
| 111 | * PR38735: Add BXVD_LinkDecoders/UnlinkDecoders and associated data |
|---|
| 112 | * structures. |
|---|
| 113 | * |
|---|
| 114 | * Hydra_Software_Devel/55 9/19/07 1:12p davidp |
|---|
| 115 | * PR35058: Test hXvd for NULL before dereferencing in |
|---|
| 116 | * BXVD_P_WatchdogInterrupt_isr. |
|---|
| 117 | * |
|---|
| 118 | * Hydra_Software_Devel/54 9/11/07 3:30p davidp |
|---|
| 119 | * PR22327: Once a decode is started on a channel, DM must be called, even |
|---|
| 120 | * if the decoder is stopped on that channel. |
|---|
| 121 | * |
|---|
| 122 | * Hydra_Software_Devel/53 8/30/07 12:20p nilesh |
|---|
| 123 | * PR34430: Channel specific heaps are now used for address conversion |
|---|
| 124 | * |
|---|
| 125 | * Hydra_Software_Devel/52 8/22/07 11:50a nilesh |
|---|
| 126 | * PR34240: Support moving eDisplayInterrupt and uiVDCRectangleNumber |
|---|
| 127 | * settings from BXVD_ChannelSettings to BXVD_DecodeSettings |
|---|
| 128 | * |
|---|
| 129 | * Hydra_Software_Devel/51 8/21/07 7:15p nilesh |
|---|
| 130 | * PR22327: Changed PicDataReady interrupt behavior to the following: |
|---|
| 131 | * - If no channels are open or no channels are decoding, XVD delivers |
|---|
| 132 | * a single muted picture to the VDC callback that has the correct |
|---|
| 133 | * polarity |
|---|
| 134 | * - Otherwise, a picture list will contain pictures of only channels |
|---|
| 135 | * that are actively decoding |
|---|
| 136 | * |
|---|
| 137 | * Hydra_Software_Devel/50 8/21/07 4:21p davidp |
|---|
| 138 | * PR34052: Access PCROffset_STC register thru platformInfo.stReg |
|---|
| 139 | * structure. |
|---|
| 140 | * |
|---|
| 141 | * Hydra_Software_Devel/49 8/21/07 3:04p davidp |
|---|
| 142 | * PR34052: Remove nolonger used register addr pointers from BXVD_Handle, |
|---|
| 143 | * use platform_info.stReg structure to reference registers |
|---|
| 144 | * |
|---|
| 145 | * Hydra_Software_Devel/48 8/13/07 4:08p nilesh |
|---|
| 146 | * PR29915: Multi-decode merge to mainline |
|---|
| 147 | * |
|---|
| 148 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/16 8/10/07 2:27p davidp |
|---|
| 149 | * PR29915: Prevent inserting two BAVC_XVD_Picture items with the same |
|---|
| 150 | * rectangle number in picture list being sent back to app for VDC. |
|---|
| 151 | * |
|---|
| 152 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/15 8/10/07 1:02p davidp |
|---|
| 153 | * PR29915: Move VDCRectangleNum from BXVD_StartDecode settings to |
|---|
| 154 | * BXVD_OpenChannel settings. |
|---|
| 155 | * |
|---|
| 156 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/14 8/7/07 3:45p davidp |
|---|
| 157 | * PR29915: Order picture list being sent back to app for VDC to use. |
|---|
| 158 | * |
|---|
| 159 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/13 7/25/07 1:36p nilesh |
|---|
| 160 | * PR29915: Cleaned up bxvd_priv.h and bxvd_vdec_info.h constants to match |
|---|
| 161 | * XVD coding style |
|---|
| 162 | * |
|---|
| 163 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/12 7/24/07 12:55p nilesh |
|---|
| 164 | * PR29915: Added BXVD_DeviceInterrupt_eDisplayInterrupt support from |
|---|
| 165 | * mainline |
|---|
| 166 | * |
|---|
| 167 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/11 7/19/07 5:17p nilesh |
|---|
| 168 | * PR29915: Fixed stripe_width value in still picture buffer |
|---|
| 169 | * |
|---|
| 170 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/10 6/28/07 1:36p davidp |
|---|
| 171 | * PR29915: Move remaining data structure definitions for |
|---|
| 172 | * bxvd_devcmds_priv.h to bxvd_vdec_api.h |
|---|
| 173 | * |
|---|
| 174 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/9 6/27/07 4:58p davidp |
|---|
| 175 | * PR29915: Removed unused data types and data structures per code review. |
|---|
| 176 | * |
|---|
| 177 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/8 6/25/07 6:32p davidp |
|---|
| 178 | * PR29915: Finish adding support for 2nd display device for each decoder |
|---|
| 179 | * |
|---|
| 180 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/7 6/19/07 12:12p nilesh |
|---|
| 181 | * PR29915: Merge from mainline |
|---|
| 182 | * |
|---|
| 183 | * Hydra_Software_Devel/47 5/29/07 5:43p rayshap |
|---|
| 184 | * PR31653: Fix error handling |
|---|
| 185 | * |
|---|
| 186 | * Hydra_Software_Devel/46 5/29/07 5:39p rayshap |
|---|
| 187 | * PR31653: Add return on error condition for early exit |
|---|
| 188 | * |
|---|
| 189 | * Hydra_Software_Devel/45 5/24/07 3:54p nilesh |
|---|
| 190 | * PR30249: Move display interrupt callback to end of Picture Data Ready |
|---|
| 191 | * Interrupt handler |
|---|
| 192 | * |
|---|
| 193 | * Hydra_Software_Devel/44 5/14/07 11:30a nilesh |
|---|
| 194 | * PR30249: Merged UOD 2.x changes to mainline |
|---|
| 195 | * |
|---|
| 196 | * Hydra_Software_Devel/PR30249/1 5/1/07 3:44p nilesh |
|---|
| 197 | * PR30249: Changes to support UOD 2.x development |
|---|
| 198 | * |
|---|
| 199 | * |
|---|
| 200 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/6 6/14/07 1:16p davidp |
|---|
| 201 | * PR29915: Add support for 2nd display device interrupt. |
|---|
| 202 | * |
|---|
| 203 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/5 6/1/07 6:17p davidp |
|---|
| 204 | * PR29915: Add multi-decode support to watchdog processing |
|---|
| 205 | * |
|---|
| 206 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/4 6/1/07 2:20p nilesh |
|---|
| 207 | * PR29915: Still picture release is now delayed and occurs on |
|---|
| 208 | * BXVD_StopDecode() |
|---|
| 209 | * |
|---|
| 210 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/3 5/29/07 5:30p nilesh |
|---|
| 211 | * PR29915: Updated still picture compatibility mode to match discussed |
|---|
| 212 | * design |
|---|
| 213 | * |
|---|
| 214 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/2 5/22/07 5:01p nilesh |
|---|
| 215 | * PR29915: Added still picture support according to FW mosaic API |
|---|
| 216 | * document v2.3 (TODO: Add compatibility mode) |
|---|
| 217 | * |
|---|
| 218 | * Hydra_Software_Devel/xvd_PR29915_Rel_Mosaic_FW_API/1 5/8/07 4:01p davidp |
|---|
| 219 | * PR29915: Add support for multi-decode (channels) |
|---|
| 220 | * |
|---|
| 221 | * Hydra_Software_Devel/43 3/28/07 1:25p pblanco |
|---|
| 222 | * PR27168: Changed hardwired constants to defined constants. |
|---|
| 223 | * |
|---|
| 224 | * Hydra_Software_Devel/42 3/27/07 2:03p pblanco |
|---|
| 225 | * PR27168: Removed deprecated bxvd_mem.h include. |
|---|
| 226 | * |
|---|
| 227 | * Hydra_Software_Devel/41 3/15/07 10:37a pblanco |
|---|
| 228 | * PR27168: Fixed compiler warning caused by previous checkin. |
|---|
| 229 | * |
|---|
| 230 | * Hydra_Software_Devel/40 3/15/07 10:25a pblanco |
|---|
| 231 | * PR27168: Removed deprecated FW command event and associated code. |
|---|
| 232 | * |
|---|
| 233 | * Hydra_Software_Devel/39 12/14/06 3:05p davidp |
|---|
| 234 | * PR25443: Signal FW Cmd done event at the end of mbx_isr routine. |
|---|
| 235 | * |
|---|
| 236 | * Hydra_Software_Devel/38 12/13/06 7:16p davidp |
|---|
| 237 | * PR25443: Remove deprecated API routines and associated data structures. |
|---|
| 238 | * |
|---|
| 239 | * Hydra_Software_Devel/37 12/12/06 3:00p davidp |
|---|
| 240 | * PR25443: Merge Simplified FW API branch into mainline |
|---|
| 241 | * |
|---|
| 242 | * Hydra_Software_Devel/36 12/11/06 2:52p nilesh |
|---|
| 243 | * PR26414: Merge branch PR26414 to mainline |
|---|
| 244 | * |
|---|
| 245 | * Hydra_Software_Devel/PR26414/1 12/8/06 12:20p nilesh |
|---|
| 246 | * PR26414: Fixed race condition when SeqHdr interrupt occurred before XVD |
|---|
| 247 | * copied necessary data from the AVD ChannelOpen response for use by the |
|---|
| 248 | * SeqHdr interrupt handler. |
|---|
| 249 | * |
|---|
| 250 | * Hydra_Software_Devel/35 11/17/06 4:51p nilesh |
|---|
| 251 | * PR25868: Merged authenticated image support to mainline |
|---|
| 252 | * |
|---|
| 253 | * Hydra_Software_Devel/PR25868/2 11/17/06 3:48p nilesh |
|---|
| 254 | * PR25868: Added NULL handle error checking in watchdog routines |
|---|
| 255 | * |
|---|
| 256 | * Hydra_Software_Devel/PR25868/1 11/16/06 3:38p nilesh |
|---|
| 257 | * PR25868: Added authenticated image support |
|---|
| 258 | * |
|---|
| 259 | * Hydra_Software_Devel/34 10/27/06 5:23p davidp |
|---|
| 260 | * PR25098: Fix compiler warning |
|---|
| 261 | * |
|---|
| 262 | * Hydra_Software_Devel/33 10/27/06 4:57p davidp |
|---|
| 263 | * PR25098: Only set mute flag in xvd_to_vdc info structure if channel |
|---|
| 264 | * state is set to mute when decoder is stopped. |
|---|
| 265 | * |
|---|
| 266 | * Hydra_Software_Devel/32 10/13/06 3:20p davidp |
|---|
| 267 | * PR24448: Remove C++ style comment prefix. |
|---|
| 268 | * |
|---|
| 269 | * Hydra_Software_Devel/31 10/12/06 3:01p davidp |
|---|
| 270 | * PR24448: Prevent DM from being called during BXVD_ProcessWathchdog |
|---|
| 271 | * |
|---|
| 272 | * Hydra_Software_Devel/30 9/12/06 3:39p davidp |
|---|
| 273 | * PR24121: Enter critical section after XVD command done event is |
|---|
| 274 | * signaled and before we test the ifBusy flag in SendDecodeCommand(). |
|---|
| 275 | * |
|---|
| 276 | * Hydra_Software_Devel/29 8/1/06 5:58p davidp |
|---|
| 277 | * PR22673: Add verify watchdog fired platform routine. |
|---|
| 278 | * |
|---|
| 279 | * Hydra_Software_Devel/28 7/31/06 7:50p davidp |
|---|
| 280 | * PR22673: Add picture buffer address macros for chip specific use. |
|---|
| 281 | * |
|---|
| 282 | * Hydra_Software_Devel/27 7/18/06 12:10a nilesh |
|---|
| 283 | * PR22673: Code restructure for 97400, 97401 B0, and 97118 |
|---|
| 284 | * |
|---|
| 285 | * Hydra_Software_Devel/PR22673/1 7/17/06 2:33p nilesh |
|---|
| 286 | * PR22673: Restructure on 97401 |
|---|
| 287 | * |
|---|
| 288 | * Hydra_Software_Devel/26 7/17/06 1:56p pblanco |
|---|
| 289 | * PR22673: Removed 7401a0 conditionalized code and restructured some of |
|---|
| 290 | * the remaining conditional code. |
|---|
| 291 | * |
|---|
| 292 | * Hydra_Software_Devel/25 7/11/06 5:06p davidp |
|---|
| 293 | * PR20017: Add FW inner loop Watchdog support, also add platform specific |
|---|
| 294 | * SetupInterrupts routines |
|---|
| 295 | * |
|---|
| 296 | * Hydra_Software_Devel/24 7/6/06 9:41a pblanco |
|---|
| 297 | * PR21943: Fixed conditional compilation for 7401 B0, broken when |
|---|
| 298 | * conditionalizing for 7118. |
|---|
| 299 | * |
|---|
| 300 | * Hydra_Software_Devel/23 7/5/06 3:21p pblanco |
|---|
| 301 | * PR21943: Conditionalization for 7118 |
|---|
| 302 | * |
|---|
| 303 | * Hydra_Software_Devel/22 7/5/06 11:40a davidp |
|---|
| 304 | * PR20017: Fix unref warning for 7400 build |
|---|
| 305 | * |
|---|
| 306 | * Hydra_Software_Devel/21 6/29/06 6:55p davidp |
|---|
| 307 | * PR20017: Enable 7401 B0 watchdog support |
|---|
| 308 | * |
|---|
| 309 | * Hydra_Software_Devel/20 6/21/06 6:13p davidp |
|---|
| 310 | * PR22259: Add Watchdog support and fix a couple problems related to L2 |
|---|
| 311 | * MBX interrupt processing |
|---|
| 312 | * |
|---|
| 313 | * Hydra_Software_Devel/19 6/15/06 4:07p davidp |
|---|
| 314 | * PR20017: Remove references to mmap'd FW heap |
|---|
| 315 | * |
|---|
| 316 | * Hydra_Software_Devel/18 6/14/06 5:18p davidp |
|---|
| 317 | * PR20017: Add 7401 B0 support for MBX, SeqHdr and DecodeStillPicture FW |
|---|
| 318 | * generated interrupts. |
|---|
| 319 | * |
|---|
| 320 | * Hydra_Software_Devel/17 6/8/06 4:31p davidp |
|---|
| 321 | * PR20017: Add support for FW/MIPS cmd mailbox interrupt. |
|---|
| 322 | * |
|---|
| 323 | * Hydra_Software_Devel/16 6/8/06 9:18a pblanco |
|---|
| 324 | * PR20017: Changed chip version test conditionals from A0 and B0 to |
|---|
| 325 | * BCHP_VER_A0 and BCHP_VER_B0 to conform with the rest of magnum. |
|---|
| 326 | * |
|---|
| 327 | * Hydra_Software_Devel/14 5/22/06 5:58p davidp |
|---|
| 328 | * PR21712: Use 7400 decoder specific watchdog timers. |
|---|
| 329 | * |
|---|
| 330 | * Hydra_Software_Devel/12 5/11/06 6:08p davidp |
|---|
| 331 | * PR21532: Created new BXVD_[Un]InstallDeviceInterruptCallback to handle |
|---|
| 332 | * device instance interrupts for DecodeStillPicture and Watchdog. |
|---|
| 333 | * |
|---|
| 334 | * Hydra_Software_Devel/11 5/5/06 2:10p davidp |
|---|
| 335 | * PR21156: Add BXVD_P_ReleasePPB_isr and related _isr routines for DM to |
|---|
| 336 | * use at ISR time. |
|---|
| 337 | * |
|---|
| 338 | * Hydra_Software_Devel/10 4/28/06 2:46p davidp |
|---|
| 339 | * PR20537: Decoder FW was not decoding the last slice. |
|---|
| 340 | * |
|---|
| 341 | * Hydra_Software_Devel/9 4/26/06 1:03p pblanco |
|---|
| 342 | * PR20649: Added a temporary definition for BCHP_XPT_PCROFFSET_STC until |
|---|
| 343 | * the RDB include files are straightened out. |
|---|
| 344 | * |
|---|
| 345 | * Hydra_Software_Devel/8 4/24/06 2:11p davidp |
|---|
| 346 | * PR18043: Add support for Sequence Header interrupt processing |
|---|
| 347 | * |
|---|
| 348 | * Hydra_Software_Devel/7 4/17/06 4:40p davidp |
|---|
| 349 | * PR20906: Add nowait support for 7400 SendDecoderCommand |
|---|
| 350 | * |
|---|
| 351 | * Hydra_Software_Devel/6 4/4/06 3:28p davidp |
|---|
| 352 | * PR20353: Add capture still picture debug support for 7400 |
|---|
| 353 | * |
|---|
| 354 | * Hydra_Software_Devel/5 3/28/06 6:14p davidp |
|---|
| 355 | * PR20353: Add decoder private memory base address to luma/chroma buffer |
|---|
| 356 | * address being returned to app. |
|---|
| 357 | * |
|---|
| 358 | * Hydra_Software_Devel/4 3/27/06 6:33p davidp |
|---|
| 359 | * PR20353: Add Decode Still Picture support for 7400 |
|---|
| 360 | * |
|---|
| 361 | * Hydra_Software_Devel/3 3/22/06 5:16p davidp |
|---|
| 362 | * PR20347: Add L2 interrupt support |
|---|
| 363 | * |
|---|
| 364 | * Hydra_Software_Devel/2 3/8/06 12:48p pblanco |
|---|
| 365 | * PR20077: Cleaned up some of the code... formatting only. |
|---|
| 366 | * |
|---|
| 367 | * Hydra_Software_Devel/1 3/8/06 11:18a pblanco |
|---|
| 368 | * PR20077: Initial checkin. |
|---|
| 369 | * |
|---|
| 370 | ***************************************************************************/ |
|---|
| 371 | #include "bstd.h" /* standard types */ |
|---|
| 372 | #include "bdbg.h" /* Dbglib */ |
|---|
| 373 | #include "bkni.h" /* malloc */ |
|---|
| 374 | #include "btmr.h" |
|---|
| 375 | #include "bxvd_platform.h" |
|---|
| 376 | #include "bxvd.h" |
|---|
| 377 | #include "bavc.h" |
|---|
| 378 | #include "bxvd_img.h" |
|---|
| 379 | #include "bxvd_priv.h" |
|---|
| 380 | #include "bxvd_intr.h" |
|---|
| 381 | #include "bxvd_reg.h" |
|---|
| 382 | #include "bxvd_decoder.h" |
|---|
| 383 | |
|---|
| 384 | #if BXVD_P_FW_DEBUG_DRAM_LOGGING |
|---|
| 385 | #include "bxvd_dbg.h" |
|---|
| 386 | |
|---|
| 387 | #define BXVD_P_LOG_ENTRY_SIZE 80 |
|---|
| 388 | |
|---|
| 389 | static char LogBuf[BXVD_P_LOG_ENTRY_SIZE+4]; |
|---|
| 390 | #endif |
|---|
| 391 | |
|---|
| 392 | BDBG_MODULE(BXVD_INTR); |
|---|
| 393 | |
|---|
| 394 | static void BXVD_S_SetAspectRatio( |
|---|
| 395 | BXVD_P_PPB* pPPB, |
|---|
| 396 | BXVD_StillPictureBuffers *pStillPicBuf |
|---|
| 397 | ) |
|---|
| 398 | { |
|---|
| 399 | BXDM_Picture stXdmPicture; |
|---|
| 400 | |
|---|
| 401 | BDBG_ENTER(BXVD_S_SetAspectRatio); |
|---|
| 402 | |
|---|
| 403 | BXVD_Decoder_P_ComputeAspectRatio( pPPB, &stXdmPicture ); |
|---|
| 404 | |
|---|
| 405 | pStillPicBuf->eAspectRatio = stXdmPicture.stAspectRatio.eAspectRatio; |
|---|
| 406 | pStillPicBuf->uiSampleAspectRatioX = stXdmPicture.stAspectRatio.uiSampleAspectRatioX; |
|---|
| 407 | pStillPicBuf->uiSampleAspectRatioY = stXdmPicture.stAspectRatio.uiSampleAspectRatioY; |
|---|
| 408 | |
|---|
| 409 | if ( false == stXdmPicture.stAspectRatio.bValid ) |
|---|
| 410 | { |
|---|
| 411 | BDBG_MSG(("Unknown protocol/aspect ratio: %d/%#x", pPPB->protocol, pPPB->aspect_ratio)); |
|---|
| 412 | } |
|---|
| 413 | |
|---|
| 414 | BDBG_LEAVE(BXVD_S_SetAspectRatio); |
|---|
| 415 | return; |
|---|
| 416 | |
|---|
| 417 | } /* end of BXVD_S_SetAspectRatio() */ |
|---|
| 418 | |
|---|
| 419 | |
|---|
| 420 | void BXVD_P_AVD_MBX_isr(void *pvXvd, int iParam2) |
|---|
| 421 | { |
|---|
| 422 | BXVD_DecoderContext *pDecCntx = pvXvd; |
|---|
| 423 | |
|---|
| 424 | BDBG_ENTER(BXVD_P_AVD_MBX_isr); |
|---|
| 425 | BSTD_UNUSED(iParam2); |
|---|
| 426 | |
|---|
| 427 | BXVD_DBG_MSG(pDecCntx->hXvd, ("MBX_isr")); |
|---|
| 428 | |
|---|
| 429 | BKNI_SetEvent(pDecCntx->hFWCmdDoneEvent); |
|---|
| 430 | |
|---|
| 431 | BDBG_LEAVE(BXVD_P_AVD_MBX_isr); |
|---|
| 432 | } |
|---|
| 433 | |
|---|
| 434 | void BXVD_P_AVD_StillPictureRdy_isr(void *pvXvd, int iParam2) |
|---|
| 435 | { |
|---|
| 436 | BXVD_DecoderContext *pDecCntx = pvXvd; |
|---|
| 437 | BXVD_Handle hXvd = pDecCntx->hXvd; |
|---|
| 438 | BXVD_ChannelHandle hXvdCh = NULL; |
|---|
| 439 | struct BXVD_P_InterruptCallbackInfo *pCallback; |
|---|
| 440 | BXVD_P_PictureDeliveryQueue *pPictureDeliveryQueue; |
|---|
| 441 | BXVD_P_PPB *pPPB = NULL; |
|---|
| 442 | BXVD_StillPictureBuffers stAppStillPictBuffers; |
|---|
| 443 | |
|---|
| 444 | if (hXvd->bStillChannelAllocated) |
|---|
| 445 | { |
|---|
| 446 | /* Find the still channel handle */ |
|---|
| 447 | hXvdCh = hXvd->ahChannel[hXvd->uiStillChannelNum]; |
|---|
| 448 | } |
|---|
| 449 | |
|---|
| 450 | BDBG_ENTER(BXVD_P_AVD_StillPictureRdy_isr); |
|---|
| 451 | BSTD_UNUSED(iParam2); |
|---|
| 452 | |
|---|
| 453 | if (hXvdCh != NULL) |
|---|
| 454 | { |
|---|
| 455 | uint32_t uiDeliveryQReadOffset; |
|---|
| 456 | |
|---|
| 457 | BXVD_AVD_P_DELIVERY_QUEUE_GET_ADDR( hXvdCh, pPictureDeliveryQueue ); |
|---|
| 458 | BXVD_AVD_P_DELIVERY_QUEUE_GET_READ_OFFSET( hXvdCh, uiDeliveryQReadOffset ); |
|---|
| 459 | |
|---|
| 460 | /* Get picture off of delivery queue */ |
|---|
| 461 | BDBG_ASSERT(hXvdCh->bStillPictureToRelease == false); |
|---|
| 462 | |
|---|
| 463 | /* Decoder stops after still picture is decoded */ |
|---|
| 464 | hXvdCh->eDecoderState = BXVD_P_DecoderState_eNotActive; |
|---|
| 465 | |
|---|
| 466 | hXvd->auiActiveDecodes[hXvdCh->sChSettings.eChannelMode][hXvdCh->eDisplayInterrupt]--; |
|---|
| 467 | |
|---|
| 468 | hXvdCh->bStillPictureToRelease = true; |
|---|
| 469 | hXvdCh->uiStillDisplayElementOffset = (uint32_t)pPictureDeliveryQueue->display_elements[uiDeliveryQReadOffset - BXVD_P_INITIAL_OFFSET_DISPLAY_QUEUE]; |
|---|
| 470 | BMEM_ConvertOffsetToAddress(hXvdCh->hSystemHeap, |
|---|
| 471 | hXvdCh->uiStillDisplayElementOffset, |
|---|
| 472 | (void*) &pPPB); |
|---|
| 473 | |
|---|
| 474 | BXVD_AVD_P_INCREMENT_2BASED_OFFSET( uiDeliveryQReadOffset, 1 ); |
|---|
| 475 | |
|---|
| 476 | BXVD_AVD_P_DELIVERY_QUEUE_SET_READ_OFFSET( hXvdCh, uiDeliveryQReadOffset ); |
|---|
| 477 | |
|---|
| 478 | pCallback = &hXvd->stDeviceInterruptCallbackInfo[BXVD_DeviceInterrupt_eDecodedStillBufferReady]; |
|---|
| 479 | if (pCallback && pCallback->BXVD_P_pAppIntCallbackPtr) |
|---|
| 480 | { |
|---|
| 481 | stAppStillPictBuffers.ulImageWidth = pPPB->video_width; |
|---|
| 482 | stAppStillPictBuffers.ulImageHeight = pPPB->video_height; |
|---|
| 483 | |
|---|
| 484 | switch (pPPB->flags & BXVD_P_PPB_FLAG_SOURCE_TYPE_MASK) |
|---|
| 485 | { |
|---|
| 486 | case BXVD_P_PPB_FLAG_PROGRESSIVE_SRC: |
|---|
| 487 | stAppStillPictBuffers.eSourceType = BXVD_SourceType_eProgressive; |
|---|
| 488 | break; |
|---|
| 489 | case BXVD_P_PPB_FLAG_INTERLACED_SRC: |
|---|
| 490 | stAppStillPictBuffers.eSourceType = BXVD_SourceType_eInterlaced; |
|---|
| 491 | break; |
|---|
| 492 | case BXVD_P_PPB_FLAG_UNKNOWN_SRC: |
|---|
| 493 | stAppStillPictBuffers.eSourceType = BXVD_SourceType_eUnknown; |
|---|
| 494 | break; |
|---|
| 495 | } |
|---|
| 496 | |
|---|
| 497 | switch (pPPB->flags & BXVD_P_PPB_FLAG_BUFFER_TYPE_MASK) |
|---|
| 498 | { |
|---|
| 499 | case BXVD_P_PPB_FLAG_FRAME: |
|---|
| 500 | stAppStillPictBuffers.eBufferType = BXVD_BufferType_eFrame; |
|---|
| 501 | break; |
|---|
| 502 | |
|---|
| 503 | case BXVD_P_PPB_FLAG_FIELDPAIR: |
|---|
| 504 | stAppStillPictBuffers.eBufferType = BXVD_BufferType_eFieldPair; |
|---|
| 505 | break; |
|---|
| 506 | |
|---|
| 507 | case BXVD_P_PPB_FLAG_TOPFIELD: |
|---|
| 508 | stAppStillPictBuffers.eBufferType = BXVD_BufferType_eTopField; |
|---|
| 509 | break; |
|---|
| 510 | |
|---|
| 511 | case BXVD_P_PPB_FLAG_BOTTOMFIELD: |
|---|
| 512 | stAppStillPictBuffers.eBufferType = BXVD_BufferType_eBotField; |
|---|
| 513 | break; |
|---|
| 514 | } |
|---|
| 515 | |
|---|
| 516 | BXVD_DBG_MSG(hXvdCh, ("Still Pic: Width: %d, Height %d", pPPB->video_width, pPPB->video_height)); |
|---|
| 517 | BXVD_DBG_MSG(hXvdCh, ("Still Pic: Source type : %d, Buffer type %d", (pPPB->flags & 0x0c), (pPPB->flags & 0x03))); |
|---|
| 518 | |
|---|
| 519 | BMEM_ConvertOffsetToAddress( hXvdCh->hPictureHeap, (uint32_t)pPPB->luma_video_address, (void *)&stAppStillPictBuffers.pLumaBuffer); |
|---|
| 520 | BMEM_ConvertOffsetToAddress( hXvdCh->hPictureHeap, (uint32_t)pPPB->chroma_video_address, (void *)&stAppStillPictBuffers.pChromaBuffer); |
|---|
| 521 | |
|---|
| 522 | stAppStillPictBuffers.ulStripedWidth = BXVD_P_StripeWidthLUT[hXvd->uiDecode_StripeWidth]; |
|---|
| 523 | stAppStillPictBuffers.ulLumaStripedHeight = pPPB->luma_stripe_height; |
|---|
| 524 | stAppStillPictBuffers.ulChromaStripedHeight = pPPB->chroma_stripe_height; |
|---|
| 525 | |
|---|
| 526 | BXVD_DBG_MSG(hXvdCh, ("Still Pic: LumaStripeHgt: %d, ChromaStripeHgt %d", pPPB->luma_stripe_height, pPPB->chroma_stripe_height)); |
|---|
| 527 | |
|---|
| 528 | BXVD_S_SetAspectRatio(pPPB, &stAppStillPictBuffers); |
|---|
| 529 | |
|---|
| 530 | /* Set decode error when error bit set in PPB */ |
|---|
| 531 | stAppStillPictBuffers.bDecodeError = ((pPPB->flags & BXVD_P_PPB_FLAG_DECODE_ERROR) == BXVD_P_PPB_FLAG_DECODE_ERROR); |
|---|
| 532 | |
|---|
| 533 | pCallback->BXVD_P_pAppIntCallbackPtr(pCallback->pParm1, |
|---|
| 534 | pCallback->parm2, |
|---|
| 535 | &stAppStillPictBuffers); |
|---|
| 536 | |
|---|
| 537 | /* The release of the still picture on the release queue is |
|---|
| 538 | * delayed until the next still picture decode to ensure the |
|---|
| 539 | * contents of this still picture remain intact. See |
|---|
| 540 | * BXVD_StopDecode() for the release code */ |
|---|
| 541 | } |
|---|
| 542 | } |
|---|
| 543 | BDBG_LEAVE(BXVD_P_AVD_StillPictureRdy_isr); |
|---|
| 544 | } |
|---|
| 545 | |
|---|
| 546 | void BXVD_P_WatchdogInterrupt_isr(void *pvXvd, int param2) |
|---|
| 547 | { |
|---|
| 548 | BXVD_Handle hXvd = pvXvd; |
|---|
| 549 | BXVD_ChannelHandle hXvdCh; |
|---|
| 550 | |
|---|
| 551 | uint32_t chanNum; |
|---|
| 552 | bool watchdog_fired; |
|---|
| 553 | |
|---|
| 554 | struct BXVD_P_InterruptCallbackInfo *pCallback; |
|---|
| 555 | |
|---|
| 556 | BDBG_ENTER(BXVD_P_WatchdogInterrupt_isr); |
|---|
| 557 | BXVD_DBG_MSG(hXvd, ("BXVD Watchdog fired!!!")); |
|---|
| 558 | |
|---|
| 559 | if (hXvd != NULL) |
|---|
| 560 | { |
|---|
| 561 | watchdog_fired = BXVD_P_VERIFY_WATCHDOG_FIRED(hXvd, param2); |
|---|
| 562 | |
|---|
| 563 | if (watchdog_fired) |
|---|
| 564 | { |
|---|
| 565 | hXvd->eAVDBootMode = BXVD_AVDBootMode_eWatchdog; |
|---|
| 566 | |
|---|
| 567 | for ( chanNum = 0; chanNum < BXVD_MAX_VIDEO_CHANNELS; chanNum++) |
|---|
| 568 | { |
|---|
| 569 | hXvdCh = hXvd->ahChannel[chanNum]; |
|---|
| 570 | |
|---|
| 571 | if (hXvdCh != NULL) |
|---|
| 572 | { |
|---|
| 573 | /* Only reset DM on Video channels, not Still Picture channel */ |
|---|
| 574 | if (hXvdCh->sChSettings.eChannelMode == BXVD_ChannelMode_eVideo) |
|---|
| 575 | { |
|---|
| 576 | BXDM_PictureProvider_WatchdogReset_isr(hXvdCh->hPictureProvider); |
|---|
| 577 | } |
|---|
| 578 | } |
|---|
| 579 | } |
|---|
| 580 | |
|---|
| 581 | /* Notify application if watchdog callback is registered */ |
|---|
| 582 | pCallback = &hXvd->stDeviceInterruptCallbackInfo[BXVD_DeviceInterrupt_eWatchdog]; |
|---|
| 583 | |
|---|
| 584 | if (pCallback->BXVD_P_pAppIntCallbackPtr) |
|---|
| 585 | { |
|---|
| 586 | pCallback->BXVD_P_pAppIntCallbackPtr(pCallback->pParm1, |
|---|
| 587 | pCallback->parm2, |
|---|
| 588 | 0); |
|---|
| 589 | } |
|---|
| 590 | } |
|---|
| 591 | } |
|---|
| 592 | BDBG_LEAVE(BXVD_P_WatchdogInterrupt_isr); |
|---|
| 593 | } |
|---|
| 594 | |
|---|
| 595 | |
|---|
| 596 | void BXVD_P_VidInstrChkr_isr(void *pvXvd, int param2) |
|---|
| 597 | { |
|---|
| 598 | BXVD_Handle hXvd = pvXvd; |
|---|
| 599 | |
|---|
| 600 | struct BXVD_P_InterruptCallbackInfo *pCallback; |
|---|
| 601 | |
|---|
| 602 | BDBG_ENTER(BXVD_P_VidInstrChkr_isr); |
|---|
| 603 | |
|---|
| 604 | BXVD_DBG_MSG(hXvd, ("BXVD Video Instruction Checker triggered!!!")); |
|---|
| 605 | |
|---|
| 606 | if (hXvd != NULL) |
|---|
| 607 | { |
|---|
| 608 | pCallback = &hXvd->stDeviceInterruptCallbackInfo[BXVD_DeviceInterrupt_eVidInstrChecker]; |
|---|
| 609 | |
|---|
| 610 | if (pCallback->BXVD_P_pAppIntCallbackPtr) |
|---|
| 611 | { |
|---|
| 612 | pCallback->BXVD_P_pAppIntCallbackPtr(pCallback->pParm1, |
|---|
| 613 | pCallback->parm2, |
|---|
| 614 | (void *)¶m2); |
|---|
| 615 | } |
|---|
| 616 | } |
|---|
| 617 | BDBG_LEAVE(BXVD_P_VidInstrChkr_isr); |
|---|
| 618 | } |
|---|
| 619 | |
|---|
| 620 | |
|---|
| 621 | void BXVD_P_StereoSeqError_isr(void *pvXvd, |
|---|
| 622 | int param2) |
|---|
| 623 | { |
|---|
| 624 | BXVD_Handle hXvd = pvXvd; |
|---|
| 625 | |
|---|
| 626 | struct BXVD_P_InterruptCallbackInfo *pCallback; |
|---|
| 627 | |
|---|
| 628 | BDBG_ENTER(BXVD_P_StereoSeqError_isr); |
|---|
| 629 | |
|---|
| 630 | BXVD_DBG_MSG(hXvd, ("BXVD Stereo Sequence Error!!!")); |
|---|
| 631 | |
|---|
| 632 | if (hXvd != NULL) |
|---|
| 633 | { |
|---|
| 634 | pCallback = &hXvd->stDeviceInterruptCallbackInfo[BXVD_DeviceInterrupt_eStereoSeqError]; |
|---|
| 635 | |
|---|
| 636 | if (pCallback->BXVD_P_pAppIntCallbackPtr) |
|---|
| 637 | { |
|---|
| 638 | pCallback->BXVD_P_pAppIntCallbackPtr(pCallback->pParm1, |
|---|
| 639 | pCallback->parm2, |
|---|
| 640 | (void *)¶m2); |
|---|
| 641 | } |
|---|
| 642 | } |
|---|
| 643 | |
|---|
| 644 | BDBG_LEAVE(BXVD_P_StereoSeqError_isr); |
|---|
| 645 | } |
|---|