eyescan.h (4839B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 7 * 8 * EYESCAN H 9 */ 10 11 12 #ifndef _SOC_EYESCAN_H_ 13 #define _SOC_EYESCAN_H_ 14 15 #include <soc/types.h> 16 17 #define SOC_PORT_PHY_EYESCAN_MAX_HORIZINAL_RESOLUTION 63 18 #define SOC_PORT_PHY_EYESCAN_MAX_VERTICAL_RESOLUTION 63 19 20 #define SOC_PORT_PHY_EYESCAN_H_INDEX SOC_PORT_PHY_EYESCAN_MAX_HORIZINAL_RESOLUTION / 2 21 #define SOC_PORT_PHY_EYESCAN_V_INDEX SOC_PORT_PHY_EYESCAN_MAX_VERTICAL_RESOLUTION / 2 22 23 #define SRD_EYESCAN_INVALID 0xffffffff 24 #define SRD_EYESCAN_INVALID_VOFFSET 0x7fffffff 25 26 #define SRD_EYESCAN_FLAG_VERTICAL_ONLY 0x1 27 #define SRD_EYESCAN_FLAG_AVOID_EXTRAPOLATION 0x2 28 #define SRD_EYESCAN_FLAG_DSC_PRINT 0x4 29 30 #define TIME_MULTIPLIER 2 31 32 /* #define BER_EXTRAP_SPD_UP */ 33 #define MAX_EYE_LOOPS 49 34 #define HI_CONFIDENCE_ERR_CNT 100 /* bit errors to determine high confidence */ 35 #define LO_CONFIDENCE_MIN_ERR_CNT 10 /* bit errors, exit condition for low confidence */ 36 #define HI_CONFIDENCE_MIN_ERR_CNT 20 /* bit errors exit condition for high confidence */ 37 #define INDEX_UNINITIALIZED (-1) 38 #define VEYE_UNIT 1.75 39 #define EYESCAN_UTIL_MAX_ROUND_DIGITS (8) 40 41 /*Eyescan test bounds*/ 42 typedef struct soc_stat_resolution_bounds_e { 43 int horizontal_min; /* Typically 0 */ 44 int horizontal_max; 45 int vertical_min; /* Ignored */ 46 int vertical_max; /* Actual movement is [-max;max]*/ 47 } soc_port_phy_eye_bounds_t; 48 49 /*Select eyescan errors counting method*/ 50 typedef enum soc_stat_eyscan_counter_e { 51 socPortPhyEyescanCounterRelativePhy = 0, 52 socPortPhyEyescanCounterPrbsPhy, 53 socPortPhyEyescanCounterPrbsMac, 54 socPortPhyEyescanCounterCrcMac, 55 socPortPhyEyescanCounterBerMac, 56 socPortPhyEyescanCounterCustom, 57 socPortPhyEyescanNofCounters /*last*/ 58 } soc_port_phy_eyscan_counter_t; 59 60 /*Eyescan test parameters*/ 61 typedef struct soc_stat_eyescan_params_s { 62 int sample_time; /*milisec*/ 63 int sample_resolution; /*interval between two samples*/ 64 soc_port_phy_eye_bounds_t bounds; 65 soc_port_phy_eyscan_counter_t counter; 66 int error_threshold; /*minimum error threshold required, otherwise increase sample time*/ 67 int time_upper_bound; /*maximum sample time*/ 68 int nof_threshold_links; /*num of links that should be below error_threshold before increasing time*/ 69 int type; 70 int ber_proj_scan_mode; /* BER proj Controls the direction and polarity of the test. */ 71 int ber_proj_timer_cnt; /* BER proj total measurement time in units of ~1.3 seconds. */ 72 int ber_proj_err_cnt; /* BER proj the error threshold it uses to step to next measurement in units of 16 */ 73 } soc_port_phy_eyescan_params_t; 74 75 /*Eyescan test results*/ 76 typedef struct soc_stat_eyescan_results_s { 77 uint32 error_count[SOC_PORT_PHY_EYESCAN_MAX_HORIZINAL_RESOLUTION][SOC_PORT_PHY_EYESCAN_MAX_VERTICAL_RESOLUTION]; 78 uint32 run_time[SOC_PORT_PHY_EYESCAN_MAX_HORIZINAL_RESOLUTION][SOC_PORT_PHY_EYESCAN_MAX_VERTICAL_RESOLUTION]; 79 int ext_results_int; 80 int ext_results_remainder; 81 int ext_better; /* 1 for better than, 0 for exact, -1 for worse than */ 82 int ext_done; 83 } soc_port_phy_eyescan_results_t; 84 85 int soc_port_phy_eyescan_run( 86 int unit, 87 uint32 inst, 88 int flags, 89 soc_port_phy_eyescan_params_t* params, 90 uint32 nof_ports, 91 soc_port_t* ports, 92 int* lane_num, 93 soc_port_phy_eyescan_results_t* results /*array of result per port*/); 94 95 typedef int (*port_phy_eyescan_counter_clear_f) (int unit, soc_port_t port); 96 typedef int (*port_phy_eyescan_counter_get_f) (int unit, soc_port_t port, uint32* err_count); 97 98 typedef struct soc_port_phy_eyescan_counter_cb_s { 99 port_phy_eyescan_counter_clear_f clear_func; 100 port_phy_eyescan_counter_get_f get_func; 101 }soc_port_phy_eyescan_counter_cb_t; 102 103 typedef struct { 104 int total_errs[MAX_EYE_LOOPS]; 105 int total_elapsed_time[MAX_EYE_LOOPS]; 106 int mono_flags[MAX_EYE_LOOPS]; 107 int offset_max; 108 int veye_cnt; 109 uint32 rate; /* frequency in KHZ */ 110 int first_good_ber_idx; 111 int first_small_errcnt_idx; 112 } EYE_DIAG_INFOt; 113 114 int 115 soc_port_phy_eyescan_counter_register( 116 int unit, 117 soc_port_phy_eyscan_counter_t counter, 118 soc_port_phy_eyescan_counter_cb_t* cf); 119 120 int soc_port_phy_eyescan_extrapolate( 121 int unit, 122 int flags, 123 soc_port_phy_eyescan_params_t* params, 124 uint32 nof_ports, 125 soc_port_t* ports, 126 soc_port_phy_eyescan_results_t* results /*array of result per port*/); 127 128 #ifdef PHYMOD_SUPPORT 129 extern int is_eyescan_algorithm_legacy_mode(int unit, uint32 nof_ports, soc_port_t* ports, uint32 inst); 130 extern int is_eyescan_algorithm_legacy_rpt_mode(int unit, uint32 nof_ports, soc_port_t* ports, uint32 inst); 131 #endif /* PHYMOD_SUPPORT */ 132 #endif /* _SOC_EYESCAN_H_ */ 133