162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  cx18 header containing common defines.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 2007  Hans Verkuil <hverkuil@xs4all.nl>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef CX23418_H
962306a36Sopenharmony_ci#define CX23418_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <media/drv-intf/cx2341x.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define MGR_CMD_MASK				0x40000000
1462306a36Sopenharmony_ci/* The MSB of the command code indicates that this is the completion of a
1562306a36Sopenharmony_ci   command */
1662306a36Sopenharmony_ci#define MGR_CMD_MASK_ACK			(MGR_CMD_MASK | 0x80000000)
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* Description: This command creates a new instance of a certain task
1962306a36Sopenharmony_ci   IN[0]  - Task ID. This is one of the XPU_CMD_MASK_YYY where XPU is
2062306a36Sopenharmony_ci	    the processor on which the task YYY will be created
2162306a36Sopenharmony_ci   OUT[0] - Task handle. This handle is passed along with commands to
2262306a36Sopenharmony_ci	    dispatch to the right instance of the task
2362306a36Sopenharmony_ci   ReturnCode - One of the ERR_SYS_... */
2462306a36Sopenharmony_ci#define CX18_CREATE_TASK			(MGR_CMD_MASK | 0x0001)
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* Description: This command destroys an instance of a task
2762306a36Sopenharmony_ci   IN[0] - Task handle. Hanlde of the task to destroy
2862306a36Sopenharmony_ci   ReturnCode - One of the ERR_SYS_... */
2962306a36Sopenharmony_ci#define CX18_DESTROY_TASK			(MGR_CMD_MASK | 0x0002)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* All commands for CPU have the following mask set */
3262306a36Sopenharmony_ci#define CPU_CMD_MASK				0x20000000
3362306a36Sopenharmony_ci#define CPU_CMD_MASK_DEBUG			(CPU_CMD_MASK | 0x00000000)
3462306a36Sopenharmony_ci#define CPU_CMD_MASK_ACK			(CPU_CMD_MASK | 0x80000000)
3562306a36Sopenharmony_ci#define CPU_CMD_MASK_CAPTURE			(CPU_CMD_MASK | 0x00020000)
3662306a36Sopenharmony_ci#define CPU_CMD_MASK_TS				(CPU_CMD_MASK | 0x00040000)
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define EPU_CMD_MASK				0x02000000
3962306a36Sopenharmony_ci#define EPU_CMD_MASK_DEBUG			(EPU_CMD_MASK | 0x000000)
4062306a36Sopenharmony_ci#define EPU_CMD_MASK_DE				(EPU_CMD_MASK | 0x040000)
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define APU_CMD_MASK				0x10000000
4362306a36Sopenharmony_ci#define APU_CMD_MASK_ACK			(APU_CMD_MASK | 0x80000000)
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define CX18_APU_ENCODING_METHOD_MPEG		(0 << 28)
4662306a36Sopenharmony_ci#define CX18_APU_ENCODING_METHOD_AC3		(1 << 28)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/* Description: Command APU to start audio
4962306a36Sopenharmony_ci   IN[0] - audio parameters (same as CX18_CPU_SET_AUDIO_PARAMETERS?)
5062306a36Sopenharmony_ci   IN[1] - caller buffer address, or 0
5162306a36Sopenharmony_ci   ReturnCode - ??? */
5262306a36Sopenharmony_ci#define CX18_APU_START				(APU_CMD_MASK | 0x01)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* Description: Command APU to stop audio
5562306a36Sopenharmony_ci   IN[0] - encoding method to stop
5662306a36Sopenharmony_ci   ReturnCode - ??? */
5762306a36Sopenharmony_ci#define CX18_APU_STOP				(APU_CMD_MASK | 0x02)
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/* Description: Command APU to reset the AI
6062306a36Sopenharmony_ci   ReturnCode - ??? */
6162306a36Sopenharmony_ci#define CX18_APU_RESETAI			(APU_CMD_MASK | 0x05)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* Description: This command indicates that a Memory Descriptor List has been
6462306a36Sopenharmony_ci   filled with the requested channel type
6562306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task
6662306a36Sopenharmony_ci   IN[1] - Offset of the MDL_ACK from the beginning of the local DDR.
6762306a36Sopenharmony_ci   IN[2] - Number of CNXT_MDL_ACK structures in the array pointed to by IN[1]
6862306a36Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
6962306a36Sopenharmony_ci#define CX18_EPU_DMA_DONE			(EPU_CMD_MASK_DE | 0x0001)
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* Something interesting happened
7262306a36Sopenharmony_ci   IN[0] - A value to log
7362306a36Sopenharmony_ci   IN[1] - An offset of a string in the MiniMe memory;
7462306a36Sopenharmony_ci	   0/zero/NULL means "I have nothing to say" */
7562306a36Sopenharmony_ci#define CX18_EPU_DEBUG				(EPU_CMD_MASK_DEBUG | 0x0003)
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/* Reads memory/registers (32-bit)
7862306a36Sopenharmony_ci   IN[0] - Address
7962306a36Sopenharmony_ci   OUT[1] - Value */
8062306a36Sopenharmony_ci#define CX18_CPU_DEBUG_PEEK32			(CPU_CMD_MASK_DEBUG | 0x0003)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/* Description: This command starts streaming with the set channel type
8362306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
8462306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
8562306a36Sopenharmony_ci#define CX18_CPU_CAPTURE_START			(CPU_CMD_MASK_CAPTURE | 0x0002)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/* Description: This command stops streaming with the set channel type
8862306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to stop
8962306a36Sopenharmony_ci   IN[1] - 0 = stop at end of GOP, 1 = stop at end of frame (MPEG only)
9062306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
9162306a36Sopenharmony_ci#define CX18_CPU_CAPTURE_STOP			(CPU_CMD_MASK_CAPTURE | 0x0003)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/* Description: This command pauses streaming with the set channel type
9462306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to pause
9562306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
9662306a36Sopenharmony_ci#define CX18_CPU_CAPTURE_PAUSE			(CPU_CMD_MASK_CAPTURE | 0x0007)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/* Description: This command resumes streaming with the set channel type
9962306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to resume
10062306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
10162306a36Sopenharmony_ci#define CX18_CPU_CAPTURE_RESUME			(CPU_CMD_MASK_CAPTURE | 0x0008)
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_NONE		0
10462306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_MPEG		1
10562306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_INDEX		2
10662306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_YUV		3
10762306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_PCM		4
10862306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_VBI		5
10962306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_SLICED_VBI		6
11062306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_TS			7
11162306a36Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_MAX		15
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/* Description: This command sets the channel type. This can only be done
11462306a36Sopenharmony_ci   when stopped.
11562306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
11662306a36Sopenharmony_ci   IN[1] - Channel Type. See Below.
11762306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
11862306a36Sopenharmony_ci#define CX18_CPU_SET_CHANNEL_TYPE		(CPU_CMD_MASK_CAPTURE + 1)
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci/* Description: Set stream output type
12162306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
12262306a36Sopenharmony_ci   IN[1] - type
12362306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
12462306a36Sopenharmony_ci#define CX18_CPU_SET_STREAM_OUTPUT_TYPE		(CPU_CMD_MASK_CAPTURE | 0x0012)
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* Description: Set video input resolution and frame rate
12762306a36Sopenharmony_ci   IN[0] - task handle
12862306a36Sopenharmony_ci   IN[1] - reserved
12962306a36Sopenharmony_ci   IN[2] - reserved
13062306a36Sopenharmony_ci   IN[3] - reserved
13162306a36Sopenharmony_ci   IN[4] - reserved
13262306a36Sopenharmony_ci   IN[5] - frame rate, 0 - 29.97f/s, 1 - 25f/s
13362306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
13462306a36Sopenharmony_ci#define CX18_CPU_SET_VIDEO_IN			(CPU_CMD_MASK_CAPTURE | 0x0004)
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* Description: Set video frame rate
13762306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
13862306a36Sopenharmony_ci   IN[1] - video bit rate mode
13962306a36Sopenharmony_ci   IN[2] - video average rate
14062306a36Sopenharmony_ci   IN[3] - video peak rate
14162306a36Sopenharmony_ci   IN[4] - system mux rate
14262306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
14362306a36Sopenharmony_ci#define CX18_CPU_SET_VIDEO_RATE			(CPU_CMD_MASK_CAPTURE | 0x0005)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/* Description: Set video output resolution
14662306a36Sopenharmony_ci   IN[0] - task handle
14762306a36Sopenharmony_ci   IN[1] - horizontal size
14862306a36Sopenharmony_ci   IN[2] - vertical size
14962306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
15062306a36Sopenharmony_ci#define CX18_CPU_SET_VIDEO_RESOLUTION		(CPU_CMD_MASK_CAPTURE | 0x0006)
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci/* Description: This command set filter parameters
15362306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task
15462306a36Sopenharmony_ci   IN[1] - type, 0 - temporal, 1 - spatial, 2 - median
15562306a36Sopenharmony_ci   IN[2] - mode,  temporal/spatial: 0 - disable, 1 - static, 2 - dynamic
15662306a36Sopenharmony_ci			median:	0 = disable, 1 = horizontal, 2 = vertical,
15762306a36Sopenharmony_ci				3 = horizontal/vertical, 4 = diagonal
15862306a36Sopenharmony_ci   IN[3] - strength, temporal 0 - 31, spatial 0 - 15
15962306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
16062306a36Sopenharmony_ci#define CX18_CPU_SET_FILTER_PARAM		(CPU_CMD_MASK_CAPTURE | 0x0009)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci/* Description: This command set spatial filter type
16362306a36Sopenharmony_ci   IN[0] - Task handle.
16462306a36Sopenharmony_ci   IN[1] - luma type: 0 = disable, 1 = 1D horizontal only, 2 = 1D vertical only,
16562306a36Sopenharmony_ci		      3 = 2D H/V separable, 4 = 2D symmetric non-separable
16662306a36Sopenharmony_ci   IN[2] - chroma type: 0 - disable, 1 = 1D horizontal
16762306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
16862306a36Sopenharmony_ci#define CX18_CPU_SET_SPATIAL_FILTER_TYPE	(CPU_CMD_MASK_CAPTURE | 0x000C)
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci/* Description: This command set coring levels for median filter
17162306a36Sopenharmony_ci   IN[0] - Task handle.
17262306a36Sopenharmony_ci   IN[1] - luma_high
17362306a36Sopenharmony_ci   IN[2] - luma_low
17462306a36Sopenharmony_ci   IN[3] - chroma_high
17562306a36Sopenharmony_ci   IN[4] - chroma_low
17662306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
17762306a36Sopenharmony_ci#define CX18_CPU_SET_MEDIAN_CORING		(CPU_CMD_MASK_CAPTURE | 0x000E)
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci/* Description: This command set the picture type mask for index file
18062306a36Sopenharmony_ci   IN[0] - Task handle (ignored by firmware)
18162306a36Sopenharmony_ci   IN[1] -	0 = disable index file output
18262306a36Sopenharmony_ci			1 = output I picture
18362306a36Sopenharmony_ci			2 = P picture
18462306a36Sopenharmony_ci			4 = B picture
18562306a36Sopenharmony_ci			other = illegal */
18662306a36Sopenharmony_ci#define CX18_CPU_SET_INDEXTABLE			(CPU_CMD_MASK_CAPTURE | 0x0010)
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci/* Description: Set audio parameters
18962306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
19062306a36Sopenharmony_ci   IN[1] - audio parameter
19162306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
19262306a36Sopenharmony_ci#define CX18_CPU_SET_AUDIO_PARAMETERS		(CPU_CMD_MASK_CAPTURE | 0x0011)
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci/* Description: Set video mute
19562306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
19662306a36Sopenharmony_ci   IN[1] - bit31-24: muteYvalue
19762306a36Sopenharmony_ci	   bit23-16: muteUvalue
19862306a36Sopenharmony_ci	   bit15-8:  muteVvalue
19962306a36Sopenharmony_ci	   bit0:     1:mute, 0: unmute
20062306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
20162306a36Sopenharmony_ci#define CX18_CPU_SET_VIDEO_MUTE			(CPU_CMD_MASK_CAPTURE | 0x0013)
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci/* Description: Set audio mute
20462306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
20562306a36Sopenharmony_ci   IN[1] - mute/unmute
20662306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
20762306a36Sopenharmony_ci#define CX18_CPU_SET_AUDIO_MUTE			(CPU_CMD_MASK_CAPTURE | 0x0014)
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci/* Description: Set stream output type
21062306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
21162306a36Sopenharmony_ci   IN[1] - subType
21262306a36Sopenharmony_ci	    SET_INITIAL_SCR			1
21362306a36Sopenharmony_ci	    SET_QUALITY_MODE            2
21462306a36Sopenharmony_ci	    SET_VIM_PROTECT_MODE        3
21562306a36Sopenharmony_ci	    SET_PTS_CORRECTION          4
21662306a36Sopenharmony_ci	    SET_USB_FLUSH_MODE          5
21762306a36Sopenharmony_ci	    SET_MERAQPAR_ENABLE         6
21862306a36Sopenharmony_ci	    SET_NAV_PACK_INSERTION      7
21962306a36Sopenharmony_ci	    SET_SCENE_CHANGE_ENABLE     8
22062306a36Sopenharmony_ci   IN[2] - parameter 1
22162306a36Sopenharmony_ci   IN[3] - parameter 2
22262306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
22362306a36Sopenharmony_ci#define CX18_CPU_SET_MISC_PARAMETERS		(CPU_CMD_MASK_CAPTURE | 0x0015)
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci/* Description: Set raw VBI parameters
22662306a36Sopenharmony_ci   IN[0] - Task handle
22762306a36Sopenharmony_ci   IN[1] - No. of input lines per field:
22862306a36Sopenharmony_ci				bit[15:0]: field 1,
22962306a36Sopenharmony_ci				bit[31:16]: field 2
23062306a36Sopenharmony_ci   IN[2] - No. of input bytes per line
23162306a36Sopenharmony_ci   IN[3] - No. of output frames per transfer
23262306a36Sopenharmony_ci   IN[4] - start code
23362306a36Sopenharmony_ci   IN[5] - stop code
23462306a36Sopenharmony_ci   ReturnCode */
23562306a36Sopenharmony_ci#define CX18_CPU_SET_RAW_VBI_PARAM		(CPU_CMD_MASK_CAPTURE | 0x0016)
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci/* Description: Set capture line No.
23862306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
23962306a36Sopenharmony_ci   IN[1] - height1
24062306a36Sopenharmony_ci   IN[2] - height2
24162306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
24262306a36Sopenharmony_ci#define CX18_CPU_SET_CAPTURE_LINE_NO		(CPU_CMD_MASK_CAPTURE | 0x0017)
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci/* Description: Set copyright
24562306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
24662306a36Sopenharmony_ci   IN[1] - copyright
24762306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
24862306a36Sopenharmony_ci#define CX18_CPU_SET_COPYRIGHT			(CPU_CMD_MASK_CAPTURE | 0x0018)
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci/* Description: Set audio PID
25162306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
25262306a36Sopenharmony_ci   IN[1] - PID
25362306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
25462306a36Sopenharmony_ci#define CX18_CPU_SET_AUDIO_PID			(CPU_CMD_MASK_CAPTURE | 0x0019)
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci/* Description: Set video PID
25762306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
25862306a36Sopenharmony_ci   IN[1] - PID
25962306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
26062306a36Sopenharmony_ci#define CX18_CPU_SET_VIDEO_PID			(CPU_CMD_MASK_CAPTURE | 0x001A)
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci/* Description: Set Vertical Crop Line
26362306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
26462306a36Sopenharmony_ci   IN[1] - Line
26562306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
26662306a36Sopenharmony_ci#define CX18_CPU_SET_VER_CROP_LINE		(CPU_CMD_MASK_CAPTURE | 0x001B)
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci/* Description: Set COP structure
26962306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
27062306a36Sopenharmony_ci   IN[1] - M
27162306a36Sopenharmony_ci   IN[2] - N
27262306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
27362306a36Sopenharmony_ci#define CX18_CPU_SET_GOP_STRUCTURE		(CPU_CMD_MASK_CAPTURE | 0x001C)
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci/* Description: Set Scene Change Detection
27662306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
27762306a36Sopenharmony_ci   IN[1] - scene change
27862306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
27962306a36Sopenharmony_ci#define CX18_CPU_SET_SCENE_CHANGE_DETECTION	(CPU_CMD_MASK_CAPTURE | 0x001D)
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci/* Description: Set Aspect Ratio
28262306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
28362306a36Sopenharmony_ci   IN[1] - AspectRatio
28462306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
28562306a36Sopenharmony_ci#define CX18_CPU_SET_ASPECT_RATIO		(CPU_CMD_MASK_CAPTURE | 0x001E)
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci/* Description: Set Skip Input Frame
28862306a36Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
28962306a36Sopenharmony_ci   IN[1] - skip input frames
29062306a36Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
29162306a36Sopenharmony_ci#define CX18_CPU_SET_SKIP_INPUT_FRAME		(CPU_CMD_MASK_CAPTURE | 0x001F)
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci/* Description: Set sliced VBI parameters -
29462306a36Sopenharmony_ci   Note This API will only apply to MPEG and Sliced VBI Channels
29562306a36Sopenharmony_ci   IN[0] - Task handle
29662306a36Sopenharmony_ci   IN[1] - output type, 0 - CC, 1 - Moji, 2 - Teletext
29762306a36Sopenharmony_ci   IN[2] - start / stop line
29862306a36Sopenharmony_ci			bit[15:0] start line number
29962306a36Sopenharmony_ci			bit[31:16] stop line number
30062306a36Sopenharmony_ci   IN[3] - number of output frames per interrupt
30162306a36Sopenharmony_ci   IN[4] - VBI insertion mode
30262306a36Sopenharmony_ci			bit 0:	output user data, 1 - enable
30362306a36Sopenharmony_ci			bit 1:	output private stream, 1 - enable
30462306a36Sopenharmony_ci			bit 2:	mux option, 0 - in GOP, 1 - in picture
30562306a36Sopenharmony_ci			bit[7:0]	private stream ID
30662306a36Sopenharmony_ci   IN[5] - insertion period while mux option is in picture
30762306a36Sopenharmony_ci   ReturnCode - VBI data offset */
30862306a36Sopenharmony_ci#define CX18_CPU_SET_SLICED_VBI_PARAM		(CPU_CMD_MASK_CAPTURE | 0x0020)
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci/* Description: Set the user data place holder
31162306a36Sopenharmony_ci   IN[0] - type of data (0 for user)
31262306a36Sopenharmony_ci   IN[1] - Stuffing period
31362306a36Sopenharmony_ci   IN[2] - ID data size in word (less than 10)
31462306a36Sopenharmony_ci   IN[3] - Pointer to ID buffer */
31562306a36Sopenharmony_ci#define CX18_CPU_SET_USERDATA_PLACE_HOLDER	(CPU_CMD_MASK_CAPTURE | 0x0021)
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci/* Description:
31962306a36Sopenharmony_ci   In[0] Task Handle
32062306a36Sopenharmony_ci   return parameter:
32162306a36Sopenharmony_ci   Out[0]  Reserved
32262306a36Sopenharmony_ci   Out[1]  Video PTS bit[32:2] of last output video frame.
32362306a36Sopenharmony_ci   Out[2]  Video PTS bit[ 1:0] of last output video frame.
32462306a36Sopenharmony_ci   Out[3]  Hardware Video PTS counter bit[31:0],
32562306a36Sopenharmony_ci	     these bits get incremented on every 90kHz clock tick.
32662306a36Sopenharmony_ci   Out[4]  Hardware Video PTS counter bit32,
32762306a36Sopenharmony_ci	     these bits get incremented on every 90kHz clock tick.
32862306a36Sopenharmony_ci   ReturnCode */
32962306a36Sopenharmony_ci#define CX18_CPU_GET_ENC_PTS			(CPU_CMD_MASK_CAPTURE | 0x0022)
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci/* Description: Set VFC parameters
33262306a36Sopenharmony_ci   IN[0] - task handle
33362306a36Sopenharmony_ci   IN[1] - VFC enable flag, 1 - enable, 0 - disable
33462306a36Sopenharmony_ci*/
33562306a36Sopenharmony_ci#define CX18_CPU_SET_VFC_PARAM                  (CPU_CMD_MASK_CAPTURE | 0x0023)
33662306a36Sopenharmony_ci
33762306a36Sopenharmony_ci/* Below is the list of commands related to the data exchange */
33862306a36Sopenharmony_ci#define CPU_CMD_MASK_DE				(CPU_CMD_MASK | 0x040000)
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci/* Description: This command provides the physical base address of the local
34162306a36Sopenharmony_ci   DDR as viewed by EPU
34262306a36Sopenharmony_ci   IN[0] - Physical offset where EPU has the local DDR mapped
34362306a36Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
34462306a36Sopenharmony_ci#define CPU_CMD_DE_SetBase			(CPU_CMD_MASK_DE | 0x0001)
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci/* Description: This command provides the offsets in the device memory where
34762306a36Sopenharmony_ci   the 2 cx18_mdl_ack blocks reside
34862306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
34962306a36Sopenharmony_ci   IN[1] - Offset of the first cx18_mdl_ack from the beginning of the
35062306a36Sopenharmony_ci	   local DDR.
35162306a36Sopenharmony_ci   IN[2] - Offset of the second cx18_mdl_ack from the beginning of the
35262306a36Sopenharmony_ci	   local DDR.
35362306a36Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
35462306a36Sopenharmony_ci#define CX18_CPU_DE_SET_MDL_ACK			(CPU_CMD_MASK_DE | 0x0002)
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ci/* Description: This command provides the offset to a Memory Descriptor List
35762306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
35862306a36Sopenharmony_ci   IN[1] - Offset of the MDL from the beginning of the local DDR.
35962306a36Sopenharmony_ci   IN[2] - Number of cx18_mdl_ent structures in the array pointed to by IN[1]
36062306a36Sopenharmony_ci   IN[3] - Buffer ID
36162306a36Sopenharmony_ci   IN[4] - Total buffer length
36262306a36Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
36362306a36Sopenharmony_ci#define CX18_CPU_DE_SET_MDL			(CPU_CMD_MASK_DE | 0x0005)
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci/* Description: This command requests return of all current Memory
36662306a36Sopenharmony_ci   Descriptor Lists to the driver
36762306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
36862306a36Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
36962306a36Sopenharmony_ci#define CX18_CPU_DE_RELEASE_MDL			(CPU_CMD_MASK_DE | 0x0006)
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ci/* Description: This command signals the cpu that the dat buffer has been
37262306a36Sopenharmony_ci   consumed and ready for re-use.
37362306a36Sopenharmony_ci   IN[0] - Task handle. Handle of the task
37462306a36Sopenharmony_ci   IN[1] - Offset of the data block from the beginning of the local DDR.
37562306a36Sopenharmony_ci   IN[2] - Number of bytes in the data block
37662306a36Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
37762306a36Sopenharmony_ci/* #define CX18_CPU_DE_RELEASE_BUFFER           (CPU_CMD_MASK_DE | 0x0007) */
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_ci/* No Error / Success */
38062306a36Sopenharmony_ci#define CNXT_OK                 0x000000
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci/* Received unknown command */
38362306a36Sopenharmony_ci#define CXERR_UNK_CMD           0x000001
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci/* First parameter in the command is invalid */
38662306a36Sopenharmony_ci#define CXERR_INVALID_PARAM1    0x000002
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ci/* Second parameter in the command is invalid */
38962306a36Sopenharmony_ci#define CXERR_INVALID_PARAM2    0x000003
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci/* Device interface is not open/found */
39262306a36Sopenharmony_ci#define CXERR_DEV_NOT_FOUND     0x000004
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ci/* Requested function is not implemented/available */
39562306a36Sopenharmony_ci#define CXERR_NOTSUPPORTED      0x000005
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ci/* Invalid pointer is provided */
39862306a36Sopenharmony_ci#define CXERR_BADPTR            0x000006
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ci/* Unable to allocate memory */
40162306a36Sopenharmony_ci#define CXERR_NOMEM             0x000007
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci/* Object/Link not found */
40462306a36Sopenharmony_ci#define CXERR_LINK              0x000008
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_ci/* Device busy, command cannot be executed */
40762306a36Sopenharmony_ci#define CXERR_BUSY              0x000009
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci/* File/device/handle is not open. */
41062306a36Sopenharmony_ci#define CXERR_NOT_OPEN          0x00000A
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci/* Value is out of range */
41362306a36Sopenharmony_ci#define CXERR_OUTOFRANGE        0x00000B
41462306a36Sopenharmony_ci
41562306a36Sopenharmony_ci/* Buffer overflow */
41662306a36Sopenharmony_ci#define CXERR_OVERFLOW          0x00000C
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ci/* Version mismatch */
41962306a36Sopenharmony_ci#define CXERR_BADVER            0x00000D
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci/* Operation timed out */
42262306a36Sopenharmony_ci#define CXERR_TIMEOUT           0x00000E
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/* Operation aborted */
42562306a36Sopenharmony_ci#define CXERR_ABORT             0x00000F
42662306a36Sopenharmony_ci
42762306a36Sopenharmony_ci/* Specified I2C device not found for read/write */
42862306a36Sopenharmony_ci#define CXERR_I2CDEV_NOTFOUND   0x000010
42962306a36Sopenharmony_ci
43062306a36Sopenharmony_ci/* Error in I2C data xfer (but I2C device is present) */
43162306a36Sopenharmony_ci#define CXERR_I2CDEV_XFERERR    0x000011
43262306a36Sopenharmony_ci
43362306a36Sopenharmony_ci/* Channel changing component not ready */
43462306a36Sopenharmony_ci#define CXERR_CHANNELNOTREADY   0x000012
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ci/* PPU (Presensation/Decoder) mail box is corrupted */
43762306a36Sopenharmony_ci#define CXERR_PPU_MB_CORRUPT    0x000013
43862306a36Sopenharmony_ci
43962306a36Sopenharmony_ci/* CPU (Capture/Encoder) mail box is corrupted */
44062306a36Sopenharmony_ci#define CXERR_CPU_MB_CORRUPT    0x000014
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ci/* APU (Audio) mail box is corrupted */
44362306a36Sopenharmony_ci#define CXERR_APU_MB_CORRUPT    0x000015
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_ci/* Unable to open file for reading */
44662306a36Sopenharmony_ci#define CXERR_FILE_OPEN_READ    0x000016
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_ci/* Unable to open file for writing */
44962306a36Sopenharmony_ci#define CXERR_FILE_OPEN_WRITE   0x000017
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci/* Unable to find the I2C section specified */
45262306a36Sopenharmony_ci#define CXERR_I2C_BADSECTION    0x000018
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ci/* Error in I2C data xfer (but I2C device is present) */
45562306a36Sopenharmony_ci#define CXERR_I2CDEV_DATALOW    0x000019
45662306a36Sopenharmony_ci
45762306a36Sopenharmony_ci/* Error in I2C data xfer (but I2C device is present) */
45862306a36Sopenharmony_ci#define CXERR_I2CDEV_CLOCKLOW   0x00001A
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci/* No Interrupt received from HW (for I2C access) */
46162306a36Sopenharmony_ci#define CXERR_NO_HW_I2C_INTR    0x00001B
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci/* RPU is not ready to accept commands! */
46462306a36Sopenharmony_ci#define CXERR_RPU_NOT_READY     0x00001C
46562306a36Sopenharmony_ci
46662306a36Sopenharmony_ci/* RPU is not ready to accept commands! */
46762306a36Sopenharmony_ci#define CXERR_RPU_NO_ACK        0x00001D
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ci/* The are no buffers ready. Try again soon! */
47062306a36Sopenharmony_ci#define CXERR_NODATA_AGAIN      0x00001E
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci/* The stream is stopping. Function not allowed now! */
47362306a36Sopenharmony_ci#define CXERR_STOPPING_STATUS   0x00001F
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci/* Trying to access hardware when the power is turned OFF */
47662306a36Sopenharmony_ci#define CXERR_DEVPOWER_OFF      0x000020
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_ci#endif /* CX23418_H */
479