HPFS: Remove CR/LF conversion option
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / crystalhd / bc_dts_defs.h
blob778e76af0528c6015e07180f52eb494209ef1d61
1 /********************************************************************
2 * Copyright(c) 2006-2009 Broadcom Corporation.
4 * Name: bc_dts_defs.h
6 * Description: Common definitions for all components. Only types
7 * is allowed to be included from this file.
9 * AU
11 * HISTORY:
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 /* BIT Mask */
30 #define BC_BIT(_x) (1 << (_x))
32 enum BC_STATUS {
33 BC_STS_SUCCESS = 0,
34 BC_STS_INV_ARG = 1,
35 BC_STS_BUSY = 2,
36 BC_STS_NOT_IMPL = 3,
37 BC_STS_PGM_QUIT = 4,
38 BC_STS_NO_ACCESS = 5,
39 BC_STS_INSUFF_RES = 6,
40 BC_STS_IO_ERROR = 7,
41 BC_STS_NO_DATA = 8,
42 BC_STS_VER_MISMATCH = 9,
43 BC_STS_TIMEOUT = 10,
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,
58 BC_STS_PENDING = 25,
59 BC_STS_CLK_NOCHG = 26,
61 /* Must be the last one.*/
62 BC_STS_ERROR = -1
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"
73 * Options:
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
82 enum BC_SW_OPTIONS {
83 BC_OPT_DOSER_OUT_ENCRYPT = BC_BIT(3),
84 BC_OPT_LINK_OUT_ENCRYPT = BC_BIT(29),
87 struct BC_REG_CONFIG{
88 uint32_t DbgOptions;
91 #if defined(__KERNEL__) || defined(__LINUX_USER__)
92 #else
93 /* Align data structures */
94 #define ALIGN(x) __declspec(align(x))
95 #endif
97 /* mode
98 * b[0]..b[7] = _DtsDeviceOpenMode
99 * b[8] = Load new FW
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,
111 DTS_DIAG_MODE,
112 DTS_MONITOR_MODE,
113 DTS_HWINIT_MODE
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 */
134 enum FW_FILE_VER {
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,
155 BC_VID_ALGO_VC1 = 4,
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 {
165 uint32_t valid;
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. */
191 uint32_t valid;
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;
206 /* H264_VALID_VUI */
207 uint32_t chroma_top;
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 {
217 uint32_t valid;
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];
228 int32_t ps_width[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. */
238 enum {
239 vdecNoPulldownInfo = 0,
240 vdecTop = 1,
241 vdecBottom = 2,
242 vdecTopBottom = 3,
243 vdecBottomTop = 4,
244 vdecTopBottomTop = 5,
245 vdecBottomTopBottom = 6,
246 vdecFrame_X2 = 7,
247 vdecFrame_X3 = 8,
248 vdecFrame_X1 = 9,
249 vdecFrame_X4 = 10,
252 /* Values for the 'frame_rate' field. */
253 enum {
254 vdecFrameRateUnknown = 0,
255 vdecFrameRate23_97,
256 vdecFrameRate24,
257 vdecFrameRate25,
258 vdecFrameRate29_97,
259 vdecFrameRate30,
260 vdecFrameRate50,
261 vdecFrameRate59_94,
262 vdecFrameRate60,
265 /* Values for the 'aspect_ratio' field. */
266 enum {
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,
281 vdecAspectRatio4_3,
282 vdecAspectRatio16_9,
283 vdecAspectRatio221_1,
284 vdecAspectRatioOther = 255,
287 /* Values for the 'colour_primaries' field. */
288 enum {
289 vdecColourPrimariesUnknown = 0,
290 vdecColourPrimariesBT709,
291 vdecColourPrimariesUnspecified,
292 vdecColourPrimariesReserved,
293 vdecColourPrimariesBT470_2M = 4,
294 vdecColourPrimariesBT470_2BG,
295 vdecColourPrimariesSMPTE170M,
296 vdecColourPrimariesSMPTE240M,
297 vdecColourPrimariesGenericFilm,
300 enum {
301 vdecRESOLUTION_CUSTOM = 0x00000000, /* custom */
302 vdecRESOLUTION_480i = 0x00000001, /* 480i */
303 vdecRESOLUTION_1080i = 0x00000002, /* 1080i (1920x1080, 60i) */
304 vdecRESOLUTION_NTSC = 0x00000003, /* NTSC (720x483, 60i) */
305 vdecRESOLUTION_480p = 0x00000004, /* 480p (720x480, 60p) */
306 vdecRESOLUTION_720p = 0x00000005, /* 720p (1280x720, 60p) */
307 vdecRESOLUTION_PAL1 = 0x00000006, /* PAL_1 (720x576, 50i) */
308 vdecRESOLUTION_1080i25 = 0x00000007, /* 1080i25 (1920x1080, 50i) */
309 vdecRESOLUTION_720p50 = 0x00000008, /* 720p50 (1280x720, 50p) */
310 vdecRESOLUTION_576p = 0x00000009, /* 576p (720x576, 50p) */
311 vdecRESOLUTION_1080i29_97 = 0x0000000A, /* 1080i (1920x1080, 59.94i) */
312 vdecRESOLUTION_720p59_94 = 0x0000000B, /* 720p (1280x720, 59.94p) */
313 vdecRESOLUTION_SD_DVD = 0x0000000C, /* SD DVD (720x483, 60i) */
314 vdecRESOLUTION_480p656 = 0x0000000D, /* 480p (720x480, 60p), output bus width 8 bit, clock 74.25MHz */
315 vdecRESOLUTION_1080p23_976 = 0x0000000E, /* 1080p23_976 (1920x1080, 23.976p) */
316 vdecRESOLUTION_720p23_976 = 0x0000000F, /* 720p23_976 (1280x720p, 23.976p) */
317 vdecRESOLUTION_240p29_97 = 0x00000010, /* 240p (1440x240, 29.97p ) */
318 vdecRESOLUTION_240p30 = 0x00000011, /* 240p (1440x240, 30p) */
319 vdecRESOLUTION_288p25 = 0x00000012, /* 288p (1440x288p, 25p) */
320 vdecRESOLUTION_1080p29_97 = 0x00000013, /* 1080p29_97 (1920x1080, 29.97p) */
321 vdecRESOLUTION_1080p30 = 0x00000014, /* 1080p30 (1920x1080, 30p) */
322 vdecRESOLUTION_1080p24 = 0x00000015, /* 1080p24 (1920x1080, 24p) */
323 vdecRESOLUTION_1080p25 = 0x00000016, /* 1080p25 (1920x1080, 25p) */
324 vdecRESOLUTION_720p24 = 0x00000017, /* 720p24 (1280x720, 25p) */
325 vdecRESOLUTION_720p29_97 = 0x00000018, /* 720p29.97 (1280x720, 29.97p) */
326 vdecRESOLUTION_480p23_976 = 0x00000019, /* 480p23.976 (720*480, 23.976) */
327 vdecRESOLUTION_480p29_97 = 0x0000001A, /* 480p29.976 (720*480, 29.97p) */
328 vdecRESOLUTION_576p25 = 0x0000001B, /* 576p25 (720*576, 25p) */
329 /* For Zero Frame Rate */
330 vdecRESOLUTION_480p0 = 0x0000001C, /* 480p (720x480, 0p) */
331 vdecRESOLUTION_480i0 = 0x0000001D, /* 480i (720x480, 0i) */
332 vdecRESOLUTION_576p0 = 0x0000001E, /* 576p (720x576, 0p) */
333 vdecRESOLUTION_720p0 = 0x0000001F, /* 720p (1280x720, 0p) */
334 vdecRESOLUTION_1080p0 = 0x00000020, /* 1080p (1920x1080, 0p) */
335 vdecRESOLUTION_1080i0 = 0x00000021, /* 1080i (1920x1080, 0i) */
338 /* Bit definitions for 'flags' field */
339 #define VDEC_FLAG_EOS (0x0004)
341 #define VDEC_FLAG_FRAME (0x0000)
342 #define VDEC_FLAG_FIELDPAIR (0x0008)
343 #define VDEC_FLAG_TOPFIELD (0x0010)
344 #define VDEC_FLAG_BOTTOMFIELD (0x0018)
346 #define VDEC_FLAG_PROGRESSIVE_SRC (0x0000)
347 #define VDEC_FLAG_INTERLACED_SRC (0x0020)
348 #define VDEC_FLAG_UNKNOWN_SRC (0x0040)
350 #define VDEC_FLAG_BOTTOM_FIRST (0x0080)
351 #define VDEC_FLAG_LAST_PICTURE (0x0100)
353 #define VDEC_FLAG_PICTURE_META_DATA_PRESENT (0x40000)
355 #endif /* __LINUX_USER__ */
357 enum _BC_OUTPUT_FORMAT {
358 MODE420 = 0x0,
359 MODE422_YUY2 = 0x1,
360 MODE422_UYVY = 0x2,
363 struct BC_PIC_INFO_BLOCK {
364 /* Common fields. */
365 uint64_t timeStamp; /* Timestamp */
366 uint32_t picture_number; /* Ordinal display number */
367 uint32_t width; /* pixels */
368 uint32_t height; /* pixels */
369 uint32_t chroma_format; /* 0x420, 0x422 or 0x444 */
370 uint32_t pulldown;
371 uint32_t flags;
372 uint32_t frame_rate;
373 uint32_t aspect_ratio;
374 uint32_t colour_primaries;
375 uint32_t picture_meta_payload;
376 uint32_t sess_num;
377 uint32_t ycom;
378 uint32_t custom_aspect_ratio_width_height;
379 uint32_t n_drop; /* number of non-reference frames remaining to be dropped */
381 /* Protocol-specific extensions. */
382 union {
383 struct BC_PIB_EXT_H264 h264;
384 struct BC_PIB_EXT_MPEG mpeg;
385 struct BC_PIB_EXT_VC1 vc1;
386 } other;
390 /*------------------------------------------------------*
391 * ProcOut Info *
392 *------------------------------------------------------*/
393 /* Optional flags for ProcOut Interface.*/
394 enum POUT_OPTIONAL_IN_FLAGS_{
395 /* Flags from App to Device */
396 BC_POUT_FLAGS_YV12 = 0x01, /* Copy Data in YV12 format */
397 BC_POUT_FLAGS_STRIDE = 0x02, /* Stride size is valid. */
398 BC_POUT_FLAGS_SIZE = 0x04, /* Take size information from Application */
399 BC_POUT_FLAGS_INTERLACED = 0x08, /* copy only half the bytes */
400 BC_POUT_FLAGS_INTERLEAVED = 0x10, /* interleaved frame */
402 /* Flags from Device to APP */
403 BC_POUT_FLAGS_FMT_CHANGE = 0x10000, /* Data is not VALID when this flag is set */
404 BC_POUT_FLAGS_PIB_VALID = 0x20000, /* PIB Information valid */
405 BC_POUT_FLAGS_ENCRYPTED = 0x40000, /* Data is encrypted. */
406 BC_POUT_FLAGS_FLD_BOT = 0x80000, /* Bottom Field data */
409 typedef enum BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut);
411 /* Line 21 Closed Caption */
412 /* User Data */
413 #define MAX_UD_SIZE 1792 /* 1920 - 128 */
415 struct BC_DTS_PROC_OUT {
416 uint8_t *Ybuff; /* Caller Supplied buffer for Y data */
417 uint32_t YbuffSz; /* Caller Supplied Y buffer size */
418 uint32_t YBuffDoneSz; /* Transferred Y datasize */
420 uint8_t *UVbuff; /* Caller Supplied buffer for UV data */
421 uint32_t UVbuffSz; /* Caller Supplied UV buffer size */
422 uint32_t UVBuffDoneSz; /* Transferred UV data size */
424 uint32_t StrideSz; /* Caller supplied Stride Size */
425 uint32_t PoutFlags; /* Call IN Flags */
427 uint32_t discCnt; /* Picture discontinuity count */
429 struct BC_PIC_INFO_BLOCK PicInfo; /* Picture Information Block Data */
431 /* Line 21 Closed Caption */
432 /* User Data */
433 uint32_t UserDataSz;
434 uint8_t UserData[MAX_UD_SIZE];
436 void *hnd;
437 dts_pout_callback AppCallBack;
438 uint8_t DropFrames;
439 uint8_t b422Mode; /* Picture output Mode */
440 uint8_t bPibEnc; /* PIB encrypted */
441 uint8_t bRevertScramble;
445 struct BC_DTS_STATUS {
446 uint8_t ReadyListCount; /* Number of frames in ready list (reported by driver) */
447 uint8_t FreeListCount; /* Number of frame buffers free. (reported by driver) */
448 uint8_t PowerStateChange; /* Number of active state power transitions (reported by driver) */
449 uint8_t reserved_[1];
451 uint32_t FramesDropped; /* Number of frames dropped. (reported by DIL) */
452 uint32_t FramesCaptured; /* Number of frames captured. (reported by DIL) */
453 uint32_t FramesRepeated; /* Number of frames repeated. (reported by DIL) */
455 uint32_t InputCount; /* Times compressed video has been sent to the HW.
456 * i.e. Successful DtsProcInput() calls (reported by DIL) */
457 uint64_t InputTotalSize; /* Amount of compressed video that has been sent to the HW.
458 * (reported by DIL) */
459 uint32_t InputBusyCount; /* Times compressed video has attempted to be sent to the HW
460 * but the input FIFO was full. (reported by DIL) */
462 uint32_t PIBMissCount; /* Amount of times a PIB is invalid. (reported by DIL) */
464 uint32_t cpbEmptySize; /* supported only for H.264, specifically changed for
465 * Adobe. Report size of CPB buffer available.
466 * Reported by DIL */
467 uint64_t NextTimeStamp; /* TimeStamp of the next picture that will be returned
468 * by a call to ProcOutput. Added for Adobe. Reported
469 * back from the driver */
470 uint8_t reserved__[16];
474 #define BC_SWAP32(_v) \
475 ((((_v) & 0xFF000000)>>24)| \
476 (((_v) & 0x00FF0000)>>8)| \
477 (((_v) & 0x0000FF00)<<8)| \
478 (((_v) & 0x000000FF)<<24))
480 #define WM_AGENT_TRAYICON_DECODER_OPEN 10001
481 #define WM_AGENT_TRAYICON_DECODER_CLOSE 10002
482 #define WM_AGENT_TRAYICON_DECODER_START 10003
483 #define WM_AGENT_TRAYICON_DECODER_STOP 10004
484 #define WM_AGENT_TRAYICON_DECODER_RUN 10005
485 #define WM_AGENT_TRAYICON_DECODER_PAUSE 10006
488 #endif /* _BC_DTS_DEFS_H_ */