133 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			133 lines
		
	
	
		
			4.4 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 __ATE_MAIN_H
							 | 
						||
| 
								 | 
							
								#define __ATE_MAIN_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "phy_cal.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(push)  /* save the pack status */
							 | 
						||
| 
								 | 
							
								#pragma pack(1)     /* 1 byte align */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* case branch */
							 | 
						||
| 
								 | 
							
								// 6: ana&&flash 1:efuse
							 | 
						||
| 
								 | 
							
								#define ATE_TEST_CASE_ID                (6)
							 | 
						||
| 
								 | 
							
								#define ATE_DEBUG_LEVEL                 (0)
							 | 
						||
| 
								 | 
							
								#define ATE_FUSE_INFO_EN                (0)
							 | 
						||
| 
								 | 
							
								#define ATE_SADC_SUPPORT                (1)
							 | 
						||
| 
								 | 
							
								// 1 geode only
							 | 
						||
| 
								 | 
							
								#define ATE_GEODE_ONLY                  (0)
							 | 
						||
| 
								 | 
							
								#define ATE_EFUSE_PROG_DONE             (1)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define ATE_TONE_3M                     (41)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_READ_ID_ERR        (1 << 0)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_SET_QUAD_ERR       (1 << 1)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_ERASE_SECTOR_ERR   (1 << 2)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_WRITE_SERIAL_ERR   (1 << 3)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_WRITE_QUAD_ERR     (1 << 4)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_READ_SERIAL_ERR    (1 << 5)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_READ_QUAD_ERR      (1 << 6)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_EFUSE_ZERO_ERR     (1 << 7)
							 | 
						||
| 
								 | 
							
								#define SFC_ATE_TEST_OK                 (0)
							 | 
						||
| 
								 | 
							
								#define PHY_NF_RST_VAL                  (121)
							 | 
						||
| 
								 | 
							
								#define PHY_NF_RTY_CNT                  (10)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* ATE software version */
							 | 
						||
| 
								 | 
							
								#define ATE_SW_VER              ("SW_V1.4_20180411")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define REG8(a)                 (*((volatile uint8_t *)(a)))
							 | 
						||
| 
								 | 
							
								#define REG32(a)                (*((volatile uint32_t *)(a)))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define ERR_BIT(a)              (0x00000001<<(a)) // | 0x00000002)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef enum _iot_ftm_result {
							 | 
						||
| 
								 | 
							
								    ATE_TEST_OK     = 0x01,
							 | 
						||
| 
								 | 
							
								    ATE_TEST_FAIL   = 0xFF,
							 | 
						||
| 
								 | 
							
								} iot_ftm_result_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* ate total info structure:512byte start from 0xff8000 */
							 | 
						||
