phymod_diagnostics.h (25181B)
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 * DO NOT EDIT THIS FILE! 11 */ 12 13 #ifndef _PHYMOD_DIAGNOSTICS_H__H_ 14 #define _PHYMOD_DIAGNOSTICS_H__H_ 15 16 #include <phymod/phymod_definitions.h> 17 #include <phymod/phymod.h> 18 typedef struct phymod_slicer_position_s { 19 uint32_t horizontal; 20 uint32_t vertical; 21 } phymod_slicer_position_t; 22 23 /* phymod_slicer_position_t initialization and validation */ 24 int phymod_slicer_position_t_validate(const phymod_slicer_position_t* phymod_slicer_position); 25 int phymod_slicer_position_t_init(phymod_slicer_position_t* phymod_slicer_position); 26 27 /*! 28 * @brief Flags for phymod_phy_rx_slicer_position_set/get APIs 29 */ 30 #define PHYMOD_SLICER_F_LIVE_LINK 0x1 /**< Use the live-link slicer */ 31 32 33 /*! 34 * phymod_phy_rx_slicer_position_set 35 * 36 * @brief Set/get slicer position 37 * 38 * @param [in] phy - phy access information 39 * @param [in] flags - 40 * @param [in] position - Slicer location to set 41 */ 42 int phymod_phy_rx_slicer_position_set(const phymod_phy_access_t* phy, uint32_t flags, const phymod_slicer_position_t* position); 43 /*! 44 * phymod_phy_rx_slicer_position_get 45 * 46 * @brief Set/get slicer position 47 * 48 * @param [in] phy - phy access information 49 * @param [in] flags - 50 * @param [out] position - Current slicer position 51 */ 52 int phymod_phy_rx_slicer_position_get(const phymod_phy_access_t* phy, uint32_t flags, phymod_slicer_position_t* position); 53 54 /*! 55 * phymod_phy_rx_slicer_position_max_get 56 * 57 * @brief Get slicer range limitation 58 * 59 * @param [in] phy - phy access information 60 * @param [in] flags - 61 * @param [in] position_min - Slicer minimum position 62 * @param [in] position_max - Slicer maxumum position 63 */ 64 int phymod_phy_rx_slicer_position_max_get(const phymod_phy_access_t* phy, uint32_t flags, const phymod_slicer_position_t* position_min, const phymod_slicer_position_t* position_max); 65 66 67 /*! 68 * @enum phymod_prbs_poly_e 69 * @brief PRBS polynomial 70 */ 71 typedef enum phymod_prbs_poly_e { 72 phymodPrbsPoly7 = 0, 73 phymodPrbsPoly9, 74 phymodPrbsPoly11, 75 phymodPrbsPoly15, 76 phymodPrbsPoly23, 77 phymodPrbsPoly31, 78 phymodPrbsPoly58, 79 phymodPrbsPoly49, 80 phymodPrbsPoly10, 81 phymodPrbsPoly20, 82 phymodPrbsPoly13, 83 phymodPrbsPolyQ13, 84 phymodPrbsPolyCount 85 } phymod_prbs_poly_t; 86 87 #ifdef PHYMOD_DIAG 88 extern enum_mapping_t phymod_prbs_poly_t_mapping[]; 89 #endif /*PHYMOD_DIAGNOSTICS_DIAG*/ 90 91 /* phymod_prbs_poly_t validation */ 92 int phymod_prbs_poly_t_validate(phymod_prbs_poly_t phymod_prbs_poly); 93 /*! 94 * @brief RX/TX selector. no flags means both 95 */ 96 #define PHYMOD_PRBS_DIRECTION_RX 0x1 /**< Config RX */ 97 #define PHYMOD_PRBS_DIRECTION_TX 0x2 /**< Config TX */ 98 99 #define PHYMOD_PRBS_DIRECTION_RX_SET(flags) (flags |= PHYMOD_PRBS_DIRECTION_RX) 100 #define PHYMOD_PRBS_DIRECTION_TX_SET(flags) (flags |= PHYMOD_PRBS_DIRECTION_TX) 101 102 #define PHYMOD_PRBS_DIRECTION_RX_CLR(flags) (flags &= ~PHYMOD_PRBS_DIRECTION_RX) 103 #define PHYMOD_PRBS_DIRECTION_TX_CLR(flags) (flags &= ~PHYMOD_PRBS_DIRECTION_TX) 104 105 #define PHYMOD_PRBS_DIRECTION_RX_GET(flags) (flags & PHYMOD_PRBS_DIRECTION_RX ? 1 : 0) 106 #define PHYMOD_PRBS_DIRECTION_TX_GET(flags) (flags & PHYMOD_PRBS_DIRECTION_TX ? 1 : 0) 107 108 109 /*! 110 * @struct phymod_prbs_s 111 * @brief PRBS control 112 */ 113 typedef struct phymod_prbs_s { 114 phymod_prbs_poly_t poly; 115 uint32_t invert; 116 } phymod_prbs_t; 117 118 /* phymod_prbs_t initialization and validation */ 119 int phymod_prbs_t_validate(const phymod_prbs_t* phymod_prbs); 120 int phymod_prbs_t_init(phymod_prbs_t* phymod_prbs); 121 122 /*! 123 * phymod_phy_prbs_config_set 124 * 125 * @brief set/get PRBS configuration 126 * 127 * @param [in] phy - phy access information 128 * @param [in] flags - see PHYMOD_PRBS_DIRECTION_ 129 * @param [in] prbs - PRBS configuration to set 130 */ 131 int phymod_phy_prbs_config_set(const phymod_phy_access_t* phy, uint32_t flags , const phymod_prbs_t* prbs); 132 /*! 133 * phymod_phy_prbs_config_get 134 * 135 * @brief set/get PRBS configuration 136 * 137 * @param [in] phy - phy access information 138 * @param [in] flags - see PHYMOD_PRBS_DIRECTION_ 139 * @param [out] prbs - PRBS configuration 140 */ 141 int phymod_phy_prbs_config_get(const phymod_phy_access_t* phy, uint32_t flags , phymod_prbs_t* prbs); 142 143 /*! 144 * phymod_phy_prbs_enable_set 145 * 146 * @brief Set/get PRBS enable state 147 * 148 * @param [in] phy - phy access information 149 * @param [in] flags - see PHYMOD_PRBS_DIRECTION_ 150 * @param [in] enable - Enable \ disable PRBS 151 */ 152 int phymod_phy_prbs_enable_set(const phymod_phy_access_t* phy, uint32_t flags , uint32_t enable); 153 /*! 154 * phymod_phy_prbs_enable_get 155 * 156 * @brief Set/get PRBS enable state 157 * 158 * @param [in] phy - phy access information 159 * @param [in] flags - see PHYMOD_PRBS_DIRECTION_ 160 * @param [out] enable - PRBS state 161 */ 162 int phymod_phy_prbs_enable_get(const phymod_phy_access_t* phy, uint32_t flags , uint32_t* enable); 163 164 165 /*! 166 * @struct phymod_prbs_status_s 167 * @brief PRBS control 168 */ 169 typedef struct phymod_prbs_status_s { 170 uint32_t prbs_lock; /**< Whether PRBS is currently locked */ 171 uint32_t prbs_lock_loss; /**< Whether PRBS was unlocked since last call */ 172 uint32_t error_count; /**< PRBS errors count */ 173 } phymod_prbs_status_t; 174 175 /* phymod_prbs_status_t initialization and validation */ 176 int phymod_prbs_status_t_validate(const phymod_prbs_status_t* phymod_prbs_status); 177 int phymod_prbs_status_t_init(phymod_prbs_status_t* phymod_prbs_status); 178 179 /*! 180 * @brief Flags for phymod_phy_prbs_status_get API 181 */ 182 #define PHYMOD_PRBS_STATUS_F_CLEAR_ON_READ 0x1 /**< Clear error counter on read */ 183 184 185 /*! 186 * phymod_phy_prbs_status_get 187 * 188 * @brief Get PRBS Status 189 * 190 * @param [in] phy - phy access information 191 * @param [in] flags - 192 * @param [out] prbs_status - PRBS status 193 */ 194 int phymod_phy_prbs_status_get(const phymod_phy_access_t* phy, uint32_t flags, phymod_prbs_status_t* prbs_status); 195 196 typedef struct phymod_pattern_s { 197 uint32_t pattern_len; 198 uint32_t* pattern; /**< Pattern to set */ 199 } phymod_pattern_t; 200 201 /* phymod_pattern_t initialization and validation */ 202 int phymod_pattern_t_validate(const phymod_pattern_t* phymod_pattern); 203 int phymod_pattern_t_init(phymod_pattern_t* phymod_pattern); 204 205 /*! 206 * phymod_phy_pattern_config_set 207 * 208 * @brief Set/get pattern state 209 * 210 * @param [in] phy - phy access information 211 * @param [in] pattern - Pattern Configuration 212 */ 213 int phymod_phy_pattern_config_set(const phymod_phy_access_t* phy, const phymod_pattern_t* pattern); 214 /*! 215 * phymod_phy_pattern_config_get 216 * 217 * @brief Set/get pattern state 218 * 219 * @param [in] phy - phy access information 220 * @param [inout] pattern - Pattern Configuration 221 */ 222 int phymod_phy_pattern_config_get(const phymod_phy_access_t* phy, phymod_pattern_t* pattern); 223 224 /*! 225 * phymod_phy_pattern_enable_set 226 * 227 * @brief Set/get pattern state 228 * 229 * @param [in] phy - phy access information 230 * @param [in] enable - Enable \ disable pattern send \ receive 231 * @param [in] pattern - Pattern Configuration 232 */ 233 int phymod_phy_pattern_enable_set(const phymod_phy_access_t* phy, uint32_t enable, const phymod_pattern_t* pattern); 234 /*! 235 * phymod_phy_pattern_enable_get 236 * 237 * @brief Set/get pattern state 238 * 239 * @param [in] phy - phy access information 240 * @param [out] enable - Pattern state 241 */ 242 int phymod_phy_pattern_enable_get(const phymod_phy_access_t* phy, uint32_t* enable); 243 244 typedef struct phymod_core_diagnostics_s { 245 uint32_t temperature; 246 uint32_t pll_range; 247 } phymod_core_diagnostics_t; 248 249 /* phymod_core_diagnostics_t initialization and validation */ 250 int phymod_core_diagnostics_t_validate(const phymod_core_diagnostics_t* phymod_core_diagnostics); 251 int phymod_core_diagnostics_t_init(phymod_core_diagnostics_t* phymod_core_diagnostics); 252 253 /*! 254 * phymod_core_diagnostics_get 255 * 256 * @brief Get core diagnostics information 257 * 258 * @param [in] core - core access information 259 * @param [out] diag - Core diagnostics information 260 */ 261 int phymod_core_diagnostics_get(const phymod_core_access_t* core, phymod_core_diagnostics_t* diag); 262 263 typedef struct phymod_diag_slicer_offset_s { 264 uint32_t offset_pe; 265 uint32_t offset_ze; 266 uint32_t offset_me; 267 uint32_t offset_po; 268 uint32_t offset_zo; 269 uint32_t offset_mo; 270 } phymod_diag_slicer_offset_t; 271 272 /* phymod_diag_slicer_offset_t initialization and validation */ 273 int phymod_diag_slicer_offset_t_validate(const phymod_diag_slicer_offset_t* phymod_diag_slicer_offset); 274 int phymod_diag_slicer_offset_t_init(phymod_diag_slicer_offset_t* phymod_diag_slicer_offset); 275 276 typedef struct phymod_diag_eyescan_s { 277 uint32_t heye_left; 278 uint32_t heye_right; 279 uint32_t veye_upper; 280 uint32_t veye_lower; 281 } phymod_diag_eyescan_t; 282 283 /* phymod_diag_eyescan_t initialization and validation */ 284 int phymod_diag_eyescan_t_validate(const phymod_diag_eyescan_t* phymod_diag_eyescan); 285 int phymod_diag_eyescan_t_init(phymod_diag_eyescan_t* phymod_diag_eyescan); 286 287 288 /*! 289 * @enum phymod_pmd_mode_e 290 * @brief pmd modes 291 */ 292 typedef enum phymod_pmd_mode_e { 293 phymodPmdModeOs = 0, 294 phymodPmdModeOsDfe, 295 phymodPmdModeBrDfe, 296 phymodPmdModeCount 297 } phymod_pmd_mode_t; 298 299 #ifdef PHYMOD_DIAG 300 extern enum_mapping_t phymod_pmd_mode_t_mapping[]; 301 #endif /*PHYMOD_DIAGNOSTICS_DIAG*/ 302 303 /* phymod_pmd_mode_t validation */ 304 int phymod_pmd_mode_t_validate(phymod_pmd_mode_t phymod_pmd_mode); 305 typedef struct phymod_phy_diagnostics_s { 306 uint32_t signal_detect; 307 uint32_t vga_bias_reduced; 308 uint32_t postc_metric; 309 phymod_osr_mode_t osr_mode; 310 phymod_pmd_mode_t pmd_mode; 311 uint32_t rx_lock; 312 uint32_t rx_ppm; 313 uint32_t tx_ppm; 314 uint32_t clk90_offset; 315 uint32_t clkp1_offset; 316 uint32_t p1_lvl; 317 uint32_t m1_lvl; 318 uint32_t dfe1_dcd; 319 uint32_t dfe2_dcd; 320 uint32_t slicer_target; 321 phymod_diag_slicer_offset_t slicer_offset; 322 phymod_diag_eyescan_t eyescan; 323 uint32_t state_machine_status; 324 uint32_t link_time; 325 int pf_main; 326 int pf_hiz; 327 int pf_bst; 328 int pf_low; 329 int pf2_ctrl; 330 int vga; 331 int dc_offset; 332 int p1_lvl_ctrl; 333 int dfe1; 334 int dfe2; 335 int dfe3; 336 int dfe4; 337 int dfe5; 338 int dfe6; 339 int txfir_pre; 340 int txfir_main; 341 int txfir_post1; 342 int txfir_post2; 343 int txfir_post3; 344 int tx_amp_ctrl; 345 uint8_t br_pd_en; 346 } phymod_phy_diagnostics_t; 347 348 /* phymod_phy_diagnostics_t initialization and validation */ 349 int phymod_phy_diagnostics_t_validate(const phymod_phy_diagnostics_t* phymod_phy_diagnostics); 350 int phymod_phy_diagnostics_t_init(phymod_phy_diagnostics_t* phymod_phy_diagnostics); 351 352 /*! 353 * phymod_phy_diagnostics_get 354 * 355 * @brief Get phy diagnostics information 356 * 357 * @param [in] phy - phy access information 358 * @param [out] diag - 359 */ 360 int phymod_phy_diagnostics_get(const phymod_phy_access_t* phy, phymod_phy_diagnostics_t* diag); 361 362 /*! 363 * phymod_phy_pmd_info_dump 364 * 365 * @brief Get phy diagnostics information 366 * 367 * @param [in] phy - phy access information 368 * @param [in] type - 369 */ 370 int phymod_phy_pmd_info_dump(const phymod_phy_access_t* phy, const char* type); 371 372 /*! 373 * phymod_phy_pcs_info_dump 374 * 375 * @brief Get phy diagnostics information 376 * 377 * @param [in] phy - phy access information 378 * @param [in] type - 379 */ 380 int phymod_phy_pcs_info_dump(const phymod_phy_access_t* phy, const char* type); 381 382 typedef struct phymod_phy_eyescan_options_s { 383 uint32_t linerate_in_khz; 384 uint16_t timeout_in_milliseconds; 385 int8_t horz_max; 386 int8_t horz_min; 387 int8_t hstep; 388 int8_t vert_max; 389 int8_t vert_min; 390 int8_t vstep; 391 uint8_t ber_proj_scan_mode; /**< For BER projection Controls the direction and polarity of the test. */ 392 uint8_t ber_proj_timer_cnt; /**< BER proj total measurement time in units of ~1.3 seconds. */ 393 uint8_t ber_proj_err_cnt; /**< BER proj the error threshold it uses to step to next measurement in units of 16. */ 394 int8_t mode; 395 } phymod_phy_eyescan_options_t; 396 397 /* phymod_phy_eyescan_options_t initialization and validation */ 398 int phymod_phy_eyescan_options_t_validate(const phymod_phy_eyescan_options_t* phymod_phy_eyescan_options); 399 int phymod_phy_eyescan_options_t_init(phymod_phy_eyescan_options_t* phymod_phy_eyescan_options); 400 401 402 /*! 403 * @enum phymod_eyescan_mode_e 404 * @brief Eyescan modes 405 */ 406 typedef enum phymod_eyescan_mode_e { 407 phymodEyescanModeFast = 0, /**< Fast eyescan resoultion. */ 408 phymodEyescanModeLowBER, /**< Allow more aquirate BER resolution. */ 409 phymodEyescanModeBERProj, /**< Do BER projection. */ 410 phymodEyescanModeCount 411 } phymod_eyescan_mode_t; 412 413 #ifdef PHYMOD_DIAG 414 extern enum_mapping_t phymod_eyescan_mode_t_mapping[]; 415 #endif /*PHYMOD_DIAGNOSTICS_DIAG*/ 416 417 /* phymod_eyescan_mode_t validation */ 418 int phymod_eyescan_mode_t_validate(phymod_eyescan_mode_t phymod_eyescan_mode); 419 /*! 420 * @brief Eyescan flags 421 */ 422 #define PHYMOD_EYESCAN_F_ENABLE 0x1 /**< Enable eyescan */ 423 #define PHYMOD_EYESCAN_F_PROCESS 0x2 /**< Process eyescan */ 424 #define PHYMOD_EYESCAN_F_DONE 0x4 /**< Eyescan done */ 425 #define PHYMOD_EYESCAN_F_ENABLE_DONT_WAIT 0x8 /**< Don't wait to finish enable operation */ 426 427 #define PHYMOD_EYESCAN_F_ENABLE_SET(flags) ((flags) |= PHYMOD_EYESCAN_F_ENABLE) 428 #define PHYMOD_EYESCAN_F_PROCESS_SET(flags) ((flags) |= PHYMOD_EYESCAN_F_PROCESS) 429 #define PHYMOD_EYESCAN_F_DONE_SET(flags) ((flags) |= PHYMOD_EYESCAN_F_DONE) 430 #define PHYMOD_EYESCAN_F_ENABLE_DONT_WAIT_SET(flags) ((flags) |= PHYMOD_EYESCAN_F_ENABLE_DONT_WAIT) 431 432 #define PHYMOD_EYESCAN_F_ENABLE_CLR(flags) ((flags) &= ~PHYMOD_EYESCAN_F_ENABLE) 433 #define PHYMOD_EYESCAN_F_PROCESS_CLR(flags) ((flags) &= ~PHYMOD_EYESCAN_F_PROCESS) 434 #define PHYMOD_EYESCAN_F_DONE_CLR(flags) ((flags) &= ~PHYMOD_EYESCAN_F_DONE) 435 #define PHYMOD_EYESCAN_F_ENABLE_DONT_WAIT_CLR(flags) ((flags) &= ~PHYMOD_EYESCAN_F_ENABLE_DONT_WAIT) 436 437 #define PHYMOD_EYESCAN_F_ENABLE_GET(flags) ((flags) & PHYMOD_EYESCAN_F_ENABLE ? 1 : 0) 438 #define PHYMOD_EYESCAN_F_PROCESS_GET(flags) ((flags) & PHYMOD_EYESCAN_F_PROCESS ? 1 : 0) 439 #define PHYMOD_EYESCAN_F_DONE_GET(flags) ((flags) & PHYMOD_EYESCAN_F_DONE ? 1 : 0) 440 #define PHYMOD_EYESCAN_F_ENABLE_DONT_WAIT_GET(flags) ((flags) & PHYMOD_EYESCAN_F_ENABLE_DONT_WAIT ? 1 : 0) 441 442 /*! 443 * phymod_phy_eyescan_run 444 * 445 * @brief Display eyescan information 446 * 447 * @param [in] phy - phy access information 448 * @param [in] flags - 449 * @param [in] mode - Select eyescan mode 450 * @param [in] eyescan_options - Eyescan options. Set to NULL for eyescan types without options, or to use defaults. 451 */ 452 int phymod_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); 453 454 455 /*! 456 * @enum phymod_link_monitor_mode_e 457 * @brief Link monitor modes 458 */ 459 typedef enum phymod_link_monitor_mode_e { 460 phymodLinkMonPCS49_1x10G = 0, 461 phymodLinkMonPCS82_4x10G, 462 phymodLinkMonPCS82_2x25G, 463 phymodLinkMonPCS82_4x25G, 464 phymodLinkMonFC4, 465 phymodLinkMonFC8, 466 phymodLinkMonFC16, 467 phymodLinkMonFC32, 468 phymodLinkMonCount 469 } phymod_link_monitor_mode_t; 470 471 #ifdef PHYMOD_DIAG 472 extern enum_mapping_t phymod_link_monitor_mode_t_mapping[]; 473 #endif /*PHYMOD_DIAGNOSTICS_DIAG*/ 474 475 /* phymod_link_monitor_mode_t validation */ 476 int phymod_link_monitor_mode_t_validate(phymod_link_monitor_mode_t phymod_link_monitor_mode); 477 478 /*! 479 * @enum phymod_diag_type_e 480 * @brief diag types 481 */ 482 typedef enum phymod_diag_type_e { 483 phymod_diag_GENERAL = 0x00000001, /**< General device wide information. */ 484 phymod_diag_TOPOLOGY = 0x00000002, /**< General device wide information. */ 485 phymod_diag_LINK = 0x00000004, /**< General device wide information. */ 486 phymod_diag_SPEED = 0x00000008, /**< General device wide information. */ 487 phymod_diag_ANEG = 0x00000010, /**< General device wide information. */ 488 phymod_diag_TFC = 0x00000020, /**< General device wide information. */ 489 phymod_diag_AN_TIMERS = 0x00000040, /**< General device wide information. */ 490 phymod_diag_STATE = 0x00000080, /**< General device wide information. */ 491 phymod_diag_DEBUG = 0x00000100, /**< General device wide information. */ 492 phymod_diag_IEEE = 0x00000200, /**< General device wide information. */ 493 phymod_diag_EEE = 0x00000400, /**< General device wide information. */ 494 phymod_diag_BER = 0x00000800, /**< General device wide information. */ 495 phymod_diag_CFG = 0x00001000, /**< General device wide information. */ 496 phymod_diag_CL72 = 0x00002000, /**< General device wide information. */ 497 phymod_diag_DSC = 0x00004000, /**< General device wide information. */ 498 phymod_diag_DSC_STD = 0x00008000, /**< General device wide information. */ 499 phymod_diag_ALL = 0x00010000, /**< General device wide information. */ 500 phymod_diag_Count 501 } phymod_diag_type_t; 502 503 #ifdef PHYMOD_DIAG 504 extern enum_mapping_t phymod_diag_type_t_mapping[]; 505 #endif /*PHYMOD_DIAGNOSTICS_DIAG*/ 506 507 /* phymod_diag_type_t validation */ 508 int phymod_diag_type_t_validate(phymod_diag_type_t phymod_diag_type); 509 /*! 510 * phymod_phy_link_mon_enable_set 511 * 512 * @brief Get/Set link monitor enable/disable 513 * 514 * @param [in] phy - phy access information 515 * @param [in] link_mon_mode - 516 * @param [in] enable - 517 */ 518 int phymod_phy_link_mon_enable_set(const phymod_phy_access_t* phy, phymod_link_monitor_mode_t link_mon_mode, uint32_t enable); 519 /*! 520 * phymod_phy_link_mon_enable_get 521 * 522 * @brief Get/Set link monitor enable/disable 523 * 524 * @param [in] phy - phy access information 525 * @param [in] link_mon_mode - 526 * @param [out] enable - 527 */ 528 int phymod_phy_link_mon_enable_get(const phymod_phy_access_t* phy, phymod_link_monitor_mode_t link_mon_mode, uint32_t* enable); 529 530 /*! 531 * phymod_phy_link_mon_status_get 532 * 533 * @brief Get link monitor Status 534 * 535 * @param [in] phy - phy access information 536 * @param [out] lock_status - link mon status 537 * @param [out] lock_lost_lh - Whether link mon was unlocked since last call 538 * @param [out] error_count - link mon error count 539 */ 540 int phymod_phy_link_mon_status_get(const phymod_phy_access_t* phy, uint32_t* lock_status, uint32_t* lock_lost_lh, uint32_t* error_count); 541 542 /*! 543 * phymod_phy_fec_correctable_counter_get 544 * 545 * @brief Get CL74 FEC Corrected Codeword Counter 546 * 547 * @param [in] phy - phy access information 548 * @param [out] count - CL74 FEC corrected codeword counter 549 */ 550 int phymod_phy_fec_correctable_counter_get(const phymod_phy_access_t* phy, uint32_t* count); 551 552 /*! 553 * phymod_phy_fec_uncorrectable_counter_get 554 * 555 * @brief Get CL74 FEC Uncorrected Codeword Counter 556 * 557 * @param [in] phy - phy access information 558 * @param [out] count - CL74 FEC uncorrected codeword counter 559 */ 560 int phymod_phy_fec_uncorrectable_counter_get(const phymod_phy_access_t* phy, uint32_t* count); 561 562 typedef struct phymod_phy_stat_s { 563 uint32_t pcs_bip_err_count[PHYMOD_MAX_LANES_PER_CORE]; /**< BIP error count per lane */ 564 uint32_t pcs_ber_count[PHYMOD_MAX_LANES_PER_CORE]; /**< BER count per lane */ 565 } phymod_phy_stat_t; 566 567 /* phymod_phy_stat_t initialization and validation */ 568 int phymod_phy_stat_t_validate(const phymod_phy_stat_t* phymod_phy_stat); 569 int phymod_phy_stat_t_init(phymod_phy_stat_t* phymod_phy_stat); 570 571 /*! 572 * phymod_phy_stat_get 573 * 574 * @brief Get PHY Stat Counter 575 * 576 * @param [in] phy - phy access information 577 * @param [out] stat - PHY stat, such as BIP error count, BER count and so on 578 */ 579 int phymod_phy_stat_get(const phymod_phy_access_t* phy, phymod_phy_stat_t* stat); 580 581 /*! 582 * phymod_phy_fec_cl91_correctable_counter_get 583 * 584 * @brief Get CL91 FEC Corrected Codeword Counter 585 * 586 * @param [in] phy - phy access information 587 * @param [out] count - CL91 FEC corrected codeword counter 588 */ 589 int phymod_phy_fec_cl91_correctable_counter_get(const phymod_phy_access_t* phy, uint32_t* count); 590 591 /*! 592 * phymod_phy_fec_cl91_uncorrectable_counter_get 593 * 594 * @brief Get CL91 FEC Uncorrected Codeword Counter 595 * 596 * @param [in] phy - phy access information 597 * @param [out] count - CL91 FEC uncorrected codeword counter 598 */ 599 int phymod_phy_fec_cl91_uncorrectable_counter_get(const phymod_phy_access_t* phy, uint32_t* count); 600 601 602 /*! 603 * @enum phymod_PAM4_tx_pattern_e 604 * @brief PAM4 tx pattern 605 */ 606 typedef enum phymod_PAM4_tx_pattern_e { 607 phymod_PAM4TxPattern_JP03B = 1, /**< JP03B tx pattern enable */ 608 phymod_PAM4TxPattern_Linear, /**< PAM4 linear tx pattern */ 609 phymod_Count 610 } phymod_PAM4_tx_pattern_t; 611 612 #ifdef PHYMOD_DIAG 613 extern enum_mapping_t phymod_PAM4_tx_pattern_t_mapping[]; 614 #endif /*PHYMOD_DIAGNOSTICS_DIAG*/ 615 616 /* phymod_PAM4_tx_pattern_t validation */ 617 int phymod_PAM4_tx_pattern_t_validate(phymod_PAM4_tx_pattern_t phymod_PAM4_tx_pattern); 618 /*! 619 * phymod_phy_PAM4_tx_pattern_enable_set 620 * 621 * @brief PAM4 tx pattern set/get 622 * 623 * @param [in] phy - phy access information 624 * @param [in] pattern_type - 625 * @param [in] enable - enable 626 */ 627 int phymod_phy_PAM4_tx_pattern_enable_set(const phymod_phy_access_t* phy, phymod_PAM4_tx_pattern_t pattern_type, uint32_t enable); 628 /*! 629 * phymod_phy_PAM4_tx_pattern_enable_get 630 * 631 * @brief PAM4 tx pattern set/get 632 * 633 * @param [in] phy - phy access information 634 * @param [in] pattern_type - 635 * @param [out] enable - enable 636 */ 637 int phymod_phy_PAM4_tx_pattern_enable_get(const phymod_phy_access_t* phy, phymod_PAM4_tx_pattern_t pattern_type, uint32_t* enable); 638 639 /*! 640 * @brief Flags for phymod_phy_ber_proj API 641 */ 642 #define PHYMOD_BER_PROJ_PHASE_F_PRE 0x1 /**< Pre-config stage, only required when using optimized errcnt threshold. */ 643 #define PHYMOD_BER_PROJ_PHASE_F_CONFIG 0x2 /**< Config PRBS analyzer */ 644 #define PHYMOD_BER_PROJ_PHASE_F_START 0x4 /**< Start error accumulation */ 645 #define PHYMOD_BER_PROJ_PHASE_F_COLLECT 0x8 /**< Collect PRBS error count */ 646 #define PHYMOD_BER_PROJ_PHASE_F_CAL 0x10 /**< Calculate BER */ 647 648 649 typedef struct phymod_phy_ber_proj_errcnt_s { 650 uint32_t prbs_errcnt[9]; /**< Array which stores prbs error count. */ 651 } phymod_phy_ber_proj_errcnt_t; 652 653 /* phymod_phy_ber_proj_errcnt_t initialization and validation */ 654 int phymod_phy_ber_proj_errcnt_t_validate(const phymod_phy_ber_proj_errcnt_t* phymod_phy_ber_proj_errcnt); 655 int phymod_phy_ber_proj_errcnt_t_init(phymod_phy_ber_proj_errcnt_t* phymod_phy_ber_proj_errcnt); 656 657 typedef struct phymod_phy_ber_proj_options_s { 658 uint32_t ber_proj_phase; /**< Stage flag for BER projection. */ 659 uint16_t ber_proj_fec_size; /**< FEC frame size in bits. */ 660 uint8_t ber_proj_hist_errcnt_thresh; /**< Histogram error threshold. */ 661 uint32_t ber_proj_timeout_s; /**< Measurement time that PRBS errors are accumulated */ 662 phymod_phy_ber_proj_errcnt_t* ber_proj_prbs_errcnt; /**< Arrays which stores prbs error count. */ 663 } phymod_phy_ber_proj_options_t; 664 665 /* phymod_phy_ber_proj_options_t initialization and validation */ 666 int phymod_phy_ber_proj_options_t_validate(const phymod_phy_ber_proj_options_t* phymod_phy_ber_proj_options); 667 int phymod_phy_ber_proj_options_t_init(phymod_phy_ber_proj_options_t* phymod_phy_ber_proj_options); 668 669 670 /*! 671 * @enum phymod_ber_proj_mode_e 672 * @brief BER projection mode 673 */ 674 typedef enum phymod_ber_proj_mode_e { 675 phymodBERProjModePostFEC = 1, /**< Post-fec error projection using PRBS analyzer */ 676 phymodBERProjModeCount 677 } phymod_ber_proj_mode_t; 678 679 #ifdef PHYMOD_DIAG 680 extern enum_mapping_t phymod_ber_proj_mode_t_mapping[]; 681 #endif /*PHYMOD_DIAGNOSTICS_DIAG*/ 682 683 /* phymod_ber_proj_mode_t validation */ 684 int phymod_ber_proj_mode_t_validate(phymod_ber_proj_mode_t phymod_ber_proj_mode); 685 /*! 686 * phymod_phy_ber_proj 687 * 688 * @brief BER Projection 689 * 690 * @param [in] phy - phy access information 691 * @param [in] mode - BER projection mode 692 * @param [in] options - BER projection options 693 */ 694 int phymod_phy_ber_proj(const phymod_phy_access_t* phy, phymod_ber_proj_mode_t mode, const phymod_phy_ber_proj_options_t* options); 695 696 /*! 697 * phymod_phy_fast_ber_proj_get 698 * 699 * @brief fast BER Projection 700 * 701 * @param [in] phy - phy access information 702 * @param [out] ber_proj_data - ber_proj_data 703 */ 704 int phymod_phy_fast_ber_proj_get(const phymod_phy_access_t* phy, uint32_t* ber_proj_data); 705 706 /*! 707 * phymod_phy_rsfec_symbol_error_counter_get 708 * 709 * @brief Get RS FEC symbol error count. 710 * 711 * @param [in] phy - phy access information 712 * @param [in] max_count - Size of the error_count array. 713 * @param [out] actual_count - Actual number of entries returned in the error_count array. 714 * @param [out] error_count - Per-lane based RS FEC symbol error count array. 715 */ 716 int phymod_phy_rsfec_symbol_error_counter_get(const phymod_phy_access_t* phy, int max_count, int* actual_count, uint32_t* error_count); 717 718 #endif /*_PHYMOD_DIAGNOSTICS_H_*/