openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

falcon_tsc_internal.h (28175B)


      1 /**********************************************************************************
      2 **********************************************************************************
      3 *                                                                                *
      4 *                                                                                *
      5 *  Description :  Internal API functions                                         *
      6 *                                                                                *
      7 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      8 * 
      9 * Copyright 2007-2019 Broadcom Inc. All rights reserved.                                                          *
     10 *  No portions of this material may be reproduced in any form without            *
     11 *  the written permission of:                                                    *
     12 *      Broadcom Corporation                                                      *
     13 *      5300 California Avenue                                                    *
     14 *      Irvine, CA  92617                                                         *
     15 *                                                                                *
     16 *  All information contained in this document is Broadcom Corporation            *
     17 *  company private proprietary, and trade secret.                                *
     18  */
     19 
     20 /** @file falcon_tsc_internal.h
     21  * Internal API functions
     22  */
     23 
     24 #ifndef FALCON_TSC_API_INTERNAL_H
     25 #define FALCON_TSC_API_INTERNAL_H
     26 
     27 #define SDK_STATIC static
     28 
     29 
     30 #include "falcon_tsc_common.h"
     31 #include "falcon_tsc_field_access.h"
     32 #include "falcon_tsc_ipconfig.h"
     33 #include "common/srds_api_err_code.h"
     34 #include "falcon_tsc_interface.h"
     35 #include "falcon_tsc_debug_functions.h"
     36 
     37 /* Verbose level used in BER projection */
     38 #define BER_PROJ_VERBOSE 0
     39 
     40 /*------------------------------*/
     41 /** Serdes OSR Mode Structure   */
     42 /*------------------------------*/
     43 typedef struct {
     44 	/** TX OSR Mode */
     45 	uint8_t tx;
     46 	/** RX OSR Mode */
     47 	uint8_t rx;
     48 	/** OSR Mode for TX and RX (used when both TX and RX should have same OSR Mode) */
     49 	uint8_t tx_rx;
     50 }falcon_tsc_osr_mode_st;
     51 
     52 /*------------------------------*/
     53 /** Serdes Lane State Structure */
     54 /*------------------------------*/
     55 typedef struct {
     56 	/** uC lane configuration */
     57 	uint16_t ucv_config;
     58 	/** Frequency offset of local reference clock with respect to RX data in ppm */
     59 	int16_t rx_ppm;
     60 	/** Vertical threshold voltage of p1 slicer (mV) */
     61 	int16_t p1_lvl;
     62 	/** Vertical threshold voltage of m1 slicer (mV) */
     63 	int16_t m1_lvl;
     64 	/** Link time in milliseconds */
     65 	uint16_t link_time;
     66 	/** OSR Mode */
     67 	falcon_tsc_osr_mode_st osr_mode;
     68 	/** Signal Detect */
     69 	uint8_t sig_det;
     70 	/** Signal Detect Change */
     71 	uint8_t sig_det_chg;
     72 	/** PMD RX Lock */
     73 	uint8_t rx_lock;
     74 	/** PMD RX Lock Change */
     75 	uint8_t rx_lock_chg;
     76 	/** Delay of zero crossing slicer, m1, wrt to data in PI codes */
     77 	int8_t clk90;
     78 	/** Delay of diagnostic/lms slicer, p1, wrt to data in PI codes */
     79 	int8_t clkp1;
     80 	/** Peaking Filter Main Settings */
     81 	int8_t pf_main;
     82 	/** Peaking Filter Hiz mode enable */
     83 	int8_t pf_hiz;
     84 	/** Peaking Filter DC gain adjustment for CTLE */
     85 	int8_t pf_bst;
     86 	/** Low Frequency Peaking filter control */
     87 	int8_t pf2_ctrl;
     88 	/** Variable Gain Amplifier settings */
     89 	int8_t vga;
     90 	/** DC offset DAC control value */
     91 	int8_t dc_offset;
     92 	/** P1 eyediag status */
     93 	int8_t p1_lvl_ctrl;
     94 	/** DFE tap 1 value */
     95 	int8_t dfe1;
     96 	/** DFE tap 2 value */
     97 	int8_t dfe2;
     98 	/** DFE tap 3 value */
     99 	int8_t dfe3;
    100 	/** DFE tap 4 value */
    101 	int8_t dfe4;
    102 	/** DFE tap 5 value */
    103 	int8_t dfe5;
    104 	/** DFE tap 6 value */
    105 	int8_t dfe6;
    106 	/** DFE tap 1 Duty Cycle Distortion */
    107 	int8_t dfe1_dcd;
    108 	/** DFE tap 2 Duty Cycle Distortion */
    109 	int8_t dfe2_dcd;
    110 	/** Slicer calibration control codes (p1 even) */
    111 	int8_t pe;
    112 	/** Slicer calibration control codes (data even) */
    113 	int8_t ze;
    114 	/** Slicer calibration control codes (m1 even) */
    115 	int8_t me;
    116 	/** Slicer calibration control codes (p1 odd) */
    117 	int8_t po;
    118 	/** Slicer calibration control codes (data odd) */
    119 	int8_t zo;
    120 	/** Slicer calibration control codes (m1 odd) */
    121 	int8_t mo;
    122 	/** Frequency offset of local reference clock with respect to TX data in ppm */
    123 	int16_t tx_ppm;
    124 	/** TX equalization FIR pre tap weight */
    125 	int8_t txfir_pre;
    126 	/** TX equalization FIR main tap weight */
    127 	int8_t txfir_main;
    128 	/** TX equalization FIR post1 tap weight */
    129 	int8_t txfir_post1;
    130 	/** TX equalization FIR post2 tap weight */
    131 	int8_t txfir_post2;
    132 	/** TX equalization FIR post3 tap weight */
    133 	int8_t txfir_post3;
    134 	/** Horizontal left eye margin @ 1e-5 as seen by internal diagnostic slicer in mUI and mV */
    135 	uint16_t heye_left;
    136 	/** Horizontal right eye margin @ 1e-5 as seen by internal diagnostic slicer in mUI and mV */
    137 	uint16_t heye_right;
    138 	/** Vertical upper eye margin @ 1e-5 as seen by internal diagnostic slicer in mUI and mV */
    139 	uint16_t veye_upper;
    140 	/** Vertical lower eye margin @ 1e-5 as seen by internal diagnostic slicer in mUI and mV */
    141 	uint16_t veye_lower;
    142 	/** Baud Rate Phase Detector enable */
    143 	uint8_t br_pd_en;
    144 	/** lane_reset_state **/
    145 	uint8_t reset_state;
    146 	/** uC stopped state **/
    147 	uint8_t stop_state;
    148 	/** TX_AMP **/
    149 	int8_t tx_amp;
    150 	/** TX_Drivermode **/
    151 	uint8_t drivermode;
    152 	/** TX pll select */
    153 	uint8_t tx_pll_select;
    154 	/** RX pll select */
    155 	uint8_t rx_pll_select;
    156 } falcon_tsc_lane_state_st;
    157 
    158 /*------------------------------*/
    159 /** Serdes Core State Structure */
    160 /*------------------------------*/
    161 typedef struct {
    162 	/** Core DP Reset State */
    163 	uint8_t core_reset;
    164 	/**  PLL Powerdown enable */
    165 	uint8_t pll_pwrdn;
    166 	/** Micro active enable */
    167 	uint8_t uc_active;
    168 	/** Comclk Frequency in Mhz */
    169 	uint16_t comclk_mhz;
    170 	/** uCode Major Version number */
    171 	uint16_t ucode_version;
    172 	/** uCode Minor Version number */
    173 	uint8_t ucode_minor_version;
    174        /** API version */
    175        uint32_t api_version;
    176 	/** AFE Hardware version */
    177 	uint8_t afe_hardware_version;
    178 	/** uC Die Temperature Index */
    179 	uint8_t temp_idx;
    180 	/** Average Die Temperature (13-bit format) */
    181 	uint16_t avg_tmon;
    182 	/** Analog Resistor Calibration value */
    183 	uint8_t rescal;
    184 	/** VCO Rate in MHz */
    185 	uint16_t vco_rate_mhz;
    186 	/**  Analog VCO Range */
    187 	uint8_t analog_vco_range;
    188 	/** PLL Divider value */
    189 	uint8_t pll_div;
    190 	/** PLL Lock */
    191 	uint8_t pll_lock;
    192 	/** PLL Lock Change */
    193 	uint8_t pll_lock_chg;
    194 	/** Live die temperature in Celsius */
    195 	int16_t die_temp;
    196 	/** Core Status Variable */
    197 	uint8_t core_status;
    198 } falcon_tsc_core_state_st;
    199 
    200 /** Print Error messages to screen before returning.
    201  * @param pa phymod_access_t struct
    202  * @param err_code Error Code input which is returned as well
    203  * @return Error Code
    204  */
    205 SDK_STATIC err_code_t _print_err_msg (uint16_t err_code);
    206 
    207 /** Print Convert Error code to String.
    208  * @param pa phymod_access_t struct
    209  * @param err_code Error Code input which is converted to string
    210  * @return String containing Error code information.
    211  */
    212 SDK_STATIC char* _e2s_err_code (err_code_t err_code);
    213 
    214 
    215 
    216 /** Check if the micro's operations on that lane are stopped.
    217  * @param pa phymod_access_t struct
    218  * @return err_code Error Code "ERR_CODE_UC_NOT_STOPPED" returned if micro NOT stopped
    219  */
    220 SDK_STATIC err_code_t _check_uc_lane_stopped (const phymod_access_t *pa);
    221 
    222 /** Calculate the mode_sel parameter for tx pattern generator.
    223  * @param pa phymod_access_t struct
    224  * @param *mode_sel Mode select to be used for generating required pattern
    225  * @param *zero_pad_len Length of zero padding to be used for generating required pattern
    226  * @param patt_length Desired Pattern length
    227  * @return Error Code, if generated (returns ERR_CODE_NONE if no errors)
    228  */
    229 SDK_STATIC err_code_t _calc_patt_gen_mode_sel (const phymod_access_t *pa, uint8_t *mode_sel, uint8_t *zero_pad_len, uint8_t patt_length);
    230 
    231 /** Convert the PLL_mode to actual PLL divider value and display
    232  * as part of falcon_tsc_display_core_state_line()
    233  * @param pa phymod_access_t struct
    234  * @param val PLL_DIV register value
    235  * @return Error Code, if generated (returns ERR_CODE_NONE if no errors)
    236  */
    237 static err_code_t _falcon_tsc_display_pll_to_divider (const phymod_access_t *pa, uint8_t val);
    238 
    239 
    240 
    241 /*-------------------*/
    242 /*  Ladder controls  */
    243 /*-------------------*/
    244 /** Converts a ladder setting to mV, given the range.
    245  * @param pa phymod_access_t struct
    246  * @param ctrl is the threshold control (-31..31) maps to -RANGE to RANGE in non-uniform steps
    247  * @param range_250 determines the range 0 = +/-150mV, 1 = +/-250mV
    248  * @return ladder threshold voltage in mV
    249  */
    250 SDK_STATIC int16_t _ladder_setting_to_mV (const phymod_access_t *pa, int8_t ctrl, uint8_t range_250);
    251 
    252 
    253 
    254 /*-----------------------*/
    255 /*  TX_PI and ULL Setup  */
    256 /*-----------------------*/
    257 
    258 /** Safe multiply - multiplies 2 numbers and checks for overflow.
    259  * @param pa phymod_access_t struct
    260  * @param a First input
    261  * @param b Second input
    262  * @param *of Pointer to overflow indicator
    263  * @return value of a * b
    264  */
    265 static uint32_t _mult_with_overflow_check (const phymod_access_t *pa, uint32_t a, uint32_t b, uint8_t *of);
    266 
    267 
    268 /*-----------------------------------------*/
    269 /*  APIs used in Config Shared TX Pattern  */
    270 /*-----------------------------------------*/
    271 /** Compute Binary string for a Hex value ['0' to 'F'].
    272  * @param pa phymod_access_t struct
    273  * @param var Hex value to be converted to Binary (eg: '6', 'A', ...)
    274  * @param bin Binary string returned by API (eg: '0110', '1010', ...)
    275  * @return Error Code generated by invalid hex variable (returns ERR_CODE_NONE if no errors)
    276  */
    277 static err_code_t _compute_bin (const phymod_access_t *pa, char var, char bin[]);
    278 
    279 /** Compute Hex value for a Binary string ['0000' to '1111'].
    280  * @param pa phymod_access_t struct
    281  * @param bin Binary string to be coverted (eg: '0110', '1010', ...)
    282  * @param *hex Hex value calculated from the input Binary string
    283  * @return Error Code generated by invalid Binary string (returns ERR_CODE_NONE if no errors)
    284  */
    285 static err_code_t _compute_hex (const phymod_access_t *pa, char bin[], uint8_t * hex);
    286 
    287 
    288 /*-----------------------------------*/
    289 /*  APIs used in Read Event Logger   */
    290 /*-----------------------------------*/
    291 
    292 /** Interpret error event code.
    293  * @param pa phymod_access_t struct
    294  * @param val Event code error value to be interpreted
    295  * @return Char string to be displayed in event log
    296  */
    297 static char* _error_val_2_str (const phymod_access_t *pa, uint8_t val);
    298 
    299 /** Display event information.
    300  * @param pa phymod_access_t struct
    301  * @param event_id Event id to be displayed
    302  * @param entry_len Length of the event entry
    303  * @param prev_cursor CL72 prev cursor value
    304  * @param curr_cursor CL72 curr cursor value
    305  * @param post_cursor CL72 post cursor value
    306  * @param *supp_info Supplement information
    307  */
    308 static err_code_t _display_event (const phymod_access_t *pa, uint8_t event_id, uint8_t entry_len, uint8_t prev_cursor, uint8_t curr_cursor, uint8_t post_cursor, uint8_t *supp_info);
    309 
    310 
    311 /** Convert float8 to usigned int32.
    312  * uint32 = 1.XXX * 2^Y  where float8 bits are XXXYYYYY
    313  * @param pa phymod_access_t struct
    314  * @param input Float8 number
    315  * @return Usigned 32bit number
    316  */
    317 static uint32_t _float8_to_int32 (const phymod_access_t *pa, float8_t input);
    318 
    319 
    320 #ifdef TO_FLOATS
    321 /*-----------------------------------*/
    322 /*  APIs used in uC data conversion  */
    323 /*-----------------------------------*/
    324 
    325 /** Convert usigned int32 to float8.
    326  * uint32 = 1.XXX * 2^Y  where float8 bits are XXXYYYYY
    327  * @param pa phymod_access_t struct
    328  * @param input Unsigned int
    329  * @return Float8 8 bit representations of 32bit number
    330  */
    331 static float8_t _int32_to_float8 (const phymod_access_t *pa, uint32_t input);
    332 #endif
    333 
    334 
    335 /*-----------------------------*/
    336 /*  Read / Display Core state  */
    337 /*-----------------------------*/
    338 /** Read current falcon_tsc core status.
    339  * @param pa phymod_access_t struct
    340  * @param *istate Current falcon_tsc core status read back and populated by the API
    341  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    342  */
    343 SDK_STATIC err_code_t _falcon_tsc_read_core_state (const phymod_access_t *pa, falcon_tsc_core_state_st *istate);
    344 
    345 /** Display current core state.
    346  * Reads and displays all important core state values.
    347  * @param pa phymod_access_t struct
    348  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    349  */
    350 static err_code_t _falcon_tsc_display_core_state_no_newline (const phymod_access_t *pa);
    351 
    352 /*-----------------------------*/
    353 /*  Read / Display Lane state  */
    354 /*-----------------------------*/
    355 /** Read current falcon_tsc lane status.
    356  * @param pa phymod_access_t struct
    357  * @param *istate Current falcon_tsc lane status read back and populated by the API
    358  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    359  */
    360 SDK_STATIC err_code_t _falcon_tsc_read_lane_state (const phymod_access_t *pa, falcon_tsc_lane_state_st *istate);
    361 
    362 
    363 /*-----------------------------------*/
    364 /*  Pll_lock/Sigdet/Pmd_lock status  */
    365 /*-----------------------------------*/
    366 /** Read current PLL Lock and PLL Lock change status of a lane.
    367  * @param pa phymod_access_t struct
    368  * @param *pll_lock Current falcon_tsc lane pll_lock status read back and populated by the API
    369  * @param *pll_lock_chg Current falcon_tsc lane pll_lock_change status read back and populated by the API
    370  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    371  */
    372 SDK_STATIC err_code_t _falcon_tsc_pll_lock_status (const phymod_access_t *pa, uint8_t *pll_lock, uint8_t *pll_lock_chg);
    373 
    374 /** Read current PMD Lock and PMD Lock change status of a lane.
    375  * @param pa phymod_access_t struct
    376  * @param *pmd_lock Current falcon_tsc lane pmd_rx_lock status read back and populated by the API
    377  * @param *pmd_lock_chg Current falcon_tsc lane pmd_rx_lock_change status read back and populated by the API
    378  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    379  */
    380 SDK_STATIC err_code_t _falcon_tsc_pmd_lock_status (const phymod_access_t *pa, uint8_t *pmd_lock, uint8_t *pmd_lock_chg);
    381 
    382 /** Read current Signal_detect and Signal_detect change status of a lane.
    383  * @param pa phymod_access_t struct
    384  * @param *sig_det Current falcon_tsc lane signal_detect status read back and populated by the API
    385  * @param *sig_det_chg Current falcon_tsc lane signal_detect_change status read back and populated by the API
    386  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    387  */
    388 SDK_STATIC err_code_t _falcon_tsc_sigdet_status (const phymod_access_t *pa, uint8_t *sig_det, uint8_t *sig_det_chg);
    389 
    390 
    391 
    392 
    393 /*-----------------*/
    394 /*  Get OSR mode   */
    395 /*-----------------*/
    396 /** Read current falcon_tsc lane status.
    397  * @param pa phymod_access_t struct
    398  * @param *mode Returns with the osr mode structure
    399  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    400  */
    401 SDK_STATIC err_code_t _falcon_tsc_get_osr_mode (const phymod_access_t *pa, falcon_tsc_osr_mode_st *mode);
    402 
    403 /** Display current lane state.
    404  * Reads and displays all important lane state values.
    405  * @param pa phymod_access_t struct
    406  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    407  */
    408 static err_code_t _falcon_tsc_display_lane_state_no_newline (const phymod_access_t *pa);
    409 
    410 
    411 
    412 /** Convert eye margin to mV.
    413  * Takes in the ladder setting with 3 fractional bits and converts to mV.
    414  * @param pa phymod_access_t struct
    415  * @param var Ladder setting with 3 fractional bits
    416  * @param ladder_range Specified if ladder is configured for 150mV or 250mV range
    417  * @return Eye opening in mV
    418  */
    419 SDK_STATIC uint16_t _eye_to_mV (const phymod_access_t *pa, uint8_t var, uint8_t ladder_range);
    420 
    421 /** Convert eye margin to mUI.
    422  * Takes in a horizontal margin in Phase Interpolator codes and converts it to mUI.
    423  * @param pa phymod_access_t struct
    424  * @param var Horizontal margin in Phase Interpolator codes with 3 fractional bits
    425  * @return Eye opening in mV
    426  */
    427 SDK_STATIC uint16_t _eye_to_mUI (const phymod_access_t *pa, uint8_t var);
    428 
    429 
    430 /** Serdes Core ClockGate.
    431  * Along with falcon_tsc_core_clkgate(), all lanes should also be clock gated using falcon_tsc_lane_clkgate() to complete a Core Clockgate
    432  * @param pa phymod_access_t struct
    433  * @param enable Enable clockgate (1 = Enable clokgate; 0 = Disable clockgate)
    434  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    435  */
    436 static err_code_t _falcon_tsc_core_clkgate (const phymod_access_t *pa, uint8_t enable);
    437 
    438 /** Serdes Lane ClockGate.
    439  * @param pa phymod_access_t struct
    440  * @param enable Enable lane clockgate (1 = Enable clockgate; 0 = Disable clockgate)
    441  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    442  */
    443 static err_code_t _falcon_tsc_lane_clkgate (const phymod_access_t *pa, uint8_t enable);
    444 
    445 
    446 /** Set function for PF.
    447  * @param pa phymod_access_t struct
    448  * @param val Signed input value
    449  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    450  */
    451 SDK_STATIC err_code_t _set_rx_pf_main (const phymod_access_t *pa, uint8_t val);
    452 
    453 /** Get function for PF
    454  * @param pa phymod_access_t struct
    455  * @param *val PF read value
    456  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    457  */
    458 static err_code_t _get_rx_pf_main (const phymod_access_t *pa, int8_t *val);
    459 
    460 /** Set function for PF2.
    461  * @param pa phymod_access_t struct
    462  * @param val signed input value
    463  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    464  */
    465 SDK_STATIC err_code_t _set_rx_pf2 (const phymod_access_t *pa, uint8_t val);
    466 
    467 /** Get function for PF2.
    468  * @param pa phymod_access_t struct
    469  * @param *val PF2 read value
    470  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    471  */
    472 static err_code_t _get_rx_pf2 (const phymod_access_t *pa, int8_t *val);
    473 
    474 /** Set function for VGA.
    475  * @param pa phymod_access_t struct
    476  * @param val signed input value
    477  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    478  */
    479 SDK_STATIC err_code_t _set_rx_vga (const phymod_access_t *pa, uint8_t val);
    480 
    481 /** Get function for VGA.
    482  * @param pa phymod_access_t struct
    483  * @param *val VGA read value
    484  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    485  */
    486 static err_code_t _get_rx_vga (const phymod_access_t *pa, int8_t *val);
    487 
    488 
    489 /** Set function for DFE Tap1.
    490  * @param pa phymod_access_t struct
    491  * @param val signed input value
    492  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    493  */
    494 SDK_STATIC err_code_t _set_rx_dfe1 (const phymod_access_t *pa, int8_t val);
    495 
    496 /** Get function for DFE Tap1.
    497  * @param pa phymod_access_t struct
    498  * @param *val DFE1 read value
    499  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    500  */
    501 SDK_STATIC err_code_t _get_rx_dfe1 (const phymod_access_t *pa, int8_t *val);
    502 
    503 /** Set function for DFE Tap2.
    504  * @param pa phymod_access_t struct
    505  * @param val signed input value
    506  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    507  */
    508 SDK_STATIC err_code_t _set_rx_dfe2 (const phymod_access_t *pa, int8_t val);
    509 
    510 /** Get function for DFE Tap2.
    511  * @param pa phymod_access_t struct
    512  * @param *val DFE2 read value
    513  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    514  */
    515 SDK_STATIC err_code_t _get_rx_dfe2 (const phymod_access_t *pa, int8_t *val);
    516 
    517 /** Set function for DFE Tap3.
    518  * @param pa phymod_access_t struct
    519  * @param val signed input value
    520  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    521  */
    522 static err_code_t _set_rx_dfe3 (const phymod_access_t *pa, int8_t val);
    523 
    524 /** Get function for DFE Tap3.
    525  * @param pa phymod_access_t struct
    526  * @param *val DFE3 read value
    527  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    528  */
    529 static err_code_t _get_rx_dfe3 (const phymod_access_t *pa, int8_t *val);
    530 
    531 /** Set function for DFE Tap4.
    532  * @param pa phymod_access_t struct
    533  * @param val signed input value
    534  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    535  */
    536 static err_code_t _set_rx_dfe4 (const phymod_access_t *pa, int8_t val);
    537 
    538 /** Get function for DFE Tap4.
    539  * @param pa phymod_access_t struct
    540  * @param *val DFE4 read value
    541  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    542  */
    543 static err_code_t _get_rx_dfe4 (const phymod_access_t *pa, int8_t *val);
    544 
    545 /** Set function for DFE Tap5.
    546  * @param pa phymod_access_t struct
    547  * @param val signed input value
    548  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    549  */
    550 static err_code_t _set_rx_dfe5 (const phymod_access_t *pa, int8_t val);
    551 
    552 /** Get function for DFE Tap5
    553  * @param pa phymod_access_t struct
    554  * @param *val DFE5 read value
    555  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    556  */
    557 static err_code_t _get_rx_dfe5 (const phymod_access_t *pa, int8_t *val);
    558 
    559 /* Set/Get DFE tap values */
    560 static err_code_t _set_rx_dfe6 (const phymod_access_t *pa, int8_t val);
    561 static err_code_t _get_rx_dfe6 (const phymod_access_t *pa, int8_t *val);
    562 static err_code_t _set_rx_dfe7 (const phymod_access_t *pa, int8_t val);
    563 static err_code_t _get_rx_dfe7 (const phymod_access_t *pa, int8_t *val);
    564 static err_code_t _set_rx_dfe8 (const phymod_access_t *pa, int8_t val);
    565 static err_code_t _get_rx_dfe8 (const phymod_access_t *pa, int8_t *val);
    566 static err_code_t _set_rx_dfe9 (const phymod_access_t *pa, int8_t val);
    567 static err_code_t _get_rx_dfe9 (const phymod_access_t *pa, int8_t *val);
    568 static err_code_t _set_rx_dfe10 (const phymod_access_t *pa, int8_t val);
    569 static err_code_t _get_rx_dfe10 (const phymod_access_t *pa, int8_t *val);
    570 static err_code_t _set_rx_dfe11 (const phymod_access_t *pa, int8_t val);
    571 static err_code_t _get_rx_dfe11 (const phymod_access_t *pa, int8_t *val);
    572 static err_code_t _set_rx_dfe12 (const phymod_access_t *pa, int8_t val);
    573 static err_code_t _get_rx_dfe12 (const phymod_access_t *pa, int8_t *val);
    574 static err_code_t _set_rx_dfe13 (const phymod_access_t *pa, int8_t val);
    575 static err_code_t _get_rx_dfe13 (const phymod_access_t *pa, int8_t *val);
    576 static err_code_t _set_rx_dfe14 (const phymod_access_t *pa, int8_t val);
    577 static err_code_t _get_rx_dfe14 (const phymod_access_t *pa, int8_t *val);
    578 
    579 /* Set/Get TX Tap values */
    580 static err_code_t _set_tx_pre (const phymod_access_t *pa, uint8_t val);
    581 static err_code_t _set_tx_amp (const phymod_access_t *pa, int8_t val);
    582 static err_code_t _get_tx_amp (const phymod_access_t *pa, int8_t *val);
    583 static err_code_t _set_tx_main (const phymod_access_t *pa, uint8_t val);
    584 static err_code_t _set_tx_post1 (const phymod_access_t *pa, uint8_t val);
    585 static err_code_t _set_tx_post2 (const phymod_access_t *pa, int8_t val);
    586 static err_code_t _set_tx_post3 (const phymod_access_t *pa, int8_t val);
    587 static err_code_t _get_tx_post3 (const phymod_access_t *pa, int8_t *val);
    588 
    589 /* Lane Config Struct */
    590 static err_code_t _update_uc_lane_config_st (const phymod_access_t *pa, struct falcon_tsc_uc_lane_config_st *st);
    591 static err_code_t _update_uc_lane_config_word (const phymod_access_t *pa, struct falcon_tsc_uc_lane_config_st *st);
    592 
    593 /* Lane User Control Disable Startup Function Struct */
    594 static err_code_t _update_usr_ctrl_disable_functions_st (const phymod_access_t *pa, struct falcon_tsc_usr_ctrl_disable_functions_st *st);
    595 static err_code_t _update_usr_ctrl_disable_functions_byte (const phymod_access_t *pa, struct falcon_tsc_usr_ctrl_disable_functions_st *st);
    596 
    597 /* Lane User Control Disable Startup DFE Function Struct */
    598 static err_code_t _update_usr_ctrl_disable_dfe_functions_st (const phymod_access_t *pa, struct falcon_tsc_usr_ctrl_disable_dfe_functions_st *st);
    599 static err_code_t _update_usr_ctrl_disable_dfe_functions_byte (const phymod_access_t *pa, struct falcon_tsc_usr_ctrl_disable_dfe_functions_st *st);
    600 
    601 /* Core Config Struct */
    602 static err_code_t _update_uc_core_config_st (const phymod_access_t *pa, struct  falcon_tsc_uc_core_config_st *st);
    603 static err_code_t _update_uc_core_config_word (const phymod_access_t *pa, struct  falcon_tsc_uc_core_config_st *st);
    604 
    605 static uint8_t _falcon_tsc_rdb_uc_var (const phymod_access_t *pa, err_code_t *err_code_p, uint16_t addr);
    606 static uint16_t _falcon_tsc_rdw_uc_var (const phymod_access_t *pa, err_code_t *err_code_p, uint16_t addr);
    607 static err_code_t _falcon_tsc_wrb_uc_var (const phymod_access_t *pa, uint16_t addr, uint8_t wr_val);
    608 static err_code_t _falcon_tsc_wrw_uc_var (const phymod_access_t *pa, uint16_t addr, uint16_t wr_val);
    609 static err_code_t _falcon_tsc_display_ber_scan_data (const phymod_access_t *pa, uint8_t ber_scan_mode, uint8_t timer_control, uint8_t max_error_control);
    610 
    611 
    612 /*--------------------------*/
    613 /*  Register field polling  */
    614 /*--------------------------*/
    615 
    616 /** Polls lane variable "usr_diag_status" to verify data is available in uC diag buffer.
    617  * It then reads a WORD of data wich is 2 float8_t samples, it converts them to uint32_t
    618  * and returns them in the memory pointed to by *data.
    619  * Define macro CUSTOM_REG_POLLING to replace the default implementation provided in falcon_tsc_functions.c.
    620  *
    621  * @param pa phymod_access_t struct
    622  * @param *data is pointer to 2 element array of uint32_tpassed from uC through dsc_data
    623  * @param *status returns a status byte           \n
    624  *    bit 15 - indicates the ey scan is complete \n
    625  *    bit 14 - indicates uC is slower than read access \n
    626  *    bit 13 - indicates uC is faster than read access \n
    627  *    bit 7-0 - indicates amount of data in the uC buffer
    628  *
    629  * @param pa phymod_access_t struct
    630  * @param timeout_ms Maximum time interval in milliseconds for which the polling is done
    631  * @return Error code generated by polling function (returns ERR_CODE_NONE if no errors)
    632  */
    633 err_code_t falcon_tsc_poll_diag_eye_data (const phymod_access_t *pa, uint32_t *data, uint16_t *status, uint32_t timeout_ms);
    634 
    635 /** Polls lane variable "usr_diag_status" to verify data is available in uC diag buffer.
    636  * Define macro CUSTOM_REG_POLLING to replace the default implementation provided in falcon_tsc_functions.c.
    637  *
    638  * @param pa phymod_access_t struct
    639  * @param *status returns a status byte \n
    640  *    bit 15 - indicates the ey scan is complete \n
    641  *    bit 14-0 - reserved for debug
    642  *
    643  * @param pa phymod_access_t struct
    644  * @param timeout_ms Maximum time interval in milliseconds for which the polling is done
    645  * @return Error code generated by polling function (returns ERR_CODE_NONE if no errors)
    646  */
    647 err_code_t falcon_tsc_poll_diag_done (const phymod_access_t *pa, uint16_t *status, uint32_t timeout_ms);
    648 
    649 /** Polls for register field "uc_dsc_ready_for_cmd" to be 1 within the time interval specified by timeout_ms.
    650  * Function returns 0 if polling passes, else it returns error code.
    651  * Define macro CUSTOM_REG_POLLING to replace the default implementation provided in falcon_tsc_functions.c.
    652  * @param pa phymod_access_t struct
    653  * @param timeout_ms Maximum time interval in milliseconds for which the polling is done
    654  * @return Error code generated by polling function (returns ERR_CODE_NONE if no errors)
    655  */
    656 err_code_t falcon_tsc_poll_uc_dsc_ready_for_cmd_equals_1 (const phymod_access_t *pa, uint32_t timeout_ms);
    657 
    658 /** Polls for register field "dsc_state" to be "DSC_STATE_UC_TUNE"
    659  * within the time interval specified by timeout_ms.
    660  * Function returns 0 if polling passes, else it returns error code.
    661  * Define macro CUSTOM_REG_POLLING to replace the default implementation provided in
    662  * falcon_tsc_functions.c.
    663  * @param pa phymod_access_t struct
    664  * @param timeout_ms Maximum time interval in milliseconds for which the polling is done
    665  * @return Error code generated by polling function (returns ERR_CODE_NONE if no errors)
    666  */
    667 err_code_t falcon_tsc_poll_dsc_state_equals_uc_tune (const phymod_access_t *pa, uint32_t timeout_ms);
    668 
    669 
    670 /** Polls for register field "micro_ra_initdone" to be 1 within the time interval specified by timeout_ms.
    671  * Function returns 0 if polling passes, else it returns error code.
    672  * Define macro CUSTOM_REG_POLLING to replace the default implementation provided in falcon_tsc_functions.c.
    673  * @param pa phymod_access_t struct
    674  * @param timeout_ms Maximum time interval in milliseconds for which the polling is done
    675  * @return Error code generated by polling function (returns ERR_CODE_NONE if no errors)
    676  */
    677 err_code_t falcon_tsc_poll_micro_ra_initdone (const phymod_access_t *pa, uint32_t timeout_ms);
    678 
    679 
    680 #endif