blob: 2601bc71c51d190d608b9902f73618add2692445 [file] [log] [blame]
Mauro Carvalho Chehabebfbc302006-05-22 10:31:38 -03001/*
Andy Walls0d82fe82009-01-01 19:02:31 -03002 cx23415/6/8 header containing common defines.
Mauro Carvalho Chehabebfbc302006-05-22 10:31:38 -03003
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef CX2341X_H
20#define CX2341X_H
21
Hans Verkuil45ad9f82006-06-21 17:04:13 -030022enum cx2341x_port {
Hans Verkuil0ccac4a2006-06-23 15:52:50 -030023 CX2341X_PORT_MEMORY = 0,
24 CX2341X_PORT_STREAMING = 1,
25 CX2341X_PORT_SERIAL = 2
Hans Verkuil45ad9f82006-06-21 17:04:13 -030026};
27
Hans Verkuil8cbde942006-06-24 14:36:02 -030028enum cx2341x_cap {
29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
Hans Verkuile0e31cd2008-06-22 12:03:28 -030030 CX2341X_CAP_HAS_TS = 1 << 1,
Andy Walls0d82fe82009-01-01 19:02:31 -030031 CX2341X_CAP_HAS_AC3 = 1 << 2,
32 CX2341X_CAP_HAS_LPCM = 1 << 3,
Hans Verkuil8cbde942006-06-24 14:36:02 -030033};
34
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030035struct cx2341x_mpeg_params {
36 /* misc */
Hans Verkuil8cbde942006-06-24 14:36:02 -030037 u32 capabilities;
Hans Verkuil45ad9f82006-06-21 17:04:13 -030038 enum cx2341x_port port;
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030039 u16 width;
40 u16 height;
41 u16 is_50hz;
42
43 /* stream */
44 enum v4l2_mpeg_stream_type stream_type;
Hans Verkuil8cbde942006-06-24 14:36:02 -030045 enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt;
Hans Verkuil5eee72e2007-04-27 12:31:00 -030046 u16 stream_insert_nav_packets;
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030047
48 /* audio */
49 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
50 enum v4l2_mpeg_audio_encoding audio_encoding;
51 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate;
Andy Walls0d82fe82009-01-01 19:02:31 -030052 enum v4l2_mpeg_audio_ac3_bitrate audio_ac3_bitrate;
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030053 enum v4l2_mpeg_audio_mode audio_mode;
54 enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
55 enum v4l2_mpeg_audio_emphasis audio_emphasis;
56 enum v4l2_mpeg_audio_crc audio_crc;
Andy Walls0d82fe82009-01-01 19:02:31 -030057 u32 audio_properties;
Hans Verkuil5eee72e2007-04-27 12:31:00 -030058 u16 audio_mute;
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030059
60 /* video */
61 enum v4l2_mpeg_video_encoding video_encoding;
62 enum v4l2_mpeg_video_aspect video_aspect;
63 u16 video_b_frames;
64 u16 video_gop_size;
65 u16 video_gop_closure;
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030066 enum v4l2_mpeg_video_bitrate_mode video_bitrate_mode;
67 u32 video_bitrate;
68 u32 video_bitrate_peak;
69 u16 video_temporal_decimation;
Hans Verkuil5eee72e2007-04-27 12:31:00 -030070 u16 video_mute;
71 u32 video_mute_yuv;
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030072
73 /* encoding filters */
74 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode;
75 u16 video_spatial_filter;
76 enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type video_luma_spatial_filter_type;
77 enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type video_chroma_spatial_filter_type;
78 enum v4l2_mpeg_cx2341x_video_temporal_filter_mode video_temporal_filter_mode;
79 u16 video_temporal_filter;
80 enum v4l2_mpeg_cx2341x_video_median_filter_type video_median_filter_type;
81 u16 video_luma_median_filter_top;
82 u16 video_luma_median_filter_bottom;
83 u16 video_chroma_median_filter_top;
84 u16 video_chroma_median_filter_bottom;
85};
86
87#define CX2341X_MBOX_MAX_DATA 16
88
Hans Verkuilcc7bc642006-06-19 17:53:08 -030089extern const u32 cx2341x_mpeg_ctrls[];
Hans Verkuilea48c132007-12-12 07:04:58 -030090typedef int (*cx2341x_mbox_func)(void *priv, u32 cmd, int in, int out,
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030091 u32 data[CX2341X_MBOX_MAX_DATA]);
92int cx2341x_update(void *priv, cx2341x_mbox_func func,
93 const struct cx2341x_mpeg_params *old,
94 const struct cx2341x_mpeg_params *new);
Hans Verkuile0e31cd2008-06-22 12:03:28 -030095int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -030096 struct v4l2_queryctrl *qctrl);
Hans Verkuile0e31cd2008-06-22 12:03:28 -030097const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id);
Hans Verkuil01f1e442007-08-21 18:32:42 -030098int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
Hans Verkuil4d6b5ae2006-06-26 09:31:18 -030099 struct v4l2_ext_controls *ctrls, unsigned int cmd);
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -0300100void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
Hans Verkuile0e31cd2008-06-22 12:03:28 -0300101void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix);
Hans Verkuil5d1a9ae2006-06-18 14:40:30 -0300102
Mauro Carvalho Chehabebfbc302006-05-22 10:31:38 -0300103/* Firmware names */
104#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"
105/* Decoder firmware for the cx23415 only */
106#define CX2341X_FIRM_DEC_FILENAME "v4l-cx2341x-dec.fw"
107
108/* Firmware API commands */
109
110/* MPEG decoder API, specific to the cx23415 */
111#define CX2341X_DEC_PING_FW 0x00
112#define CX2341X_DEC_START_PLAYBACK 0x01
113#define CX2341X_DEC_STOP_PLAYBACK 0x02
114#define CX2341X_DEC_SET_PLAYBACK_SPEED 0x03
115#define CX2341X_DEC_STEP_VIDEO 0x05
116#define CX2341X_DEC_SET_DMA_BLOCK_SIZE 0x08
117#define CX2341X_DEC_GET_XFER_INFO 0x09
118#define CX2341X_DEC_GET_DMA_STATUS 0x0a
119#define CX2341X_DEC_SCHED_DMA_FROM_HOST 0x0b
120#define CX2341X_DEC_PAUSE_PLAYBACK 0x0d
121#define CX2341X_DEC_HALT_FW 0x0e
122#define CX2341X_DEC_SET_STANDARD 0x10
123#define CX2341X_DEC_GET_VERSION 0x11
124#define CX2341X_DEC_SET_STREAM_INPUT 0x14
125#define CX2341X_DEC_GET_TIMING_INFO 0x15
126#define CX2341X_DEC_SET_AUDIO_MODE 0x16
127#define CX2341X_DEC_SET_EVENT_NOTIFICATION 0x17
128#define CX2341X_DEC_SET_DISPLAY_BUFFERS 0x18
129#define CX2341X_DEC_EXTRACT_VBI 0x19
130#define CX2341X_DEC_SET_DECODER_SOURCE 0x1a
Mauro Carvalho Chehabebfbc302006-05-22 10:31:38 -0300131#define CX2341X_DEC_SET_PREBUFFERING 0x1e
132
133/* MPEG encoder API */
134#define CX2341X_ENC_PING_FW 0x80
135#define CX2341X_ENC_START_CAPTURE 0x81
136#define CX2341X_ENC_STOP_CAPTURE 0x82
137#define CX2341X_ENC_SET_AUDIO_ID 0x89
138#define CX2341X_ENC_SET_VIDEO_ID 0x8b
139#define CX2341X_ENC_SET_PCR_ID 0x8d
140#define CX2341X_ENC_SET_FRAME_RATE 0x8f
141#define CX2341X_ENC_SET_FRAME_SIZE 0x91
142#define CX2341X_ENC_SET_BIT_RATE 0x95
143#define CX2341X_ENC_SET_GOP_PROPERTIES 0x97
144#define CX2341X_ENC_SET_ASPECT_RATIO 0x99
145#define CX2341X_ENC_SET_DNR_FILTER_MODE 0x9b
146#define CX2341X_ENC_SET_DNR_FILTER_PROPS 0x9d
147#define CX2341X_ENC_SET_CORING_LEVELS 0x9f
148#define CX2341X_ENC_SET_SPATIAL_FILTER_TYPE 0xa1
Mauro Carvalho Chehabebfbc302006-05-22 10:31:38 -0300149#define CX2341X_ENC_SET_VBI_LINE 0xb7
150#define CX2341X_ENC_SET_STREAM_TYPE 0xb9
151#define CX2341X_ENC_SET_OUTPUT_PORT 0xbb
152#define CX2341X_ENC_SET_AUDIO_PROPERTIES 0xbd
153#define CX2341X_ENC_HALT_FW 0xc3
154#define CX2341X_ENC_GET_VERSION 0xc4
155#define CX2341X_ENC_SET_GOP_CLOSURE 0xc5
156#define CX2341X_ENC_GET_SEQ_END 0xc6
157#define CX2341X_ENC_SET_PGM_INDEX_INFO 0xc7
158#define CX2341X_ENC_SET_VBI_CONFIG 0xc8
159#define CX2341X_ENC_SET_DMA_BLOCK_SIZE 0xc9
160#define CX2341X_ENC_GET_PREV_DMA_INFO_MB_10 0xca
161#define CX2341X_ENC_GET_PREV_DMA_INFO_MB_9 0xcb
162#define CX2341X_ENC_SCHED_DMA_TO_HOST 0xcc
163#define CX2341X_ENC_INITIALIZE_INPUT 0xcd
164#define CX2341X_ENC_SET_FRAME_DROP_RATE 0xd0
165#define CX2341X_ENC_PAUSE_ENCODER 0xd2
166#define CX2341X_ENC_REFRESH_INPUT 0xd3
167#define CX2341X_ENC_SET_COPYRIGHT 0xd4
168#define CX2341X_ENC_SET_EVENT_NOTIFICATION 0xd5
169#define CX2341X_ENC_SET_NUM_VSYNC_LINES 0xd6
170#define CX2341X_ENC_SET_PLACEHOLDER 0xd7
171#define CX2341X_ENC_MUTE_VIDEO 0xd9
172#define CX2341X_ENC_MUTE_AUDIO 0xda
Hans Verkuil0b200602007-04-27 12:31:22 -0300173#define CX2341X_ENC_SET_VERT_CROP_LINE 0xdb
Mauro Carvalho Chehabebfbc302006-05-22 10:31:38 -0300174#define CX2341X_ENC_MISC 0xdc
175
176/* OSD API, specific to the cx23415 */
177#define CX2341X_OSD_GET_FRAMEBUFFER 0x41
178#define CX2341X_OSD_GET_PIXEL_FORMAT 0x42
179#define CX2341X_OSD_SET_PIXEL_FORMAT 0x43
180#define CX2341X_OSD_GET_STATE 0x44
181#define CX2341X_OSD_SET_STATE 0x45
182#define CX2341X_OSD_GET_OSD_COORDS 0x46
183#define CX2341X_OSD_SET_OSD_COORDS 0x47
184#define CX2341X_OSD_GET_SCREEN_COORDS 0x48
185#define CX2341X_OSD_SET_SCREEN_COORDS 0x49
186#define CX2341X_OSD_GET_GLOBAL_ALPHA 0x4a
187#define CX2341X_OSD_SET_GLOBAL_ALPHA 0x4b
188#define CX2341X_OSD_SET_BLEND_COORDS 0x4c
189#define CX2341X_OSD_GET_FLICKER_STATE 0x4f
190#define CX2341X_OSD_SET_FLICKER_STATE 0x50
191#define CX2341X_OSD_BLT_COPY 0x52
192#define CX2341X_OSD_BLT_FILL 0x53
193#define CX2341X_OSD_BLT_TEXT 0x54
194#define CX2341X_OSD_SET_FRAMEBUFFER_WINDOW 0x56
195#define CX2341X_OSD_SET_CHROMA_KEY 0x60
196#define CX2341X_OSD_GET_ALPHA_CONTENT_INDEX 0x61
197#define CX2341X_OSD_SET_ALPHA_CONTENT_INDEX 0x62
198
199#endif /* CX2341X_H */