]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/crystalhd/crystalhd_fw_if.h
Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee139...
[karo-tx-linux.git] / drivers / staging / crystalhd / crystalhd_fw_if.h
1 /***************************************************************************
2  * Copyright (c) 2005-2009, Broadcom Corporation.
3  *
4  *  Name: crystalhd_fw_if . h
5  *
6  *  Description:
7  *              BCM70012 Firmware interface definitions.
8  *
9  *  HISTORY:
10  *
11  **********************************************************************
12  * This file is part of the crystalhd device driver.
13  *
14  * This driver is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, version 2 of the License.
17  *
18  * This driver 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 General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this driver.  If not, see <http://www.gnu.org/licenses/>.
25  **********************************************************************/
26
27 #ifndef _CRYSTALHD_FW_IF_H_
28 #define _CRYSTALHD_FW_IF_H_
29
30 /* TBD: Pull in only required defs into this file.. */
31
32 /* User Data Header */
33 struct user_data {
34         struct user_data        *next;
35         uint32_t                type;
36         uint32_t                size;
37 };
38
39 /*------------------------------------------------------*
40  *    MPEG Extension to the PPB                  *
41  *------------------------------------------------------*/
42 struct ppb_mpeg {
43         uint32_t                to_be_defined;
44         uint32_t                valid;
45
46         /* Always valid, defaults to picture size if no
47            sequence display extension in the stream. */
48         uint32_t                display_horizontal_size;
49         uint32_t                display_vertical_size;
50
51         /* MPEG_VALID_PANSCAN
52            Offsets are a copy values from the MPEG stream. */
53         uint32_t                offset_count;
54         int32_t         horizontal_offset[3];
55         int32_t         vertical_offset[3];
56
57         /* MPEG_VALID_USERDATA
58            User data is in the form of a linked list. */
59         int32_t         userDataSize;
60         struct user_data        *userData;
61
62 };
63
64
65 /*------------------------------------------------------*
66  *    VC1 Extension to the PPB                    *
67  *------------------------------------------------------*/
68 struct ppb_vc1 {
69         uint32_t                to_be_defined;
70         uint32_t                valid;
71
72         /* Always valid, defaults to picture size if no
73            sequence display extension in the stream. */
74         uint32_t                display_horizontal_size;
75         uint32_t                display_vertical_size;
76
77         /* VC1 pan scan windows */
78         uint32_t                num_panscan_windows;
79         int32_t         ps_horiz_offset[4];
80         int32_t         ps_vert_offset[4];
81         int32_t         ps_width[4];
82         int32_t         ps_height[4];
83
84         /* VC1_VALID_USERDATA
85            User data is in the form of a linked list. */
86         int32_t         userDataSize;
87         struct user_data        *userData;
88
89 };
90
91 /*------------------------------------------------------*
92  *    H.264 Extension to the PPB                        *
93  *------------------------------------------------------*/
94
95 /**
96  * @brief Film grain SEI message.
97  *
98  * Content of the film grain SEI message.
99  */
100
101 /* maximum number of model-values as for Thomson spec(standard says 5) */
102 #define MAX_FGT_MODEL_VALUE      (3)
103
104 /* maximum number of intervals(as many as 256 intervals?) */
105 #define MAX_FGT_VALUE_INTERVAL  (256)
106
107 struct fgt_sei {
108         struct fgt_sei *next;
109         unsigned char
110                  model_values[3][MAX_FGT_VALUE_INTERVAL][MAX_FGT_MODEL_VALUE];
111         unsigned char upper_bound[3][MAX_FGT_VALUE_INTERVAL];
112         unsigned char lower_bound[3][MAX_FGT_VALUE_INTERVAL];
113
114         unsigned char cancel_flag;      /* Cancel flag: 1 no film grain. */
115         unsigned char model_id; /* Model id. */
116
117         /* +unused SE based on Thomson spec */
118         unsigned char color_desc_flag;  /* Separate color description flag. */
119         unsigned char bit_depth_luma;   /* Bit depth luma minus 8. */
120         unsigned char bit_depth_chroma; /* Bit depth chroma minus 8. */
121         unsigned char full_range_flag;  /* Full range flag. */
122         unsigned char color_primaries;  /* Color primaries. */
123         unsigned char transfer_charact; /* Transfer characteristics. */
124         unsigned char matrix_coeff;             /*< Matrix coefficients. */
125         /* -unused SE based on Thomson spec */
126
127         unsigned char blending_mode_id; /* Blending mode. */
128         unsigned char log2_scale_factor;        /* Log2 scale factor (2-7). */
129         unsigned char comp_flag[3];     /* Components [0,2]
130                                          parameters present flag. */
131         unsigned char num_intervals_minus1[3]; /* Number of
132                                          intensity level intervals. */
133         unsigned char num_model_values[3];      /* Number of model values. */
134         uint16_t      repetition_period; /* Repetition period (0-16384) */
135
136 };
137
138 struct ppb_h264 {
139         /* 'valid' specifies which fields (or sets of
140          * fields) below are valid.  If the corresponding
141          * bit in 'valid' is NOT set then that field(s)
142          * is (are) not initialized. */
143         uint32_t        valid;
144
145         int32_t         poc_top;        /* POC for Top Field/Frame */
146         int32_t         poc_bottom;     /* POC for Bottom Field    */
147         uint32_t                idr_pic_id;
148
149         /* H264_VALID_PANSCAN */
150         uint32_t                pan_scan_count;
151         int32_t         pan_scan_left[3];
152         int32_t         pan_scan_right[3];
153         int32_t         pan_scan_top[3];
154         int32_t         pan_scan_bottom[3];
155
156         /* H264_VALID_CT_TYPE */
157         uint32_t                ct_type_count;
158         uint32_t                ct_type[3];
159
160         /* H264_VALID_SPS_CROP */
161         int32_t         sps_crop_left;
162         int32_t         sps_crop_right;
163         int32_t         sps_crop_top;
164         int32_t         sps_crop_bottom;
165
166         /* H264_VALID_VUI */
167         uint32_t                chroma_top;
168         uint32_t                chroma_bottom;
169
170         /* H264_VALID_USER */
171         uint32_t                user_data_size;
172         struct user_data        *user_data;
173
174         /* H264 VALID FGT */
175         struct fgt_sei  *pfgt;
176
177 };
178
179 struct ppb {
180         /* Common fields. */
181         uint32_t        picture_number; /* Ordinal display number */
182         uint32_t        video_buffer;   /* Video (picbuf) number */
183         uint32_t        video_address;  /* Address of picbuf Y */
184         uint32_t        video_address_uv; /* Address of picbuf UV */
185         uint32_t        video_stripe;   /* Picbuf stripe */
186         uint32_t        video_width;    /* Picbuf width */
187         uint32_t        video_height;   /* Picbuf height */
188
189         uint32_t        channel_id;     /* Decoder channel ID */
190         uint32_t        status;         /* reserved */
191         uint32_t        width;          /* pixels */
192         uint32_t        height;         /* pixels */
193         uint32_t        chroma_format;  /* see above */
194         uint32_t        pulldown;       /* see above */
195         uint32_t        flags;          /* see above */
196         uint32_t        pts;            /* 32 LSBs of PTS */
197         uint32_t        protocol;       /* protocolXXX (above) */
198
199         uint32_t        frame_rate;     /* see above */
200         uint32_t        matrix_coeff;   /* see above */
201         uint32_t        aspect_ratio;   /* see above */
202         uint32_t        colour_primaries; /* see above */
203         uint32_t        transfer_char;  /* see above */
204         uint32_t        pcr_offset;     /* 45kHz if PCR type; else 27MHz */
205         uint32_t        n_drop;         /* Number of pictures to be dropped */
206
207         uint32_t        custom_aspect_ratio_width_height;
208         /* upper 16-bits is Y and lower 16-bits is X */
209
210         uint32_t        picture_tag;    /* Indexing tag from BUD packets */
211         uint32_t        picture_done_payload;
212         uint32_t        picture_meta_payload;
213         uint32_t        reserved[1];
214
215         /* Protocol-specific extensions. */
216         union {
217                 struct ppb_h264 h264;
218                 struct ppb_mpeg mpeg;
219                 struct ppb_vc1   vc1;
220         } other;
221
222 };
223
224 struct c011_pib {
225         uint32_t        bFormatChange;
226         uint32_t        resolution;
227         uint32_t        channelId;
228         uint32_t        ppbPtr;
229         int32_t ptsStcOffset;
230         uint32_t        zeroPanscanValid;
231         uint32_t        dramOutBufAddr;
232         uint32_t        yComponent;
233         struct ppb      ppb;
234
235 };
236
237 struct dec_rsp_channel_start_video {
238         uint32_t        command;
239         uint32_t        sequence;
240         uint32_t        status;
241         uint32_t        picBuf;
242         uint32_t        picRelBuf;
243         uint32_t        picInfoDeliveryQ;
244         uint32_t        picInfoReleaseQ;
245         uint32_t        channelStatus;
246         uint32_t        userDataDeliveryQ;
247         uint32_t        userDataReleaseQ;
248         uint32_t        transportStreamCaptureAddr;
249         uint32_t        asyncEventQ;
250
251 };
252
253 #define eCMD_C011_CMD_BASE        (0x73763000)
254
255 /* host commands */
256 enum  c011_ts_cmd {
257         eCMD_TS_GET_NEXT_PIC    = 0x7376F100, /* debug get next picture */
258         eCMD_TS_GET_LAST_PIC    = 0x7376F102, /* debug get last pic status */
259         eCMD_TS_READ_WRITE_MEM  = 0x7376F104, /* debug read write memory */
260
261         /* New API commands */
262         /* General commands */
263         eCMD_C011_INIT          = eCMD_C011_CMD_BASE + 0x01,
264         eCMD_C011_RESET         = eCMD_C011_CMD_BASE + 0x02,
265         eCMD_C011_SELF_TEST             = eCMD_C011_CMD_BASE + 0x03,
266         eCMD_C011_GET_VERSION   = eCMD_C011_CMD_BASE + 0x04,
267         eCMD_C011_GPIO          = eCMD_C011_CMD_BASE + 0x05,
268         eCMD_C011_DEBUG_SETUP   = eCMD_C011_CMD_BASE + 0x06,
269
270         /* Decoding commands */
271         eCMD_C011_DEC_CHAN_OPEN                 = eCMD_C011_CMD_BASE + 0x100,
272         eCMD_C011_DEC_CHAN_CLOSE                = eCMD_C011_CMD_BASE + 0x101,
273         eCMD_C011_DEC_CHAN_ACTIVATE             = eCMD_C011_CMD_BASE + 0x102,
274         eCMD_C011_DEC_CHAN_STATUS               = eCMD_C011_CMD_BASE + 0x103,
275         eCMD_C011_DEC_CHAN_FLUSH                = eCMD_C011_CMD_BASE + 0x104,
276         eCMD_C011_DEC_CHAN_TRICK_PLAY           = eCMD_C011_CMD_BASE + 0x105,
277         eCMD_C011_DEC_CHAN_TS_PIDS              = eCMD_C011_CMD_BASE + 0x106,
278         eCMD_C011_DEC_CHAN_PS_STREAM_ID         = eCMD_C011_CMD_BASE + 0x107,
279         eCMD_C011_DEC_CHAN_INPUT_PARAMS         = eCMD_C011_CMD_BASE + 0x108,
280         eCMD_C011_DEC_CHAN_VIDEO_OUTPUT         = eCMD_C011_CMD_BASE + 0x109,
281         eCMD_C011_DEC_CHAN_OUTPUT_FORMAT        = eCMD_C011_CMD_BASE + 0x10A,
282         eCMD_C011_DEC_CHAN_SCALING_FILTERS      = eCMD_C011_CMD_BASE + 0x10B,
283         eCMD_C011_DEC_CHAN_OSD_MODE             = eCMD_C011_CMD_BASE + 0x10D,
284         eCMD_C011_DEC_CHAN_DROP                 = eCMD_C011_CMD_BASE + 0x10E,
285         eCMD_C011_DEC_CHAN_RELEASE              = eCMD_C011_CMD_BASE + 0x10F,
286         eCMD_C011_DEC_CHAN_STREAM_SETTINGS      = eCMD_C011_CMD_BASE + 0x110,
287         eCMD_C011_DEC_CHAN_PAUSE_OUTPUT         = eCMD_C011_CMD_BASE + 0x111,
288         eCMD_C011_DEC_CHAN_CHANGE               = eCMD_C011_CMD_BASE + 0x112,
289         eCMD_C011_DEC_CHAN_SET_STC              = eCMD_C011_CMD_BASE + 0x113,
290         eCMD_C011_DEC_CHAN_SET_PTS              = eCMD_C011_CMD_BASE + 0x114,
291         eCMD_C011_DEC_CHAN_CC_MODE              = eCMD_C011_CMD_BASE + 0x115,
292         eCMD_C011_DEC_CREATE_AUDIO_CONTEXT      = eCMD_C011_CMD_BASE + 0x116,
293         eCMD_C011_DEC_COPY_AUDIO_CONTEXT        = eCMD_C011_CMD_BASE + 0x117,
294         eCMD_C011_DEC_DELETE_AUDIO_CONTEXT      = eCMD_C011_CMD_BASE + 0x118,
295         eCMD_C011_DEC_CHAN_SET_DECYPTION        = eCMD_C011_CMD_BASE + 0x119,
296         eCMD_C011_DEC_CHAN_START_VIDEO          = eCMD_C011_CMD_BASE + 0x11A,
297         eCMD_C011_DEC_CHAN_STOP_VIDEO           = eCMD_C011_CMD_BASE + 0x11B,
298         eCMD_C011_DEC_CHAN_PIC_CAPTURE          = eCMD_C011_CMD_BASE + 0x11C,
299         eCMD_C011_DEC_CHAN_PAUSE                = eCMD_C011_CMD_BASE + 0x11D,
300         eCMD_C011_DEC_CHAN_PAUSE_STATE          = eCMD_C011_CMD_BASE + 0x11E,
301         eCMD_C011_DEC_CHAN_SET_SLOWM_RATE       = eCMD_C011_CMD_BASE + 0x11F,
302         eCMD_C011_DEC_CHAN_GET_SLOWM_RATE       = eCMD_C011_CMD_BASE + 0x120,
303         eCMD_C011_DEC_CHAN_SET_FF_RATE          = eCMD_C011_CMD_BASE + 0x121,
304         eCMD_C011_DEC_CHAN_GET_FF_RATE          = eCMD_C011_CMD_BASE + 0x122,
305         eCMD_C011_DEC_CHAN_FRAME_ADVANCE        = eCMD_C011_CMD_BASE + 0x123,
306         eCMD_C011_DEC_CHAN_SET_SKIP_PIC_MODE    = eCMD_C011_CMD_BASE + 0x124,
307         eCMD_C011_DEC_CHAN_GET_SKIP_PIC_MODE    = eCMD_C011_CMD_BASE + 0x125,
308         eCMD_C011_DEC_CHAN_FILL_PIC_BUF         = eCMD_C011_CMD_BASE + 0x126,
309         eCMD_C011_DEC_CHAN_SET_CONTINUITY_CHECK = eCMD_C011_CMD_BASE + 0x127,
310         eCMD_C011_DEC_CHAN_GET_CONTINUITY_CHECK = eCMD_C011_CMD_BASE + 0x128,
311         eCMD_C011_DEC_CHAN_SET_BRCM_TRICK_MODE  = eCMD_C011_CMD_BASE + 0x129,
312         eCMD_C011_DEC_CHAN_GET_BRCM_TRICK_MODE  = eCMD_C011_CMD_BASE + 0x12A,
313         eCMD_C011_DEC_CHAN_REVERSE_FIELD_STATUS = eCMD_C011_CMD_BASE + 0x12B,
314         eCMD_C011_DEC_CHAN_I_PICTURE_FOUND      = eCMD_C011_CMD_BASE + 0x12C,
315         eCMD_C011_DEC_CHAN_SET_PARAMETER        = eCMD_C011_CMD_BASE + 0x12D,
316         eCMD_C011_DEC_CHAN_SET_USER_DATA_MODE   = eCMD_C011_CMD_BASE + 0x12E,
317         eCMD_C011_DEC_CHAN_SET_PAUSE_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x12F,
318         eCMD_C011_DEC_CHAN_SET_SLOW_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x130,
319         eCMD_C011_DEC_CHAN_SET_FF_DISPLAY_MODE  = eCMD_C011_CMD_BASE + 0x131,
320         eCMD_C011_DEC_CHAN_SET_DISPLAY_TIMING_MODE = eCMD_C011_CMD_BASE +
321                                                                  0x132,
322         eCMD_C011_DEC_CHAN_SET_DISPLAY_MODE     = eCMD_C011_CMD_BASE + 0x133,
323         eCMD_C011_DEC_CHAN_GET_DISPLAY_MODE     = eCMD_C011_CMD_BASE + 0x134,
324         eCMD_C011_DEC_CHAN_SET_REVERSE_FIELD    = eCMD_C011_CMD_BASE + 0x135,
325         eCMD_C011_DEC_CHAN_STREAM_OPEN          = eCMD_C011_CMD_BASE + 0x136,
326         eCMD_C011_DEC_CHAN_SET_PCR_PID          = eCMD_C011_CMD_BASE + 0x137,
327         eCMD_C011_DEC_CHAN_SET_VID_PID          = eCMD_C011_CMD_BASE + 0x138,
328         eCMD_C011_DEC_CHAN_SET_PAN_SCAN_MODE    = eCMD_C011_CMD_BASE + 0x139,
329         eCMD_C011_DEC_CHAN_START_DISPLAY_AT_PTS = eCMD_C011_CMD_BASE + 0x140,
330         eCMD_C011_DEC_CHAN_STOP_DISPLAY_AT_PTS  = eCMD_C011_CMD_BASE + 0x141,
331         eCMD_C011_DEC_CHAN_SET_DISPLAY_ORDER    = eCMD_C011_CMD_BASE + 0x142,
332         eCMD_C011_DEC_CHAN_GET_DISPLAY_ORDER    = eCMD_C011_CMD_BASE + 0x143,
333         eCMD_C011_DEC_CHAN_SET_HOST_TRICK_MODE  = eCMD_C011_CMD_BASE + 0x144,
334         eCMD_C011_DEC_CHAN_SET_OPERATION_MODE   = eCMD_C011_CMD_BASE + 0x145,
335         eCMD_C011_DEC_CHAN_DISPLAY_PAUSE_UNTO_PTS = eCMD_C011_CMD_BASE + 0x146,
336         eCMD_C011_DEC_CHAN_SET_PTS_STC_DIFF_THRESHOLD = eCMD_C011_CMD_BASE +
337                                                                  0x147,
338         eCMD_C011_DEC_CHAN_SEND_COMPRESSED_BUF  = eCMD_C011_CMD_BASE + 0x148,
339         eCMD_C011_DEC_CHAN_SET_CLIPPING         = eCMD_C011_CMD_BASE + 0x149,
340         eCMD_C011_DEC_CHAN_SET_PARAMETERS_FOR_HARD_RESET_INTERRUPT_TO_HOST
341                 = eCMD_C011_CMD_BASE + 0x150,
342
343         /* Decoder RevD commands */
344         eCMD_C011_DEC_CHAN_SET_CSC      = eCMD_C011_CMD_BASE + 0x180, /* color
345                                                          space conversion */
346         eCMD_C011_DEC_CHAN_SET_RANGE_REMAP      = eCMD_C011_CMD_BASE + 0x181,
347         eCMD_C011_DEC_CHAN_SET_FGT              = eCMD_C011_CMD_BASE + 0x182,
348         /* Note: 0x183 not implemented yet in Rev D main */
349         eCMD_C011_DEC_CHAN_SET_LASTPICTURE_PADDING = eCMD_C011_CMD_BASE +
350                                                                  0x183,
351
352         /* Decoder 7412 commands (7412-only) */
353         eCMD_C011_DEC_CHAN_SET_CONTENT_KEY      = eCMD_C011_CMD_BASE + 0x190,
354         eCMD_C011_DEC_CHAN_SET_SESSION_KEY      = eCMD_C011_CMD_BASE + 0x191,
355         eCMD_C011_DEC_CHAN_FMT_CHANGE_ACK       = eCMD_C011_CMD_BASE + 0x192,
356
357         eCMD_C011_DEC_CHAN_CUSTOM_VIDOUT    = eCMD_C011_CMD_BASE + 0x1FF,
358
359         /* Encoding commands */
360         eCMD_C011_ENC_CHAN_OPEN         = eCMD_C011_CMD_BASE + 0x200,
361         eCMD_C011_ENC_CHAN_CLOSE                = eCMD_C011_CMD_BASE + 0x201,
362         eCMD_C011_ENC_CHAN_ACTIVATE             = eCMD_C011_CMD_BASE + 0x202,
363         eCMD_C011_ENC_CHAN_CONTROL              = eCMD_C011_CMD_BASE + 0x203,
364         eCMD_C011_ENC_CHAN_STATISTICS   = eCMD_C011_CMD_BASE + 0x204,
365
366         eNOTIFY_C011_ENC_CHAN_EVENT             = eCMD_C011_CMD_BASE + 0x210,
367
368 };
369
370 #endif