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

diag_dnxc_diag.h (5026B)


      1 /**
      2  *  \file diag_dnxc_diag.h 
      3  * structure, definition and utilities for diagnostic pack 
      4  */
      5 /*
      6  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      7  * 
      8  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      9  */
     10 #ifndef DIAG_DNXC_DIAG_H_INCLUDED
     11 #define DIAG_DNXC_DIAG_H_INCLUDED
     12 #include <soc/mcm/enum_max.h>
     13 /* 
     14 * { Local Defines
     15 */
     16 
     17 #define BLOCK_MAX_INDEX (SOC_MAX_NUM_BLKS)   /* defined by MCM release */
     18 #define NOF_BITS_PER_WORD (32)
     19 #define FULL_32_BITS_MASK (0xffffffff)
     20 #define ASCII_CODE_OF_0 (48)
     21 #define ASCII_CODE_OF_9 (57)
     22 #define BLOCK_NAME_LENGTH 6     /* Length of block name */
     23 /*
     24  * Maximal number of characters assigned to uint64 when converted to string,
     25  * as decimal, including separateing commas, every 3 digits. Includes ending NULL
     26  * XX,XXX,XXX,XXX,XXX,XXX,XXX
     27  * Note that this definition may also be used, of course, as container for Hex
     28  * conversion.
     29  */
     30 #define MAX_UINT64_SIZE_AS_STRING 27
     31 
     32 /* 
     33 * } Local Defines
     34 */
     35 
     36 /**
     37  * \brief
     38  *   translate hex value to a string"
     39  * \param [in] val - hex value stored in the uint32 array
     40  * \param [in] nof_bit - number of bits this decimal value occupies 
     41  * \param [out] buf - buffer to store the string
     42  * \return 
     43  *      Standard error handling
     44  * \see
     45  *   MAX_UINT64_SIZE_AS_STRING
     46  */
     47 shr_error_e format_value_hex_to_str(
     48     uint32 *val,
     49     int nof_bit,
     50     char *buf);
     51 
     52 /**
     53  * \brief
     54  *   translate decimal (max 64 bits) or hex value  to a string"
     55  * \param [in] val - the value stored in the uint32 array
     56  * \param [in] nof_bit - number of bits this decimal value occupies 
     57  * \param [in] in_hex - indicate decimal or hex string is required 
     58  * \param [out] buf - buffer to store the string
     59  * \return 
     60  *      Standard error handling
     61  * \see
     62  *   MAX_UINT64_SIZE_AS_STRING
     63  */
     64 shr_error_e format_value_to_str(
     65     uint32 *val,
     66     int nof_bit,
     67     int in_hex,
     68     char *buf);
     69 
     70 /**
     71  * \brief
     72  *   add two values together and then translate the sum (decimal or hex) to a string
     73  *   the supported maximal value is 64 bits.
     74  * \param [in] val_1 - value 1 stored in the uint32 array
     75  * \param [in] val_2 - value 2 stored in the uint32 array
     76  * \param [in] nof_bit - number of bits this decimal value occupies 
     77  * \param [in] in_hex - indicate decimal or hex string is required 
     78  * \param [out] buf - buffer to store the string
     79  * \param [out] overflow - indicates if sum of val_1+val_2 has overflow 
     80  * \return 
     81  *      Standard error handling
     82  */
     83 shr_error_e sum_value_to_str(
     84     uint32 *val_1,
     85     uint32 *val_2,
     86     int nof_bit,
     87     int in_hex,
     88     char *buf,
     89     int *overflow);
     90 
     91 /**
     92  * \brief
     93  *   To start gtimer of the blocks specified by block index array
     94  * \param [in] unit - Unit #
     95  * \param [in] nof_block - number of blocks contained in block_ids array
     96  * \param [in] block_ids - an array to contain the blockes
     97  * \param [in] interval - indicate how long gtimer keeps enabled (usec)
     98  * \return
     99  *      Standard error handling
    100  */
    101 shr_error_e sh_dnxc_diag_block_gtimer_start(
    102     int unit,
    103     int nof_block,
    104     int *block_ids,
    105     int interval);
    106 
    107 /**
    108  * \brief
    109  *   To stop gtimer of the blocks specified by block index array
    110  * \param [in] unit - Unit #
    111  * \param [in] nof_block - number of blocks contained in block_ids array
    112  * \param [in] block_ids - an array to contain the blockes
    113  * \return
    114  *      Standard error handling
    115  */
    116 shr_error_e sh_dnxc_diag_block_gtimer_stop(
    117     int unit,
    118     int nof_block,
    119     int *block_ids);
    120 
    121 /**
    122  * \brief
    123  *   Check if the register match the blocks specified by "*match_n"
    124  * \param [in] unit - Unit #
    125  * \param [in] match_n - to specify block name that block should match with
    126  * \param [out] nof_block - to get number of blocks that this register matches with
    127  * \param [out] block_ids - an integer array to get all of block ID that this register matches with
    128  * \return
    129  *      Standard error handling
    130  */
    131 shr_error_e counter_block_name_match(
    132     int unit,
    133     char *match_n,
    134     int *nof_block,
    135     int *block_ids);
    136 
    137 /**
    138  * \brief
    139  *   To get the counter value and overflow value.
    140  * \param [in] unit - Unit #
    141  * \param [in] interval - indicate the interval of g-timer (second)
    142  * \param [in] reg - The register id of counter
    143  * \param [in] reg_value - The value of register
    144  * \param [in] cnt_field - The field of counter
    145  * \param [in] cnt_field_len - The field length of counter.
    146  * \param [out] fld_value - The counter value
    147  * \param [out] ovf_value - The overflow field value
    148  * \return
    149  *      Standard error handling
    150  */
    151 shr_error_e sh_dnxc_get_cnt_and_ovf_value(
    152     int unit,
    153     uint32 interval,
    154     soc_reg_t reg,
    155     soc_reg_above_64_val_t reg_value,
    156     soc_field_t cnt_field,
    157     uint32 cnt_field_len,
    158     soc_reg_above_64_val_t fld_value,
    159     uint32 *ovf_value);
    160 /* 
    161 * } Local Functions
    162 */
    163 
    164 /* 
    165 * { Local Structures
    166 */
    167 
    168 /* 
    169 * } Local Structures
    170 */
    171 
    172 extern sh_sand_man_t Sh_dnxc_diag_ser_man;
    173 extern sh_sand_cmd_t Sh_dnxc_diag_ser_cmds[];
    174 #endif /* DIAG_DNXC_DIAG_H_INCLUDED */