merlin16_pcieg3_prbs.h (9950B)
1 /*********************************************************************************** 2 *********************************************************************************** 3 * * 4 * Revision : * 5 * * 6 * Description : Interface functions targeted to IP user * 7 * * 8 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 9 * 10 * Copyright 2007-2019 Broadcom Inc. All rights reserved. * 11 * No portions of this material may be reproduced in any form without * 12 * the written permission of: * 13 * Broadcom Corporation * 14 * 5300 California Avenue * 15 * Irvine, CA 92617 * 16 * * 17 * All information contained in this document is Broadcom Corporation * 18 * company private proprietary, and trade secret. * 19 */ 20 21 /** @file merlin16_pcieg3_prbs.h 22 * PRBS test functions provided to IP User 23 */ 24 25 #ifndef MERLIN16_PCIEG3_API_PRBS_H 26 #define MERLIN16_PCIEG3_API_PRBS_H 27 28 #include "merlin16_pcieg3_ipconfig.h" 29 #include "common/srds_api_enum.h" 30 #include "common/srds_api_err_code.h" 31 #include "common/srds_api_types.h" 32 #include "merlin16_pcieg3_usr_includes.h" 33 34 #define PRBS_VERBOSE 0 35 36 /*------------------------------*/ 37 /* Shared TX Pattern Generator */ 38 /*------------------------------*/ 39 /** Configure Shared TX Pattern API. 40 * An input string (hex or binary) and pattern length are taken in as inputs, based on which the Pattern Generator registers 41 * are programmed to the appropriate values to generate that pattern.\n 42 * eg: For a repeating pattern "0000010110101111", input_pattern = "0000010110101111" or "0x05AF" and patt_length = 16\n\n 43 * NOTE: merlin16_pcieg3_tx_shared_patt_gen_en() API should be called to enable the Pattern generator for that particular lane. \n 44 * @param sa__ is an opaque state vector passed through to device access functions. 45 * @param patt_length Pattern length 46 * @param pattern Input Pattern - Can be in hex (eg: "0xB055") or in binary (eg: "011011") 47 * @return Error Code generated by invalid input pattern or pattern length (returns ERR_CODE_NONE if no errors) 48 */ 49 err_code_t merlin16_pcieg3_config_shared_tx_pattern(srds_access_t *sa__, uint8_t patt_length, const char pattern[]); 50 51 /**************************************************/ 52 /* LANE Based APIs - Required to be used per Lane */ 53 /**************************************************/ 54 55 /*----------------------------*/ 56 /* Enable Pattern Generator */ 57 /*----------------------------*/ 58 /** Enable/Disable Shared TX pattern generator. 59 * Note: The patt_length input to the function should be the value sent to the merlin16_pcieg3_config_shared_tx_pattern() function 60 * @param sa__ is an opaque state vector passed through to device access functions. 61 * @param enable Enable shared fixed pattern generator (1 = Enable; 0 = Disable) 62 * @param patt_length length of the pattern used in merlin16_pcieg3_config_shared_tx_pattern() 63 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 64 */ 65 err_code_t merlin16_pcieg3_tx_shared_patt_gen_en(srds_access_t *sa__, uint8_t enable, uint8_t patt_length); 66 67 /*----------------------------*/ 68 /* Configure PRBS Functions */ 69 /*----------------------------*/ 70 /** Configure PRBS Generator. 71 * Once the PRBS generator is configured, to enable PRBS use the merlin16_pcieg3_tx_prbs_en() API. 72 * @param sa__ is an opaque state vector passed through to device access functions. 73 * @param prbs_poly_mode PRBS generator mode select (selects required PRBS polynomial) 74 * @param prbs_inv PRBS invert enable 75 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 76 */ 77 err_code_t merlin16_pcieg3_config_tx_prbs(srds_access_t *sa__, enum srds_prbs_polynomial_enum prbs_poly_mode, uint8_t prbs_inv); 78 79 /** Get PRBS Generator Configuration. 80 * @param sa__ is an opaque state vector passed through to device access functions. 81 * @param *prbs_poly_mode PRBS generator mode select (selects required PRBS polynomial) 82 * @param *prbs_inv PRBS invert enable 83 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 84 */ 85 err_code_t merlin16_pcieg3_get_tx_prbs_config(srds_access_t *sa__, enum srds_prbs_polynomial_enum *prbs_poly_mode, uint8_t *prbs_inv); 86 87 /** PRBS Generator Enable/Disable. 88 * @param sa__ is an opaque state vector passed through to device access functions. 89 * @param enable Enable PRBS Generator (1 = Enable; 0 = Disable) 90 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 91 */ 92 err_code_t merlin16_pcieg3_tx_prbs_en(srds_access_t *sa__, uint8_t enable); 93 94 /** Get PRBS Generator Enable/Disable. 95 * @param sa__ is an opaque state vector passed through to device access functions. 96 * @param *enable returns the value of Enable PRBS Generator (1 = Enable; 0 = Disable) 97 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 98 */ 99 err_code_t merlin16_pcieg3_get_tx_prbs_en(srds_access_t *sa__, uint8_t *enable); 100 101 /** PRBS Generator Single Bit Error Injection. 102 * @param sa__ is an opaque state vector passed through to device access functions. 103 * @param enable (1 = error is injected; 0 = no error is injected) 104 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 105 */ 106 err_code_t merlin16_pcieg3_tx_prbs_err_inject(srds_access_t *sa__, uint8_t enable); 107 108 /** Configure PRBS Checker. 109 * Once the PRBS checker is configured, use the merlin16_pcieg3_rx_prbs_en() API to enable the checker. 110 * @param sa__ is an opaque state vector passed through to device access functions. 111 * @param prbs_poly_mode PRBS checker mode select (selects required PRBS polynomial) 112 * @param prbs_checker_mode Checker Mode to select PRBS LOCK state machine 113 * @param prbs_inv PRBS invert enable 114 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 115 */ 116 err_code_t merlin16_pcieg3_config_rx_prbs(srds_access_t *sa__, enum srds_prbs_polynomial_enum prbs_poly_mode, enum srds_prbs_checker_mode_enum prbs_checker_mode, uint8_t prbs_inv); 117 118 /** Get PRBS Checker congifuration. 119 * @param sa__ is an opaque state vector passed through to device access functions. 120 * @param *prbs_poly_mode PRBS checker mode select (selects required PRBS polynomial) 121 * @param *prbs_checker_mode Checker Mode to select PRBS LOCK state machine 122 * @param *prbs_inv PRBS invert enable 123 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 124 */ 125 err_code_t merlin16_pcieg3_get_rx_prbs_config(srds_access_t *sa__, enum srds_prbs_polynomial_enum *prbs_poly_mode, enum srds_prbs_checker_mode_enum *prbs_checker_mode, uint8_t *prbs_inv); 126 127 /** PRBS Checker Enable/Disable. 128 * @param sa__ is an opaque state vector passed through to device access functions. 129 * @param enable Enable PRBS Checker (1 = Enable; 0 = Disable) 130 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 131 */ 132 err_code_t merlin16_pcieg3_rx_prbs_en(srds_access_t *sa__, uint8_t enable); 133 134 /** Get PRBS Checker Enable/Disable. 135 * @param sa__ is an opaque state vector passed through to device access functions. 136 * @param *enable returns with the value of Enable PRBS Checker (1 = Enable; 0 = Disable) 137 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 138 */ 139 err_code_t merlin16_pcieg3_get_rx_prbs_en(srds_access_t *sa__, uint8_t *enable); 140 141 /** PRBS Checker LOCK status (live status). 142 * @param sa__ is an opaque state vector passed through to device access functions. 143 * @param *chk_lock Live lock status read by API 144 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 145 */ 146 err_code_t merlin16_pcieg3_prbs_chk_lock_state(srds_access_t *sa__, uint8_t *chk_lock); 147 148 /** PRBS Error Count and Lock Lost status. 149 * Error count and lock lost read back as a single 32bit value. Bit 31 is lock lost and [30:0] is error count. 150 * @param sa__ is an opaque state vector passed through to device access functions. 151 * @param *prbs_err_cnt 32bit value returned by API ([30:0] = Error Count; [31] = Lock lost) 152 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 153 */ 154 err_code_t merlin16_pcieg3_prbs_err_count_ll(srds_access_t *sa__, uint32_t *prbs_err_cnt); 155 156 /** PRBS Error Count and Lock Lost status. 157 * Error count and lock lost read back on separate variables 158 * @param sa__ is an opaque state vector passed through to device access functions. 159 * @param *prbs_err_cnt 32bit Error count value 160 * @param *lock_lost Lock Lost status (1 = if lock was ever lost) 161 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 162 */ 163 err_code_t merlin16_pcieg3_prbs_err_count_state(srds_access_t *sa__, uint32_t *prbs_err_cnt, uint8_t *lock_lost); 164 165 /** Header display for detailed PRBS display function 166 * This can be displayed once and then several cores and lanes after each showing one line 167 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 168 */ 169 err_code_t merlin16_pcieg3_display_detailed_prbs_state_hdr(void); 170 171 /** Display detailed PRBS data per lane including Burst Error 172 * 173 * @param sa__ is an opaque state vector passed through to device access functions. 174 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 175 */ 176 err_code_t merlin16_pcieg3_display_detailed_prbs_state(srds_access_t *sa__); 177 178 extern const char* merlin16_pcieg3_e2s_prbs_mode_enum[8]; 179 180 181 #endif