merlin16_debug_functions.h (14045B)
1 /***************************************************************************************** 2 ***************************************************************************************** 3 * * 4 * Revision : * 5 * * 6 * Description : Functions used internally and available in debug shell only * 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_debug_functions.h 22 * Functions used internally and available in debug shell only 23 */ 24 25 #ifndef MERLIN16_DEBUG_FUNCTIONS_H 26 #define MERLIN16_DEBUG_FUNCTIONS_H 27 28 #include "merlin16_ipconfig.h" 29 #include "common/srds_api_enum.h" 30 #include "common/srds_api_err_code.h" 31 #include "common/srds_api_uc_common.h" 32 #include "merlin16_dependencies.h" 33 #include "merlin16_types.h" 34 #include "merlin16_usr_includes.h" 35 36 /** Isolate Control pins. 37 * Can be used for debug to avoid any interference from inputs coming through pins. 38 * @param sa__ is an opaque state vector passed through to device access functions. 39 * @param enable Isolate pins enable (1 = Isolate pins; 0 = Pins not isolated) 40 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 41 */ 42 err_code_t merlin16_isolate_ctrl_pins(srds_access_t *sa__, uint8_t enable); 43 44 /** Isolate Lane Control pins. 45 * Can be used for debug to avoid any interference from inputs coming through pins. 46 * @param sa__ is an opaque state vector passed through to device access functions. 47 * @param enable Isolate pins enable (1 = Isolate pins; 0 = Pins not isolated) 48 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 49 */ 50 err_code_t merlin16_isolate_lane_ctrl_pins(srds_access_t *sa__, uint8_t enable); 51 52 /** Isolate Core Control pins. 53 * Can be used for debug to avoid any interference from inputs coming through pins. 54 * @param sa__ is an opaque state vector passed through to device access functions. 55 * @param enable Isolate pins enable (1 = Isolate pins; 0 = Pins not isolated) 56 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 57 */ 58 err_code_t merlin16_isolate_core_ctrl_pins(srds_access_t *sa__, uint8_t enable); 59 60 /*-----------------------*/ 61 /* Stop/Resume uC Lane */ 62 /*-----------------------*/ 63 /** Stop/Resume Micro operations on a Lane (Graceful Stop). 64 * @param sa__ is an opaque state vector passed through to device access functions. 65 * @param enable Enable micro lane stop (1 = Stop Micro opetarions on lane; 0 = Resume Micro operations on lane) 66 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 67 */ 68 err_code_t merlin16_stop_uc_lane(srds_access_t *sa__, uint8_t enable); 69 70 /** Status of whether Micro is stopped on a lane. 71 * @param sa__ is an opaque state vector passed through to device access functions. 72 * @param *uc_lane_stopped Micro lane stopped status returned by API 73 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 74 */ 75 err_code_t merlin16_stop_uc_lane_status(srds_access_t *sa__, uint8_t *uc_lane_stopped); 76 77 /** Write to lane user control disable startup function uC RAM variable. 78 * Note: This function should be used only during configuration under dp_reset. 79 * @param sa__ is an opaque state vector passed through to device access functions. 80 * @param set_val Value to be written into lane user control disable startup function RAM variable 81 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 82 */ 83 err_code_t merlin16_set_usr_ctrl_disable_startup(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_functions_st set_val); 84 85 /** Write to lane user control disable startup dfe function uC RAM variable. 86 * Note: This function should be used only during configuration under dp_reset. 87 * @param sa__ is an opaque state vector passed through to device access functions. 88 * @param set_val Value to be written into lane user control disable startup dfe function RAM variable 89 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 90 */ 91 err_code_t merlin16_set_usr_ctrl_disable_startup_dfe(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_dfe_functions_st set_val); 92 93 /** Write to lane user control disable steady-state function uC RAM variable. 94 * Note: This function should be used only during configuration under dp_reset. 95 * @param sa__ is an opaque state vector passed through to device access functions. 96 * @param set_val Value to be written into lane user control disable steady-state function RAM variable 97 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 98 */ 99 err_code_t merlin16_set_usr_ctrl_disable_steady_state(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_functions_st set_val); 100 101 /** Write to lane user control disable steady-state dfe function uC RAM variable. 102 * Note: This function should be used only during configuration under dp_reset. 103 * @param sa__ is an opaque state vector passed through to device access functions. 104 * @param set_val Value to be written into lane user control disable steady-state dfe function RAM variable 105 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 106 */ 107 err_code_t merlin16_set_usr_ctrl_disable_steady_state_dfe(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_dfe_functions_st set_val); 108 109 /** Read value of lane user control disable startup uC RAM variable. 110 * @param sa__ is an opaque state vector passed through to device access functions. 111 * @param *get_val Value read from lane user control disable startup RAM variable 112 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 113 */ 114 err_code_t merlin16_get_usr_ctrl_disable_startup(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_functions_st *get_val); 115 116 /** Read value of lane user control disable startup dfe uC RAM variable. 117 * @param sa__ is an opaque state vector passed through to device access functions. 118 * @param *get_val Value read from lane user control disable startup dfe RAM variable 119 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 120 */ 121 err_code_t merlin16_get_usr_ctrl_disable_startup_dfe(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_dfe_functions_st *get_val); 122 123 /** Read value of lane user control disable steady-state uC RAM variable. 124 * @param sa__ is an opaque state vector passed through to device access functions. 125 * @param *get_val Value read from lane user control disable steady-state RAM variable 126 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 127 */ 128 err_code_t merlin16_get_usr_ctrl_disable_steady_state(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_functions_st *get_val); 129 130 /** Read value of lane user control disable steady-state dfe uC RAM variable. 131 * @param sa__ is an opaque state vector passed through to device access functions. 132 * @param *get_val Value read from lane user control disable steady-state dfe RAM variable 133 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 134 */ 135 err_code_t merlin16_get_usr_ctrl_disable_steady_state_dfe(srds_access_t *sa__, struct merlin16_usr_ctrl_disable_dfe_functions_st *get_val); 136 137 /*-------------------------------------------*/ 138 /* Registers and Core uC RAM Variable Dump */ 139 /*-------------------------------------------*/ 140 /** Display values of both Core level and (currently selected) Lane level Registers. 141 * @param sa__ is an opaque state vector passed through to device access functions. 142 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 143 */ 144 err_code_t merlin16_reg_dump(srds_access_t *sa__); 145 146 /** Display values of all Core uC RAM Variables (Core RAM Variable Dump). 147 * @param sa__ is an opaque state vector passed through to device access functions. 148 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 149 */ 150 err_code_t merlin16_uc_core_var_dump(srds_access_t *sa__); 151 152 153 /*-----------------------------*/ 154 /* uC RAM Lane Variable Dump */ 155 /*-----------------------------*/ 156 /** Display values of all Lane uC RAM Variables (Lane RAM Variable Dump). 157 * @param sa__ is an opaque state vector passed through to device access functions. 158 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 159 */ 160 err_code_t merlin16_uc_lane_var_dump(srds_access_t *sa__); 161 162 163 /*--------------------------*/ 164 /* TX_PI Jitter Generation */ 165 /*--------------------------*/ 166 167 /** Generate TX_PI Sinusoidal or Spread-Spectrum (SSC) jitter. 168 * @param sa__ is an opaque state vector passed through to device access functions. 169 * @param enable Enable/Disable jitter generation (1 = Enable; 0 = Disable) 170 * @param freq_override_val Fixed Frequency Override value (-8192 to + 8192) 171 * @param jit_type Jitter generation mode 172 * @param tx_pi_jit_freq_idx Jitter generation frequency index (0 to 63) [see spec for more details] 173 * @param tx_pi_jit_amp Jitter generation amplification factor (0 to 63) [max value of this register depends on tx_pi_jit_freq_idx and freq_override values] 174 * @return Error Code generated by invalid TX_PI settings (returns ERR_CODE_NONE if no errors) 175 */ 176 err_code_t merlin16_tx_pi_jitt_gen(srds_access_t *sa__, uint8_t enable, int16_t freq_override_val, enum srds_tx_pi_freq_jit_gen_enum jit_type, uint8_t tx_pi_jit_freq_idx, uint8_t tx_pi_jit_amp); 177 178 179 /*-------------*/ 180 /* Event Log */ 181 /*-------------*/ 182 /** Get Event Log from uC. 183 * Dump uC events from core memory. 184 * @param sa__ is an opaque state vector passed through to device access functions. 185 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 186 */ 187 err_code_t merlin16_read_event_log(srds_access_t *sa__); 188 189 /** Write to usr_ctrl_lane_event_log_level uC RAM variable. 190 * Note: This function should be used only during configuration under dp_reset. 191 * @param sa__ is an opaque state vector passed through to device access functions. 192 * @param lane_event_log_level Value to be written into usr_ctrl_lane_event_log_level RAM variable 193 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 194 */ 195 err_code_t merlin16_set_usr_ctrl_lane_event_log_level(srds_access_t *sa__, uint8_t lane_event_log_level); 196 197 /** Read value of usr_ctrl_lane_event_log_level uC RAM variable. 198 * @param sa__ is an opaque state vector passed through to device access functions. 199 * @param *lane_event_log_level Value read from usr_ctrl_lane_event_log_level RAM variable 200 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 201 */ 202 err_code_t merlin16_get_usr_ctrl_lane_event_log_level(srds_access_t *sa__, uint8_t *lane_event_log_level); 203 204 /** Write to usr_ctrl_core_event_log_level uC RAM variable. 205 * @param sa__ is an opaque state vector passed through to device access functions. 206 * @param core_event_log_level Value to be written into the usr_ctrl_core_event_log_level RAM variable 207 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 208 */ 209 err_code_t merlin16_set_usr_ctrl_core_event_log_level(srds_access_t *sa__, uint8_t core_event_log_level); 210 211 /** Read value of usr_ctrl_core_event_log_level uC RAM variable. 212 * @param sa__ is an opaque state vector passed through to device access functions. 213 * @param *core_event_log_level Value read from usr_ctrl_core_event_log_level RAM variable 214 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 215 */ 216 err_code_t merlin16_get_usr_ctrl_core_event_log_level(srds_access_t *sa__, uint8_t *core_event_log_level); 217 218 219 /*------------------------------*/ 220 /* Digital Loopback Functions */ 221 /*------------------------------*/ 222 223 /** Enable/Disable Digital Loopback. 224 * @param sa__ is an opaque state vector passed through to device access functions. 225 * @param enable Enable Digital Loopback (1 = Enable dig_lpbk; 0 = Disable dig_lpbk) 226 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 227 */ 228 err_code_t merlin16_dig_lpbk(srds_access_t *sa__, uint8_t enable); 229 230 231 /** Enable/Disable Digital Loopback in Repeater mode. 232 * @param sa__ is an opaque state vector passed through to device access functions. 233 * @param enable Enable Digital Loopback (1 = Enable dig_lpbk; 0 = Disable dig_lpbk) 234 * @param mode Appropriate Repeater mode (DATA_IN_SIDE - side where data is fed into , DIG_LPBK_SIDE - side where data is looped back) 235 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 236 */ 237 err_code_t merlin16_dig_lpbk_rptr(srds_access_t *sa__, uint8_t enable, enum srds_rptr_mode_enum mode); 238 239 240 /** Disable Digital Loopback in Repeater mode and enter Normal datapath. 241 * This function should be called twice; once on DATA_IN_SIDE core and once on DIG_LPBK_SIDE core. 242 * @param sa__ is an opaque state vector passed through to device access functions. 243 * @param mode Appropriate Repeater mode (DATA_IN_SIDE - side where data is fed into , DIG_LPBK_SIDE - side where data is looped back) 244 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 245 */ 246 err_code_t merlin16_nl_from_dig_lpbk(srds_access_t *sa__, enum srds_rptr_mode_enum mode); 247 248 #endif