214 lines
7.0 KiB
C
214 lines
7.0 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 PLC_MME_DIAGNOSE_H
|
|
#define PLC_MME_DIAGNOSE_H
|
|
|
|
/* os shim includes */
|
|
#include "os_types_api.h"
|
|
#include "plc_fr.h"
|
|
#include "plc_mme.h"
|
|
#include "plc_utils.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* pack for the structures in the whole file */
|
|
#pragma pack(push) /* save the pack status */
|
|
#pragma pack(1) /* 1 byte align */
|
|
|
|
/* diag message ID definition */
|
|
#define MME_DIAG_MSG_ID_INVALID 0
|
|
#define MME_DIAG_MSG_ID_APP 1
|
|
#define MME_DIAG_MSG_ID_ZC_COLLECT_IND 2
|
|
#define MME_DIAG_MSG_ID_ZC_RPT 3
|
|
#define MME_DIAG_MSG_ID_TSFM_LOG_RPT 4
|
|
#define MME_DIAG_MSG_ID_PCO_SNR_RPT 5
|
|
|
|
/* maximum number of level snr stats reported in transformer detection log */
|
|
#define PLC_TSFM_LOG_MAX_LEVEL 2
|
|
|
|
/* definition of each sta snr info */
|
|
typedef struct _mme_diag_sta_snr_info {
|
|
/* tei of the sta */
|
|
tei_t sta_tei;
|
|
/* downlink snr */
|
|
int8_t dl_snr;
|
|
/* uplink snr */
|
|
int8_t ul_snr;
|
|
} mme_diag_sta_snr_info_t;
|
|
|
|
/* definition of pco snr report */
|
|
typedef struct _mme_diag_pco_snr_rpt {
|
|
/* tei of the proxy sending this packet */
|
|
tei_t pco_tei;
|
|
/* number of direct sub sta */
|
|
uint16_t sub_sta_cnt;
|
|
/* snr info of each sub sta */
|
|
mme_diag_sta_snr_info_t sta_snr[0];
|
|
} mme_diag_pco_snr_rpt_t;
|
|
|
|
/* definition of level snr statistics */
|
|
typedef struct _mme_diag_tsfm_level_snr {
|
|
/* level info */
|
|
uint8_t level :4,
|
|
/* flag to mark if the level data is valid */
|
|
valid :1,
|
|
/* reserved for future */
|
|
rsvd :3;
|
|
/* average snr */
|
|
int8_t snr;
|
|
/* received count */
|
|
uint16_t cnt;
|
|
} mme_diag_tsfm_nw_level_snr_t;
|
|
|
|
/* definition of peer snr statistics */
|
|
typedef struct _mme_diag_tsfm_peer_snr {
|
|
/* level info */
|
|
uint8_t level :4,
|
|
/* reserved for future */
|
|
rsvd :4;
|
|
/* mac address info. big endian */
|
|
uint8_t addr[6];
|
|
/* average snr, unit is (1 db >> 8) */
|
|
int16_t snr;
|
|
/* received count */
|
|
uint16_t cnt;
|
|
} mme_diag_tsfm_nw_peer_snr_t;
|
|
|
|
/* definition of zc ntb diff statistics */
|
|
typedef struct _mme_diag_tsfm_ntb_diff {
|
|
/* zc ntb delta variance of the last statistics */
|
|
uint32_t ntb_delta_var;
|
|
/* zc ntb delta average of the last statistics */
|
|
uint32_t ntb_delta_avg;
|
|
/* zc period difference average of the last statistics */
|
|
uint32_t period_delta_var_avg;
|
|
} mme_diag_tsfm_nw_ntb_diff_t;
|
|
|
|
/* definition of tranformer statistics */
|
|
typedef struct _mme_diag_tsfm_nw_stat {
|
|
/* the STA reporting zero corss NTB */
|
|
uint32_t nid :24,
|
|
/* reserved for future */
|
|
rsvd :8;
|
|
/* level snr statistics */
|
|
mme_diag_tsfm_nw_level_snr_t level_snr[PLC_TSFM_LOG_MAX_LEVEL];
|
|
/* peer snr statistics */
|
|
mme_diag_tsfm_nw_peer_snr_t peer_snr[PLC_TSFM_LOG_MAX_LEVEL];
|
|
/* zc ntb diff statistics */
|
|
mme_diag_tsfm_nw_ntb_diff_t ntb_diff;
|
|
} mme_diag_tsfm_nw_stat_t;
|
|
|
|
typedef struct _mme_diag_tsfm_log_rpt {
|
|
/* number of network info in the array */
|
|
uint8_t nn_nwm_cnt :6,
|
|
/* flag to mark if current network is locked */
|
|
locked :1,
|
|
/* reserved for future */
|
|
rsvd :1;
|
|
/* duration since last tsfm check. unit is 1s */
|
|
uint16_t last_check_dur;
|
|
/* network statistics. first one in the array is the current network
|
|
* network statistics.
|
|
*/
|
|
mme_diag_tsfm_nw_stat_t nn_nw[0];
|
|
} mme_diag_tsfm_log_rpt_t;
|
|
|
|
/* each ntb_diff_value_t contain 2 NTB diff value.
|
|
* please use ntb_diff1 to access the 1st value and ntb_diff2 for the 2nd one.
|
|
*/
|
|
typedef struct _diag_ntb_diff_value {
|
|
union {
|
|
struct {
|
|
uint32_t ntb_diff1 :20;
|
|
uint32_t _reserved_1 :12;
|
|
uint8_t _reserved_2;
|
|
};
|
|
struct {
|
|
uint8_t _reserved_3;
|
|
uint32_t _reserved_4 :12;
|
|
uint32_t ntb_diff2 :20;
|
|
};
|
|
uint8_t data[5];
|
|
};
|
|
} diag_ntb_diff_value_t;
|
|
|
|
/* definition of zero cross NTB report */
|
|
typedef struct _mme_diag_zc_ntb_report {
|
|
/* the STA reporting zero corss NTB */
|
|
tei_t sta;
|
|
/* number of zero cross NTB collected */
|
|
uint8_t clct_cnt;
|
|
/* standard NTB */
|
|
uint32_t std_ntb;
|
|
/* each item contain 2 NTB diff values */
|
|
diag_ntb_diff_value_t ntb_diff_val[0];
|
|
} mme_diag_zc_ntb_report_t;
|
|
|
|
/* definition of zero cross NTB collect indication */
|
|
typedef struct _mme_diag_zc_ntb_clct_ind {
|
|
/* the STA should collect zero cross NTB */
|
|
tei_t sta;
|
|
/* ntb collection period. see MME_ZC_CP_XXX */
|
|
uint8_t clct_period;
|
|
/* number of zero cross NTB to collect */
|
|
uint8_t clct_cnt;
|
|
} mme_diag_zc_ntb_clct_ind_t;
|
|
|
|
/* note that this data structure must be 4 bytes aligned */
|
|
typedef struct _mme_diag_app {
|
|
/* application id of this diagnose data */
|
|
uint8_t app_id;
|
|
/* reserved for future */
|
|
uint8_t rsvd[3];
|
|
/* application specific data */
|
|
uint8_t data[0];
|
|
} mme_diag_app_t;
|
|
|
|
/* note that this data structure must be 4 bytes aligned */
|
|
typedef struct _mme_diagnose {
|
|
/* chip vendor ID */
|
|
uint16_t chip_vendor_id;
|
|
/* note that, below fields are vendor specific data */
|
|
/* message id, see MME_DIAG_MSG_ID_XXX */
|
|
uint8_t msg_id;
|
|
/* reserved for future */
|
|
uint8_t rsvd;
|
|
/* message specific data. see mme_diag_xxx */
|
|
uint8_t data[0];
|
|
} mme_diagnose_t;
|
|
|
|
/* note that this data structure must be 2 bytes aligned */
|
|
typedef struct _spg_mme_diagnose {
|
|
/* chip vendor ID */
|
|
uint16_t chip_vendor_id;
|
|
/* note that, below fields are vendor specific data */
|
|
/* message id, see MME_DIAG_MSG_ID_XXX */
|
|
uint8_t msg_id;
|
|
/* reserved for future */
|
|
uint8_t rsvd[3];
|
|
/* message specific data. see mme_diag_xxx */
|
|
uint8_t data[0];
|
|
} spg_mme_diagnose_t;
|
|
|
|
#pragma pack(pop) /* restore the pack status */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PLC_MME_DIAGNOSE_H */ |