/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved. * Description: Define the infomation about hdmi module. * Author: Hisilicon * Create: 2019-11-20 */ #ifndef UAPI_HDMIRX_H #define UAPI_HDMIRX_H #include "uapi_audio.h" #include "uapi_video.h" #include "uapi_cec.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif #define UAPI_HDMIRX_VENDOR_NAME_LEN 9 #define UAPI_HDMIRX_PRODUCT_DESCRIPTION_LEN 17 /* * Defines the config parameter of HDMIRX interface * CNcomment: 定义HDMIRX 接口参数配置 */ typedef struct { td_u32 width; /* HDMIRX Hactive */ /* CNcomment: HDMIRX 宽有效值 */ td_u32 height; /* HDMIRX Vactive */ /* CNcomment: HDMIRX 高有效值 */ td_u32 frame_rate; /* HDMIRX frequency of vsync */ /* CNcomment: HDMIRX 场频率 */ uapi_color_description color_space; /* HDMIRX color space */ /* CNcomment: HDMIRX 色度空间 */ uapi_video_pixel_format pixel_fmt; /* HDMIRX video formate */ /* CNcomment: HDMIRX 视频格式 */ uapi_pixel_bit_depth depth; /* HDMIRX video BitWidth */ /* CNcomment: HDMIRX 视频位宽 */ td_bool is_interlace; /* HDMIRX video interlace or progressive */ /* CNcomment: HDMIRX HDMIRX视频扫描方式是逐行还是隔行 */ uapi_oversample oversample; /* HDMIRX video Oversample */ /* CNcomment: HDMIRX 视频过采样大小 */ uapi_video_frame_packing_type fmt; /* HDMIRX video 3D formate */ /* CNcomment: HDMIRX 视频3D格式 */ td_bool hdmi_mode; /* HDMIRX video HDMI or DVI */ /* CNcomment: HDMIRX 视频模式 */ td_u32 v_blank; /* HDMIRX video Vblank the value must set when the 3D formate is Frame PACKING */ /* CNcomment: HDMIRX Vblank值仅在视频格式为3D Frame PACKING时有效 */ td_bool pc_mode; /* HDMIRX PC Timing Mode flag */ /* CNcomment: HDMIRX PC Timing标志位 */ td_u32 timing_idx; /* HDMIRX Timing Inedex Table */ /* CNcomment: HDMIRX Timing对应Index */ td_bool is_mhl; /* HDMIRX MHL flag */ /* CNcomment: HDMIRX MHL标志位 */ } uapi_hdmirx_timing_info; /* * Defines the config parameter of HDCP interface * CNcomment: 定义HDCP 接口参数配置 */ typedef struct { td_u32 hdcp_length; td_u8 *hdcp_data; /* HDMIRX HDCP Value */ /* CNcomment:HDMIRX HDCP值 */ } uapi_hdmirx_hdcp; /* * Defines HDCP version * CNcomment: 定义HDCP 版本参数 */ typedef enum { UAPI_HDMIRX_HDCP_VER_1X, /* HDCP1x version */ /* CNcomment: HDCP1x版本 */ UAPI_HDMIRX_HDCP_VER_2X, /* HDCP2x version */ /* CNcomment: HDCP2x版本 */ UAPI_HDMIRX_HDCP_VER_MAX } uapi_hdmirx_hdcp_ver; /* * Defines HDMI port ID * CNcomment: 定义HDMI 端口ID号 */ typedef enum { UAPI_HDMIRX_PORT0, /* HDMIRX port 0 */ /* CNcomment: HDMIRX port0 */ UAPI_HDMIRX_PORT1, /* HDMIRX port 1 */ /* CNcomment: HDMIRX port1 */ UAPI_HDMIRX_PORT2, /* HDMIRX port 2 */ /* CNcomment: HDMIRX port2 */ UAPI_HDMIRX_PORT3, /* HDMIRX port 3 */ /* CNcomment: HDMIRX port3 */ UAPI_HDMIRX_PORT_MAX } uapi_hdmirx_port; /* * Defines HDMIRX format type * CNcomment: 定义HDMIRX 信号类型 */ typedef enum { UAPI_HDMIRX_FORMAT_HDMI, UAPI_HDMIRX_FORMAT_DVI, UAPI_HDMIRX_FORMAT_MHL, UAPI_HDMIRX_FORMAT_MAX } uapi_hdmirx_format; /* * Defines HDMIRX audio inputport attribute * CNcomment: 定义HDMIRX 音频输入端口属性 */ typedef struct { uapi_audio_channel channels; /* Channel number */ /* CNcomment: 声道数 */ uapi_audio_bit_depth bit_depth; /* Bit Depth */ /* CNcomment: 位宽 */ uapi_audio_sample_rate sample_rate; /* Sample Rate */ /* CNcomment: 采样率 */ uapi_audio_format audio_format; /* audio data format */ /* CNcomment: HDMIRX音频数据格式 */ uapi_audio_data_type audio_data_type; /* passthrough audio data type */ /* CNcomment: HDMIRX透传数据类型 */ } uapi_hdmirx_audio_attr; /* * Defines the config parameter of EDID interface * CNcomment: 定义EDID 接口参数配置 */ typedef struct { td_u32 edid_length; td_u8 *edid; /* HDMIRX EDID Value */ /* CNcomment: HDMIRX EDID 值 */ td_u32 cec_addr; /* HDMIRX CecAddr Value */ /* CNcomment: HDMIRX CEC 地址值 */ } uapi_hdmirx_edid; /* * Defines the config parameter of EDID Mode * CNcomment: 定义EDID 切换模式配置 */ typedef enum { UAPI_HDMIRX_EDID_MODE_AUTO, /* EDID Mode :Auto operation */ /* CNcomment: HDMIRX 自动刷新方式EDID */ UAPI_HDMIRX_EDID_MODE_14, /* EDID Mode :Manual 1.4 operation */ /* CNcomment: HDMIRX 手动刷新1.4 EDID方式 */ UAPI_HDMIRX_EDID_MODE_20, /* EDID Mode :Manual 2.0 operation */ /* CNcomment: HDMIRX 手动刷新2.0 EDID方式 */ UAPI_HDMIRX_EDID_MODE_21, /* EDID Mode :Manual 2.1 operation */ /* CNcomment: HDMIRX 手动刷新2.1 EDID方式 */ UAPI_HDMIRX_EDID_MODE_MAX } uapi_hdmirx_edid_mode; /* * Defines the config parameter of HDMI Version * CNcomment: 定义HDMI 协议版本 */ typedef enum { UAPI_HDMIRX_VER_14, /* hdmirx 1.4 version */ /* CNcomment: HDMIRX 1.4 版本 */ UAPI_HDMIRX_VER_20, /* hdmirx 2.0 version */ /* CNcomment: HDMIRX 2.0 版本 */ UAPI_HDMIRX_VER_21, /* hdmirx 2.1 version */ /* CNcomment: HDMIRX 2.1 版本 */ UAPI_HDMIRX_VER_MAX, } uapi_hdmirx_ver; /* * Defines the CEC command state of sending * CNcomment: 定义CEC命令发送状态 */ typedef enum { UAPI_HDMIRX_CEC_MSG_STATE_SUCCESS, /* cec msg send success */ /* CNcomment: CEC 命令发送成功 */ UAPI_HDMIRX_CEC_MSG_STATE_FAILED, /* cec msg send fail */ /* CNcomment: CEC 命令发送失败 */ UAPI_HDMIRX_CEC_MSG_STATE_MAX } uapi_hdmirx_cec_msg_status; typedef struct { uapi_cec_opcode cur_opcode; /* opration code */ /* CNcomment: 操作码 */ uapi_hdmirx_cec_msg_status cur_status; td_u32 dst_addr; /* logical address of destination */ /* CNcomment: 目标设备地址 */ } uapi_hdmirx_cec_status; typedef struct { td_bool connected; /* power connected state */ /* CNcomment: power 连接状态 */ uapi_hdmirx_format format; /* hdmi format */ /* CNcomment: 信号格式 */ } uapi_hdmirx_offline_info; typedef struct { td_bool enable; /* current port enable */ /* CNcomment: 当前口是否可使用 */ td_bool arc_port; /* current port is arc port */ /* CNcomment: 当前口是否为ARC口 */ uapi_hdmirx_ver ver; /* hdmirx supported version */ /* CNcomment: HDMIRX 支持的最大版本 */ } uapi_hdmirx_port_capability; typedef struct { td_u8 port_max; /* HDMIRX max port */ /* CNcomment: HDMIRX 可使用的最大接口数量 */ /* HDMIRX port capability */ /* CNcomment: HDMIRX各个接口能力描述 */ uapi_hdmirx_port_capability caps[UAPI_HDMIRX_PORT_MAX]; } uapi_hdmirx_capability; typedef enum { UAPI_HDMIRX_ALLM_STATUS_NONE, /* allm status unknow */ /* CNcomment: allm的状态未知 */ UAPI_HDMIRX_ALLM_STATUS_ENABLE, /* allm status enable */ /* CNcomment: allm使能 */ UAPI_HDMIRX_ALLM_STATUS_DISABLE, /* allm status disable */ /* CNcomment: allm未使能 */ UAPI_HDMIRX_ALLM_STATUS_MAX, } uapi_hdmirx_allm_status; typedef enum { UAPI_HDMIRX_VRR_MODE_NONE, /* VRR is not enabled */ /* CNcomment: 非VRR模式 */ UAPI_HDMIRX_VRR_MODE_VRR, /* HDMI VRR mode */ /* CNcomment: 当前为HDMI VRR模式 */ UAPI_HDMIRX_VRR_MODE_QMS, /* QMS mode */ /* CNcomment: 当前为QMS模式 */ UAPI_HDMIRX_VRR_MODE_ARR, /* ARR mode */ /* CNcomment: 当前为Alterable Refresh Rate模式 */ UAPI_HDMIRX_VRR_MODE_FRR, /* FRR mode */ /* CNcomment: 当前为Fixed Refresh Rate模式 */ UAPI_HDMIRX_VRR_MODE_MAX, } uapi_hdmirx_vrr_mode; typedef struct { uapi_hdmirx_allm_status allm_status; /* allm status */ /* CNcomment: allm的状态 */ uapi_hdmirx_vrr_mode vrr_mode; /* vrr mode */ /* CNcomment: vrr的模式 */ td_u32 cur_frame_rate; /* current-time frame rate */ /* CNcomment: 实时帧率 */ } uapi_hdmirx_video_info; typedef struct { td_u8 vendor_name[UAPI_HDMIRX_VENDOR_NAME_LEN]; /* vendor name */ /* CNcomment: 厂商名称 */ td_u8 product_description[UAPI_HDMIRX_PRODUCT_DESCRIPTION_LEN]; /* product description */ /* CNcomment: 产品描述 */ } uapi_hdmirx_source_product_description; /* * brief the whole initialization of the hdmirx. CNcomment: HDMIRX接口驱动软件初始化 CNend * attention this func should be called after sys_init. * CNcomment: 必须先系统初始化 CNend * param \n. CNcomment: 无 CNend * retval ::TD_SUCCESS Success CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_init(td_void); /* * brief deinit the hdmirx. CNcomment: HDMIRX接口去初始化 CNend * attention this must be called before sys_deinit. * CNcomment: 必须在系统去初始化之前打开 CNend * param \n. CNcomment: 无 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_deinit(td_void); /* * brief create hdmirx device. Select the input port. CNcomment: 创建HDMIRX设备, 选择输入port口 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要连接的port口 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_connect(uapi_hdmirx_port port); /* * brief disConnect the handler created by uapi_hdmirx_connect. * CNcomment: 销毁由uapi_hdmirx_disconnect创建的句柄 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要断开连接的port口 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_disconnect(uapi_hdmirx_port port); /* * brief Get the current timing information. CNcomment: 获取当前Timing信息 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要获取timing信息的port口 CNend * param[in] uapi_hdmirx_timing_info *timing_info. CNcomment: 获取到的timing信息 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_timing_info(uapi_hdmirx_port port, uapi_hdmirx_timing_info *timing_info); /* * brief Get the current Audio information. CNcomment: 获取当前音频信息 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要获取audio信息的port口 CNend * param[in] uapi_hdmirx_audio_attr *audio_info. CNcomment: 获取到的audio信息 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_audio_info(uapi_hdmirx_port port, uapi_hdmirx_audio_attr *audio_info); /* * brief Get the signal status like no signal/unstable/support. * CNcomment: 查询当前视频信号状态如无信号、不稳定、稳定 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要获取信号状态的port口 CNend * param[in] uapi_sig_status *status. CNcomment: 获取到的信号状态 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_signal_status(uapi_hdmirx_port port, uapi_sig_status *status); /* * brief Get the Audio status like no signal/unstable/support . * CNcomment:查询当前音频信号状态如无信号、不稳定、稳定 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要获取音频状态的port口 CNend * param[in] uapi_sig_status *status. CNcomment: 获取到的音频信号状态 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_audio_status(uapi_hdmirx_port port, uapi_sig_status *status); /* * brief Init the EDID in SRAM. CNcomment: 初始化EDID 至SRAM中 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要加载edid的port口 CNend * param[in] *uapi_hdmirx_edid, Pointer of EDID Structure. CNcomment: EDID的结构指针 CNend * param[in] td_u32 edid_count the number of EDID Structure. CNcomment: edid_info 结构体个数 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_init_edid(uapi_hdmirx_port port, const uapi_hdmirx_edid *edid_info, td_u32 edid_count); /* * brief Set the Mode of EDID. CNcomment: 设置EDID模式 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要设置edid模式的port口 CNend * param[in] uapi_hdmirx_edid_mode key struct point. CNcomment: Mode枚举 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_set_edid_mode(uapi_hdmirx_port port, uapi_hdmirx_edid_mode edid_mode); /* * brief get the hdmirx capability. CNcomment: 获取hdmirx能力 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要获取能力的port口 CNend * param[in] uapi_hdmirx_capability *capability. CNcomment: 获取到的能力信息 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_capability(uapi_hdmirx_capability *capability); /* * brief Load HDCP key. CNcomment: 导入hdcpkey CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port port. CNcomment: 要设置加载hdcp的port口 CNend * param[in] uapi_hdmirx_hdcp_type type. CNcomment: 要加载的hdcp的type CNend * param[in] *uapi_hdmirx_hdcp hdcp struct point. CNcomment: key的结构指针 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_load_hdcp(uapi_hdmirx_port port, uapi_hdmirx_hdcp_ver type, const uapi_hdmirx_hdcp *hdcp); /* * brief Get the port OffLineDetect Status. CNcomment: 获取port口离线检测状态 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port The port ID. CNcomment: HDMIRX port口ID CNend * param[in] *td_bool connected the port connect Status. CNcomment: HDMIRX port口连接状态 CNend * param[in] uapi_hdmirx_offline_info detect the port offline info. CNcomment: 返回当前口离线检测状态 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_offline_status(uapi_hdmirx_port port, uapi_hdmirx_offline_info *offline_info); /* * brief Set HotPlug Value. CNcomment: 设置HDMI HotPlug 值 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port Port. CNcomment: HDMIRX port口ID CNend * param[in] td_bool value. CNcomment: HotPlug Value CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_set_hpd_value(uapi_hdmirx_port port, td_bool value); /* * brief Get Video Info. CNcomment: 获取HDMI Video信息 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port Port. CNcomment: HDMIRX port口ID CNend * param[in] *uapi_hdmirx_video_info video info point. CNcomment: video info结构指针 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_video_info(uapi_hdmirx_port port, uapi_hdmirx_video_info *video_info); /* * brief disable the cec func. CNcomment: CEC 使能 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] enable hdmi cec enable. CNcomment: HDMI CEC使能 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see \n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_cec_enable(td_bool enable); /* * brief send the cec data. CNcomment: 发送CEC 命令 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_cec_msg the cec cmd data. CNcomment: Cec Command 内容 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see uapi_cec_msg\n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_cec_send_msg(const uapi_cec_msg *cec_msg); /* * brief get the cec data received. CNcomment: 接收的CEC 命令 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_cec_msg the cec cmd data. CNcomment: Cec Command 内容 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see ::uapi_cec_msg\n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_cec_receive_msg(uapi_cec_msg *cec_msg); /* * brief get CEC CMD status. CNcomment: 获取命令发送状态 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] cec_status the CEC CMD status. CNcomment: 命令发送状态 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see ::uapi_hdmirx_cec_status\n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_cec_get_cur_msg_state(uapi_hdmirx_cec_status *cec_status); /* * brief get source product description. CNcomment: 获取SPD信息帧 CNend * attention \n * N/A CNcomment: 无 CNend * param[in] uapi_hdmirx_port Port. CNcomment: HDMIRX port口 CNend * param[in] uapi_hdmirx_source_product_description. CNcomment: SPD信息帧数据 CNend * retval ::TD_SUCCESS Success. CNcomment: 成功 CNend * retval ::please refer to the err code definitino of mpi. CNcomment: 请参考MPI错误码 CNend * see ::\n * N/A CNcomment: 无 CNend */ td_s32 uapi_hdmirx_get_source_product_description(uapi_hdmirx_port port, uapi_hdmirx_source_product_description *source_product_description); #ifdef __cplusplus #if __cplusplus } #endif #endif #endif /* __UAPI_HDMIRX_H__ */