/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved. * Description: AMP IAPI function define * Author: Hisilicon * Create: 2019-04-16 */ #ifndef __UAPI_AMP_H__ #define __UAPI_AMP_H__ #include "td_type.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif /* __cplusplus */ #define UAPI_AMP_MAX 8 /* Defines the info of amp config. */ /* CNcomment:定义功放的配置信息 */ typedef struct { /* device type of amp */ /* CNcomment:功放的型号 */ td_u8 device_type; /* device address of amp when communicate with i2c */ /* CNcomment:功放使用I2C通信时使用的器件地址 */ td_u8 device_addr; /* GPIO output mode polarity,it is 0 normally */ /* CNcomment:GPIO配置为输出模式的配置,一般配置为0 */ td_u8 gpio_output_polarity; /* GPIO number of amp reset pin,if it is GPIO1_5,then the result is 1*8+5=13 */ /* CNcomment:功放的复位管脚的GPIO号,如GPIO1_5,则为1*8+5=13 */ td_u8 reset_gpio_num; /* Polarity of reset pin when amp reset */ /* CNcomment:功放复位时复位管脚的电平 */ td_u8 reset_polarity; /* GPIO number of amp mute pin,if it is GPIO1_5, then the result is 1*8+5=13 */ /* CNcomment:功放的静音管脚的GPIO号,如GPIO1_5,则为1*8+5=13 */ td_u8 hw_mute_gpio_num; /* Polarity of mute pin when amp mute is enable */ /* CNcomment:功放静音时复位管脚的电平 */ td_u8 hw_mute_polarity; /* I2C channel number that amp use */ /* CNcomment:功放使用的I2C通道号 */ td_u8 i2c_num; } uapi_amp_info; typedef struct { /* device number of amp */ /* CNcomment:功放的ID号 */ td_u32 amp_id; /* device type of amp */ /* CNcomment:功放的型号 */ td_u32 device_type; /* speaker location of amp */ /* CNcomment:喇叭布局 */ td_u32 channel_mask; } uapi_amp_speaker_info; typedef struct { /* all speaker location of amp */ /* CNcomment:所有喇叭布局 */ td_u32 all_channel_mask; /* stores all PA information */ /* CNcomment:存放所有功放信息 */ uapi_amp_speaker_info amp_speaker_info[UAPI_AMP_MAX]; /* number of current power amplifiers */ /* CNcomment:当前功放数量 */ td_u32 amp_count; } uapi_amp_multi_info; /* \brief Initializes an AMP device. CNcomment:初始化功放设备驱动 CNend \attention \n \param[in] the pointer to the infomation of amp CNcomment: 指向功放信息的指针 \retval ::TD_SUCCESS Success CNcomment:成功 CNend \see \n N/A */ td_s32 uapi_amp_init(uapi_amp_info *amp_info); /* \brief Deinitializes an AMP device. CNcomment:去初始化功放设备驱动 CNend \attention \n \param N/A \retval ::TD_SUCCESS Success CNcomment:成功 CNend \see \n N/A */ td_s32 uapi_amp_deinit(td_void); /* \brief Mute an AMP device. CNcomment: 设置功放静音 CNend \attention \n \param[in] mute Mute control CNcomment: 是否静音 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_set_mute(td_bool mute); /* \brief Obtains the Mute state of an AMP device. CNcomment: 获取功放静音状态 CNend \attention \n \param[out] mute Pointer to AMP's Mute state CNcomment: 是否静音 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_get_mute(td_bool *mute); /* \brief Set SubWoofer volume of an AMP device. CNcomment: 设置功放SubWoofer音量 CNend \attention \n \param[in] volume SubWoofer volume CNcomment: 音量大小 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_set_sub_woofer_volume(td_u32 volume); /* \brief Obtains the SubWoofer volume of an AMP device. CNcomment: 获取功放SubWoofer音量 CNend \attention \n \param[out] volume Pointer to AMP's SubWoofer volume CNcomment: 音量大小 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_get_sub_woofer_volume(td_u32 *volume); /* \brief write value to AMP device's register. CNcomment: 给功放寄存器赋值 CNend \attention \n \param[in] reg_addr register address CNcomment: 寄存器地址 CNend \param[in] byte_size how many bytes to write.CNcomment:写入多少个字节 CNend \param[in] value register value CNcomment: 寄存器值 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_write_reg(td_u32 reg_addr, td_u32 size, td_u8 *value); /* \brief read value of AMP device's register. CNcomment: 读取功放寄存器值 CNend \attention \n \param[in] reg_addr register address CNcomment: 寄存器地址 CNend \param[in] byte_size how many bytes to read.CNcomment:读多少个字节 CNend \param[out] value register value CNcomment: 寄存器值 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_read_reg(td_u32 reg_addr, td_u32 size, td_u8 *value); /* \brief Open an AMP device. CNcomment:打开功放设备驱动 CNend \attention \n \param[in] N/A \retval ::TD_SUCCESS Success CNcomment:成功 CNend \see \n N/A */ td_s32 uapi_amp_open(td_void); /* \brief Close an AMP device. CNcomment:关闭功放设备驱动 CNend \attention \n \param[in] N/A \retval ::TD_SUCCESS Success CNcomment:成功 CNend \see \n N/A */ td_s32 uapi_amp_close(td_void); /* \brief Obtains the information of all AMP device. CNcomment:获取所有功放设备信息 CNend \attention \n \param[out] the pointer to the infomation of amp device CNcomment:指向功放设备信息的指针 \retval ::TD_SUCCESS Success CNcomment:成功 CNend \see \n N/A */ td_s32 uapi_amp_get_info(uapi_amp_multi_info *amp_multi_info); /* \brief Mute channel for AMP device. CNcomment: 静音功放设备的对应声道 CNend \attention \n \param[in] channel mask for channel configuration. CNcomment:声道掩码 CNend \param[in] mute Mute control CNcomment: 是否静音 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_mute_channel(td_u32 channel_mask, td_bool mute); /* \brief Mute channel for AMP device. CNcomment: 静音功放设备的对应声道 CNend \attention \n \param[in] channel mask for channel configuration. CNcomment:声道掩码 CNend \param[in] mute Mute control CNcomment: 是否静音 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 鏃?CNend */ td_s32 uapi_amp_get_channel_mute(td_u32 channel_mask, td_bool *mute); /* \brief Obtains the active status of an AMP device. CNcomment: 获取某个功放工作情况 CNend \attention \n \param[in] AMP ID CNcomment: 功放ID CNend \param[out] active status CNcomment: 工作情况 CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_get_active_status(td_u32 amp_id, td_bool *active); /* \brief Reset an AMP device. CNcomment: 重置某个功放 CNend \attention \n \param[in] AMP ID CNcomment: 功放ID CNend \retval ::0 if success CNcomment: 成功 CNend \retval ::otherwise error code CNcomment: 错误 CNend \see \n N/A CNcomment: 无 CNend */ td_s32 uapi_amp_reset(td_u32 amp_id); #ifdef __cplusplus #if __cplusplus } #endif #endif /* __cplusplus */ #endif /* __UAPI_AMP_H__ */