/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2020-2020. All rights reserved. * Description: hdmirx mpi-part * Author: hdmirx * Create: 2020-06-19 */ #ifndef __MPI_HDMIRX_H__ #define __MPI_HDMIRX_H__ #include "soc_log.h" #include "drv_ioctl_hdmirx.h" #include "drv_ioctl_sys.h" #ifndef CONFIG_HDMIRX_EXCLUDE_HDCP #include "uapi_cipher.h" #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #undef LOG_MODULE_ID #define LOG_MODULE_ID SOC_ID_HDMIRX #define ext_err_hdmirx(fmt...) soc_log_err(fmt) #define ext_info_hdmirx(fmt...) soc_log_info(fmt) #ifndef CONFIG_HDMIRX_EXCLUDE_HDCP #define HDMIRX_HDCP_ENC_PK_SZ 16 #define HDMIRX_HDCP_KEY_MAX_SZ 1024 #define HDMIRX_ALGORITHM_AES128_GCM 0x10 #define HDMIRX_ALGORITHM_SM4_CTR 0x11 #endif typedef struct ext_mpi_hdmirx_ctx { td_bool inited; td_bool connected[EXT_DRV_HDMIRX_PORT_MAX]; td_s32 fd; ext_drv_sig_status en_sig_status; ext_sys_version sys_version; } ext_mpi_hdmirx_ctx; typedef struct { td_u32 iapi_video_format; ext_drv_pixel_format drv_video_format; } ext_hdmirx_video_format_convert; typedef struct { ext_drv_hdmirx_aud_data_type drv_audio_format; td_u32 iapi_audio_format; } ext_hdmirx_audio_format_convert; #ifndef CONFIG_HDMIRX_EXCLUDE_HDCP typedef enum { HDMIRX_HDCP_KEY_TYPE_OEM = 0, HDMIRX_HDCP_KEY_TYPE_SOCT, HDMIRX_HDCP_KEY_TYPE_MAX } ext_hdmirx_hdcp_key_type; enum { HDMIRX_OTP_KEY_TYPE_SOCT, HDMIRX_OTP_KEY_TYPE_RESERVED, HDMIRX_OTP_KEY_TYPE_STBM, HDMIRX_OTP_KEY_TYPE_CLEAR_PK }; enum { HDMIRX_HDCP14_TX_KEY = 0x10, HDMIRX_HDCP14_RX_KEY = 0x11, HDMIRX_HDCP22_RX_KEY = 0x12, HDMIRX_HDCP22_TX_KEY = 0x13, }; typedef struct { td_u32 image_type; td_u32 structure_version; td_u32 data_type; td_u32 key_area_offset; td_u32 data_area_offset; td_u32 data_area_length; } ext_hdmirx_hdcp_package_header; typedef struct { td_u32 algorithm; td_u32 otp_key_type; td_u32 vendor_id; td_u32 reserved; td_u8 enc_pk[HDMIRX_HDCP_ENC_PK_SZ]; } ext_hdmirx_hdcp_package_pk; typedef struct { td_u8 manufacture_name[UAPI_CIPHER_HDCP_AES_GCM_AAD_LEN]; td_u8 iv[UAPI_CIPHER_HDCP_AES_GCM_IV_LEN]; td_u8 tag[UAPI_CIPHER_HDCP_AES_GCM_TAG_LEN]; td_u32 key_len; td_u8 key[HDMIRX_HDCP_KEY_MAX_SZ]; } ext_hdmirx_hdcp_package_key; typedef struct { ext_hdmirx_hdcp_package_header header; ext_hdmirx_hdcp_package_pk pk; ext_hdmirx_hdcp_package_key key; td_u32 crc32; } ext_hdmirx_hdcp_package; #endif #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __MPI_HDMIRX_H__ */