1 /********************************************************************
2 * Copyright(c) 2006-2009 Broadcom Corporation.
6 * Description: Common definitions for all components. Only types
7 * is allowed to be included from this file.
13 ********************************************************************
14 * This header is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License as published
16 * by the Free Software Foundation, either version 2.1 of the License.
18 * This header is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this header. If not, see <http://www.gnu.org/licenses/>.
24 *******************************************************************/
26 #ifndef _BC_DTS_DEFS_H_
27 #define _BC_DTS_DEFS_H_
30 #define BC_BIT(_x) (1 << (_x))
39 BC_STS_INSUFF_RES = 6,
42 BC_STS_VER_MISMATCH = 9,
44 BC_STS_FW_CMD_ERR = 11,
45 BC_STS_DEC_NOT_OPEN = 12,
46 BC_STS_ERR_USAGE = 13,
47 BC_STS_IO_USER_ABORT = 14,
48 BC_STS_IO_XFR_ERROR = 15,
49 BC_STS_DEC_NOT_STARTED = 16,
50 BC_STS_FWHEX_NOT_FOUND = 17,
51 BC_STS_FMT_CHANGE = 18,
52 BC_STS_HIF_ACCESS = 19,
53 BC_STS_CMD_CANCELLED = 20,
54 BC_STS_FW_AUTH_FAILED = 21,
55 BC_STS_BOOTLOADER_FAILED = 22,
56 BC_STS_CERT_VERIFY_ERROR = 23,
57 BC_STS_DEC_EXIST_OPEN = 24,
59 BC_STS_CLK_NOCHG = 26,
61 /* Must be the last one.*/
65 /*------------------------------------------------------*
66 * Registry Key Definitions *
67 *------------------------------------------------------*/
68 #define BC_REG_KEY_MAIN_PATH "Software\\Broadcom\\MediaPC\\70010"
69 #define BC_REG_KEY_FWPATH "FirmwareFilePath"
70 #define BC_REG_KEY_SEC_OPT "DbgOptions"
75 * b[5] = Enable RSA KEY in EEPROM Support
76 * b[6] = Enable Old PIB scheme. (0 = Use PIB with video scheme)
78 * b[12] = Enable send message to NotifyIcon
83 BC_OPT_DOSER_OUT_ENCRYPT = BC_BIT(3),
84 BC_OPT_LINK_OUT_ENCRYPT = BC_BIT(29),
87 struct BC_REG_CONFIG {
91 #if defined(__KERNEL__) || defined(__LINUX_USER__)
93 /* Align data structures */
94 #define ALIGN(x) __declspec(align(x))
98 * b[0]..b[7] = _DtsDeviceOpenMode
100 * b[9] = Load file play back FW
101 * b[10] = Disk format (0 for HD DVD and 1 for BLU ray)
102 * b[11]-b[15] = default output resolution
103 * b[16] = Skip TX CPB Buffer Check
104 * b[17] = Adaptive Output Encrypt/Scramble Scheme
105 * b[18]-b[31] = reserved for future use
108 /* To allow multiple apps to open the device. */
109 enum DtsDeviceOpenMode {
110 DTS_PLAYBACK_MODE = 0,
116 /* To enable the filter to selectively enable/disable fixes or erratas */
117 enum DtsDeviceFixMode {
118 DTS_LOAD_NEW_FW = BC_BIT(8),
119 DTS_LOAD_FILE_PLAY_FW = BC_BIT(9),
120 DTS_DISK_FMT_BD = BC_BIT(10),
121 /* b[11]-b[15] : Default output resolution */
122 DTS_SKIP_TX_CHK_CPB = BC_BIT(16),
123 DTS_ADAPTIVE_OUTPUT_PER = BC_BIT(17),
124 DTS_INTELLIMAP = BC_BIT(18),
125 /* b[19]-b[21] : select clock frequency */
126 DTS_PLAYBACK_DROP_RPT_MODE = BC_BIT(22)
129 #define DTS_DFLT_RESOLUTION(x) (x<<11)
131 #define DTS_DFLT_CLOCK(x) (x<<19)
133 /* F/W File Version corresponding to S/W Releases */
135 /* S/W release: 02.04.02 F/W release 2.12.2.0 */
136 BC_FW_VER_020402 = ((12<<16) | (2<<8) | (0))
139 /*------------------------------------------------------*
140 * Stream Types for DtsOpenDecoder() *
141 *------------------------------------------------------*/
142 enum DtsOpenDecStreamTypes {
143 BC_STREAM_TYPE_ES = 0,
144 BC_STREAM_TYPE_PES = 1,
145 BC_STREAM_TYPE_TS = 2,
146 BC_STREAM_TYPE_ES_TSTAMP = 6,
149 /*------------------------------------------------------*
150 * Video Algorithms for DtsSetVideoParams() *
151 *------------------------------------------------------*/
152 enum DtsSetVideoParamsAlgo {
153 BC_VID_ALGO_H264 = 0,
154 BC_VID_ALGO_MPEG2 = 1,
156 BC_VID_ALGO_VC1MP = 7,
159 /*------------------------------------------------------*
160 * MPEG Extension to the PPB *
161 *------------------------------------------------------*/
162 #define BC_MPEG_VALID_PANSCAN (1)
164 struct BC_PIB_EXT_MPEG {
166 /* Always valid, defaults to picture size if no
167 * sequence display extension in the stream. */
168 uint32_t display_horizontal_size;
169 uint32_t display_vertical_size;
171 /* MPEG_VALID_PANSCAN
172 * Offsets are a copy values from the MPEG stream. */
173 uint32_t offset_count;
174 int32_t horizontal_offset[3];
175 int32_t vertical_offset[3];
178 /*------------------------------------------------------*
179 * H.264 Extension to the PPB *
180 *------------------------------------------------------*/
181 /* Bit definitions for 'other.h264.valid' field */
182 #define H264_VALID_PANSCAN (1)
183 #define H264_VALID_SPS_CROP (2)
184 #define H264_VALID_VUI (4)
186 struct BC_PIB_EXT_H264 {
187 /* 'valid' specifies which fields (or sets of
188 * fields) below are valid. If the corresponding
189 * bit in 'valid' is NOT set then that field(s)
190 * is (are) not initialized. */
193 /* H264_VALID_PANSCAN */
194 uint32_t pan_scan_count;
195 int32_t pan_scan_left[3];
196 int32_t pan_scan_right[3];
197 int32_t pan_scan_top[3];
198 int32_t pan_scan_bottom[3];
200 /* H264_VALID_SPS_CROP */
201 int32_t sps_crop_left;
202 int32_t sps_crop_right;
203 int32_t sps_crop_top;
204 int32_t sps_crop_bottom;
208 uint32_t chroma_bottom;
211 /*------------------------------------------------------*
212 * VC1 Extension to the PPB *
213 *------------------------------------------------------*/
214 #define VC1_VALID_PANSCAN (1)
216 struct BC_PIB_EXT_VC1 {
219 /* Always valid, defaults to picture size if no
220 * sequence display extension in the stream. */
221 uint32_t display_horizontal_size;
222 uint32_t display_vertical_size;
224 /* VC1 pan scan windows */
225 uint32_t num_panscan_windows;
226 int32_t ps_horiz_offset[4];
227 int32_t ps_vert_offset[4];
229 int32_t ps_height[4];
232 /*------------------------------------------------------*
233 * Picture Information Block *
234 *------------------------------------------------------*/
235 #if defined(__LINUX_USER__)
236 /* Values for 'pulldown' field. '0' means no pulldown information
237 * was present for this picture. */
239 vdecNoPulldownInfo = 0,
244 vdecTopBottomTop = 5,
245 vdecBottomTopBottom = 6,
252 /* Values for the 'frame_rate' field. */
254 vdecFrameRateUnknown = 0,
265 /* Values for the 'aspect_ratio' field. */
267 vdecAspectRatioUnknown = 0,
268 vdecAspectRatioSquare,
269 vdecAspectRatio12_11,
270 vdecAspectRatio10_11,
271 vdecAspectRatio16_11,
272 vdecAspectRatio40_33,
273 vdecAspectRatio24_11,
274 vdecAspectRatio20_11,
275 vdecAspectRatio32_11,
276 vdecAspectRatio80_33,
277 vdecAspectRatio18_11,
278 vdecAspectRatio15_11,
279 vdecAspectRatio64_33,
280 vdecAspectRatio160_99,
283 vdecAspectRatio221_1,
284 vdecAspectRatioOther = 255,
287 /* Values for the 'colour_primaries' field. */
289 vdecColourPrimariesUnknown = 0,
290 vdecColourPrimariesBT709,
291 vdecColourPrimariesUnspecified,
292 vdecColourPrimariesReserved,
293 vdecColourPrimariesBT470_2M = 4,
294 vdecColourPrimariesBT470_2BG,
295 vdecColourPrimariesSMPTE170M,
296 vdecColourPrimariesSMPTE240M,
297 vdecColourPrimariesGenericFilm,
300 * @vdecRESOLUTION_CUSTOM: custom
301 * @vdecRESOLUTION_480i: 480i
302 * @vdecRESOLUTION_1080i: 1080i (1920x1080, 60i)
303 * @vdecRESOLUTION_NTSC: NTSC (720x483, 60i)
304 * @vdecRESOLUTION_480p: 480p (720x480, 60p)
305 * @vdecRESOLUTION_720p: 720p (1280x720, 60p)
306 * @vdecRESOLUTION_PAL1: PAL_1 (720x576, 50i)
307 * @vdecRESOLUTION_1080i25: 1080i25 (1920x1080, 50i)
308 * @vdecRESOLUTION_720p50: 720p50 (1280x720, 50p)
309 * @vdecRESOLUTION_576p: 576p (720x576, 50p)
310 * @vdecRESOLUTION_1080i29_97: 1080i (1920x1080, 59.94i)
311 * @vdecRESOLUTION_720p59_94: 720p (1280x720, 59.94p)
312 * @vdecRESOLUTION_SD_DVD: SD DVD (720x483, 60i)
313 * @vdecRESOLUTION_480p656: 480p (720x480, 60p),
314 * output bus width 8 bit, clock 74.25MHz
315 * @vdecRESOLUTION_1080p23_976: 1080p23_976 (1920x1080, 23.976p)
316 * @vdecRESOLUTION_720p23_976: 720p23_976 (1280x720p, 23.976p)
317 * @vdecRESOLUTION_240p29_97: 240p (1440x240, 29.97p )
318 * @vdecRESOLUTION_240p30: 240p (1440x240, 30p)
319 * @vdecRESOLUTION_288p25: 288p (1440x288p, 25p)
320 * @vdecRESOLUTION_1080p29_97: 1080p29_97 (1920x1080, 29.97p)
321 * @vdecRESOLUTION_1080p30: 1080p30 (1920x1080, 30p)
322 * @vdecRESOLUTION_1080p24: 1080p24 (1920x1080, 24p)
323 * @vdecRESOLUTION_1080p25: 1080p25 (1920x1080, 25p)
324 * @vdecRESOLUTION_720p24: 720p24 (1280x720, 25p)
325 * @vdecRESOLUTION_720p29_97: 720p29.97 (1280x720, 29.97p)
326 * @vdecRESOLUTION_480p23_976: 480p23.976 (720*480, 23.976)
327 * @vdecRESOLUTION_480p29_97: 480p29.976 (720*480, 29.97p)
328 * @vdecRESOLUTION_576p25: 576p25 (720*576, 25p)
329 * @vdecRESOLUTION_480p0: 480p (720x480, 0p)
330 * @vdecRESOLUTION_480i0: 480i (720x480, 0i)
331 * @vdecRESOLUTION_576p0: 576p (720x576, 0p)
332 * @vdecRESOLUTION_720p0: 720p (1280x720, 0p)
333 * @vdecRESOLUTION_1080p0: 1080p (1920x1080, 0p)
334 * @vdecRESOLUTION_1080i0: 1080i (1920x1080, 0i)
337 vdecRESOLUTION_CUSTOM = 0x00000000,
338 vdecRESOLUTION_480i = 0x00000001,
339 vdecRESOLUTION_1080i = 0x00000002,
340 vdecRESOLUTION_NTSC = 0x00000003,
341 vdecRESOLUTION_480p = 0x00000004,
342 vdecRESOLUTION_720p = 0x00000005,
343 vdecRESOLUTION_PAL1 = 0x00000006,
344 vdecRESOLUTION_1080i25 = 0x00000007,
345 vdecRESOLUTION_720p50 = 0x00000008,
346 vdecRESOLUTION_576p = 0x00000009,
347 vdecRESOLUTION_1080i29_97 = 0x0000000A,
348 vdecRESOLUTION_720p59_94 = 0x0000000B,
349 vdecRESOLUTION_SD_DVD = 0x0000000C,
350 vdecRESOLUTION_480p656 = 0x0000000D,
351 vdecRESOLUTION_1080p23_976 = 0x0000000E,
352 vdecRESOLUTION_720p23_976 = 0x0000000F,
353 vdecRESOLUTION_240p29_97 = 0x00000010,
354 vdecRESOLUTION_240p30 = 0x00000011,
355 vdecRESOLUTION_288p25 = 0x00000012,
356 vdecRESOLUTION_1080p29_97 = 0x00000013,
357 vdecRESOLUTION_1080p30 = 0x00000014,
358 vdecRESOLUTION_1080p24 = 0x00000015,
359 vdecRESOLUTION_1080p25 = 0x00000016,
360 vdecRESOLUTION_720p24 = 0x00000017,
361 vdecRESOLUTION_720p29_97 = 0x00000018,
362 vdecRESOLUTION_480p23_976 = 0x00000019,
363 vdecRESOLUTION_480p29_97 = 0x0000001A,
364 vdecRESOLUTION_576p25 = 0x0000001B,
365 /* For Zero Frame Rate */
366 vdecRESOLUTION_480p0 = 0x0000001C,
367 vdecRESOLUTION_480i0 = 0x0000001D,
368 vdecRESOLUTION_576p0 = 0x0000001E,
369 vdecRESOLUTION_720p0 = 0x0000001F,
370 vdecRESOLUTION_1080p0 = 0x00000020,
371 vdecRESOLUTION_1080i0 = 0x00000021,
374 /* Bit definitions for 'flags' field */
375 #define VDEC_FLAG_EOS (0x0004)
377 #define VDEC_FLAG_FRAME (0x0000)
378 #define VDEC_FLAG_FIELDPAIR (0x0008)
379 #define VDEC_FLAG_TOPFIELD (0x0010)
380 #define VDEC_FLAG_BOTTOMFIELD (0x0018)
382 #define VDEC_FLAG_PROGRESSIVE_SRC (0x0000)
383 #define VDEC_FLAG_INTERLACED_SRC (0x0020)
384 #define VDEC_FLAG_UNKNOWN_SRC (0x0040)
386 #define VDEC_FLAG_BOTTOM_FIRST (0x0080)
387 #define VDEC_FLAG_LAST_PICTURE (0x0100)
389 #define VDEC_FLAG_PICTURE_META_DATA_PRESENT (0x40000)
391 #endif /* __LINUX_USER__ */
393 enum _BC_OUTPUT_FORMAT {
399 * struct BC_PIC_INFO_BLOCK
400 * @timeStam;: Timestamp
401 * @picture_number: Ordinal display number
404 * @chroma_format: 0x420, 0x422 or 0x444
405 * @n_drop;: number of non-reference frames
406 * remaining to be dropped
408 struct BC_PIC_INFO_BLOCK {
411 uint32_t picture_number;
414 uint32_t chroma_format;
418 uint32_t aspect_ratio;
419 uint32_t colour_primaries;
420 uint32_t picture_meta_payload;
423 uint32_t custom_aspect_ratio_width_height;
424 uint32_t n_drop; /* number of non-reference frames
425 remaining to be dropped */
427 /* Protocol-specific extensions. */
429 struct BC_PIB_EXT_H264 h264;
430 struct BC_PIB_EXT_MPEG mpeg;
431 struct BC_PIB_EXT_VC1 vc1;
436 /*------------------------------------------------------*
438 *------------------------------------------------------*/
441 * enum POUT_OPTIONAL_IN_FLAGS - Optional flags for ProcOut Interface.
442 * @BC_POUT_FLAGS_YV12: Copy Data in YV12 format
443 * @BC_POUT_FLAGS_STRIDE: Stride size is valid.
444 * @BC_POUT_FLAGS_SIZE: Take size information from Application
445 * @BC_POUT_FLAGS_INTERLACED: copy only half the bytes
446 * @BC_POUT_FLAGS_INTERLEAVED: interleaved frame
447 * @: * @BC_POUT_FLAGS_FMT_CHANGE: Data is not VALID when this flag is set
448 * @BC_POUT_FLAGS_PIB_VALID: PIB Information valid
449 * @BC_POUT_FLAGS_ENCRYPTED: Data is encrypted.
450 * @BC_POUT_FLAGS_FLD_BOT: Bottom Field data
452 enum POUT_OPTIONAL_IN_FLAGS_ {
453 /* Flags from App to Device */
454 BC_POUT_FLAGS_YV12 = 0x01,
455 BC_POUT_FLAGS_STRIDE = 0x02,
456 BC_POUT_FLAGS_SIZE = 0x04,
457 BC_POUT_FLAGS_INTERLACED = 0x08,
458 BC_POUT_FLAGS_INTERLEAVED = 0x10,
460 /* Flags from Device to APP */
461 BC_POUT_FLAGS_FMT_CHANGE = 0x10000,
462 BC_POUT_FLAGS_PIB_VALID = 0x20000,
463 BC_POUT_FLAGS_ENCRYPTED = 0x40000,
464 BC_POUT_FLAGS_FLD_BOT = 0x80000,
467 typedef enum BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width,
468 uint32_t height, uint32_t stride, void *pOut);
470 /* Line 21 Closed Caption */
472 #define MAX_UD_SIZE 1792 /* 1920 - 128 */
475 * struct BC_DTS_PROC_OUT
476 * @Ybuff: Caller Supplied buffer for Y data
477 * @YbuffSz: Caller Supplied Y buffer size
478 * @YBuffDoneSz: Transferred Y datasize
479 * @*UVbuff: Caller Supplied buffer for UV data
480 * @UVbuffSz: Caller Supplied UV buffer size
481 * @UVBuffDoneSz: Transferred UV data size
482 * @StrideSz: Caller supplied Stride Size
483 * @PoutFlags: Call IN Flags
484 * @discCnt: Picture discontinuity count
485 * @PicInfo: Picture Information Block Data
486 * @b422Mode: Picture output Mode
487 * @bPibEnc: PIB encrypted
489 struct BC_DTS_PROC_OUT {
492 uint32_t YBuffDoneSz;
496 uint32_t UVBuffDoneSz;
503 struct BC_PIC_INFO_BLOCK PicInfo;
505 /* Line 21 Closed Caption */
508 uint8_t UserData[MAX_UD_SIZE];
511 dts_pout_callback AppCallBack;
515 uint8_t bRevertScramble;
519 * struct BC_DTS_STATUS
520 * @ReadyListCount: Number of frames in ready list (reported by driver)
521 * @PowerStateChange: Number of active state power
522 * transitions (reported by driver)
523 * @FramesDropped: Number of frames dropped. (reported by DIL)
524 * @FramesCaptured: Number of frames captured. (reported by DIL)
525 * @FramesRepeated: Number of frames repeated. (reported by DIL)
526 * @InputCount: Times compressed video has been sent to the HW.
527 * i.e. Successful DtsProcInput() calls (reported by DIL)
528 * @InputTotalSize: Amount of compressed video that has been sent to the HW.
530 * @InputBusyCount: Times compressed video has attempted to be sent to the HW
531 * but the input FIFO was full. (reported by DIL)
532 * @PIBMissCount: Amount of times a PIB is invalid. (reported by DIL)
533 * @cpbEmptySize: supported only for H.264, specifically changed for
534 * Adobe. Report size of CPB buffer available. (reported by DIL)
535 * @NextTimeStamp: TimeStamp of the next picture that will be returned
536 * by a call to ProcOutput. Added for Adobe. Reported
537 * back from the driver
539 struct BC_DTS_STATUS {
540 uint8_t ReadyListCount;
541 uint8_t FreeListCount;
542 uint8_t PowerStateChange;
543 uint8_t reserved_[1];
544 uint32_t FramesDropped;
545 uint32_t FramesCaptured;
546 uint32_t FramesRepeated;
548 uint64_t InputTotalSize;
549 uint32_t InputBusyCount;
550 uint32_t PIBMissCount;
551 uint32_t cpbEmptySize;
552 uint64_t NextTimeStamp;
553 uint8_t reserved__[16];
556 #define BC_SWAP32(_v) \
557 ((((_v) & 0xFF000000)>>24)| \
558 (((_v) & 0x00FF0000)>>8)| \
559 (((_v) & 0x0000FF00)<<8)| \
560 (((_v) & 0x000000FF)<<24))
562 #define WM_AGENT_TRAYICON_DECODER_OPEN 10001
563 #define WM_AGENT_TRAYICON_DECODER_CLOSE 10002
564 #define WM_AGENT_TRAYICON_DECODER_START 10003
565 #define WM_AGENT_TRAYICON_DECODER_STOP 10004
566 #define WM_AGENT_TRAYICON_DECODER_RUN 10005
567 #define WM_AGENT_TRAYICON_DECODER_PAUSE 10006
570 #endif /* _BC_DTS_DEFS_H_ */