Files
kunlun/driver/inc/iot_efuse.h
2024-09-28 14:24:04 +08:00

142 lines
4.2 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef _IOT_EFUSE_H_
#define _IOT_EFUSE_H_
#include "os_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief iot_efuse_init() - init efuse module.
*/
void iot_efuse_init(void);
/**
* @brief iot_efuse_prog_done_check() - efuse programming completion flag.
* @return - true: programming complete.
* false: not true.
*/
uint8_t iot_efuse_prog_done_check();
/**
* @brief iot_efuse_write_prog_done() - set efuse programming completion register.
*/
void iot_efuse_write_prog_done();
/**
* @brief iot_efuse_protect() - enable efuse protect function.
* @return - 0: succeed.
* other: failed.
*/
uint32_t iot_efuse_protect();
/**
* @brief iot_efuse_get_wafer_version() - get wafer version.
* @return - efuse wafer version.
*/
uint32_t iot_efuse_get_wafer_version();
/**
* @brief iot_efuse_get_reserve_version() - get reserve version.
* @return - efuse reserve version.
*/
uint32_t iot_efuse_get_reserve_version();
/**
* @brief iot_efuse_get_package_version() - get package version.
* @return - efuse package version.
*/
uint32_t iot_efuse_get_package_version();
/**
* @brief iot_efuse_get_dcdc_trim() - get dcdc trim code.
* @return - dcdc trim code.
*/
uint8_t iot_efuse_get_dcdc_trim();
/**
* @brief iot_efuse_get_pmu_ldo_trim() - get pmu ldo trim code.
* @return - pmu ldo trim code.
*/
uint8_t iot_efuse_get_pmu_ldo_trim();
/**
* @brief iot_efuse_get_mac_addr() - get mac address.
* @param mac - the pointer of mac address.
*/
void iot_efuse_get_mac_addr(uint8_t *mac);
/**
* @brief iot_efuse_set_mac_addr() - set mac address.
* @param mac - the pointer of mac address.
*/
void iot_efuse_set_mac_addr(uint8_t *mac);
/**
* @brief iot_efuse_get_chip_id() - get chip id.
* @return - chip id.
*/
uint32_t iot_efuse_get_chip_id();
/**
* @brief iot_efuse_get_sub_id() - get sub id.
* @return - sub id.
*/
uint32_t iot_efuse_get_sub_id();
/**
* @brief iot_efuse_check_data() - check efuse data validity.
* @return - 0: data is valid.
* other: data is invalid.
*/
uint8_t iot_efuse_check_data();
/**
* @brief iot_efuse_get_sadc_calib_code() - get sadc calibration data.
* @param id - sadc id, see sadc_id_t.
* @param vref - vref calibration data, got 0 means data is invalid.
* @param vcm - vcm calibration data, got 0 means data is invalid.
* @param dc_offset - dc_offset calibration data array, got 0 means data is invalid.
* @param dc_offset_array_len - dc_offset array length, fixed is SADC_HW_CALIB_GAIN_MAX.
*/
void iot_efuse_get_meter_calib_code(uint8_t id, float *vref,
float *vcm, float *dc_offset, uint8_t dc_offset_array_len);
/**
* @brief iot_efuse_get_rf_tx_iqm_dc_calib_info() - get rf tx iq mismatch and dc
* calibration data.
* @param i_mag - pointer used to return i-path mag compensation value.
* @param q_mag - pointer used to return q-path mag compensation value.
* @param i_phase - pointer used to return i-path phase compensation value.
* @param q_phase - pointer used to return q-path phase compensation value.
* @param i_dc - pointer used to return i-path dc offset compensation value.
* @param q_dc - pointer used to return q-path dc offset compensation value.
* @return
* ERR_OK - ok
* otherwise - failed
*/
uint32_t iot_efuse_get_rf_tx_iqm_dc_calib_info(uint8_t *i_mag,
uint8_t *q_mag, uint8_t *i_phase, uint8_t *q_phase,
int8_t *i_dc, int8_t *q_dc);
#ifdef __cplusplus
}
#endif
#endif /* _IOT_EFUSE_H_ */