235 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			235 lines
		
	
	
		
			6.9 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 __PHY_CHN_EST_H
							 | 
						||
| 
								 | 
							
								#define __PHY_CHN_EST_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(push)  /* save the pack status */
							 | 
						||
| 
								 | 
							
								#pragma pack(1)     /* 1 byte align */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define IOT_CHANNEL_DUMP_TEST_START          (0)
							 | 
						||
| 
								 | 
							
								#define IOT_CHANNEL_DUMP_TEST_DONE           (1)
							 | 
						||
| 
								 | 
							
								#define IOT_CHANNEL_TEST_END                 (3)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define IOT_ADA_DUMP_MSG_PKT_SIZE            (128)
							 | 
						||
| 
								 | 
							
								#define IOT_PHY_CHN_DUMP_SIZE                (32)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef enum {
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_ORIG_SPD      = 0,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_1_2_SPD       = 1,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_1_4_SPD       = 2,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_1_8_SPD       = 3
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_rt_speed_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef enum {
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_CCA           = 0,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_PKT_DECT      = 1,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_SYNC_OK       = 2,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_FC_DONE       = 3,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_FC_CRC_OK     = 4,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_FC_CRC_FAIL   = 5,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_PB_DONE       = 6,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_PB_CRC_OK     = 7,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_PB_CRC_FAIL   = 8,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_FC_OK_REV_PB  = 9,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_PWR_JUMP      = 10,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_RX_ERR_RCV_PB = 11,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_TX_UNDERFLOW  = 12,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_TX_ST_FILTER  = 13,
							 | 
						||
| 
								 | 
							
								    ADC_DUMP_TRIG_RX_ABORT      = 14
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_trig_mode_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/******************RX direction******************/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 *  description:        runtime dump type
							 | 
						||
| 
								 | 
							
								 *  range:              0 ~ 255
							 | 
						||
| 
								 | 
							
								 *  default:            0
							 | 
						||
| 
								 | 
							
								 *  display:            noise/trig:FC
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								typedef enum {
							 | 
						||
| 
								 | 
							
								    IOT_PHY_CHN_DUMP_NOISE = 0,
							 | 
						||
| 
								 | 
							
								    IOT_PHY_CHN_DUMP_TRIG_THD,
							 | 
						||
| 
								 | 
							
								    IOT_PHY_CHN_DUMP_TRIG_FC,
							 | 
						||
| 
								 | 
							
								    IOT_PHY_CHN_DUMP_RF,
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_rt_typ_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* runtime dump parameters */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_rt_param {
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              -24 ~ 60 (fix gain)
							 | 
						||
| 
								 | 
							
								     * default:            127 (auto gain)
							 | 
						||
| 
								 | 
							
								     * display:            gain:auto/fix
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    int8_t gain;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0 ~ 96K
							 | 
						||
| 
								 | 
							
								     * default:            96K
							 | 
						||
| 
								 | 
							
								     * display:            sample points
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t size;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0 ~ 1000000 ms
							 | 
						||
| 
								 | 
							
								     * default:            30000
							 | 
						||
| 
								 | 
							
								     * display:            timeout
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t timeout;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0,1,2,3
							 | 
						||
| 
								 | 
							
								     * default:            0
							 | 
						||
| 
								 | 
							
								     * display:            sample speed
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_rt_speed_t speed;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_rt_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* trig dump parameters */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_trig_param {
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              -24 ~ 60 (fix gain)
							 | 
						||
| 
								 | 
							
								     * default:            127 (auto gain)
							 | 
						||
| 
								 | 
							
								     * display:            gain:auto/fix
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    int8_t gain;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0 ~ 96K
							 | 
						||
| 
								 | 
							
								     * default:            96K
							 | 
						||
| 
								 | 
							
								     * display:            buffer points
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t buf_size;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0 ~ 96K
							 | 
						||
| 
								 | 
							
								     * default:            96K
							 | 
						||
| 
								 | 
							
								     * display:            sample points
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t sample_size;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0 ~ 1000000 ms
							 | 
						||
| 
								 | 
							
								     * default:            30000
							 | 
						||
| 
								 | 
							
								     * display:            timeout
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t timeout;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								      * range:              0,1,2,3
							 | 
						||
| 
								 | 
							
								      * default:            0
							 | 
						||
| 
								 | 
							
								      * display:            sample speed
							 | 
						||
| 
								 | 
							
								      */
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_rt_speed_t speed;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_trig_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* trig threshold dump parameters */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_trig_thd_param {
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              -512 ~ 511
							 | 
						||
| 
								 | 
							
								     * default:            100
							 | 
						||
| 
								 | 
							
								     * display:            level thrshold
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    int16_t thd;
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_trig_param_t trig_common;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_trig_thd_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* trig threshold dump parameters */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_trig_phy_param {
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0 ~ 9 see macro define
							 | 
						||
| 
								 | 
							
								     * default:            4:ADC_DUMP_TRIG_FC_CRC_OK
							 | 
						||
| 
								 | 
							
								     * display:            trig id
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_trig_mode_t trig_id;
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_trig_param_t trig_common;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_trig_phy_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* rf dump parameters */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_rf_rx_param {
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              13 ~ 74 (fix gain)
							 | 
						||
| 
								 | 
							
								     * default:            0 (auto gain)
							 | 
						||
| 
								 | 
							
								     * display:            gain:auto/fix
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint8_t gain;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              0 ~ 96K, unit is 4 bytes
							 | 
						||
| 
								 | 
							
								     * default:            96K
							 | 
						||
| 
								 | 
							
								     * display:            sample points
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t size;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              100E6 ~ 1000E6, unit is 1Hz
							 | 
						||
| 
								 | 
							
								     * display:            center frequency
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t lo_freq;
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * range:              1 ~ 0x1FF
							 | 
						||
| 
								 | 
							
								     * default:            0, current option rx filter
							 | 
						||
| 
								 | 
							
								     * display:            rx filter
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint16_t rx_filter;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_rf_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* runtime dump config */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_rt_cfg {
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_rt_typ_t dump_typ;
							 | 
						||
| 
								 | 
							
								    union {
							 | 
						||
| 
								 | 
							
								         iot_phy_chn_dump_rt_param_t force_dump;
							 | 
						||
| 
								 | 
							
								         iot_phy_chn_dump_trig_thd_param_t trig_thd;
							 | 
						||
| 
								 | 
							
								         iot_phy_chn_dump_trig_phy_param_t trig_phy;
							 | 
						||
| 
								 | 
							
								         iot_phy_chn_dump_rf_param_t rf_dump;
							 | 
						||
| 
								 | 
							
								    } param;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_rt_cfg_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* ada dump param */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_param{
							 | 
						||
| 
								 | 
							
								    /* trig point */
							 | 
						||
| 
								 | 
							
								    uint32_t trig_offset;
							 | 
						||
| 
								 | 
							
								    /* dump result */
							 | 
						||
| 
								 | 
							
								    uint32_t dump_rst;
							 | 
						||
| 
								 | 
							
								    /* dump max_pwr */
							 | 
						||
| 
								 | 
							
								    uint32_t  max_pwr;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* ada dump report */
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_report {
							 | 
						||
| 
								 | 
							
								    /* configuration */
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_param_t params;
							 | 
						||
| 
								 | 
							
								    /* dummy data to make it a fixed size */
							 | 
						||
| 
								 | 
							
								    uint8_t dummy[IOT_PHY_CHN_DUMP_SIZE - sizeof(iot_phy_chn_dump_param_t)];
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_report_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**************** dump result ******************/
							 | 
						||
| 
								 | 
							
								typedef struct _iot_phy_chn_dump_result {
							 | 
						||
| 
								 | 
							
								    int8_t gain;
							 | 
						||
| 
								 | 
							
								    uint8_t* start_ptr;
							 | 
						||
| 
								 | 
							
								    uint32_t len;
							 | 
						||
| 
								 | 
							
								    iot_phy_chn_dump_report_t report;
							 | 
						||
| 
								 | 
							
								} iot_phy_chn_dump_result;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/***************** ipc msg type ******************/
							 | 
						||
| 
								 | 
							
								typedef struct _iot_channel_test_msg {
							 | 
						||
| 
								 | 
							
								    uint8_t msg_id;
							 | 
						||
| 
								 | 
							
								    uint8_t data[0];
							 | 
						||
| 
								 | 
							
								} iot_channel_test_msg;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(pop)   /* restore the pack status */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 |