madura_diagnostics.c (4064B)
1 /* 2 * 3 * 4 * 5 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 6 * 7 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 8 */ 9 10 #include <phymod/phymod.h> 11 #include <phymod/phymod_diagnostics.h> 12 #include <phymod/phymod_diagnostics_dispatch.h> 13 14 #ifdef PHYMOD_MADURA_SUPPORT 15 #include "../tier1/madura_cfg_seq.h" 16 #include "../tier1/madura_diag_seq.h" 17 18 int madura_phy_prbs_config_set(const phymod_phy_access_t* phy, uint32_t flags , const phymod_prbs_t* prbs) 19 { 20 21 return (_madura_phy_prbs_config_set (phy, flags, prbs)); 22 23 } 24 25 int madura_phy_prbs_config_get(const phymod_phy_access_t* phy, uint32_t flags , phymod_prbs_t* prbs) 26 { 27 28 return (_madura_phy_prbs_config_get(phy, flags, prbs)); 29 30 } 31 32 33 int madura_phy_prbs_enable_set(const phymod_phy_access_t* phy, uint32_t flags , uint32_t enable) 34 { 35 36 return _madura_phy_prbs_enable_set(phy, flags, enable); 37 38 } 39 40 int madura_phy_prbs_enable_get(const phymod_phy_access_t* phy, uint32_t flags , uint32_t* enable) 41 { 42 43 return _madura_phy_prbs_enable_get(phy, flags, enable); 44 45 } 46 47 48 int madura_phy_prbs_status_get(const phymod_phy_access_t* phy, uint32_t flags, phymod_prbs_status_t* prbs_status) 49 { 50 return _madura_phy_prbs_status_get(phy, flags, prbs_status); 51 } 52 53 54 int madura_phy_diagnostics_get(const phymod_phy_access_t* phy, phymod_phy_diagnostics_t* diag) 55 { 56 57 return _madura_phy_diagnostics_get(&phy->access, diag); 58 59 } 60 61 62 int madura_phy_eyescan_run(const phymod_phy_access_t* phy, uint32_t flags, phymod_eyescan_mode_t mode, const phymod_phy_eyescan_options_t* eyescan_options) 63 { 64 65 if (PHYMOD_EYESCAN_F_DONE_GET(flags)) { 66 switch(mode) { 67 case phymodEyescanModeFast: 68 return _madura_phy_display_eyescan(&phy->access); 69 case phymodEyescanModeBERProj: 70 return _madura_ber_proj(phy, eyescan_options); 71 default: 72 return _madura_phy_display_eyescan(&phy->access); 73 break; 74 } 75 } else { 76 return PHYMOD_E_NONE; 77 } 78 79 } 80 81 /** FC/PCS checker enable set 82 * This function is used to enable or disable FC/PCS checker 83 * 84 * @param phy Pointer to phymod phy access structure 85 * @param fcpcs_chkr_mode FC/PCS checker mode 86 * @param enable Enable or disable 87 * 1 - enable 88 * 0 - disable 89 * 90 * @return PHYMOD_E_NONE successful function execution 91 */ 92 int madura_phy_link_mon_enable_set(const phymod_phy_access_t* phy, phymod_link_monitor_mode_t fcpcs_chkr_mode, uint32_t enable) 93 { 94 return _madura_pcs_link_monitor_enable_set(&phy->access, enable); 95 } 96 /** FC/PCS checker enable get 97 * This function is used to check whether or not FC/PCS checker enabled 98 * 99 * @param phy Pointer to phymod phy access structure 100 * @param fcpcs_chkr_mode FC/PCS checker mode 101 * @param enable Enable or disable 102 * 1 - enable 103 * 0 - disable 104 * 105 * @return PHYMOD_E_NONE successful function execution 106 */ 107 int madura_phy_link_mon_enable_get(const phymod_phy_access_t* phy, phymod_link_monitor_mode_t fcpcs_chkr_mode, uint32_t *enable) 108 { 109 return _madura_pcs_link_monitor_enable_get(&phy->access, enable); 110 } 111 /** FC/PCS checker status get 112 * This function is used to lock, loss of lock, error count status of the FC/PCS checker 113 * 114 * @param phy Pointer to phymod phy access structure 115 * @param lock_status Live lock status 116 * 1 - Locked 117 * 0 - Not locked 118 * @param lock_lost_lh Loss of lock 119 * 1 - Loss of lock happened 120 * 0 - No Loss of lock happended 121 * @param error_count Error count 122 * 123 * @return PHYMOD_E_NONE successful function execution 124 */ 125 int madura_phy_link_mon_status_get(const phymod_phy_access_t* phy, uint32_t* lock_status, uint32_t* lock_lost_lh, uint32_t* error_count) 126 { 127 return _madura_get_pcs_link_status(&phy->access, lock_status); 128 } 129 130 131 #endif /* PHYMOD_MADURA_SUPPORT */