90 lines
3.0 KiB
C
Executable File
90 lines
3.0 KiB
C
Executable File
/****************************************************************************
|
|
|
|
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.
|
|
|
|
****************************************************************************/
|
|
#include "os_types.h"
|
|
#include "hw_reg_api.h"
|
|
#include "phy_bb.h"
|
|
#include "iot_io.h"
|
|
#include "iot_config.h"
|
|
#include "iot_pib.h"
|
|
#include "iot_errno.h"
|
|
#include "phy_cfg.h"
|
|
#include "hw_phy_api.h"
|
|
|
|
/* read pre-saved config infomation */
|
|
void phy_load_pib_cfg(void)
|
|
{
|
|
#if IOT_DTEST_ONLY_SUPPORT == 0
|
|
uint32_t ret = ERR_FAIL;
|
|
uint8_t *section;
|
|
uint8_t pib_type = 0;
|
|
iot_pib_r_halphy_cfg_info_t *phy_cfg;
|
|
|
|
/* get configuration from pib */
|
|
ret = iot_pib_get_section(IOT_PIB_HALPHY_ID, \
|
|
§ion, \
|
|
&pib_type,
|
|
IOT_PIB_GET_READ_SECTION);
|
|
if (ret == ERR_OK) {
|
|
phy_cfg = (iot_pib_r_halphy_cfg_info_t *)section;
|
|
|
|
/* global value set */
|
|
g_phy_ctxt.indep.tx_pwr_reduce_db = phy_cfg->tx_pwr_reduce_db;
|
|
g_phy_ctxt.indep.tx_pwr_psd_fix_db = phy_cfg->tx_pwr_psd_fix_db;
|
|
g_phy_cpu_share_ctxt.tx_pwr_ctl_ena = phy_cfg->tx_pwr_ctl_ena;
|
|
iot_printf("%s pib load tx_pwr_reduce: %d dB, psd_fix_pwr: %d\n"
|
|
"tx pwr ctl en: %d\n", \
|
|
__FUNCTION__, \
|
|
g_phy_ctxt.indep.tx_pwr_reduce_db, \
|
|
g_phy_ctxt.indep.tx_pwr_psd_fix_db, \
|
|
g_phy_cpu_share_ctxt.tx_pwr_ctl_ena);
|
|
} else {
|
|
iot_printf("%s pib load fail\n", __FUNCTION__);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
/* read pre-saved config infomation */
|
|
void phy_load_ada_scan_cfg(uint16_t *start_tone,\
|
|
uint16_t *end_tone, uint16_t *inter_time)
|
|
{
|
|
#if IOT_DTEST_ONLY_SUPPORT == 0
|
|
uint32_t ret = ERR_FAIL;
|
|
uint8_t *section;
|
|
uint8_t pib_type = 0;
|
|
iot_pib_r_halphy_cfg_info_t *phy_cfg;
|
|
|
|
/* get configuration from pib */
|
|
ret = iot_pib_get_section(IOT_PIB_HALPHY_ID, \
|
|
§ion, \
|
|
&pib_type,
|
|
IOT_PIB_GET_READ_SECTION);
|
|
if (ret == ERR_OK) {
|
|
phy_cfg = (iot_pib_r_halphy_cfg_info_t *)section;
|
|
|
|
/* global value set */
|
|
*start_tone = phy_cfg->start_tone;
|
|
*end_tone = phy_cfg->end_tone;
|
|
*inter_time = phy_cfg->inter_time;
|
|
iot_printf("%s start_tone: %d dB, end_tone: %d\n"
|
|
"inter_time: %d\n", \
|
|
__FUNCTION__, \
|
|
*start_tone, *end_tone, *inter_time);
|
|
} else {
|
|
iot_printf("%s pib load fail\n", __FUNCTION__);
|
|
}
|
|
#endif
|
|
}
|
|
|