Path: blob/master/ALFA-W1F1/RTL8814AU/hal/phydm/phydm_ccx.h
1307 views
/******************************************************************************1*2* Copyright(c) 2007 - 2017 Realtek Corporation.3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of version 2 of the GNU General Public License as6* published by the Free Software Foundation.7*8* This program is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for11* more details.12*13* The full GNU General Public License is included in this distribution in the14* file called LICENSE.15*16* Contact Information:17* wlanfae <[email protected]>18* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,19* Hsinchu 300, Taiwan.20*21* Larry Finger <[email protected]>22*23*****************************************************************************/2425#ifndef __PHYDMCCX_H__26#define __PHYDMCCX_H__2728/* 2019.03.27 add noise_pwr in env_mntr_rpt.*/29#define CCX_VERSION "2.4"3031/* @1 ============================================================32* 1 Definition33* 1 ============================================================34*/35#define CCX_EN 13637#define MAX_ENV_MNTR_TIME 8 /*second*/38#define IGI_TO_NHM_TH_MULTIPLIER 239#define MS_TO_4US_RATIO 25040#define CCA_CAP 1441#define CLM_MAX_REPORT_TIME 1042#define DEVIDER_ERROR 0xffff43#define CLM_PERIOD_MAX 6553544#define NHM_PERIOD_MAX 6553445#define NHM_TH_NUM 11 /*threshold number of NHM*/46#define NHM_RPT_NUM 1247#ifdef NHM_DYM_PW_TH_SUPPORT48#define DYM_PWTH_CCA_CAP 2449#define NHM_1PEAK_PS 1 /* @case1 : positive skew*/50#define NHM_1PEAK_NS 2 /* @case2 : negative skew*/51#define NHM_1PEAK_SYM 3 /* @case3 : symmetry*/52#define NHM_TH1 33 /* @13%, for step2 decision*/53#define NHM_TH2 35 /* @14%, for step3_c1_c2 decision*/54#define NHM_TH3 31 /* @12%, for step3_c3 decision*/55#define NHM_TH4 178 /* @70%, for step4 decision*/56#define NHM_TH5 25 /* @10%, for step5_c1_c2 decision*/57#define NHM_TH6 39 /* @15%, for step5_c3 decision*/58#endif5960#define IGI_2_NHM_TH(igi) ((igi) << 1)/*NHM_threshold = IGI * 2*/61#define NTH_TH_2_RSSI(th) ((th >> 1) - 10)6263/*@FAHM*/64#define FAHM_INCLD_FA BIT(0)65#define FAHM_INCLD_CRC_OK BIT(1)66#define FAHM_INCLD_CRC_ER BIT(2)6768#define NHM_SUCCESS BIT(0)69#define CLM_SUCCESS BIT(1)70#define FAHM_SUCCESS BIT(2)71#define ENV_MNTR_FAIL 0xff7273/* @1 ============================================================74* 1 enumrate75* 1 ============================================================76*/77enum phydm_clm_level {78CLM_RELEASE = 0,79CLM_LV_1 = 1, /* @Low Priority function */80CLM_LV_2 = 2, /* @Middle Priority function */81CLM_LV_3 = 3, /* @High priority function (ex: Check hang function) */82CLM_LV_4 = 4, /* @Debug function (the highest priority) */83CLM_MAX_NUM = 584};8586enum phydm_nhm_level {87NHM_RELEASE = 0,88NHM_LV_1 = 1, /* @Low Priority function */89NHM_LV_2 = 2, /* @Middle Priority function */90NHM_LV_3 = 3, /* @High priority function (ex: Check hang function) */91NHM_LV_4 = 4, /* @Debug function (the highest priority) */92NHM_MAX_NUM = 593};9495enum nhm_divider_opt_all {96NHM_CNT_ALL = 0, /*nhm SUM report <= 255*/97NHM_VALID = 1, /*nhm SUM report = 255*/98NHM_CNT_INIT99};100101enum nhm_setting {102SET_NHM_SETTING,103STORE_NHM_SETTING,104RESTORE_NHM_SETTING105};106107enum nhm_option_cca_all {108NHM_EXCLUDE_CCA = 0,109NHM_INCLUDE_CCA = 1,110NHM_CCA_INIT111};112113enum nhm_option_txon_all {114NHM_EXCLUDE_TXON = 0,115NHM_INCLUDE_TXON = 1,116NHM_TXON_INIT117};118119enum nhm_application {120NHM_BACKGROUND = 0,/*@default*/121NHM_ACS = 1,122IEEE_11K_HIGH = 2,123IEEE_11K_LOW = 3,124INTEL_XBOX = 4,125NHM_DBG = 5, /*@manual trigger*/126};127128enum clm_application {129CLM_BACKGROUND = 0,/*@default*/130CLM_ACS = 1,131};132133enum clm_monitor_mode {134CLM_DRIVER_MNTR = 1,135CLM_FW_MNTR = 2136};137138/* @1 ============================================================139* 1 structure140* 1 ============================================================141*/142struct env_trig_rpt {143u8 nhm_rpt_stamp;144u8 clm_rpt_stamp;145};146147148struct env_mntr_rpt {149u8 nhm_ratio;150u8 nhm_result[NHM_RPT_NUM];151u8 clm_ratio;152u8 nhm_rpt_stamp;153u8 clm_rpt_stamp;154u8 nhm_noise_pwr;155};156157struct nhm_para_info {158enum nhm_option_txon_all incld_txon; /*@Include TX on*/159enum nhm_option_cca_all incld_cca; /*@Include CCA*/160enum nhm_divider_opt_all div_opt; /*@divider option*/161enum nhm_application nhm_app;162enum phydm_nhm_level nhm_lv;163u16 mntr_time; /*@0~262 unit ms*/164};165166struct clm_para_info {167enum clm_application clm_app;168enum phydm_clm_level clm_lv;169u16 mntr_time; /*@0~262 unit ms*/170};171172struct ccx_info {173u32 nhm_trigger_time;174u32 clm_trigger_time;175u64 start_time; /*@monitor for the test duration*/176#ifdef NHM_SUPPORT177enum nhm_application nhm_app;178enum nhm_option_txon_all nhm_include_txon;179enum nhm_option_cca_all nhm_include_cca;180enum nhm_divider_opt_all nhm_divider_opt;181/*Report*/182u8 nhm_th[NHM_TH_NUM];183u8 nhm_result[NHM_RPT_NUM];184u16 nhm_period; /* @4us per unit */185u8 nhm_igi;186u8 nhm_manual_ctrl;187u8 nhm_ratio; /*@1% per nuit, it means the interference igi can't overcome.*/188u8 nhm_rpt_sum;189u16 nhm_duration; /*@Real time of NHM_VALID */190u8 nhm_set_lv;191boolean nhm_ongoing;192u8 nhm_rpt_stamp;193u8 nhm_noise_pwr;194u8 nhm_noise_pwr_point;195#ifdef NHM_DYM_PW_TH_SUPPORT196boolean nhm_dym_pw_th_en;197boolean nhm_dym_1_peak_en;198boolean dym_pwth_manual_ctrl;199u8 nhm_pw_th_rf20_dft;200u8 nhm_pw_th_max;201u8 nhm_period_decre;202u8 nhm_sl_pw_th;203#endif204#endif205206#ifdef CLM_SUPPORT207enum clm_application clm_app;208u8 clm_manual_ctrl;209u8 clm_set_lv;210boolean clm_ongoing;211u16 clm_period; /* @4us per unit */212u16 clm_result;213u8 clm_ratio;214u32 clm_fw_result_acc;215u8 clm_fw_result_cnt;216enum clm_monitor_mode clm_mntr_mode;217u8 clm_rpt_stamp;218#endif219#ifdef FAHM_SUPPORT220boolean fahm_ongoing;221u8 env_mntr_igi;222u8 fahm_nume_sel; /*@fahm_numerator_sel: select {FA, CRCOK, CRC_fail} */223u8 fahm_denom_sel; /*@fahm_denominator_sel: select {FA, CRCOK, CRC_fail} */224u16 fahm_period; /*unit: 4us*/225#endif226};227228/* @1 ============================================================229* 1 Function Prototype230* 1 ============================================================231*/232233#ifdef FAHM_SUPPORT234void phydm_fahm_init(void *dm_void);235236void phydm_fahm_dbg(void *dm_void, char input[][16], u32 *_used, char *output,237u32 *_out_len);238#endif239240/*@NHM*/241#ifdef NHM_SUPPORT242void phydm_nhm_dbg(void *dm_void, char input[][16], u32 *_used, char *output,243u32 *_out_len);244u8 phydm_get_igi(void *dm_void, enum bb_path path);245#endif246247/*@CLM*/248#ifdef CLM_SUPPORT249void phydm_clm_c2h_report_handler(void *dm_void, u8 *cmd_buf, u8 cmd_len);250251void phydm_clm_dbg(void *dm_void, char input[][16], u32 *_used, char *output,252u32 *_out_len);253#endif254255u8 phydm_env_mntr_trigger(void *dm_void, struct nhm_para_info *nhm_para,256struct clm_para_info *clm_para,257struct env_trig_rpt *rpt);258259u8 phydm_env_mntr_result(void *dm_void, struct env_mntr_rpt *rpt);260261void phydm_env_mntr_watchdog(void *dm_void);262263void phydm_env_monitor_init(void *dm_void);264265void phydm_env_mntr_dbg(void *dm_void, char input[][16], u32 *_used,266char *output, u32 *_out_len);267#endif268269270