merlin16_config.h (31662B)
1 /*********************************************************************************** 2 *********************************************************************************** 3 * * 4 * Revision : * 5 * * 6 * Description : Config 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_config.h 22 * Configuration functions provided to IP User 23 */ 24 25 #ifndef MERLIN16_API_CONFIG_H 26 #define MERLIN16_API_CONFIG_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_types.h" 32 #include "merlin16_enum.h" 33 #include "merlin16_types.h" 34 #include "merlin16_select_defns.h" 35 #include "merlin16_access.h" 36 37 #define GRACEFUL_STOP_TIME 200 38 39 40 41 /****************************************************/ 42 /* CORE Based APIs - Required to be used per Core */ 43 /****************************************************/ 44 /* Returns API Version Number */ 45 /** API Version Number. 46 * @param *api_version API Version Number returned by the API 47 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 48 */ 49 err_code_t merlin16_version(uint32_t *api_version); 50 51 /*------------------------------------------------*/ 52 /* APIs to Read Core Config variables in uC RAM */ 53 /*------------------------------------------------*/ 54 /** Read value of core_config uC RAM variable. 55 * Note that various API configuration functions can modify core config. 56 * Since the value returned by this can become stale, re-read after modifying core configuration. 57 * @param sa__ is an opaque state vector passed through to device access functions. 58 * @param *struct_val Value to be written into core_config RAM variable 59 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 60 */ 61 err_code_t merlin16_get_uc_core_config(srds_access_t *sa__, struct merlin16_uc_core_config_st *struct_val); 62 63 /*-----------------------------------*/ 64 /* Microcode Load/Verify Functions */ 65 /*-----------------------------------*/ 66 #ifndef DISABLE_MDIO_LOAD 67 /** Load Microcode into Micro through Register (MDIO) Interface. 68 * Once the microcode is loaded, de-assert reset to 8051 to start executing microcode "wrc_micro_mdio_dw8051_reset_n(0x1)". 69 * \n Note: Micro should be loaded only after issuing a merlin16_uc_reset(1) followed by asserting and de-asserting 70 * core_s_reset. Information table should be intialized with merlin16_init_merlin16_info after microcode load. 71 * See relevant Programmers guide for more details. 72 * @param sa__ is an opaque state vector passed through to device access functions. 73 * @param *ucode_image pointer to the Microcode image organized in bytes 74 * @param ucode_len Length of Microcode Image (number of bytes) 75 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 76 */ 77 err_code_t merlin16_ucode_mdio_load(srds_access_t *sa__, uint8_t *ucode_image, uint32_t ucode_len); 78 #endif /* DISABLE_MDIO_LOAD */ 79 80 /** To verify the Microcode image loaded in the Micro. 81 * Read back the microcode from Micro and check against expected microcode image. 82 * @param sa__ is an opaque state vector passed through to device access functions. 83 * @param *ucode_image pointer to the expeted Microcode image organized in bytes 84 * @param ucode_len Length of Microcode Image (number of bytes) 85 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 86 */ 87 err_code_t merlin16_ucode_load_verify(srds_access_t *sa__, uint8_t *ucode_image, uint32_t ucode_len); 88 89 /** To verify the CRC of the microcode loaded in the Micro. 90 * Instruct uC to read image and calculate CRC and check against expected CRC. 91 * @param sa__ is an opaque state vector passed through to device access functions. 92 * @param ucode_len Length of Microcode Image (number of bytes) 93 * @param expected_crc_value Expected CRC value of the microcode 94 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 95 */ 96 err_code_t merlin16_ucode_crc_verify(srds_access_t *sa__, uint16_t ucode_len, uint16_t expected_crc_value); 97 98 /** To instruct the micro to start calculating the CRC of the microcode. 99 * Instruct uC to read image and calculate CRC. 100 * Control is returned after triggering start of CRC calculation (does NOT wait for completion of CRC calculation). \n \n 101 * NOTE: No uC commands should be executed between starting the CRC calculaion [merlin16_ucode_crc_verify()] and verifying the CRC value [merlin16_start_ucode_crc_calc()]. 102 * @param sa__ is an opaque state vector passed through to device access functions. 103 * @param ucode_len Length of Microcode Image (number of bytes) 104 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 105 */ 106 err_code_t merlin16_start_ucode_crc_calc(srds_access_t *sa__, uint16_t ucode_len); 107 108 /** To check the expected CRC against the CRC calulated by the micro. 109 * NOTE: No uC commands should be executed between starting the CRC calculation [merlin16_ucode_crc_verify()] and verifying the CRC value [merlin16_start_ucode_crc_calc()]. 110 * @param sa__ is an opaque state vector passed through to device access functions. 111 * @param expected_crc_value Expected CRC value of the microcode 112 * @param timeout_ms Time interval in milliseconds inside which the previous command (calculate CRC) should be completed 113 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 114 */ 115 err_code_t merlin16_check_ucode_crc(srds_access_t *sa__, uint16_t expected_crc_value, uint32_t timeout_ms); 116 117 /** Load the Micro through the pram bus. 118 * NOTE: Information table should be intialized with merlin16_init_merlin16_info after microcode load. 119 * @param sa__ is an opaque state vector passed through to device access functions. 120 * @param ucode_image Microcode Image to be written 121 * @param ucode_len Length of Microcode Image (number of bytes) 122 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 123 */ 124 err_code_t merlin16_ucode_pram_load(srds_access_t *sa__, char const * ucode_image, uint32_t ucode_len); 125 126 /** Enable or Disable the uC reset. 127 * Note: Micro should be reset using the API everytime before reloading the microcode 128 * @param sa__ is an opaque state vector passed through to device access functions. 129 * @param enable Enable/Disable uC reset (1 = Enable; 0 = Disable) 130 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 131 */ 132 err_code_t merlin16_uc_reset(srds_access_t *sa__, uint8_t enable); 133 134 /** Enable or Disable the uC reset. 135 * Note: Micro should be reset using the API everytime before reloading the microcode 136 * @param sa__ is an opaque state vector passed through to device access functions. 137 * @param enable Enable/Disable uC reset (1 = Enable; 0 = Disable) 138 * @param ucode_info struct has information regarding stack size 139 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 140 */ 141 err_code_t merlin16_uc_reset_with_info(srds_access_t *sa__, uint8_t enable, ucode_info_t ucode_info); 142 143 /** Wait for the uC to become active. 144 * @param sa__ is an opaque state vector passed through to device access functions. 145 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 146 */ 147 err_code_t merlin16_wait_uc_active(srds_access_t *sa__); 148 149 /** Initialize the merlin16_info for the uC. 150 * @param sa__ is an opaque state vector passed through to device access functions. 151 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 152 */ 153 err_code_t merlin16_init_merlin16_info(srds_access_t *sa__); 154 155 156 /** Set the core_cfg_from_pcs flag in the core configuration. 157 * @param sa__ is an opaque state vector passed through to device access functions. 158 * @param core_cfg_from_pcs The value to set 159 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 160 */ 161 err_code_t merlin16_set_core_config_from_pcs(srds_access_t *sa__, uint8_t core_cfg_from_pcs); 162 163 #if defined(MERLIN_SHORTFIN) || defined(FALCON_SHORTFIN) 164 /** Set the an_los_workaround flag in the core configuration. 165 * @param sa__ is an opaque state vector passed through to device access functions. 166 * @param an_los_workaround The value to set 167 * @return Error Code generated if uC does not become active (returns ERR_CODE_NONE if no errors) 168 */ 169 err_code_t merlin16_set_an_los_workaround(srds_access_t *sa__, uint8_t an_los_workaround); 170 #endif 171 172 /** Configure the lane address mapping. 173 * Note: Micro and core data path must be in reset when this function is called. 174 * @param sa__ is an opaque state vector passed through to device access functions. 175 * @param num_lanes The number of entries in tx_lane_map and rx_lane_map. 176 * This must match the number of lanes associated with the core. 177 * @param *tx_lane_map A num_lanes-sized array of lane indexes to map to the TX lanes. 178 * Each entry must be from 0 to num_lanes-1, and each entry must be unique. 179 * @param *rx_lane_map A num_lanes-sized array of lane indexes to map to the RX lanes. 180 * Each entry must be from 0 to num_lanes-1, and each entry must be unique. 181 * If independent TX / RX lane mapping is not enabled for a core, then this must match tx_lane_map. 182 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 183 */ 184 err_code_t merlin16_map_lanes(srds_access_t *sa__, uint8_t num_lanes, uint8_t const *tx_lane_map, uint8_t const *rx_lane_map); 185 186 187 /*-----------------*/ 188 /* Configure PLL */ 189 /*-----------------*/ 190 191 /** The pll can be configured by providing all four parameters: refclk frequency, divider value, VCO output frequency and the PLL options. 192 * This is the only option in SMALL_FOOTPRINT 193 */ 194 #define merlin16_configure_pll_refclk_div_vco merlin16_INTERNAL_configure_pll 195 /** Configure PLL. 196 * 197 * Use core_s_rstb to re-initialize all registers to default before calling this function. 198 * 199 * Configures PLL registers to obtain the required configuration. 200 * PLL configuration for this fucntion is based on refclk frequency and divider value. 201 * @param sa__ is an opaque state vector passed through to device access functions. 202 * @param refclk Reference clock frequency (enumerated) 203 * @param div Divider value (enumerated) 204 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 205 */ 206 err_code_t merlin16_configure_pll_refclk_div(srds_access_t *sa__, 207 enum merlin16_pll_refclk_enum refclk, 208 enum merlin16_pll_div_enum div); 209 210 /** Configure PLL. 211 * 212 * Use core_s_rstb to re-initialize all registers to default before calling this function. 213 * 214 * Configures PLL registers to obtain the required configuration. 215 * PLL configuration for this function is based on refclk frequency and VCO output frequency. 216 * @param sa__ is an opaque state vector passed through to device access functions. 217 * @param refclk Reference clock frequency (enumerated) 218 * @param vco_freq_khz VCO output frequency, in kHz 219 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 220 */ 221 err_code_t merlin16_configure_pll_refclk_vco(srds_access_t *sa__, 222 enum merlin16_pll_refclk_enum refclk, 223 uint32_t vco_freq_khz); 224 225 /** Configure PLL. 226 * 227 * Use core_s_rstb to re-initialize all registers to default before calling this function. 228 * 229 * Configures PLL registers to obtain the required configuration. 230 * PLL configuration for this function is based on divider value and VCO output frequency. 231 * @param sa__ is an opaque state vector passed through to device access functions. 232 * @param div Divider value (enumerated) 233 * @param vco_freq_khz VCO output frequency, in kHz 234 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 235 */ 236 err_code_t merlin16_configure_pll_div_vco(srds_access_t *sa__, 237 enum merlin16_pll_div_enum div, 238 uint32_t vco_freq_khz); 239 240 /** Configure PLL. 241 * 242 * Use core_s_rstb to re-initialize all registers to default before calling this function. 243 * 244 * Configures PLL registers to obtain the required configuration. 245 * PLL configuration for this fucntion is based on input refclk frequency and divider value. 246 * but first divides the input refclk by 2 and adjusts parameters accordingly. 247 * @param sa__ is an opaque state vector passed through to device access functions. 248 * @param refclk Input Reference clock frequency before refclk divide by 2 (enumerated) 249 * @param div Divider value based on input reference clock frequency (enumerated) 250 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 251 */ 252 err_code_t merlin16_configure_pll_refclk_div_div2refclk(srds_access_t *sa__, 253 enum merlin16_pll_refclk_enum refclk, 254 enum merlin16_pll_div_enum div); 255 256 /** Configure PLL. 257 * 258 * Use core_s_rstb to re-initialize all registers to default before calling this function. 259 * 260 * Configures PLL registers to obtain the required configuration. 261 * PLL configuration for this function is based on input refclk frequency and VCO output frequency. 262 * but first divides the input refclk by 2 and adjusts parameters accordingly. 263 * @param sa__ is an opaque state vector passed through to device access functions. 264 * @param refclk Input Reference clock frequency before refclk divide by 2 (enumerated) 265 * @param vco_freq_khz VCO output frequency, in kHz 266 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 267 */ 268 err_code_t merlin16_configure_pll_refclk_vco_div2refclk(srds_access_t *sa__, 269 enum merlin16_pll_refclk_enum refclk, 270 uint32_t vco_freq_khz); 271 272 /** Configure PLL. 273 * 274 * Use core_s_rstb to re-initialize all registers to default before calling this function. 275 * 276 * Configures PLL registers to obtain the required configuration. 277 * PLL configuration for this function is based on divider value and VCO output frequency. 278 * but first divides the input refclk by 2 and adjusts parameters accordingly. 279 * @param sa__ is an opaque state vector passed through to device access functions. 280 * @param div Divider value based on input refclk frequency before refclk divide by 2 (enumerated) 281 * @param vco_freq_khz VCO output frequency, in kHz 282 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 283 */ 284 err_code_t merlin16_configure_pll_div_vco_div2refclk(srds_access_t *sa__, 285 enum merlin16_pll_div_enum div, 286 uint32_t vco_freq_khz); 287 /** Configure PLL. 288 * 289 * Use core_s_rstb to re-initialize all registers to default before calling this function. 290 * 291 * Configures PLL registers to obtain the required configuration. 292 * PLL configuration for this fucntion is based on input refclk frequency and divider value. 293 * but first divides the input refclk by 4 and adjusts parameters accordingly. 294 * @param sa__ is an opaque state vector passed through to device access functions. 295 * @param refclk Input Reference clock frequency before refclk divide by 4 (enumerated) 296 * @param div Divider value based on input reference clock frequency (enumerated) 297 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 298 */ 299 err_code_t merlin16_configure_pll_refclk_div_div4refclk(srds_access_t *sa__, 300 enum merlin16_pll_refclk_enum refclk, 301 enum merlin16_pll_div_enum div); 302 303 /** Configure PLL. 304 * 305 * Use core_s_rstb to re-initialize all registers to default before calling this function. 306 * 307 * Configures PLL registers to obtain the required configuration. 308 * PLL configuration for this function is based on input refclk frequency and VCO output frequency. 309 * but first divides the input refclk by 4 and adjusts parameters accordingly. 310 * @param sa__ is an opaque state vector passed through to device access functions. 311 * @param refclk Input Reference clock frequency before refclk divide by 4 (enumerated) 312 * @param vco_freq_khz VCO output frequency, in kHz 313 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 314 */ 315 err_code_t merlin16_configure_pll_refclk_vco_div4refclk(srds_access_t *sa__, 316 enum merlin16_pll_refclk_enum refclk, 317 uint32_t vco_freq_khz); 318 319 /** Configure PLL. 320 * 321 * Use core_s_rstb to re-initialize all registers to default before calling this function. 322 * 323 * Configures PLL registers to obtain the required configuration. 324 * PLL configuration for this function is based on divider value and VCO output frequency. 325 * but first divides the input refclk by 4 and adjusts parameters accordingly. 326 * @param sa__ is an opaque state vector passed through to device access functions. 327 * @param div Divider value based on input refclk frequency before refclk divide by 4 (enumerated) 328 * @param vco_freq_khz VCO output frequency, in kHz 329 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 330 */ 331 err_code_t merlin16_configure_pll_div_vco_div4refclk(srds_access_t *sa__, 332 enum merlin16_pll_div_enum div, 333 uint32_t vco_freq_khz); 334 335 336 /** Get the VCO frequency in kHz, based on the reference clock frequency and divider value 337 * @param refclk_freq_hz Reference clock frequency, in Hz. 338 * @param div Divider value, in the same encoding as enum #merlin16_pll_div_enum. 339 * @param *vco_freq_khz VCO output frequency, in kHz, obtained based on reference clock frequency and dic value 340 * @param pll_option Select PLL configuration option from enum #merlin16_pll_option_enum. 341 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 342 */ 343 err_code_t merlin16_get_vco_from_refclk_div(uint32_t refclk_freq_hz, enum merlin16_pll_div_enum div, uint32_t *vco_freq_khz, enum merlin16_pll_option_enum pll_option); 344 345 /**************************************************/ 346 /* LANE Based APIs - Required to be used per Lane */ 347 /**************************************************/ 348 349 /*------------------------------------------------------------*/ 350 /* APIs to Write Lane Config and User variables into uC RAM */ 351 /*------------------------------------------------------------*/ 352 /** Write to lane_config uC RAM variable. 353 * Note: This API should be used only during configuration under dp_reset. 354 * @param sa__ is an opaque state vector passed through to device access functions. 355 * @param struct_val Value to be written into lane_config RAM variable 356 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 357 */ 358 err_code_t merlin16_set_uc_lane_cfg(srds_access_t *sa__, struct merlin16_uc_lane_config_st struct_val); 359 360 /*-----------------------------------------------------------*/ 361 /* APIs to Read Lane Config and User variables from uC RAM */ 362 /*-----------------------------------------------------------*/ 363 /** Read value of lane_config uC RAM variable. 364 * @param sa__ is an opaque state vector passed through to device access functions. 365 * @param *struct_val Value read from lane_config RAM variable 366 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 367 */ 368 err_code_t merlin16_get_uc_lane_cfg(srds_access_t *sa__, struct merlin16_uc_lane_config_st *struct_val); 369 370 371 /*--------------------------------------------*/ 372 /* APIs to Enable or Disable datapath reset */ 373 /*--------------------------------------------*/ 374 375 /** Enable or Disable TX datapath reset. 376 * Asserts handshake signals upon disable. 377 * @param sa__ is an opaque state vector passed through to device access functions. 378 * @param enable Enable/Disable TX datapath reset (1 = Enable; 0 = Disable) 379 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 380 */ 381 err_code_t merlin16_tx_dp_reset(srds_access_t *sa__, uint8_t enable); 382 383 /** Enable or Disable RX datapath reset. 384 * @param sa__ is an opaque state vector passed through to device access functions. 385 * @param enable Enable/Disable RX datapath reset (1 = Enable; 0 = Disable) 386 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 387 */ 388 err_code_t merlin16_rx_dp_reset(srds_access_t *sa__, uint8_t enable); 389 390 /** Enable or Disable Core datapath reset. 391 * @param sa__ is an opaque state vector passed through to device access functions. 392 * @param enable Enable/Disable Core datapath reset (1 = Enable; 0 = Disable) 393 * @return Error Code generated by invalid access (returns ERR_CODE_NONE if no errors) 394 */ 395 err_code_t merlin16_core_dp_reset(srds_access_t *sa__, uint8_t enable); 396 397 /*---------------------------*/ 398 /* Merlin16 TX Analog APIs */ 399 /*---------------------------*/ 400 401 /** Validates Merlin16 TXFIR tap settings. 402 * Returns failcodes if the combination of the TXFIR settings are invalid. 403 * @param pre TXFIR pre tap value (0..10) in 1/60 Vpp 404 * @param main TXFIR main tap value (40..60) in 1/60 Vpp 405 * @param post1 TXFIR post1 tap value (0..23) in 1/60 Vpp 406 * @param post2 TXFIR post2 tap value (0..5) in 1/60 Vpp 407 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 408 */ 409 err_code_t merlin16_validate_txfir_cfg(int8_t pre, int8_t main, int8_t post1, int8_t post2); 410 411 /** Validates and applies Merlin16 TXFIR tap settings. 412 * Returns failcodes if TXFIR settings are invalid. 413 * @param sa__ is an opaque state vector passed through to device access functions. 414 * @param pre TXFIR pre tap value (0..10) in 1/60 Vpp 415 * @param main TXFIR main tap value (40..60) in 1/60 Vpp 416 * @param post1 TXFIR post1 tap value (0..23) in 1/60 Vpp 417 * @param post2 TXFIR post2 tap value (0..5) in 1/60 Vpp 418 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 419 */ 420 err_code_t merlin16_apply_txfir_cfg(srds_access_t *sa__, int8_t pre, int8_t main, int8_t post1, int8_t post2); 421 422 /** Read TX AFE parameters. 423 * @param sa__ is an opaque state vector passed through to device access functions. 424 * @param param selects the parameter to read based on #merlin16_tx_afe_settings_enum 425 * @param *val is the returned signed value of the parameter 426 * @return Error Code generated by invalid tap settings (returns ERR_CODE_NONE if no errors) 427 */ 428 err_code_t merlin16_read_tx_afe(srds_access_t *sa__, enum merlin16_tx_afe_settings_enum param, int8_t *val); 429 430 /** Validates and applies Merlin16 TX CTLE High Pass Filter (HPF) settings. 431 * Returns failcode if CTLE HPF setting is invalid. 432 * @param sa__ is an opaque state vector passed through to device access functions. 433 * @param hpf_val High pass filter setting (0..4) 434 * @return Error Code generated by invalid settings (returns ERR_CODE_NONE if no errors) 435 */ 436 err_code_t merlin16_config_tx_hpf(srds_access_t *sa__, uint8_t hpf_val); 437 438 /** Reads Merlin16 TX CTLE High Pass Filter (HPF) settings. 439 * Returns failcode if CTLE HPF setting is invalid. 440 * @param sa__ is an opaque state vector passed through to device access functions. 441 * @param *hpf_val High pass filter setting (0..4) 442 * @return Error Code generated by invalid settings (returns ERR_CODE_NONE if no errors) 443 */ 444 err_code_t merlin16_rd_tx_hpf_config(srds_access_t *sa__, uint8_t *hpf_val); 445 446 447 /*----------------*/ 448 /* PMD_RX_LOCK */ 449 /*----------------*/ 450 451 /** PMD rx lock status of current lane. 452 * @param sa__ is an opaque state vector passed through to device access functions. 453 * @param *pmd_rx_lock PMD_RX_LOCK status of current lane returned by API 454 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 455 */ 456 err_code_t merlin16_pmd_lock_status(srds_access_t *sa__, uint8_t *pmd_rx_lock); 457 458 /*--------------------------------*/ 459 /* Serdes TX disable/RX Restart */ 460 /*--------------------------------*/ 461 /** TX Disable. 462 * @param sa__ is an opaque state vector passed through to device access functions. 463 * @param enable Enable/Disable TX disable (1 = TX Disable asserted; 0 = TX Disable removed) 464 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 465 */ 466 err_code_t merlin16_tx_disable(srds_access_t *sa__, uint8_t enable); 467 468 /** Enable/disable Restart RX and hold. 469 * (Reset DSC state machine into RESTART State and hold it till disabled) 470 * @param sa__ is an opaque state vector passed through to device access functions. 471 * @param enable Enable/Disable Restart RX and hold (1 = RX restart and hold; 0 = Release hold in restart state) 472 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 473 */ 474 err_code_t merlin16_rx_restart(srds_access_t *sa__, uint8_t enable); 475 476 477 /*-----------------------------*/ 478 /* Stop/Resume RX Adaptation */ 479 /*-----------------------------*/ 480 /** Stop RX Adaptation on a Lane. Control is returned only after attempting to stop adaptation. 481 * RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 482 * @param sa__ is an opaque state vector passed through to device access functions. 483 * @param enable Enable RX Adaptation stop (1 = Stop RX Adaptation on lane; 0 = Resume RX Adaptation on lane) 484 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 485 */ 486 err_code_t merlin16_stop_rx_adaptation(srds_access_t *sa__, uint8_t enable); 487 488 /** Request to stop RX Adaptation on a Lane. 489 * Control will be returned immediately before adaptaion is completely stopped. 490 * RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 491 * To resume RX adaptation, use the merlin16_stop_rx_adaptation() API. 492 * @param sa__ is an opaque state vector passed through to device access functions. 493 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 494 */ 495 err_code_t merlin16_request_stop_rx_adaptation(srds_access_t *sa__); 496 497 /*------------------------------------*/ 498 /* Read/Write all RX AFE parameters */ 499 /*------------------------------------*/ 500 501 /** Write to RX AFE settings. 502 * Note: RX Adaptation needs to be stopped before modifying any of the VGA, PF or DFE taps. 503 * @param sa__ is an opaque state vector passed through to device access functions. 504 * @param param Enum (#srds_rx_afe_settings_enum) to select the required RX AFE setting to be modified 505 * @param val Value to be written to the selected AFE setting 506 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 507 */ 508 err_code_t merlin16_write_rx_afe(srds_access_t *sa__, enum srds_rx_afe_settings_enum param, int8_t val); 509 510 /** Read from RX AFE settings. 511 * @param sa__ is an opaque state vector passed through to device access functions. 512 * @param param Enum (#srds_rx_afe_settings_enum) to select the required RX AFE setting to be read 513 * @param *val Value to be written to the selected AFE setting 514 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 515 */ 516 err_code_t merlin16_read_rx_afe(srds_access_t *sa__, enum srds_rx_afe_settings_enum param, int8_t *val); 517 518 /*-----------------------------*/ 519 /* TX_PI Fixed Frequency Mode */ 520 /*-----------------------------*/ 521 522 /** TX_PI Fixed Frequency Mode. 523 * @param sa__ is an opaque state vector passed through to device access functions. 524 * @param enable Enable/Disable TX_PI (1 = Enable; 0 = Disable) 525 * @param freq_override_val Fixed Frequency Override value (freq_override_val = desired_ppm*8192/781.25; Range: -8192 to + 8192); 526 * @return Error Code generated by invalid TX_PI settings (returns ERR_CODE_NONE if no errors) 527 */ 528 err_code_t merlin16_tx_pi_freq_override(srds_access_t *sa__, uint8_t enable, int16_t freq_override_val); 529 530 /** Perform steps necessary to align TX clocks 531 * @param sa__ is an opaque state vector passed through to device access functions. 532 * @param num_lanes is the number of lanes available in the SerDes IP core (4) 533 * @param enable 1 = Enable ; 0 = Disable 534 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 535 */ 536 err_code_t merlin16_tx_clock_align(srds_access_t *sa__, int num_lanes, int enable); 537 538 /*--------------------------------------------*/ 539 /* Loopback and Ultra-Low Latency Functions */ 540 /*--------------------------------------------*/ 541 542 /** TX PI setup for Repeater Mode. 543 * @param sa__ is an opaque state vector passed through to device access functions. 544 * @param enable Enable/Disable (1 = Enable; 0 = Disable) 545 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 546 */ 547 err_code_t merlin16_tx_rptr_mode_timing(srds_access_t *sa__, uint8_t enable); 548 549 /** RX setup for Repeater Mode timing 550 * This function should be called prior to merlin16_rptr_mode_timing(); 551 * @param sa__ is an opaque state vector passed through to device access functions. 552 * @param enable Enable/Disable (1 = Enable; 0 = Disable) 553 * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) 554 */ 555 err_code_t merlin16_rx_rptr_mode_timing(srds_access_t *sa__, uint8_t enable); 556 557 /** Switch to Remote Loopback from Normal Loopback. 558 * This function does not enable Loop Timing. 559 * If you want loop timing use merlin16_rmt_lpbk() 560 * @param sa__ is an opaque state vector passed through to device access functions. 561 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 562 */ 563 err_code_t merlin16_rmt_lpbk_from_nl(srds_access_t *sa__); 564 565 566 567 /** Switch to Normal Loopback from Remote Loopback. 568 * This function should be called twice; once on DATA_IN_SIDE core and once on RMT_LPBK_SIDE core. 569 * @param sa__ is an opaque state vector passed through to device access functions. 570 * @param mode Appropriate Repeater mode (DATA_IN_SIDE - side where data is fed into , RMT_LPBK_SIDE - side where data is looped back) 571 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 572 */ 573 err_code_t merlin16_nl_from_rmt_lpbk(srds_access_t *sa__, enum srds_rptr_mode_enum mode); 574 575 /** Locks TX_PI to Loop timing. 576 * @param sa__ is an opaque state vector passed through to device access functions. 577 * @param enable Enable TX_PI lock to loop timing (1 = Enable Lock; 0 = Disable Lock) 578 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 579 */ 580 err_code_t merlin16_loop_timing(srds_access_t *sa__, uint8_t enable); 581 582 /** Enable/Disable Remote Loopback. 583 * @param sa__ is an opaque state vector passed through to device access functions. 584 * @param enable Enable Remote Loopback (1 = Enable rmt_lpbk; 0 = Disable rmt_lpbk) 585 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 586 */ 587 err_code_t merlin16_rmt_lpbk(srds_access_t *sa__, uint8_t enable); 588 589 #endif