/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2020-2020. All rights reserved. * Description: IAPI function file for Huanglong sif * Author: audio * Create: 2020-11-02 */ #include "td_type.h" #include "uapi_sif.h" #include "mpi_sif_ext.h" #include "mpi_sif_debug.h" #include "mpi_sif_trans.h" #include "soc_errno.h" #include "securec.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif /* __cplusplus */ td_s32 uapi_sif_init(td_void) { return ext_mpi_sif_init(); } td_s32 uapi_sif_de_init(td_void) { return ext_mpi_sif_deinit(); } td_s32 uapi_sif_open(uapi_sif_id sif) { return ext_mpi_sif_open((ext_sif_id)sif); } td_s32 uapi_sif_close(uapi_sif_id sif) { return ext_mpi_sif_close((ext_sif_id)sif); } td_s32 uapi_sif_set_attr(uapi_sif_id sif, const uapi_sif_attr *sif_attr) { ext_sif_attr mpi_attr; if (sif_attr == TD_NULL) { soc_log_err("sif_attr is null\n"); return SOC_ERR_SIF_NULL_PTR; } (td_void)memset_s(&mpi_attr, sizeof(mpi_attr), 0, sizeof(ext_sif_attr)); trans_sif_attr_uapi_to_mpi(sif_attr, &mpi_attr); return ext_mpi_sif_set_attr((ext_sif_id)sif, &mpi_attr); } td_s32 uapi_sif_get_default_attr(uapi_sif_id sif, uapi_sif_attr *sif_attr) { td_s32 ret; ext_sif_attr mpi_attr; if (sif_attr == TD_NULL) { soc_log_err("sif_attr is null.\n"); return SOC_ERR_SIF_NULL_PTR; } (td_void)memset_s(&mpi_attr, sizeof(mpi_attr), 0, sizeof(ext_sif_attr)); trans_sif_attr_uapi_to_mpi(sif_attr, &mpi_attr); ret = ext_mpi_sif_get_default_attr((ext_sif_id)sif, &mpi_attr); trans_sif_attr_mpi_to_uapi(&mpi_attr, sif_attr); return ret; } td_s32 uapi_sif_get_attr(uapi_sif_id sif, uapi_sif_attr *sif_attr) { td_s32 ret; ext_sif_attr mpi_attr; if (sif_attr == TD_NULL) { soc_log_err("sif_attr is null.\n"); return SOC_ERR_SIF_NULL_PTR; } (td_void)memset_s(&mpi_attr, sizeof(mpi_attr), 0, sizeof(ext_sif_attr)); trans_sif_attr_uapi_to_mpi(sif_attr, &mpi_attr); ret = ext_mpi_sif_get_attr((ext_sif_id)sif, &mpi_attr); trans_sif_attr_mpi_to_uapi(&mpi_attr, sif_attr); return ret; } td_s32 uapi_sif_start(uapi_sif_id sif) { return ext_mpi_sif_start((ext_sif_id)sif); } td_s32 uapi_sif_stop(uapi_sif_id sif) { return ext_mpi_sif_stop((ext_sif_id)sif); } td_s32 uapi_sif_set_standard(uapi_sif_id sif, uapi_sif_standard_type sif_standard) { return ext_mpi_sif_set_standard((ext_sif_id)sif, (ext_sif_standard_type)sif_standard); } td_s32 uapi_sif_start_auto_standard_detection(uapi_sif_id sif, uapi_sif_sysctl sif_det_ctl) { return ext_mpi_sif_start_asd((ext_sif_id)sif, (ext_sif_ctl)sif_det_ctl); } td_s32 uapi_sif_get_detect_complete(uapi_sif_id sif, td_bool *asd_complete) { if (asd_complete == TD_NULL) { soc_log_err("asd_complete is null.\n"); return SOC_ERR_SIF_NULL_PTR; } return ext_mpi_sif_get_asd_complete((ext_sif_id)sif, asd_complete); } td_s32 uapi_sif_get_user_setting_standard(uapi_sif_id sif, uapi_sif_standard_type *sif_standard) { td_s32 ret; ext_sif_standard_type mpi_type; if (sif_standard == TD_NULL) { soc_log_err("sif_standard is null.\n"); return SOC_ERR_SIF_NULL_PTR; } trans_sif_standard_type_uapi_to_mpi(sif_standard, &mpi_type); ret = ext_mpi_sif_get_standard((ext_sif_id)sif, &mpi_type); trans_sif_standard_type_mpi_to_uapi(&mpi_type, sif_standard); return ret; } td_s32 uapi_sif_get_asd_result(uapi_sif_id sif, uapi_sif_standard_type *sif_auto_standard) { td_s32 ret; ext_sif_standard_type mpi_type; if (sif_auto_standard == TD_NULL) { soc_log_err("sif_auto_standard is null.\n"); return SOC_ERR_SIF_NULL_PTR; } trans_sif_standard_type_uapi_to_mpi(sif_auto_standard, &mpi_type); ret = ext_mpi_sif_get_asd_result((ext_sif_id)sif, &mpi_type); trans_sif_standard_type_mpi_to_uapi(&mpi_type, sif_auto_standard); return ret; } td_s32 uapi_sif_set_sound_mode(uapi_sif_id sif, uapi_sif_outmode sif_outmode) { return ext_mpi_sif_set_sound_mode((ext_sif_id)sif, (ext_sif_out_mode)sif_outmode); } td_s32 uapi_sif_get_sound_mode(uapi_sif_id sif, uapi_sif_aaos_mode *sif_outmode) { td_s32 ret; ext_sif_aaos_mode mpi_mode; if (sif_outmode == TD_NULL) { soc_log_err("sif_outmode is null.\n"); return SOC_ERR_SIF_NULL_PTR; } trans_sif_aaos_mode_uapi_to_mpi(sif_outmode, &mpi_mode); ret = ext_mpi_sif_get_aaos_mode((ext_sif_id)sif, &mpi_mode); trans_sif_aaos_mode_mpi_to_uapi(&mpi_mode, sif_outmode); return ret; } td_s32 uapi_sif_set_over_deviation(uapi_sif_id sif, uapi_sif_over_deviation over_deviation) { return ext_mpi_sif_set_over_deviation((ext_sif_id)sif, (ext_sif_over_deviation)over_deviation); } td_s32 uapi_sif_get_over_deviation(uapi_sif_id sif, uapi_sif_over_deviation *over_deviation) { td_s32 ret; ext_sif_over_deviation mpi_deviation; if (over_deviation == TD_NULL) { soc_log_err("over_deviation is null.\n"); return SOC_ERR_SIF_NULL_PTR; } trans_sif_over_deviation_uapi_to_mpi(over_deviation, &mpi_deviation); ret = ext_mpi_sif_get_over_deviation((ext_sif_id)sif, &mpi_deviation); trans_sif_over_deviation_mpi_to_uapi(&mpi_deviation, over_deviation); return ret; } td_s32 uapi_sif_set_carri_shift(uapi_sif_id sif, td_u32 carri_shift) { return ext_mpi_sif_set_carri_shift((ext_sif_id)sif, carri_shift); } td_s32 uapi_sif_get_standard_try(uapi_sif_id sif, uapi_sif_carrier_attr *carrier_attr) { td_s32 ret; ext_sif_carrier_attr mpi_attr; if (carrier_attr == TD_NULL) { soc_log_err("carrier_attr is null.\n"); return SOC_ERR_SIF_NULL_PTR; } (td_void)memset_s(&mpi_attr, sizeof(mpi_attr), 0, sizeof(ext_sif_carrier_attr)); trans_sif_carrier_attr_uapi_to_mpi(carrier_attr, &mpi_attr); ret = ext_mpi_sif_get_carrier_attr((ext_sif_id)sif, &mpi_attr); trans_sif_carrier_attr_mpi_to_uapi(&mpi_attr, carrier_attr); return ret; } td_s32 uapi_sif_set_standard_try_priority(uapi_sif_id sif, const uapi_sif_standard_priority_list *priority_list) { ext_sif_standard_priority_list mpi_priority; if (priority_list == TD_NULL) { soc_log_err("priority_list is null.\n"); return SOC_ERR_SIF_NULL_PTR; } (td_void)memset_s(&mpi_priority, sizeof(mpi_priority), 0, sizeof(ext_sif_standard_priority_list)); trans_sif_standard_priority_list_uapi_to_mpi(priority_list, &mpi_priority); return ext_mpi_sif_set_standard_try_priority_list((ext_sif_id)sif, &mpi_priority); } #ifdef __cplusplus #if __cplusplus } #endif #endif /* __cplusplus */