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

gtimer.h (3423B)


      1 /** \file bcm_int/dnx/gtimer/gtimer.h
      2  * 
      3  * Internal DNX GTIMER APIs to be used from other modules
      4  */
      5 
      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-2020 Broadcom Inc. All rights reserved.
     10  */
     11 
     12 #ifndef _BCMINT_DNX_GTIMER_GTIMER_H_INCLUDED
     13 /*
     14  * { 
     15  */
     16 #define _BCMINT_DNX_GTIMER_GTIMER_H_INCLUDED
     17 
     18 /**
     19  * \brief This file is only used by DNX (JR2 family). Including it by
     20  * software that is not specific to DNX is an error.
     21  */
     22 #ifndef BCM_DNX_SUPPORT
     23 #error "This file is for use by DNX (JR2) family only!"
     24 #endif
     25 
     26 #include <soc/chip.h>
     27 #include <shared/shrextend/shrextend_debug.h>
     28 
     29 /**
     30  * \brief - configure and activate gtimer for a specified block
     31  * 
     32  * \param [in] unit - unit number
     33  * \param [in] period - number of clocks to run gtimer
     34  * \param [in] block_type - block type for which to activate gtimer
     35  * \param [in] instance - block instance for which to activate gtimer - value of -1 means all instances
     36  *
     37  * \return
     38  *   shr_error_e
     39  *
     40  * \remark
     41  *   *  Gtimer is a mechanism that allows certain counters in a block to sample for a defined period of clock.
     42  *      Thus allowing to calculate rate instead of flat counter value.
     43  * \see
     44  *   * None
     45  */
     46 shr_error_e dnx_gtimer_set(
     47     int unit,
     48     uint32 period,
     49     soc_block_type_t block_type,
     50     int instance);
     51 
     52 /**
     53  * \brief - get gtimer enabled status for a specified block
     54  * 
     55  * \param [in] unit - unit number
     56  * \param [in] block_type - block type for which to activate gtimer
     57  * \param [in] instance - block instance for which to activate gtimer - value of -1 means all instances
     58  * \param [out] is_enabled - return gtimer enabled status
     59  *
     60  * \return
     61  *   shr_error_e
     62  *
     63  * \remark
     64  *   * None
     65  * \see
     66  *   * None
     67  */
     68 shr_error_e dnx_gtimer_get(
     69     int unit,
     70     soc_block_type_t block_type,
     71     int instance,
     72     int *is_enabled);
     73 
     74 /**
     75  * \brief - wait for gtimer sampling period on given block to end
     76  *
     77  * \param [in] unit - unit number
     78  * \param [in] block_type - block type for which to wait
     79  * \param [in] instance - block instance for which to wait - value of -1 means all instances
     80  *   
     81  * \return
     82  *   shr_error_e 
     83  *   
     84  * \remark
     85  *   * None
     86  * \see
     87  *   * None
     88  */
     89 shr_error_e dnx_gtimer_wait(
     90     int unit,
     91     soc_block_type_t block_type,
     92     int instance);
     93 
     94 /**
     95  * \brief - clear block from working in gtimer mode
     96  * 
     97  * \param [in] unit - unit number
     98  * \param [in] block_type - block type to clear
     99  * \param [in] instance - block instance to clear - value of -1 means all instances
    100  *   
    101  * \return
    102  *   shr_error_e 
    103  *   
    104  * \remark
    105  *   * None
    106  * \see
    107  *   * None
    108  */
    109 shr_error_e dnx_gtimer_clear(
    110     int unit,
    111     soc_block_type_t block_type,
    112     int instance);
    113 
    114 /**
    115  * \brief - check if block type is supported by gtimer infrastructure.
    116  *
    117  * \param [in] unit - unit number
    118  * \param [in] block_type - block type to check if supported
    119  * \param [out] is_supported - indication if the block type is supported or not.
    120  *                             1 - block type is supported.
    121  *                             0 - block type is not supported.
    122  *
    123  * \return
    124  *   shr_error_e
    125  *
    126  * \remark
    127  *   * None
    128  * \see
    129  *   * None
    130  */
    131 shr_error_e dnx_gtimer_block_type_is_supported(
    132     int unit,
    133     soc_block_type_t block_type,
    134     int *is_supported);
    135 
    136 /*
    137  * } 
    138  */
    139 #endif /* _BCMINT_DNX_GTIMER_GTIMER_H_INCLUDED */