2 * cx18 header containing common defines.
4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 #include <media/cx2341x.h>
27 #define MGR_CMD_MASK 0x40000000
28 /* The MSB of the command code indicates that this is the completion of a
30 #define MGR_CMD_MASK_ACK (MGR_CMD_MASK | 0x80000000)
32 /* Description: This command creates a new instance of a certain task
33 IN[0] - Task ID. This is one of the XPU_CMD_MASK_YYY where XPU is
34 the processor on which the task YYY will be created
35 OUT[0] - Task handle. This handle is passed along with commands to
36 dispatch to the right instance of the task
37 ReturnCode - One of the ERR_SYS_... */
38 #define CX18_CREATE_TASK (MGR_CMD_MASK | 0x0001)
40 /* Description: This command destroys an instance of a task
41 IN[0] - Task handle. Hanlde of the task to destroy
42 ReturnCode - One of the ERR_SYS_... */
43 #define CX18_DESTROY_TASK (MGR_CMD_MASK | 0x0002)
45 /* All commands for CPU have the following mask set */
46 #define CPU_CMD_MASK 0x20000000
47 #define CPU_CMD_MASK_ACK (CPU_CMD_MASK | 0x80000000)
48 #define CPU_CMD_MASK_CAPTURE (CPU_CMD_MASK | 0x00020000)
49 #define CPU_CMD_MASK_TS (CPU_CMD_MASK | 0x00040000)
51 #define EPU_CMD_MASK 0x02000000
52 #define EPU_CMD_MASK_DEBUG (EPU_CMD_MASK | 0x000000)
53 #define EPU_CMD_MASK_DE (EPU_CMD_MASK | 0x040000)
55 /* Description: This command indicates that a Memory Descriptor List has been
56 filled with the requested channel type
57 IN[0] - Task handle. Handle of the task
58 IN[1] - Offset of the MDL_ACK from the beginning of the local DDR.
59 IN[2] - Number of CNXT_MDL_ACK structures in the array pointed to by IN[1]
60 ReturnCode - One of the ERR_DE_... */
61 #define CX18_EPU_DMA_DONE (EPU_CMD_MASK_DE | 0x0001)
63 /* Something interesting happened
64 IN[0] - A value to log
65 IN[1] - An offset of a string in the MiniMe memory;
66 0/zero/NULL means "I have nothing to say" */
67 #define CX18_EPU_DEBUG (EPU_CMD_MASK_DEBUG | 0x0003)
69 /* Description: This command starts streaming with the set channel type
70 IN[0] - Task handle. Handle of the task to start
71 ReturnCode - One of the ERR_CAPTURE_... */
72 #define CX18_CPU_CAPTURE_START (CPU_CMD_MASK_CAPTURE | 0x0002)
74 /* Description: This command stops streaming with the set channel type
75 IN[0] - Task handle. Handle of the task to stop
76 IN[1] - 0 = stop at end of GOP, 1 = stop at end of frame (MPEG only)
77 ReturnCode - One of the ERR_CAPTURE_... */
78 #define CX18_CPU_CAPTURE_STOP (CPU_CMD_MASK_CAPTURE | 0x0003)
80 /* Description: This command pauses streaming with the set channel type
81 IN[0] - Task handle. Handle of the task to pause
82 ReturnCode - One of the ERR_CAPTURE_... */
83 #define CX18_CPU_CAPTURE_PAUSE (CPU_CMD_MASK_CAPTURE | 0x0007)
85 /* Description: This command resumes streaming with the set channel type
86 IN[0] - Task handle. Handle of the task to resume
87 ReturnCode - One of the ERR_CAPTURE_... */
88 #define CX18_CPU_CAPTURE_RESUME (CPU_CMD_MASK_CAPTURE | 0x0008)
90 #define CAPTURE_CHANNEL_TYPE_NONE 0
91 #define CAPTURE_CHANNEL_TYPE_MPEG 1
92 #define CAPTURE_CHANNEL_TYPE_INDEX 2
93 #define CAPTURE_CHANNEL_TYPE_YUV 3
94 #define CAPTURE_CHANNEL_TYPE_PCM 4
95 #define CAPTURE_CHANNEL_TYPE_VBI 5
96 #define CAPTURE_CHANNEL_TYPE_SLICED_VBI 6
97 #define CAPTURE_CHANNEL_TYPE_TS 7
98 #define CAPTURE_CHANNEL_TYPE_MAX 15
100 /* Description: This command sets the channel type. This can only be done
102 IN[0] - Task handle. Handle of the task to start
103 IN[1] - Channel Type. See Below.
104 ReturnCode - One of the ERR_CAPTURE_... */
105 #define CX18_CPU_SET_CHANNEL_TYPE (CPU_CMD_MASK_CAPTURE + 1)
107 /* Description: Set stream output type
108 IN[0] - task handle. Handle of the task to start
110 ReturnCode - One of the ERR_CAPTURE_... */
111 #define CX18_CPU_SET_STREAM_OUTPUT_TYPE (CPU_CMD_MASK_CAPTURE | 0x0012)
113 /* Description: Set video input resolution and frame rate
119 IN[5] - frame rate, 0 - 29.97f/s, 1 - 25f/s
120 ReturnCode - One of the ERR_CAPTURE_... */
121 #define CX18_CPU_SET_VIDEO_IN (CPU_CMD_MASK_CAPTURE | 0x0004)
123 /* Description: Set video frame rate
124 IN[0] - task handle. Handle of the task to start
125 IN[1] - video bit rate mode
126 IN[2] - video average rate
127 IN[3] - video peak rate
128 IN[4] - system mux rate
129 ReturnCode - One of the ERR_CAPTURE_... */
130 #define CX18_CPU_SET_VIDEO_RATE (CPU_CMD_MASK_CAPTURE | 0x0005)
132 /* Description: Set video output resolution
134 IN[1] - horizontal size
135 IN[2] - vertical size
136 ReturnCode - One of the ERR_CAPTURE_... */
137 #define CX18_CPU_SET_VIDEO_RESOLUTION (CPU_CMD_MASK_CAPTURE | 0x0006)
139 /* Description: This command set filter parameters
140 IN[0] - Task handle. Handle of the task
141 IN[1] - type, 0 - temporal, 1 - spatial, 2 - median
142 IN[2] - mode, temporal/spatial: 0 - disable, 1 - static, 2 - dynamic
143 median: 0 = disable, 1 = horizontal, 2 = vertical,
144 3 = horizontal/vertical, 4 = diagonal
145 IN[3] - strength, temporal 0 - 31, spatial 0 - 15
146 ReturnCode - One of the ERR_CAPTURE_... */
147 #define CX18_CPU_SET_FILTER_PARAM (CPU_CMD_MASK_CAPTURE | 0x0009)
149 /* Description: This command set spatial filter type
151 IN[1] - luma type: 0 = disable, 1 = 1D horizontal only, 2 = 1D vertical only,
152 3 = 2D H/V separable, 4 = 2D symmetric non-separable
153 IN[2] - chroma type: 0 - diable, 1 = 1D horizontal
154 ReturnCode - One of the ERR_CAPTURE_... */
155 #define CX18_CPU_SET_SPATIAL_FILTER_TYPE (CPU_CMD_MASK_CAPTURE | 0x000C)
157 /* Description: This command set coring levels for median filter
163 ReturnCode - One of the ERR_CAPTURE_... */
164 #define CX18_CPU_SET_MEDIAN_CORING (CPU_CMD_MASK_CAPTURE | 0x000E)
166 /* Description: This command set the picture type mask for index file
167 IN[0] - 0 = disable index file output
172 #define CX18_CPU_SET_INDEXTABLE (CPU_CMD_MASK_CAPTURE | 0x0010)
174 /* Description: Set audio parameters
175 IN[0] - task handle. Handle of the task to start
176 IN[1] - audio parameter
177 ReturnCode - One of the ERR_CAPTURE_... */
178 #define CX18_CPU_SET_AUDIO_PARAMETERS (CPU_CMD_MASK_CAPTURE | 0x0011)
180 /* Description: Set video mute
181 IN[0] - task handle. Handle of the task to start
182 IN[1] - bit31-24: muteYvalue
185 bit0: 1:mute, 0: unmute
186 ReturnCode - One of the ERR_CAPTURE_... */
187 #define CX18_CPU_SET_VIDEO_MUTE (CPU_CMD_MASK_CAPTURE | 0x0013)
189 /* Description: Set audio mute
190 IN[0] - task handle. Handle of the task to start
192 ReturnCode - One of the ERR_CAPTURE_... */
193 #define CX18_CPU_SET_AUDIO_MUTE (CPU_CMD_MASK_CAPTURE | 0x0014)
195 /* Description: Set stream output type
196 IN[0] - task handle. Handle of the task to start
200 SET_VIM_PROTECT_MODE 3
203 SET_MERAQPAR_ENABLE 6
204 SET_NAV_PACK_INSERTION 7
205 SET_SCENE_CHANGE_ENABLE 8
208 ReturnCode - One of the ERR_CAPTURE_... */
209 #define CX18_CPU_SET_MISC_PARAMETERS (CPU_CMD_MASK_CAPTURE | 0x0015)
211 /* Description: Set raw VBI parameters
213 IN[1] - No. of input lines per field:
216 IN[2] - No. of input bytes per line
217 IN[3] - No. of output frames per transfer
221 #define CX18_CPU_SET_RAW_VBI_PARAM (CPU_CMD_MASK_CAPTURE | 0x0016)
223 /* Description: Set capture line No.
224 IN[0] - task handle. Handle of the task to start
227 ReturnCode - One of the ERR_CAPTURE_... */
228 #define CX18_CPU_SET_CAPTURE_LINE_NO (CPU_CMD_MASK_CAPTURE | 0x0017)
230 /* Description: Set copyright
231 IN[0] - task handle. Handle of the task to start
233 ReturnCode - One of the ERR_CAPTURE_... */
234 #define CX18_CPU_SET_COPYRIGHT (CPU_CMD_MASK_CAPTURE | 0x0018)
236 /* Description: Set audio PID
237 IN[0] - task handle. Handle of the task to start
239 ReturnCode - One of the ERR_CAPTURE_... */
240 #define CX18_CPU_SET_AUDIO_PID (CPU_CMD_MASK_CAPTURE | 0x0019)
242 /* Description: Set video PID
243 IN[0] - task handle. Handle of the task to start
245 ReturnCode - One of the ERR_CAPTURE_... */
246 #define CX18_CPU_SET_VIDEO_PID (CPU_CMD_MASK_CAPTURE | 0x001A)
248 /* Description: Set Vertical Crop Line
249 IN[0] - task handle. Handle of the task to start
251 ReturnCode - One of the ERR_CAPTURE_... */
252 #define CX18_CPU_SET_VER_CROP_LINE (CPU_CMD_MASK_CAPTURE | 0x001B)
254 /* Description: Set COP structure
255 IN[0] - task handle. Handle of the task to start
258 ReturnCode - One of the ERR_CAPTURE_... */
259 #define CX18_CPU_SET_GOP_STRUCTURE (CPU_CMD_MASK_CAPTURE | 0x001C)
261 /* Description: Set Scene Change Detection
262 IN[0] - task handle. Handle of the task to start
264 ReturnCode - One of the ERR_CAPTURE_... */
265 #define CX18_CPU_SET_SCENE_CHANGE_DETECTION (CPU_CMD_MASK_CAPTURE | 0x001D)
267 /* Description: Set Aspect Ratio
268 IN[0] - task handle. Handle of the task to start
270 ReturnCode - One of the ERR_CAPTURE_... */
271 #define CX18_CPU_SET_ASPECT_RATIO (CPU_CMD_MASK_CAPTURE | 0x001E)
273 /* Description: Set Skip Input Frame
274 IN[0] - task handle. Handle of the task to start
275 IN[1] - skip input frames
276 ReturnCode - One of the ERR_CAPTURE_... */
277 #define CX18_CPU_SET_SKIP_INPUT_FRAME (CPU_CMD_MASK_CAPTURE | 0x001F)
279 /* Description: Set sliced VBI parameters -
280 Note This API will only apply to MPEG and Sliced VBI Channels
282 IN[1] - output type, 0 - CC, 1 - Moji, 2 - Teletext
283 IN[2] - start / stop line
284 bit[15:0] start line number
285 bit[31:16] stop line number
286 IN[3] - number of output frames per interrupt
287 IN[4] - VBI insertion mode
288 bit 0: output user data, 1 - enable
289 bit 1: output private stream, 1 - enable
290 bit 2: mux option, 0 - in GOP, 1 - in picture
291 bit[7:0] private stream ID
292 IN[5] - insertion period while mux option is in picture
293 ReturnCode - VBI data offset */
294 #define CX18_CPU_SET_SLICED_VBI_PARAM (CPU_CMD_MASK_CAPTURE | 0x0020)
296 /* Description: Set the user data place holder
297 IN[0] - type of data (0 for user)
298 IN[1] - Stuffing period
299 IN[2] - ID data size in word (less than 10)
300 IN[3] - Pointer to ID buffer */
301 #define CX18_CPU_SET_USERDATA_PLACE_HOLDER (CPU_CMD_MASK_CAPTURE | 0x0021)
308 Out[1] Video PTS bit[32:2] of last output video frame.
309 Out[2] Video PTS bit[ 1:0] of last output video frame.
310 Out[3] Hardware Video PTS counter bit[31:0],
311 these bits get incremented on every 90kHz clock tick.
312 Out[4] Hardware Video PTS counter bit32,
313 these bits get incremented on every 90kHz clock tick.
315 #define CX18_CPU_GET_ENC_PTS (CPU_CMD_MASK_CAPTURE | 0x0022)
317 /* Below is the list of commands related to the data exchange */
318 #define CPU_CMD_MASK_DE (CPU_CMD_MASK | 0x040000)
320 /* Description: This command provides the physical base address of the local
322 IN[0] - Physical offset where EPU has the local DDR mapped
323 ReturnCode - One of the ERR_DE_... */
324 #define CPU_CMD_DE_SetBase (CPU_CMD_MASK_DE | 0x0001)
326 /* Description: This command provides the offsets in the device memory where
327 the 2 cx18_mdl_ack blocks reside
328 IN[0] - Task handle. Handle of the task to start
329 IN[1] - Offset of the first cx18_mdl_ack from the beginning of the
331 IN[2] - Offset of the second cx18_mdl_ack from the beginning of the
333 ReturnCode - One of the ERR_DE_... */
334 #define CX18_CPU_DE_SET_MDL_ACK (CPU_CMD_MASK_DE | 0x0002)
336 /* Description: This command provides the offset to a Memory Descriptor List
337 IN[0] - Task handle. Handle of the task to start
338 IN[1] - Offset of the MDL from the beginning of the local DDR.
339 IN[2] - Number of cx18_mdl structures in the array pointed to by IN[1]
341 IN[4] - Total buffer length
342 ReturnCode - One of the ERR_DE_... */
343 #define CX18_CPU_DE_SET_MDL (CPU_CMD_MASK_DE | 0x0005)
345 /* Description: This command requests return of all current Memory
346 Descriptor Lists to the driver
347 IN[0] - Task handle. Handle of the task to start
348 ReturnCode - One of the ERR_DE_... */
349 /* #define CX18_CPU_DE_ReleaseMDL (CPU_CMD_MASK_DE | 0x0006) */
351 /* Description: This command signals the cpu that the dat buffer has been
352 consumed and ready for re-use.
353 IN[0] - Task handle. Handle of the task
354 IN[1] - Offset of the data block from the beginning of the local DDR.
355 IN[2] - Number of bytes in the data block
356 ReturnCode - One of the ERR_DE_... */
357 /* #define CX18_CPU_DE_RELEASE_BUFFER (CPU_CMD_MASK_DE | 0x0007) */
359 /* No Error / Success */
360 #define CNXT_OK 0x000000
362 /* Received unknown command */
363 #define CXERR_UNK_CMD 0x000001
365 /* First parameter in the command is invalid */
366 #define CXERR_INVALID_PARAM1 0x000002
368 /* Second parameter in the command is invalid */
369 #define CXERR_INVALID_PARAM2 0x000003
371 /* Device interface is not open/found */
372 #define CXERR_DEV_NOT_FOUND 0x000004
374 /* Requested function is not implemented/available */
375 #define CXERR_NOTSUPPORTED 0x000005
377 /* Invalid pointer is provided */
378 #define CXERR_BADPTR 0x000006
380 /* Unable to allocate memory */
381 #define CXERR_NOMEM 0x000007
383 /* Object/Link not found */
384 #define CXERR_LINK 0x000008
386 /* Device busy, command cannot be executed */
387 #define CXERR_BUSY 0x000009
389 /* File/device/handle is not open. */
390 #define CXERR_NOT_OPEN 0x00000A
392 /* Value is out of range */
393 #define CXERR_OUTOFRANGE 0x00000B
395 /* Buffer overflow */
396 #define CXERR_OVERFLOW 0x00000C
398 /* Version mismatch */
399 #define CXERR_BADVER 0x00000D
401 /* Operation timed out */
402 #define CXERR_TIMEOUT 0x00000E
404 /* Operation aborted */
405 #define CXERR_ABORT 0x00000F
407 /* Specified I2C device not found for read/write */
408 #define CXERR_I2CDEV_NOTFOUND 0x000010
410 /* Error in I2C data xfer (but I2C device is present) */
411 #define CXERR_I2CDEV_XFERERR 0x000011
413 /* Chanel changing component not ready */
414 #define CXERR_CHANNELNOTREADY 0x000012
416 /* PPU (Presensation/Decoder) mail box is corrupted */
417 #define CXERR_PPU_MB_CORRUPT 0x000013
419 /* CPU (Capture/Encoder) mail box is corrupted */
420 #define CXERR_CPU_MB_CORRUPT 0x000014
422 /* APU (Audio) mail box is corrupted */
423 #define CXERR_APU_MB_CORRUPT 0x000015
425 /* Unable to open file for reading */
426 #define CXERR_FILE_OPEN_READ 0x000016
428 /* Unable to open file for writing */
429 #define CXERR_FILE_OPEN_WRITE 0x000017
431 /* Unable to find the I2C section specified */
432 #define CXERR_I2C_BADSECTION 0x000018
434 /* Error in I2C data xfer (but I2C device is present) */
435 #define CXERR_I2CDEV_DATALOW 0x000019
437 /* Error in I2C data xfer (but I2C device is present) */
438 #define CXERR_I2CDEV_CLOCKLOW 0x00001A
440 /* No Interrupt received from HW (for I2C access) */
441 #define CXERR_NO_HW_I2C_INTR 0x00001B
443 /* RPU is not ready to accept commands! */
444 #define CXERR_RPU_NOT_READY 0x00001C
446 /* RPU is not ready to accept commands! */
447 #define CXERR_RPU_NO_ACK 0x00001D
449 /* The are no buffers ready. Try again soon! */
450 #define CXERR_NODATA_AGAIN 0x00001E
452 /* The stream is stopping. Function not alllowed now! */
453 #define CXERR_STOPPING_STATUS 0x00001F
455 /* Trying to access hardware when the power is turned OFF */
456 #define CXERR_DEVPOWER_OFF 0x000020
458 #endif /* CX23418_H */