Files
kunlun/plc/halphy/hw2/inc/phy_status.h
2024-09-28 14:24:04 +08:00

259 lines
5.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.
****************************************************************************/
#ifndef PHY_STATUS_H
#define PHY_STATUS_H
#include "os_types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define PHY_LOG_SPUR_MAX_CNT (10)
#pragma pack(push)
#pragma pack(1)
typedef struct _gain_dc{
/* The 8 largest group of gain in GainTable corresponds to DC pgfoffsize*/
uint8_t rx_dc_pgf[8];
/* The 8 largest group of gain in GainTable corresponds to DC pgaoffsize*/
uint8_t rx_dc_pga[8];
/* 4 tx gain */
uint16_t tx_dc[4];
}gain_dc_t;
typedef struct _phy_rx_cnt{
/* phy rx pkt count */
uint32_t phy_rx_pkt_cnt;
/* phy rx pkt fc success count */
uint32_t phy_rx_fc_ok_cnt;
/* phy rx pkt fc fail count */
uint32_t phy_rx_fc_fail_cnt;
/* phy rx pkt pld success count */
uint32_t phy_rx_pld_ok_cnt;
/* phy rx pkt pld fail count */
uint32_t phy_rx_pld_fail_cnt;
/* phy rx pkt fc fail count */
uint32_t phy_rx_fc_fail_cnt_clr;
}phy_rx_cnt_t;
typedef struct _phy_tx_pwr_reg{
/* CFG_BB_DB_AMP_CTRL_RATE0_BAND0_ADDR value */
uint16_t bb_rt0_bd0;
/* CFG_BB_DB_AMP_CTRL_RATE0_BAND1_ADDR value */
uint16_t bb_rt0_bd1;
/* CFG_BB_DB_AMP_CTRL_RATE0_BAND2_ADDR value */
uint16_t bb_rt0_bd2;
/* CFG_BB_DB_AMP_CTRL_RATE1_BAND0_ADDR value */
uint16_t bb_rt1_bd0;
/* CFG_BB_DB_AMP_CTRL_RATE1_BAND1_ADDR value */
uint16_t bb_rt1_bd1;
/* CFG_BB_DB_AMP_CTRL_RATE1_BAND2_ADDR value */
uint16_t bb_rt1_bd2;
}phy_tx_pwr_reg_t;
typedef struct _phy_band_{
/* CFG_BB_R0_B0_TONE_ADDR value */
uint32_t bb_r0_b0;
/* CFG_BB_R0_B1_TONE_ADDR value */
uint32_t bb_r0_b1;
/* CFG_BB_R0_B2_TONE_ADDR value */
uint32_t bb_r0_b2;
/* CFG_BB_R1_B0_TONE_ADDR value */
uint32_t bb_r1_b0;
/* CFG_BB_R1_B1_TONE_ADDR value */
uint32_t bb_r1_b1;
/* CFG_BB_R1_B2_TONE_ADDR value */
uint32_t bb_r1_b2;
}phy_band_t;
typedef struct _phy_status{
/* 24byte */
gain_dc_t gain_dc;
/* 24 byte band cfg */
phy_band_t phy_band;
/* 20byte rx count */
phy_rx_cnt_t phy_rx_cnt;
/* 12 byte tx power */
phy_tx_pwr_reg_t phy_tx_pwr_reg;
/* 44byte all granite reg value */
uint32_t granite_reg[11];
/* 4byte ppm value*/
uint32_t ppm_value;
/* 4byte phy tx pkt count */
uint32_t phy_tx_pkt_cnt;
/* 4byte phy tx pkt count */
uint32_t phy_tx_pkt_cnt_clr;
/* 4 byte */
uint32_t phy_gain_adjust_info;
/* 2 byte temperature result */
uint16_t temp_res;
/* 2byte dc calibration */
uint16_t dc_cal_cnt;
/* current spur array */
uint16_t spur_array[PHY_LOG_SPUR_MAX_CNT];
/* phy init cnt */
uint16_t phy_init_cnt;
/* phy reinit cnt */
uint16_t phy_reinit_cnt;
uint8_t phy_mode;
}phy_status_t;
typedef struct {
uint32_t phy_status;
uint32_t force_0;
uint32_t force_1;
uint32_t force_2;
}ana_dbg_info_t;
/**
*@brief phy_get_status_printf phy status log to flash.
*@return [none.]
*/
void phy_get_status_printf();
/**
*@brief phy_set_init_cnt phy set init cnt.
*@return [0.]
*/
uint16_t phy_set_init_cnt();
/**
*@brief phy_set_reinit_cnt phy set reinit cnt.
*@return [0.]
*/
uint16_t phy_set_reinit_cnt();
/**
*@brief phy_tx_dbg_cnt_clr
* clear phy tx debug cnt.
*@return [none.]
*/
void phy_tx_dbg_cnt_clr(void);
/**
*@brief phy_get_tx_abort_info
* set all 0 fc to be fcs error
*
*@param to_err [treat as error if all fc all 0s]
*@exception [none.]
*@return [0]
*/
uint32_t phy_get_tx_abort_info();
/**
*@brief phy_set_sw_time_out_en
* set all 0 fc to be fcs error
*
*@param to_err [treat as error if all fc all 0s]
*@exception [none.]
*@return [none]
*/
void phy_set_sw_time_out_en(uint8_t flag);
/**
*@brief phy_dbg_set_tx_abort_reg
* set all 0 fc to be fcs error
*
*@param to_err [treat as error if all fc all 0s]
*@exception [none.]
*@return [none]
*/
void phy_dbg_set_tx_abort_reg();
/**
*@brief phy_dbg_get_tx_abort_lock_value
* set all 0 fc to be fcs error
*
*@param to_err [treat as error if all fc all 0s]
*@exception [none.]
*@return [none]
*/
void phy_dbg_get_tx_abort_lock_value();
/**
*@brief phy_dump_busy_set.
*
* set dump busy flag of global phy ctxt.
*
*@param [none.]
*@exception [none.]
*@return [none.]
*/
void phy_dump_busy_set(bool_t en);
/**
*@brief get the false alarm number in every 4s
*
*
*@param [none.]
*@exception [none.]
*@return [the number of fc err]
*/
uint32_t phy_get_periodic_fc_err_num();
/**
*@brief phy_print_ana_dbg_info
*
*
*@param [none.]
*@exception [none.]
*@return [none.]
*/
void phy_print_ana_dbg_info();
#pragma pack(pop)
#ifdef __cplusplus
}
#endif
#endif