56 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.8 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 "hw_tonemask.h"
 | 
						|
#include "phy_txrx_pwr.h"
 | 
						|
 | 
						|
/* update the gain table */
 | 
						|
void phy_pgf_pga_dc_cal(uint16_t gain_idx, \
 | 
						|
    uint16_t pgf_offset, uint16_t pga_offset)
 | 
						|
{
 | 
						|
#if HW_PLATFORM >= HW_PLATFORM_FPGA
 | 
						|
    uint32_t tmp = 0;
 | 
						|
 | 
						|
    IOT_ASSERT(gain_idx < 170);
 | 
						|
 | 
						|
    tmp = all_mask_gain_table[gain_idx];
 | 
						|
    tmp &= ~0x7FF00;
 | 
						|
    tmp |= (pgf_offset & 0x3F) << 8;
 | 
						|
    tmp |= (pga_offset & 0x1F) << 14;
 | 
						|
    all_mask_gain_table[gain_idx] = tmp;
 | 
						|
#else
 | 
						|
    (void)gain_idx;
 | 
						|
    (void)pgf_offset;
 | 
						|
    (void)pga_offset;
 | 
						|
#endif
 | 
						|
}
 | 
						|
 | 
						|
/* get the gain table */
 | 
						|
void phy_pgf_pga_dc_cal_get(uint16_t gain_idx, \
 | 
						|
    volatile uint16_t *pgf_offset, volatile uint16_t *pga_offset)
 | 
						|
{
 | 
						|
#if HW_PLATFORM >= HW_PLATFORM_FPGA
 | 
						|
    uint32_t tmp = 0;
 | 
						|
 | 
						|
    IOT_ASSERT(gain_idx < 170);
 | 
						|
 | 
						|
    tmp = all_mask_gain_table[gain_idx];
 | 
						|
    *pgf_offset = (tmp >> 8) & 0x3F;
 | 
						|
    *pga_offset = (tmp >> 14) & 0x1F;
 | 
						|
#else
 | 
						|
    (void)gain_idx;
 | 
						|
    (void)pgf_offset;
 | 
						|
    (void)pga_offset;
 | 
						|
#endif
 | 
						|
} |