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

merlin16_api_uc_common.h (4888B)


      1 /***************************************************************************************
      2  ***************************************************************************************
      3  *                                                                                     *
      4  *  Revision      :   *
      5  *                                                                                     *
      6  *  Description   :  Defines and Enumerations required by Merlin16 APIs                *
      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_api_uc_common.h
     22  * Defines and Enumerations shared by Merlin16 IP Specific API and Microcode
     23  */
     24 
     25 #ifndef MERLIN16_API_UC_COMMON_H
     26 #define MERLIN16_API_UC_COMMON_H
     27 
     28 /* Add Merlin16 specific items below this */ 
     29 
     30 /* Please note that when adding entries here you should update the #defines in the merlin16_pcieg3_common.h */
     31 
     32 /** OSR_MODES Enum */
     33 enum merlin16_pcieg3_osr_mode_enum {
     34   MERLIN16_PCIEG3_OSX1    = 0,
     35   MERLIN16_PCIEG3_OSX2    = 1,
     36   MERLIN16_PCIEG3_OSX3    = 2,
     37   MERLIN16_PCIEG3_OSX3P3  = 3,
     38   MERLIN16_PCIEG3_OSX4    = 4,
     39   MERLIN16_PCIEG3_OSX5    = 5,
     40   MERLIN16_PCIEG3_OSX7P5  = 6,
     41   MERLIN16_PCIEG3_OSX8    = 7,
     42   MERLIN16_PCIEG3_OSX8P25 = 8,
     43   MERLIN16_PCIEG3_OSX10   = 9
     44 };
     45 
     46 /** LANE_RATE Enum **/
     47 enum merlin16_pcieg3_rate_enum {
     48   MERLIN16_PCIEG3_GEN1 = 0,
     49   MERLIN16_PCIEG3_GEN2 = 1,
     50   MERLIN16_PCIEG3_GEN3 = 2
     51 };
     52 
     53 /* The following functions translate between a VCO frequency in MHz and the
     54  * vco_rate that is found in the Core Config Variable Structure using the
     55  * formula:
     56  *
     57  *     vco_rate = (frequency_in_ghz * 4.0) - 22.0
     58  *
     59  * Both functions round to the nearest resulting value.  This
     60  * provides the highest accuracy possible, and ensures that:
     61  *
     62  *     vco_rate == MHZ_TO_VCO_RATE(VCO_RATE_TO_MHZ(vco_rate))
     63  *
     64  * In the microcode, these functions should only be called with a numeric
     65  * literal parameter.
     66  */
     67 #define MHZ_TO_VCO_RATE(mhz) ((uint8_t)((((uint16_t)(mhz) + 125) / 250) - 22))
     68 #define VCO_RATE_TO_MHZ(vco_rate) (((uint16_t)(vco_rate) + 22) * 250)
     69 
     70 
     71 /* BOUNDARIES FOR FIR TAP VALUES
     72  *
     73  * Sources:  M16_TXFIR document (Section 1.1.2)
     74  *
     75  *   The following constraints are enforced by CL72 SW    
     76  *     pre + main + post1 + post2   <= TXFIR_SUM_LIMIT
     77  *     main - (pre + post1 + post2) >= TXFIR_V2_LIMIT
     78  *     pre + post                   <= TXFIR_PRE_POST_SUM_LIMIT
     79  *     main                         >= TXFIR_MAIN_CL72_MIN
     80  */
     81 #define TXFIR_PRE_MIN   ( 0)
     82 #define TXFIR_PRE_MAX   (10)
     83 #define TXFIR_MAIN_MIN  ( 0)
     84 #define TXFIR_MAIN_MAX  (60)
     85 #define TXFIR_POST1_MIN ( 0)
     86 #define TXFIR_POST1_MAX (24)
     87 #define TXFIR_POST2_MIN ( 0)
     88 #define TXFIR_POST2_MAX ( 6)
     89 
     90 #define TXFIR_SUM_LIMIT (60)
     91 #define TXFIR_V2_LIMIT  ( 6)
     92 #define TXFIR_PRE_POST_SUM_LIMIT (24)
     93 #define TXFIR_MAIN_CL72_MIN      (33)
     94 
     95 /** INIT values for FIR taps */
     96 #define TXFIR_PRE_INIT   ( 4)
     97 #define TXFIR_MAIN_INIT  (40)
     98 #define TXFIR_POST1_INIT (16)
     99 
    100 /** Minimum and maximum values for rx_vga_ctrl_val */
    101 /*  These are hardware limits for VGA. The tuning limits are defined separately in ucode */
    102 #define RX_VGA_CTRL_VAL_MIN (0)
    103 #define RX_VGA_CTRL_VAL_MAX (31)
    104 
    105 /* BEGIN_GENERATED_TEMPERATURE_CODE */
    106 /*
    107  * The formula for PVTMON is:
    108  *
    109  *     T = 434.10000 - 0.54619 * reg10bit
    110  */
    111 #define _bin_to_degC_double(bin_) (434.10000 - (0.54619 * (USR_DOUBLE)(bin_)))
    112 
    113 
    114 /* Identify the temperature from the PVTMON output. */
    115 #define _bin_to_degC(bin_) (((((int32_t)(  910373683L) +           \
    116                                ((int32_t)(bin_) * (   -1145443L))) \
    117                               >> 20) + 1) >> 1)
    118 
    119 /* Identify the PVTMON output corresponding to the temperature. */
    120 #define _degC_to_bin(degc_) (((((int32_t)(  416692764L) +           \
    121                                 ((int32_t)(degc_) * (    -959900L))) \
    122                                >> 18) + 1) >> 1)
    123 /* END_GENERATED_TEMPERATURE_CODE */
    124 
    125 #endif