| 
								 | 
							
								typedef struct _ate_info {
							 | 
						||
| 
								 | 
							
								    uint8_t     result;
							 | 
						||
| 
								 | 
							
								    uint32_t    ret_flag;
							 | 
						||
| 
								 | 
							
								    uint8_t     sw_version[20];
							 | 
						||
| 
								 | 
							
								    uint8_t     mac[6];
							 | 
						||
| 
								 | 
							
								    uint8_t     version;/* bit0-3:pkg, bit4-7:wafer */
							 | 
						||
| 
								 | 
							
								    uint8_t     efuse_checksum;
							 | 
						||
| 
								 | 
							
								    uint8_t     efuse_1st_pg[4];
							 | 
						||
| 
								 | 
							
								    uint8_t     gain;
							 | 
						||
| 
								 | 
							
								    uint8_t     rssi;
							 | 
						||
| 
								 | 
							
								    uint8_t     est_dc;
							 | 
						||
| 
								 | 
							
								    int8_t      est_ppm;
							 | 
						||
| 
								 | 
							
								    int8_t      avg_snr;
							 | 
						||
| 
								 | 
							
								    uint16_t    tx_dc[4]; //ff802a(offset = 42)
							 | 
						||
| 
								 | 
							
								    uint16_t    rx_dc[PHY_GAIN_STEP_MAX];
							 | 
						||
| 
								 | 
							
								    int8_t      csi_snr[16];
							 | 
						||
| 
								 | 
							
								    int8_t      csi_amp[16];
							 | 
						||
| 
								 | 
							
								    uint8_t     spur;
							 | 
						||
| 
								 | 
							
								    uint8_t     rx_band_filter[8];
							 | 
						||
| 
								 | 
							
								    uint8_t     granite_bg;
							 | 
						||
| 
								 | 
							
								    uint32_t    geode_bg;//ff8106(offset = 262)
							 | 
						||
| 
								 | 
							
								    uint8_t     adc_cfg_dly;
							 | 
						||
| 
								 | 
							
								    uint8_t     adc_f_h;
							 | 
						||
| 
								 | 
							
								    int32_t     sadc_dc[4];
							 | 
						||
| 
								 | 
							
								    int32_t     sadc_ref[4];
							 | 
						||
| 
								 | 
							
								    uint8_t     sadc_ical_code;
							 | 
						||
| 
								 | 
							
								    uint8_t     sadc_adcref_code;
							 | 
						||
| 
								 | 
							
								    uint8_t     sadc_dcdc_code;
							 | 
						||
| 
								 | 
							
								    int16_t     sadc_vtemp; //ff812f(offset = 303)
							 | 
						||
| 
								 | 
							
								    uint32_t    sync_ok_cnt;
							 | 
						||
| 
								 | 
							
								    uint32_t    fc_crc_ok_cnt;
							 | 
						||
| 
								 | 
							
								    uint32_t    fc_crc_fail_cnt;
							 | 
						||
| 
								 | 
							
								    uint32_t    pld_crc_ok_cnt;
							 | 
						||
| 
								 | 
							
								    uint32_t    pld_crc_fail_cnt;
							 | 
						||
| 
								 | 
							
								    uint8_t     version_wafer;
							 | 
						||
| 
								 | 
							
								    uint8_t     version_reserve;
							 | 
						||
| 
								 | 
							
								    uint8_t     flash_init_ret;//ff8147(offset = 327)
							 | 
						||
| 
								 | 
							
								    uint8_t     flash_read_id;
							 | 
						||
| 
								 | 
							
								    uint8_t     flash_reg_sts;
							 | 
						||
| 
								 | 
							
								    uint8_t     flash_erase_ret;
							 | 
						||
| 
								 | 
							
								    uint8_t     flash_write_ret;
							 | 
						||
| 
								 | 
							
								    uint8_t     flash_read_ret;
							 | 
						||
| 
								 | 
							
								    uint8_t     efuse_check_ret;
							 | 
						||
| 
								 | 
							
								    uint32_t    flash_init_cost;
							 | 
						||
| 
								 | 
							
								    uint32_t    flash_id_cost;
							 | 
						||
| 
								 | 
							
								    uint32_t    flash_reg_cost;
							 | 
						||
| 
								 | 
							
								    uint32_t    flash_erase_cost;
							 | 
						||
| 
								 | 
							
								    uint32_t    flash_write_cost;
							 | 
						||
| 
								 | 
							
								    uint32_t    flash_read_cost;
							 | 
						||
| 
								 | 
							
								    uint32_t    ana_wdg_cost_cnt;
							 | 
						||
| 
								 | 
							
								    uint32_t    flash_wdg_cost_cnt;
							 | 
						||
| 
								 | 
							
								    uint8_t     flash_device_id;
							 | 
						||
| 
								 | 
							
								    uint32_t    nf; //ff816f(offset = 367)
							 | 
						||
| 
								 | 
							
								    uint32_t    rsv[4];
							 | 
						||
| 
								 | 
							
								} ate_info_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _ate_loop_back_gain_list {
							 | 
						||
| 
								 | 
							
								    int8_t      tx_tone_att;
							 | 
						||
| 
								 | 
							
								    int8_t      tx_factor;
							 | 
						||
| 
								 | 
							
								    uint8_t     tx_pga_gain;
							 | 
						||
| 
								 | 
							
								    uint8_t     rx_pgf_gain;
							 | 
						||
| 
								 | 
							
								    uint8_t     rx_bq_gain;
							 | 
						||
| 
								 | 
							
								    uint8_t     rx_pga_gain;
							 | 
						||
| 
								 | 
							
								    int8_t      rx_gain_shift;
							 | 
						||
| 
								 | 
							
								    uint8_t     rx_lna_gain;
							 | 
						||
| 
								 | 
							
								} ate_loop_back_gain_list_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(pop)   /* restore the pack status */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // !__ATE_MAIN_H
							 |