18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  cx18 header containing common defines.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2007  Hans Verkuil <hverkuil@xs4all.nl>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef CX23418_H
98c2ecf20Sopenharmony_ci#define CX23418_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <media/drv-intf/cx2341x.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define MGR_CMD_MASK				0x40000000
148c2ecf20Sopenharmony_ci/* The MSB of the command code indicates that this is the completion of a
158c2ecf20Sopenharmony_ci   command */
168c2ecf20Sopenharmony_ci#define MGR_CMD_MASK_ACK			(MGR_CMD_MASK | 0x80000000)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* Description: This command creates a new instance of a certain task
198c2ecf20Sopenharmony_ci   IN[0]  - Task ID. This is one of the XPU_CMD_MASK_YYY where XPU is
208c2ecf20Sopenharmony_ci	    the processor on which the task YYY will be created
218c2ecf20Sopenharmony_ci   OUT[0] - Task handle. This handle is passed along with commands to
228c2ecf20Sopenharmony_ci	    dispatch to the right instance of the task
238c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_SYS_... */
248c2ecf20Sopenharmony_ci#define CX18_CREATE_TASK			(MGR_CMD_MASK | 0x0001)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Description: This command destroys an instance of a task
278c2ecf20Sopenharmony_ci   IN[0] - Task handle. Hanlde of the task to destroy
288c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_SYS_... */
298c2ecf20Sopenharmony_ci#define CX18_DESTROY_TASK			(MGR_CMD_MASK | 0x0002)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* All commands for CPU have the following mask set */
328c2ecf20Sopenharmony_ci#define CPU_CMD_MASK				0x20000000
338c2ecf20Sopenharmony_ci#define CPU_CMD_MASK_DEBUG			(CPU_CMD_MASK | 0x00000000)
348c2ecf20Sopenharmony_ci#define CPU_CMD_MASK_ACK			(CPU_CMD_MASK | 0x80000000)
358c2ecf20Sopenharmony_ci#define CPU_CMD_MASK_CAPTURE			(CPU_CMD_MASK | 0x00020000)
368c2ecf20Sopenharmony_ci#define CPU_CMD_MASK_TS				(CPU_CMD_MASK | 0x00040000)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define EPU_CMD_MASK				0x02000000
398c2ecf20Sopenharmony_ci#define EPU_CMD_MASK_DEBUG			(EPU_CMD_MASK | 0x000000)
408c2ecf20Sopenharmony_ci#define EPU_CMD_MASK_DE				(EPU_CMD_MASK | 0x040000)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define APU_CMD_MASK				0x10000000
438c2ecf20Sopenharmony_ci#define APU_CMD_MASK_ACK			(APU_CMD_MASK | 0x80000000)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define CX18_APU_ENCODING_METHOD_MPEG		(0 << 28)
468c2ecf20Sopenharmony_ci#define CX18_APU_ENCODING_METHOD_AC3		(1 << 28)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* Description: Command APU to start audio
498c2ecf20Sopenharmony_ci   IN[0] - audio parameters (same as CX18_CPU_SET_AUDIO_PARAMETERS?)
508c2ecf20Sopenharmony_ci   IN[1] - caller buffer address, or 0
518c2ecf20Sopenharmony_ci   ReturnCode - ??? */
528c2ecf20Sopenharmony_ci#define CX18_APU_START				(APU_CMD_MASK | 0x01)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* Description: Command APU to stop audio
558c2ecf20Sopenharmony_ci   IN[0] - encoding method to stop
568c2ecf20Sopenharmony_ci   ReturnCode - ??? */
578c2ecf20Sopenharmony_ci#define CX18_APU_STOP				(APU_CMD_MASK | 0x02)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* Description: Command APU to reset the AI
608c2ecf20Sopenharmony_ci   ReturnCode - ??? */
618c2ecf20Sopenharmony_ci#define CX18_APU_RESETAI			(APU_CMD_MASK | 0x05)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* Description: This command indicates that a Memory Descriptor List has been
648c2ecf20Sopenharmony_ci   filled with the requested channel type
658c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task
668c2ecf20Sopenharmony_ci   IN[1] - Offset of the MDL_ACK from the beginning of the local DDR.
678c2ecf20Sopenharmony_ci   IN[2] - Number of CNXT_MDL_ACK structures in the array pointed to by IN[1]
688c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
698c2ecf20Sopenharmony_ci#define CX18_EPU_DMA_DONE			(EPU_CMD_MASK_DE | 0x0001)
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* Something interesting happened
728c2ecf20Sopenharmony_ci   IN[0] - A value to log
738c2ecf20Sopenharmony_ci   IN[1] - An offset of a string in the MiniMe memory;
748c2ecf20Sopenharmony_ci	   0/zero/NULL means "I have nothing to say" */
758c2ecf20Sopenharmony_ci#define CX18_EPU_DEBUG				(EPU_CMD_MASK_DEBUG | 0x0003)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* Reads memory/registers (32-bit)
788c2ecf20Sopenharmony_ci   IN[0] - Address
798c2ecf20Sopenharmony_ci   OUT[1] - Value */
808c2ecf20Sopenharmony_ci#define CX18_CPU_DEBUG_PEEK32			(CPU_CMD_MASK_DEBUG | 0x0003)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* Description: This command starts streaming with the set channel type
838c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
848c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
858c2ecf20Sopenharmony_ci#define CX18_CPU_CAPTURE_START			(CPU_CMD_MASK_CAPTURE | 0x0002)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* Description: This command stops streaming with the set channel type
888c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to stop
898c2ecf20Sopenharmony_ci   IN[1] - 0 = stop at end of GOP, 1 = stop at end of frame (MPEG only)
908c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
918c2ecf20Sopenharmony_ci#define CX18_CPU_CAPTURE_STOP			(CPU_CMD_MASK_CAPTURE | 0x0003)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* Description: This command pauses streaming with the set channel type
948c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to pause
958c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
968c2ecf20Sopenharmony_ci#define CX18_CPU_CAPTURE_PAUSE			(CPU_CMD_MASK_CAPTURE | 0x0007)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* Description: This command resumes streaming with the set channel type
998c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to resume
1008c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1018c2ecf20Sopenharmony_ci#define CX18_CPU_CAPTURE_RESUME			(CPU_CMD_MASK_CAPTURE | 0x0008)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_NONE		0
1048c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_MPEG		1
1058c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_INDEX		2
1068c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_YUV		3
1078c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_PCM		4
1088c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_VBI		5
1098c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_SLICED_VBI		6
1108c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_TS			7
1118c2ecf20Sopenharmony_ci#define CAPTURE_CHANNEL_TYPE_MAX		15
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/* Description: This command sets the channel type. This can only be done
1148c2ecf20Sopenharmony_ci   when stopped.
1158c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
1168c2ecf20Sopenharmony_ci   IN[1] - Channel Type. See Below.
1178c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1188c2ecf20Sopenharmony_ci#define CX18_CPU_SET_CHANNEL_TYPE		(CPU_CMD_MASK_CAPTURE + 1)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* Description: Set stream output type
1218c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
1228c2ecf20Sopenharmony_ci   IN[1] - type
1238c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1248c2ecf20Sopenharmony_ci#define CX18_CPU_SET_STREAM_OUTPUT_TYPE		(CPU_CMD_MASK_CAPTURE | 0x0012)
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/* Description: Set video input resolution and frame rate
1278c2ecf20Sopenharmony_ci   IN[0] - task handle
1288c2ecf20Sopenharmony_ci   IN[1] - reserved
1298c2ecf20Sopenharmony_ci   IN[2] - reserved
1308c2ecf20Sopenharmony_ci   IN[3] - reserved
1318c2ecf20Sopenharmony_ci   IN[4] - reserved
1328c2ecf20Sopenharmony_ci   IN[5] - frame rate, 0 - 29.97f/s, 1 - 25f/s
1338c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1348c2ecf20Sopenharmony_ci#define CX18_CPU_SET_VIDEO_IN			(CPU_CMD_MASK_CAPTURE | 0x0004)
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* Description: Set video frame rate
1378c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
1388c2ecf20Sopenharmony_ci   IN[1] - video bit rate mode
1398c2ecf20Sopenharmony_ci   IN[2] - video average rate
1408c2ecf20Sopenharmony_ci   IN[3] - video peak rate
1418c2ecf20Sopenharmony_ci   IN[4] - system mux rate
1428c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1438c2ecf20Sopenharmony_ci#define CX18_CPU_SET_VIDEO_RATE			(CPU_CMD_MASK_CAPTURE | 0x0005)
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/* Description: Set video output resolution
1468c2ecf20Sopenharmony_ci   IN[0] - task handle
1478c2ecf20Sopenharmony_ci   IN[1] - horizontal size
1488c2ecf20Sopenharmony_ci   IN[2] - vertical size
1498c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1508c2ecf20Sopenharmony_ci#define CX18_CPU_SET_VIDEO_RESOLUTION		(CPU_CMD_MASK_CAPTURE | 0x0006)
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/* Description: This command set filter parameters
1538c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task
1548c2ecf20Sopenharmony_ci   IN[1] - type, 0 - temporal, 1 - spatial, 2 - median
1558c2ecf20Sopenharmony_ci   IN[2] - mode,  temporal/spatial: 0 - disable, 1 - static, 2 - dynamic
1568c2ecf20Sopenharmony_ci			median:	0 = disable, 1 = horizontal, 2 = vertical,
1578c2ecf20Sopenharmony_ci				3 = horizontal/vertical, 4 = diagonal
1588c2ecf20Sopenharmony_ci   IN[3] - strength, temporal 0 - 31, spatial 0 - 15
1598c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1608c2ecf20Sopenharmony_ci#define CX18_CPU_SET_FILTER_PARAM		(CPU_CMD_MASK_CAPTURE | 0x0009)
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci/* Description: This command set spatial filter type
1638c2ecf20Sopenharmony_ci   IN[0] - Task handle.
1648c2ecf20Sopenharmony_ci   IN[1] - luma type: 0 = disable, 1 = 1D horizontal only, 2 = 1D vertical only,
1658c2ecf20Sopenharmony_ci		      3 = 2D H/V separable, 4 = 2D symmetric non-separable
1668c2ecf20Sopenharmony_ci   IN[2] - chroma type: 0 - disable, 1 = 1D horizontal
1678c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1688c2ecf20Sopenharmony_ci#define CX18_CPU_SET_SPATIAL_FILTER_TYPE	(CPU_CMD_MASK_CAPTURE | 0x000C)
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci/* Description: This command set coring levels for median filter
1718c2ecf20Sopenharmony_ci   IN[0] - Task handle.
1728c2ecf20Sopenharmony_ci   IN[1] - luma_high
1738c2ecf20Sopenharmony_ci   IN[2] - luma_low
1748c2ecf20Sopenharmony_ci   IN[3] - chroma_high
1758c2ecf20Sopenharmony_ci   IN[4] - chroma_low
1768c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1778c2ecf20Sopenharmony_ci#define CX18_CPU_SET_MEDIAN_CORING		(CPU_CMD_MASK_CAPTURE | 0x000E)
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci/* Description: This command set the picture type mask for index file
1808c2ecf20Sopenharmony_ci   IN[0] - Task handle (ignored by firmware)
1818c2ecf20Sopenharmony_ci   IN[1] -	0 = disable index file output
1828c2ecf20Sopenharmony_ci			1 = output I picture
1838c2ecf20Sopenharmony_ci			2 = P picture
1848c2ecf20Sopenharmony_ci			4 = B picture
1858c2ecf20Sopenharmony_ci			other = illegal */
1868c2ecf20Sopenharmony_ci#define CX18_CPU_SET_INDEXTABLE			(CPU_CMD_MASK_CAPTURE | 0x0010)
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci/* Description: Set audio parameters
1898c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
1908c2ecf20Sopenharmony_ci   IN[1] - audio parameter
1918c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
1928c2ecf20Sopenharmony_ci#define CX18_CPU_SET_AUDIO_PARAMETERS		(CPU_CMD_MASK_CAPTURE | 0x0011)
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/* Description: Set video mute
1958c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
1968c2ecf20Sopenharmony_ci   IN[1] - bit31-24: muteYvalue
1978c2ecf20Sopenharmony_ci	   bit23-16: muteUvalue
1988c2ecf20Sopenharmony_ci	   bit15-8:  muteVvalue
1998c2ecf20Sopenharmony_ci	   bit0:     1:mute, 0: unmute
2008c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2018c2ecf20Sopenharmony_ci#define CX18_CPU_SET_VIDEO_MUTE			(CPU_CMD_MASK_CAPTURE | 0x0013)
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/* Description: Set audio mute
2048c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2058c2ecf20Sopenharmony_ci   IN[1] - mute/unmute
2068c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2078c2ecf20Sopenharmony_ci#define CX18_CPU_SET_AUDIO_MUTE			(CPU_CMD_MASK_CAPTURE | 0x0014)
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/* Description: Set stream output type
2108c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2118c2ecf20Sopenharmony_ci   IN[1] - subType
2128c2ecf20Sopenharmony_ci	    SET_INITIAL_SCR			1
2138c2ecf20Sopenharmony_ci	    SET_QUALITY_MODE            2
2148c2ecf20Sopenharmony_ci	    SET_VIM_PROTECT_MODE        3
2158c2ecf20Sopenharmony_ci	    SET_PTS_CORRECTION          4
2168c2ecf20Sopenharmony_ci	    SET_USB_FLUSH_MODE          5
2178c2ecf20Sopenharmony_ci	    SET_MERAQPAR_ENABLE         6
2188c2ecf20Sopenharmony_ci	    SET_NAV_PACK_INSERTION      7
2198c2ecf20Sopenharmony_ci	    SET_SCENE_CHANGE_ENABLE     8
2208c2ecf20Sopenharmony_ci   IN[2] - parameter 1
2218c2ecf20Sopenharmony_ci   IN[3] - parameter 2
2228c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2238c2ecf20Sopenharmony_ci#define CX18_CPU_SET_MISC_PARAMETERS		(CPU_CMD_MASK_CAPTURE | 0x0015)
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/* Description: Set raw VBI parameters
2268c2ecf20Sopenharmony_ci   IN[0] - Task handle
2278c2ecf20Sopenharmony_ci   IN[1] - No. of input lines per field:
2288c2ecf20Sopenharmony_ci				bit[15:0]: field 1,
2298c2ecf20Sopenharmony_ci				bit[31:16]: field 2
2308c2ecf20Sopenharmony_ci   IN[2] - No. of input bytes per line
2318c2ecf20Sopenharmony_ci   IN[3] - No. of output frames per transfer
2328c2ecf20Sopenharmony_ci   IN[4] - start code
2338c2ecf20Sopenharmony_ci   IN[5] - stop code
2348c2ecf20Sopenharmony_ci   ReturnCode */
2358c2ecf20Sopenharmony_ci#define CX18_CPU_SET_RAW_VBI_PARAM		(CPU_CMD_MASK_CAPTURE | 0x0016)
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci/* Description: Set capture line No.
2388c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2398c2ecf20Sopenharmony_ci   IN[1] - height1
2408c2ecf20Sopenharmony_ci   IN[2] - height2
2418c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2428c2ecf20Sopenharmony_ci#define CX18_CPU_SET_CAPTURE_LINE_NO		(CPU_CMD_MASK_CAPTURE | 0x0017)
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* Description: Set copyright
2458c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2468c2ecf20Sopenharmony_ci   IN[1] - copyright
2478c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2488c2ecf20Sopenharmony_ci#define CX18_CPU_SET_COPYRIGHT			(CPU_CMD_MASK_CAPTURE | 0x0018)
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci/* Description: Set audio PID
2518c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2528c2ecf20Sopenharmony_ci   IN[1] - PID
2538c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2548c2ecf20Sopenharmony_ci#define CX18_CPU_SET_AUDIO_PID			(CPU_CMD_MASK_CAPTURE | 0x0019)
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/* Description: Set video PID
2578c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2588c2ecf20Sopenharmony_ci   IN[1] - PID
2598c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2608c2ecf20Sopenharmony_ci#define CX18_CPU_SET_VIDEO_PID			(CPU_CMD_MASK_CAPTURE | 0x001A)
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci/* Description: Set Vertical Crop Line
2638c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2648c2ecf20Sopenharmony_ci   IN[1] - Line
2658c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2668c2ecf20Sopenharmony_ci#define CX18_CPU_SET_VER_CROP_LINE		(CPU_CMD_MASK_CAPTURE | 0x001B)
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/* Description: Set COP structure
2698c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2708c2ecf20Sopenharmony_ci   IN[1] - M
2718c2ecf20Sopenharmony_ci   IN[2] - N
2728c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2738c2ecf20Sopenharmony_ci#define CX18_CPU_SET_GOP_STRUCTURE		(CPU_CMD_MASK_CAPTURE | 0x001C)
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/* Description: Set Scene Change Detection
2768c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2778c2ecf20Sopenharmony_ci   IN[1] - scene change
2788c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2798c2ecf20Sopenharmony_ci#define CX18_CPU_SET_SCENE_CHANGE_DETECTION	(CPU_CMD_MASK_CAPTURE | 0x001D)
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci/* Description: Set Aspect Ratio
2828c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2838c2ecf20Sopenharmony_ci   IN[1] - AspectRatio
2848c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2858c2ecf20Sopenharmony_ci#define CX18_CPU_SET_ASPECT_RATIO		(CPU_CMD_MASK_CAPTURE | 0x001E)
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci/* Description: Set Skip Input Frame
2888c2ecf20Sopenharmony_ci   IN[0] - task handle. Handle of the task to start
2898c2ecf20Sopenharmony_ci   IN[1] - skip input frames
2908c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_CAPTURE_... */
2918c2ecf20Sopenharmony_ci#define CX18_CPU_SET_SKIP_INPUT_FRAME		(CPU_CMD_MASK_CAPTURE | 0x001F)
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci/* Description: Set sliced VBI parameters -
2948c2ecf20Sopenharmony_ci   Note This API will only apply to MPEG and Sliced VBI Channels
2958c2ecf20Sopenharmony_ci   IN[0] - Task handle
2968c2ecf20Sopenharmony_ci   IN[1] - output type, 0 - CC, 1 - Moji, 2 - Teletext
2978c2ecf20Sopenharmony_ci   IN[2] - start / stop line
2988c2ecf20Sopenharmony_ci			bit[15:0] start line number
2998c2ecf20Sopenharmony_ci			bit[31:16] stop line number
3008c2ecf20Sopenharmony_ci   IN[3] - number of output frames per interrupt
3018c2ecf20Sopenharmony_ci   IN[4] - VBI insertion mode
3028c2ecf20Sopenharmony_ci			bit 0:	output user data, 1 - enable
3038c2ecf20Sopenharmony_ci			bit 1:	output private stream, 1 - enable
3048c2ecf20Sopenharmony_ci			bit 2:	mux option, 0 - in GOP, 1 - in picture
3058c2ecf20Sopenharmony_ci			bit[7:0]	private stream ID
3068c2ecf20Sopenharmony_ci   IN[5] - insertion period while mux option is in picture
3078c2ecf20Sopenharmony_ci   ReturnCode - VBI data offset */
3088c2ecf20Sopenharmony_ci#define CX18_CPU_SET_SLICED_VBI_PARAM		(CPU_CMD_MASK_CAPTURE | 0x0020)
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci/* Description: Set the user data place holder
3118c2ecf20Sopenharmony_ci   IN[0] - type of data (0 for user)
3128c2ecf20Sopenharmony_ci   IN[1] - Stuffing period
3138c2ecf20Sopenharmony_ci   IN[2] - ID data size in word (less than 10)
3148c2ecf20Sopenharmony_ci   IN[3] - Pointer to ID buffer */
3158c2ecf20Sopenharmony_ci#define CX18_CPU_SET_USERDATA_PLACE_HOLDER	(CPU_CMD_MASK_CAPTURE | 0x0021)
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci/* Description:
3198c2ecf20Sopenharmony_ci   In[0] Task Handle
3208c2ecf20Sopenharmony_ci   return parameter:
3218c2ecf20Sopenharmony_ci   Out[0]  Reserved
3228c2ecf20Sopenharmony_ci   Out[1]  Video PTS bit[32:2] of last output video frame.
3238c2ecf20Sopenharmony_ci   Out[2]  Video PTS bit[ 1:0] of last output video frame.
3248c2ecf20Sopenharmony_ci   Out[3]  Hardware Video PTS counter bit[31:0],
3258c2ecf20Sopenharmony_ci	     these bits get incremented on every 90kHz clock tick.
3268c2ecf20Sopenharmony_ci   Out[4]  Hardware Video PTS counter bit32,
3278c2ecf20Sopenharmony_ci	     these bits get incremented on every 90kHz clock tick.
3288c2ecf20Sopenharmony_ci   ReturnCode */
3298c2ecf20Sopenharmony_ci#define CX18_CPU_GET_ENC_PTS			(CPU_CMD_MASK_CAPTURE | 0x0022)
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci/* Description: Set VFC parameters
3328c2ecf20Sopenharmony_ci   IN[0] - task handle
3338c2ecf20Sopenharmony_ci   IN[1] - VFC enable flag, 1 - enable, 0 - disable
3348c2ecf20Sopenharmony_ci*/
3358c2ecf20Sopenharmony_ci#define CX18_CPU_SET_VFC_PARAM                  (CPU_CMD_MASK_CAPTURE | 0x0023)
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci/* Below is the list of commands related to the data exchange */
3388c2ecf20Sopenharmony_ci#define CPU_CMD_MASK_DE				(CPU_CMD_MASK | 0x040000)
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci/* Description: This command provides the physical base address of the local
3418c2ecf20Sopenharmony_ci   DDR as viewed by EPU
3428c2ecf20Sopenharmony_ci   IN[0] - Physical offset where EPU has the local DDR mapped
3438c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
3448c2ecf20Sopenharmony_ci#define CPU_CMD_DE_SetBase			(CPU_CMD_MASK_DE | 0x0001)
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci/* Description: This command provides the offsets in the device memory where
3478c2ecf20Sopenharmony_ci   the 2 cx18_mdl_ack blocks reside
3488c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
3498c2ecf20Sopenharmony_ci   IN[1] - Offset of the first cx18_mdl_ack from the beginning of the
3508c2ecf20Sopenharmony_ci	   local DDR.
3518c2ecf20Sopenharmony_ci   IN[2] - Offset of the second cx18_mdl_ack from the beginning of the
3528c2ecf20Sopenharmony_ci	   local DDR.
3538c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
3548c2ecf20Sopenharmony_ci#define CX18_CPU_DE_SET_MDL_ACK			(CPU_CMD_MASK_DE | 0x0002)
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci/* Description: This command provides the offset to a Memory Descriptor List
3578c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
3588c2ecf20Sopenharmony_ci   IN[1] - Offset of the MDL from the beginning of the local DDR.
3598c2ecf20Sopenharmony_ci   IN[2] - Number of cx18_mdl_ent structures in the array pointed to by IN[1]
3608c2ecf20Sopenharmony_ci   IN[3] - Buffer ID
3618c2ecf20Sopenharmony_ci   IN[4] - Total buffer length
3628c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
3638c2ecf20Sopenharmony_ci#define CX18_CPU_DE_SET_MDL			(CPU_CMD_MASK_DE | 0x0005)
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci/* Description: This command requests return of all current Memory
3668c2ecf20Sopenharmony_ci   Descriptor Lists to the driver
3678c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task to start
3688c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
3698c2ecf20Sopenharmony_ci#define CX18_CPU_DE_RELEASE_MDL			(CPU_CMD_MASK_DE | 0x0006)
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci/* Description: This command signals the cpu that the dat buffer has been
3728c2ecf20Sopenharmony_ci   consumed and ready for re-use.
3738c2ecf20Sopenharmony_ci   IN[0] - Task handle. Handle of the task
3748c2ecf20Sopenharmony_ci   IN[1] - Offset of the data block from the beginning of the local DDR.
3758c2ecf20Sopenharmony_ci   IN[2] - Number of bytes in the data block
3768c2ecf20Sopenharmony_ci   ReturnCode - One of the ERR_DE_... */
3778c2ecf20Sopenharmony_ci/* #define CX18_CPU_DE_RELEASE_BUFFER           (CPU_CMD_MASK_DE | 0x0007) */
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci/* No Error / Success */
3808c2ecf20Sopenharmony_ci#define CNXT_OK                 0x000000
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci/* Received unknown command */
3838c2ecf20Sopenharmony_ci#define CXERR_UNK_CMD           0x000001
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci/* First parameter in the command is invalid */
3868c2ecf20Sopenharmony_ci#define CXERR_INVALID_PARAM1    0x000002
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/* Second parameter in the command is invalid */
3898c2ecf20Sopenharmony_ci#define CXERR_INVALID_PARAM2    0x000003
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci/* Device interface is not open/found */
3928c2ecf20Sopenharmony_ci#define CXERR_DEV_NOT_FOUND     0x000004
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci/* Requested function is not implemented/available */
3958c2ecf20Sopenharmony_ci#define CXERR_NOTSUPPORTED      0x000005
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/* Invalid pointer is provided */
3988c2ecf20Sopenharmony_ci#define CXERR_BADPTR            0x000006
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ci/* Unable to allocate memory */
4018c2ecf20Sopenharmony_ci#define CXERR_NOMEM             0x000007
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci/* Object/Link not found */
4048c2ecf20Sopenharmony_ci#define CXERR_LINK              0x000008
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci/* Device busy, command cannot be executed */
4078c2ecf20Sopenharmony_ci#define CXERR_BUSY              0x000009
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/* File/device/handle is not open. */
4108c2ecf20Sopenharmony_ci#define CXERR_NOT_OPEN          0x00000A
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci/* Value is out of range */
4138c2ecf20Sopenharmony_ci#define CXERR_OUTOFRANGE        0x00000B
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci/* Buffer overflow */
4168c2ecf20Sopenharmony_ci#define CXERR_OVERFLOW          0x00000C
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_ci/* Version mismatch */
4198c2ecf20Sopenharmony_ci#define CXERR_BADVER            0x00000D
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci/* Operation timed out */
4228c2ecf20Sopenharmony_ci#define CXERR_TIMEOUT           0x00000E
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci/* Operation aborted */
4258c2ecf20Sopenharmony_ci#define CXERR_ABORT             0x00000F
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci/* Specified I2C device not found for read/write */
4288c2ecf20Sopenharmony_ci#define CXERR_I2CDEV_NOTFOUND   0x000010
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/* Error in I2C data xfer (but I2C device is present) */
4318c2ecf20Sopenharmony_ci#define CXERR_I2CDEV_XFERERR    0x000011
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci/* Channel changing component not ready */
4348c2ecf20Sopenharmony_ci#define CXERR_CHANNELNOTREADY   0x000012
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci/* PPU (Presensation/Decoder) mail box is corrupted */
4378c2ecf20Sopenharmony_ci#define CXERR_PPU_MB_CORRUPT    0x000013
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ci/* CPU (Capture/Encoder) mail box is corrupted */
4408c2ecf20Sopenharmony_ci#define CXERR_CPU_MB_CORRUPT    0x000014
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci/* APU (Audio) mail box is corrupted */
4438c2ecf20Sopenharmony_ci#define CXERR_APU_MB_CORRUPT    0x000015
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci/* Unable to open file for reading */
4468c2ecf20Sopenharmony_ci#define CXERR_FILE_OPEN_READ    0x000016
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci/* Unable to open file for writing */
4498c2ecf20Sopenharmony_ci#define CXERR_FILE_OPEN_WRITE   0x000017
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci/* Unable to find the I2C section specified */
4528c2ecf20Sopenharmony_ci#define CXERR_I2C_BADSECTION    0x000018
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci/* Error in I2C data xfer (but I2C device is present) */
4558c2ecf20Sopenharmony_ci#define CXERR_I2CDEV_DATALOW    0x000019
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci/* Error in I2C data xfer (but I2C device is present) */
4588c2ecf20Sopenharmony_ci#define CXERR_I2CDEV_CLOCKLOW   0x00001A
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci/* No Interrupt received from HW (for I2C access) */
4618c2ecf20Sopenharmony_ci#define CXERR_NO_HW_I2C_INTR    0x00001B
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci/* RPU is not ready to accept commands! */
4648c2ecf20Sopenharmony_ci#define CXERR_RPU_NOT_READY     0x00001C
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci/* RPU is not ready to accept commands! */
4678c2ecf20Sopenharmony_ci#define CXERR_RPU_NO_ACK        0x00001D
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci/* The are no buffers ready. Try again soon! */
4708c2ecf20Sopenharmony_ci#define CXERR_NODATA_AGAIN      0x00001E
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci/* The stream is stopping. Function not allowed now! */
4738c2ecf20Sopenharmony_ci#define CXERR_STOPPING_STATUS   0x00001F
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci/* Trying to access hardware when the power is turned OFF */
4768c2ecf20Sopenharmony_ci#define CXERR_DEVPOWER_OFF      0x000020
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci#endif /* CX23418_H */
479