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