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_
29 #include <linux/types.h>
32 #define BC_BIT(_x) (1 << (_x))
41 BC_STS_INSUFF_RES
= 6,
44 BC_STS_VER_MISMATCH
= 9,
46 BC_STS_FW_CMD_ERR
= 11,
47 BC_STS_DEC_NOT_OPEN
= 12,
48 BC_STS_ERR_USAGE
= 13,
49 BC_STS_IO_USER_ABORT
= 14,
50 BC_STS_IO_XFR_ERROR
= 15,
51 BC_STS_DEC_NOT_STARTED
= 16,
52 BC_STS_FWHEX_NOT_FOUND
= 17,
53 BC_STS_FMT_CHANGE
= 18,
54 BC_STS_HIF_ACCESS
= 19,
55 BC_STS_CMD_CANCELLED
= 20,
56 BC_STS_FW_AUTH_FAILED
= 21,
57 BC_STS_BOOTLOADER_FAILED
= 22,
58 BC_STS_CERT_VERIFY_ERROR
= 23,
59 BC_STS_DEC_EXIST_OPEN
= 24,
61 BC_STS_CLK_NOCHG
= 26,
63 /* Must be the last one.*/
67 /*------------------------------------------------------*
68 * Registry Key Definitions *
69 *------------------------------------------------------*/
70 #define BC_REG_KEY_MAIN_PATH "Software\\Broadcom\\MediaPC\\70010"
71 #define BC_REG_KEY_FWPATH "FirmwareFilePath"
72 #define BC_REG_KEY_SEC_OPT "DbgOptions"
77 * b[5] = Enable RSA KEY in EEPROM Support
78 * b[6] = Enable Old PIB scheme. (0 = Use PIB with video scheme)
80 * b[12] = Enable send message to NotifyIcon
85 BC_OPT_DOSER_OUT_ENCRYPT
= BC_BIT(3),
86 BC_OPT_LINK_OUT_ENCRYPT
= BC_BIT(29),
89 struct BC_REG_CONFIG
{
93 #if defined(__KERNEL__) || defined(__LINUX_USER__)
95 /* Align data structures */
96 #define ALIGN(x) __declspec(align(x))
100 * b[0]..b[7] = _DtsDeviceOpenMode
102 * b[9] = Load file play back FW
103 * b[10] = Disk format (0 for HD DVD and 1 for BLU ray)
104 * b[11]-b[15] = default output resolution
105 * b[16] = Skip TX CPB Buffer Check
106 * b[17] = Adaptive Output Encrypt/Scramble Scheme
107 * b[18]-b[31] = reserved for future use
110 /* To allow multiple apps to open the device. */
111 enum DtsDeviceOpenMode
{
112 DTS_PLAYBACK_MODE
= 0,
118 /* To enable the filter to selectively enable/disable fixes or erratas */
119 enum DtsDeviceFixMode
{
120 DTS_LOAD_NEW_FW
= BC_BIT(8),
121 DTS_LOAD_FILE_PLAY_FW
= BC_BIT(9),
122 DTS_DISK_FMT_BD
= BC_BIT(10),
123 /* b[11]-b[15] : Default output resolution */
124 DTS_SKIP_TX_CHK_CPB
= BC_BIT(16),
125 DTS_ADAPTIVE_OUTPUT_PER
= BC_BIT(17),
126 DTS_INTELLIMAP
= BC_BIT(18),
127 /* b[19]-b[21] : select clock frequency */
128 DTS_PLAYBACK_DROP_RPT_MODE
= BC_BIT(22)
131 #define DTS_DFLT_RESOLUTION(x) (x<<11)
133 #define DTS_DFLT_CLOCK(x) (x<<19)
135 /* F/W File Version corresponding to S/W Releases */
137 /* S/W release: 02.04.02 F/W release 2.12.2.0 */
138 BC_FW_VER_020402
= ((12<<16) | (2<<8) | (0))
141 /*------------------------------------------------------*
142 * Stream Types for DtsOpenDecoder() *
143 *------------------------------------------------------*/
144 enum DtsOpenDecStreamTypes
{
145 BC_STREAM_TYPE_ES
= 0,
146 BC_STREAM_TYPE_PES
= 1,
147 BC_STREAM_TYPE_TS
= 2,
148 BC_STREAM_TYPE_ES_TSTAMP
= 6,
151 /*------------------------------------------------------*
152 * Video Algorithms for DtsSetVideoParams() *
153 *------------------------------------------------------*/
154 enum DtsSetVideoParamsAlgo
{
155 BC_VID_ALGO_H264
= 0,
156 BC_VID_ALGO_MPEG2
= 1,
158 BC_VID_ALGO_VC1MP
= 7,
161 /*------------------------------------------------------*
162 * MPEG Extension to the PPB *
163 *------------------------------------------------------*/
164 #define BC_MPEG_VALID_PANSCAN (1)
166 struct BC_PIB_EXT_MPEG
{
168 /* Always valid, defaults to picture size if no
169 * sequence display extension in the stream. */
170 uint32_t display_horizontal_size
;
171 uint32_t display_vertical_size
;
173 /* MPEG_VALID_PANSCAN
174 * Offsets are a copy values from the MPEG stream. */
175 uint32_t offset_count
;
176 int32_t horizontal_offset
[3];
177 int32_t vertical_offset
[3];
180 /*------------------------------------------------------*
181 * H.264 Extension to the PPB *
182 *------------------------------------------------------*/
183 /* Bit definitions for 'other.h264.valid' field */
184 #define H264_VALID_PANSCAN (1)
185 #define H264_VALID_SPS_CROP (2)
186 #define H264_VALID_VUI (4)
188 struct BC_PIB_EXT_H264
{
189 /* 'valid' specifies which fields (or sets of
190 * fields) below are valid. If the corresponding
191 * bit in 'valid' is NOT set then that field(s)
192 * is (are) not initialized. */
195 /* H264_VALID_PANSCAN */
196 uint32_t pan_scan_count
;
197 int32_t pan_scan_left
[3];
198 int32_t pan_scan_right
[3];
199 int32_t pan_scan_top
[3];
200 int32_t pan_scan_bottom
[3];
202 /* H264_VALID_SPS_CROP */
203 int32_t sps_crop_left
;
204 int32_t sps_crop_right
;
205 int32_t sps_crop_top
;
206 int32_t sps_crop_bottom
;
210 uint32_t chroma_bottom
;
213 /*------------------------------------------------------*
214 * VC1 Extension to the PPB *
215 *------------------------------------------------------*/
216 #define VC1_VALID_PANSCAN (1)
218 struct BC_PIB_EXT_VC1
{
221 /* Always valid, defaults to picture size if no
222 * sequence display extension in the stream. */
223 uint32_t display_horizontal_size
;
224 uint32_t display_vertical_size
;
226 /* VC1 pan scan windows */
227 uint32_t num_panscan_windows
;
228 int32_t ps_horiz_offset
[4];
229 int32_t ps_vert_offset
[4];
231 int32_t ps_height
[4];
234 /*------------------------------------------------------*
235 * Picture Information Block *
236 *------------------------------------------------------*/
237 #if defined(__LINUX_USER__)
238 /* Values for 'pulldown' field. '0' means no pulldown information
239 * was present for this picture. */
241 vdecNoPulldownInfo
= 0,
246 vdecTopBottomTop
= 5,
247 vdecBottomTopBottom
= 6,
254 /* Values for the 'frame_rate' field. */
256 vdecFrameRateUnknown
= 0,
267 /* Values for the 'aspect_ratio' field. */
269 vdecAspectRatioUnknown
= 0,
270 vdecAspectRatioSquare
,
271 vdecAspectRatio12_11
,
272 vdecAspectRatio10_11
,
273 vdecAspectRatio16_11
,
274 vdecAspectRatio40_33
,
275 vdecAspectRatio24_11
,
276 vdecAspectRatio20_11
,
277 vdecAspectRatio32_11
,
278 vdecAspectRatio80_33
,
279 vdecAspectRatio18_11
,
280 vdecAspectRatio15_11
,
281 vdecAspectRatio64_33
,
282 vdecAspectRatio160_99
,
285 vdecAspectRatio221_1
,
286 vdecAspectRatioOther
= 255,
289 /* Values for the 'colour_primaries' field. */
291 vdecColourPrimariesUnknown
= 0,
292 vdecColourPrimariesBT709
,
293 vdecColourPrimariesUnspecified
,
294 vdecColourPrimariesReserved
,
295 vdecColourPrimariesBT470_2M
= 4,
296 vdecColourPrimariesBT470_2BG
,
297 vdecColourPrimariesSMPTE170M
,
298 vdecColourPrimariesSMPTE240M
,
299 vdecColourPrimariesGenericFilm
,
302 * @vdecRESOLUTION_CUSTOM: custom
303 * @vdecRESOLUTION_480i: 480i
304 * @vdecRESOLUTION_1080i: 1080i (1920x1080, 60i)
305 * @vdecRESOLUTION_NTSC: NTSC (720x483, 60i)
306 * @vdecRESOLUTION_480p: 480p (720x480, 60p)
307 * @vdecRESOLUTION_720p: 720p (1280x720, 60p)
308 * @vdecRESOLUTION_PAL1: PAL_1 (720x576, 50i)
309 * @vdecRESOLUTION_1080i25: 1080i25 (1920x1080, 50i)
310 * @vdecRESOLUTION_720p50: 720p50 (1280x720, 50p)
311 * @vdecRESOLUTION_576p: 576p (720x576, 50p)
312 * @vdecRESOLUTION_1080i29_97: 1080i (1920x1080, 59.94i)
313 * @vdecRESOLUTION_720p59_94: 720p (1280x720, 59.94p)
314 * @vdecRESOLUTION_SD_DVD: SD DVD (720x483, 60i)
315 * @vdecRESOLUTION_480p656: 480p (720x480, 60p),
316 * output bus width 8 bit, clock 74.25MHz
317 * @vdecRESOLUTION_1080p23_976: 1080p23_976 (1920x1080, 23.976p)
318 * @vdecRESOLUTION_720p23_976: 720p23_976 (1280x720p, 23.976p)
319 * @vdecRESOLUTION_240p29_97: 240p (1440x240, 29.97p )
320 * @vdecRESOLUTION_240p30: 240p (1440x240, 30p)
321 * @vdecRESOLUTION_288p25: 288p (1440x288p, 25p)
322 * @vdecRESOLUTION_1080p29_97: 1080p29_97 (1920x1080, 29.97p)
323 * @vdecRESOLUTION_1080p30: 1080p30 (1920x1080, 30p)
324 * @vdecRESOLUTION_1080p24: 1080p24 (1920x1080, 24p)
325 * @vdecRESOLUTION_1080p25: 1080p25 (1920x1080, 25p)
326 * @vdecRESOLUTION_720p24: 720p24 (1280x720, 25p)
327 * @vdecRESOLUTION_720p29_97: 720p29.97 (1280x720, 29.97p)
328 * @vdecRESOLUTION_480p23_976: 480p23.976 (720*480, 23.976)
329 * @vdecRESOLUTION_480p29_97: 480p29.976 (720*480, 29.97p)
330 * @vdecRESOLUTION_576p25: 576p25 (720*576, 25p)
331 * @vdecRESOLUTION_480p0: 480p (720x480, 0p)
332 * @vdecRESOLUTION_480i0: 480i (720x480, 0i)
333 * @vdecRESOLUTION_576p0: 576p (720x576, 0p)
334 * @vdecRESOLUTION_720p0: 720p (1280x720, 0p)
335 * @vdecRESOLUTION_1080p0: 1080p (1920x1080, 0p)
336 * @vdecRESOLUTION_1080i0: 1080i (1920x1080, 0i)
339 vdecRESOLUTION_CUSTOM
= 0x00000000,
340 vdecRESOLUTION_480i
= 0x00000001,
341 vdecRESOLUTION_1080i
= 0x00000002,
342 vdecRESOLUTION_NTSC
= 0x00000003,
343 vdecRESOLUTION_480p
= 0x00000004,
344 vdecRESOLUTION_720p
= 0x00000005,
345 vdecRESOLUTION_PAL1
= 0x00000006,
346 vdecRESOLUTION_1080i25
= 0x00000007,
347 vdecRESOLUTION_720p50
= 0x00000008,
348 vdecRESOLUTION_576p
= 0x00000009,
349 vdecRESOLUTION_1080i29_97
= 0x0000000A,
350 vdecRESOLUTION_720p59_94
= 0x0000000B,
351 vdecRESOLUTION_SD_DVD
= 0x0000000C,
352 vdecRESOLUTION_480p656
= 0x0000000D,
353 vdecRESOLUTION_1080p23_976
= 0x0000000E,
354 vdecRESOLUTION_720p23_976
= 0x0000000F,
355 vdecRESOLUTION_240p29_97
= 0x00000010,
356 vdecRESOLUTION_240p30
= 0x00000011,
357 vdecRESOLUTION_288p25
= 0x00000012,
358 vdecRESOLUTION_1080p29_97
= 0x00000013,
359 vdecRESOLUTION_1080p30
= 0x00000014,
360 vdecRESOLUTION_1080p24
= 0x00000015,
361 vdecRESOLUTION_1080p25
= 0x00000016,
362 vdecRESOLUTION_720p24
= 0x00000017,
363 vdecRESOLUTION_720p29_97
= 0x00000018,
364 vdecRESOLUTION_480p23_976
= 0x00000019,
365 vdecRESOLUTION_480p29_97
= 0x0000001A,
366 vdecRESOLUTION_576p25
= 0x0000001B,
367 /* For Zero Frame Rate */
368 vdecRESOLUTION_480p0
= 0x0000001C,
369 vdecRESOLUTION_480i0
= 0x0000001D,
370 vdecRESOLUTION_576p0
= 0x0000001E,
371 vdecRESOLUTION_720p0
= 0x0000001F,
372 vdecRESOLUTION_1080p0
= 0x00000020,
373 vdecRESOLUTION_1080i0
= 0x00000021,
376 /* Bit definitions for 'flags' field */
377 #define VDEC_FLAG_EOS (0x0004)
379 #define VDEC_FLAG_FRAME (0x0000)
380 #define VDEC_FLAG_FIELDPAIR (0x0008)
381 #define VDEC_FLAG_TOPFIELD (0x0010)
382 #define VDEC_FLAG_BOTTOMFIELD (0x0018)
384 #define VDEC_FLAG_PROGRESSIVE_SRC (0x0000)
385 #define VDEC_FLAG_INTERLACED_SRC (0x0020)
386 #define VDEC_FLAG_UNKNOWN_SRC (0x0040)
388 #define VDEC_FLAG_BOTTOM_FIRST (0x0080)
389 #define VDEC_FLAG_LAST_PICTURE (0x0100)
391 #define VDEC_FLAG_PICTURE_META_DATA_PRESENT (0x40000)
393 #endif /* __LINUX_USER__ */
395 enum _BC_OUTPUT_FORMAT
{
401 * struct BC_PIC_INFO_BLOCK
402 * @timeStam;: Timestamp
403 * @picture_number: Ordinal display number
406 * @chroma_format: 0x420, 0x422 or 0x444
407 * @n_drop;: number of non-reference frames
408 * remaining to be dropped
410 struct BC_PIC_INFO_BLOCK
{
413 uint32_t picture_number
;
416 uint32_t chroma_format
;
420 uint32_t aspect_ratio
;
421 uint32_t colour_primaries
;
422 uint32_t picture_meta_payload
;
425 uint32_t custom_aspect_ratio_width_height
;
426 uint32_t n_drop
; /* number of non-reference frames
427 remaining to be dropped */
429 /* Protocol-specific extensions. */
431 struct BC_PIB_EXT_H264 h264
;
432 struct BC_PIB_EXT_MPEG mpeg
;
433 struct BC_PIB_EXT_VC1 vc1
;
438 /*------------------------------------------------------*
440 *------------------------------------------------------*/
443 * enum POUT_OPTIONAL_IN_FLAGS - Optional flags for ProcOut Interface.
444 * @BC_POUT_FLAGS_YV12: Copy Data in YV12 format
445 * @BC_POUT_FLAGS_STRIDE: Stride size is valid.
446 * @BC_POUT_FLAGS_SIZE: Take size information from Application
447 * @BC_POUT_FLAGS_INTERLACED: copy only half the bytes
448 * @BC_POUT_FLAGS_INTERLEAVED: interleaved frame
449 * @: * @BC_POUT_FLAGS_FMT_CHANGE: Data is not VALID when this flag is set
450 * @BC_POUT_FLAGS_PIB_VALID: PIB Information valid
451 * @BC_POUT_FLAGS_ENCRYPTED: Data is encrypted.
452 * @BC_POUT_FLAGS_FLD_BOT: Bottom Field data
454 enum POUT_OPTIONAL_IN_FLAGS_
{
455 /* Flags from App to Device */
456 BC_POUT_FLAGS_YV12
= 0x01,
457 BC_POUT_FLAGS_STRIDE
= 0x02,
458 BC_POUT_FLAGS_SIZE
= 0x04,
459 BC_POUT_FLAGS_INTERLACED
= 0x08,
460 BC_POUT_FLAGS_INTERLEAVED
= 0x10,
462 /* Flags from Device to APP */
463 BC_POUT_FLAGS_FMT_CHANGE
= 0x10000,
464 BC_POUT_FLAGS_PIB_VALID
= 0x20000,
465 BC_POUT_FLAGS_ENCRYPTED
= 0x40000,
466 BC_POUT_FLAGS_FLD_BOT
= 0x80000,
469 typedef enum BC_STATUS(*dts_pout_callback
)(void *shnd
, uint32_t width
,
470 uint32_t height
, uint32_t stride
, void *pOut
);
472 /* Line 21 Closed Caption */
474 #define MAX_UD_SIZE 1792 /* 1920 - 128 */
477 * struct BC_DTS_PROC_OUT
478 * @Ybuff: Caller Supplied buffer for Y data
479 * @YbuffSz: Caller Supplied Y buffer size
480 * @YBuffDoneSz: Transferred Y datasize
481 * @*UVbuff: Caller Supplied buffer for UV data
482 * @UVbuffSz: Caller Supplied UV buffer size
483 * @UVBuffDoneSz: Transferred UV data size
484 * @StrideSz: Caller supplied Stride Size
485 * @PoutFlags: Call IN Flags
486 * @discCnt: Picture discontinuity count
487 * @PicInfo: Picture Information Block Data
488 * @b422Mode: Picture output Mode
489 * @bPibEnc: PIB encrypted
491 struct BC_DTS_PROC_OUT
{
494 uint32_t YBuffDoneSz
;
498 uint32_t UVBuffDoneSz
;
505 struct BC_PIC_INFO_BLOCK PicInfo
;
507 /* Line 21 Closed Caption */
510 uint8_t UserData
[MAX_UD_SIZE
];
513 dts_pout_callback AppCallBack
;
517 uint8_t bRevertScramble
;
521 * struct BC_DTS_STATUS
522 * @ReadyListCount: Number of frames in ready list (reported by driver)
523 * @PowerStateChange: Number of active state power
524 * transitions (reported by driver)
525 * @FramesDropped: Number of frames dropped. (reported by DIL)
526 * @FramesCaptured: Number of frames captured. (reported by DIL)
527 * @FramesRepeated: Number of frames repeated. (reported by DIL)
528 * @InputCount: Times compressed video has been sent to the HW.
529 * i.e. Successful DtsProcInput() calls (reported by DIL)
530 * @InputTotalSize: Amount of compressed video that has been sent to the HW.
532 * @InputBusyCount: Times compressed video has attempted to be sent to the HW
533 * but the input FIFO was full. (reported by DIL)
534 * @PIBMissCount: Amount of times a PIB is invalid. (reported by DIL)
535 * @cpbEmptySize: supported only for H.264, specifically changed for
536 * Adobe. Report size of CPB buffer available. (reported by DIL)
537 * @NextTimeStamp: TimeStamp of the next picture that will be returned
538 * by a call to ProcOutput. Added for Adobe. Reported
539 * back from the driver
541 struct BC_DTS_STATUS
{
542 uint8_t ReadyListCount
;
543 uint8_t FreeListCount
;
544 uint8_t PowerStateChange
;
545 uint8_t reserved_
[1];
546 uint32_t FramesDropped
;
547 uint32_t FramesCaptured
;
548 uint32_t FramesRepeated
;
550 uint64_t InputTotalSize
;
551 uint32_t InputBusyCount
;
552 uint32_t PIBMissCount
;
553 uint32_t cpbEmptySize
;
554 uint64_t NextTimeStamp
;
555 uint8_t reserved__
[16];
558 #define BC_SWAP32(_v) \
559 ((((_v) & 0xFF000000)>>24)| \
560 (((_v) & 0x00FF0000)>>8)| \
561 (((_v) & 0x0000FF00)<<8)| \
562 (((_v) & 0x000000FF)<<24))
564 #define WM_AGENT_TRAYICON_DECODER_OPEN 10001
565 #define WM_AGENT_TRAYICON_DECODER_CLOSE 10002
566 #define WM_AGENT_TRAYICON_DECODER_START 10003
567 #define WM_AGENT_TRAYICON_DECODER_STOP 10004
568 #define WM_AGENT_TRAYICON_DECODER_RUN 10005
569 #define WM_AGENT_TRAYICON_DECODER_PAUSE 10006
572 #endif /* _BC_DTS_DEFS_H_ */