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

ptp.c (181816B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:    ptp.c
      8  *
      9  * Purpose: 
     10  *
     11  * Functions:
     12  *      bcm_esw_ptp_acceptable_master_add
     13  *      bcm_esw_ptp_acceptable_master_enabled_get
     14  *      bcm_esw_ptp_acceptable_master_enabled_set
     15  *      bcm_esw_ptp_acceptable_master_list
     16  *      bcm_esw_ptp_acceptable_master_remove
     17  *      bcm_esw_ptp_acceptable_master_table_clear
     18  *      bcm_esw_ptp_acceptable_master_table_size_get
     19  *      bcm_esw_ptp_cb_register
     20  *      bcm_esw_ptp_cb_unregister
     21  *      bcm_esw_ptp_clock_accuracy_get
     22  *      bcm_esw_ptp_clock_accuracy_set
     23  *      bcm_esw_ptp_clock_max_steps_removed_get
     24  *      bcm_esw_ptp_clock_max_steps_removed_set
     25  *      bcm_esw_ptp_clock_create
     26  *      bcm_esw_ptp_clock_current_dataset_get
     27  *      bcm_esw_ptp_clock_default_dataset_get
     28  *      bcm_esw_ptp_clock_domain_get
     29  *      bcm_esw_ptp_clock_domain_set
     30  *      bcm_esw_ptp_clock_get
     31  *      bcm_esw_ptp_clock_parent_dataset_get
     32  *      bcm_esw_ptp_clock_port_announce_receipt_timeout_get
     33  *      bcm_esw_ptp_clock_port_announce_receipt_timeout_set
     34  *      bcm_esw_ptp_clock_port_configure
     35  *      bcm_esw_ptp_clock_port_dataset_get
     36  *      bcm_esw_ptp_clock_port_delay_mechanism_get
     37  *      bcm_esw_ptp_clock_port_delay_mechanism_set
     38  *      bcm_esw_ptp_clock_port_disable
     39  *      bcm_esw_ptp_clock_port_enable
     40  *      bcm_esw_ptp_clock_port_identity_get
     41  *      bcm_esw_ptp_clock_port_info_get
     42  *      bcm_esw_ptp_clock_port_latency_get
     43  *      bcm_esw_ptp_clock_port_latency_set
     44  *      bcm_esw_ptp_clock_port_log_announce_interval_get
     45  *      bcm_esw_ptp_clock_port_log_announce_interval_set
     46  *      bcm_esw_ptp_clock_port_log_min_delay_req_interval_get
     47  *      bcm_esw_ptp_clock_port_log_min_delay_req_interval_set
     48  *      bcm_esw_ptp_clock_port_log_min_pdelay_req_interval_get
     49  *      bcm_esw_ptp_clock_port_log_min_pdelay_req_interval_set
     50  *      bcm_esw_ptp_clock_port_log_sync_interval_get
     51  *      bcm_esw_ptp_clock_port_log_sync_interval_set
     52  *      bcm_esw_ptp_clock_port_mac_get
     53  *      bcm_esw_ptp_clock_port_protocol_get
     54  *      bcm_esw_ptp_clock_port_type_get
     55  *      bcm_esw_ptp_clock_port_version_number_get
     56  *      bcm_esw_ptp_clock_priority1_get
     57  *      bcm_esw_ptp_clock_priority1_set
     58  *      bcm_esw_ptp_clock_priority2_get
     59  *      bcm_esw_ptp_clock_priority2_set
     60  *      bcm_esw_ptp_clock_slaveonly_get
     61  *      bcm_esw_ptp_clock_slaveonly_set
     62  *      bcm_esw_ptp_clock_time_get
     63  *      bcm_esw_ptp_clock_time_properties_get
     64  *      bcm_esw_ptp_clock_time_set
     65  *      bcm_esw_ptp_clock_timescale_get
     66  *      bcm_esw_ptp_clock_timescale_set
     67  *      bcm_esw_ptp_clock_traceability_get
     68  *      bcm_esw_ptp_clock_traceability_set
     69  *      bcm_esw_ptp_clock_user_description_set
     70  *      bcm_esw_ptp_clock_utc_get
     71  *      bcm_esw_ptp_clock_utc_set
     72  *      bcm_esw_ptp_ctdev_alarm_callback_register
     73  *      bcm_esw_ptp_ctdev_alarm_callback_unregister
     74  *      bcm_esw_ptp_ctdev_alpha_get
     75  *      bcm_esw_ptp_ctdev_alpha_set
     76  *      bcm_esw_ptp_ctdev_enable_get
     77  *      bcm_esw_ptp_ctdev_enable_set
     78  *      bcm_esw_ptp_ctdev_verbose_get
     79  *      bcm_esw_ptp_ctdev_verbose_set
     80  *      bcm_esw_ptp_detach
     81  *      bcm_esw_ptp_foreign_master_dataset_get
     82  *      bcm_esw_ptp_lock
     83  *      bcm_esw_ptp_unlock
     84  *      bcm_esw_ptp_init
     85  *      bcm_esw_ptp_input_channel_precedence_mode_set
     86  *      bcm_esw_ptp_input_channel_switching_mode_set
     87  *      bcm_esw_ptp_input_channels_get
     88  *      bcm_esw_ptp_input_channels_set
     89  *      bcm_esw_ptp_modular_enable_get
     90  *      bcm_esw_ptp_modular_enable_set
     91  *      bcm_esw_ptp_modular_phyts_get
     92  *      bcm_esw_ptp_modular_phyts_set
     93  *      bcm_esw_ptp_modular_portbitmap_get
     94  *      bcm_esw_ptp_modular_portbitmap_set
     95  *      bcm_esw_ptp_modular_verbose_get
     96  *      bcm_esw_ptp_modular_verbose_set
     97  *      bcm_esw_ptp_packet_counters_get
     98  *      bcm_esw_ptp_packet_counters_clear
     99  *      bcm_esw_ptp_peer_dataset_get
    100  *      bcm_esw_ptp_primary_domain_get
    101  *      bcm_esw_ptp_primary_domain_set
    102  *      bcm_esw_ptp_servo_configuration_get
    103  *      bcm_esw_ptp_servo_configuration_set
    104  *      bcm_esw_ptp_servo_status_get
    105  *      bcm_esw_ptp_servo_threshold_get
    106  *      bcm_esw_ptp_servo_threshold_set
    107  *      bcm_esw_ptp_signal_output_get
    108  *      bcm_esw_ptp_signal_output_remove
    109  *      bcm_esw_ptp_signal_output_set
    110  *      bcm_esw_ptp_signaled_unicast_master_add
    111  *      bcm_esw_ptp_signaled_unicast_master_remove
    112  *      bcm_esw_ptp_signaled_unicast_slave_list
    113  *      bcm_esw_ptp_signaled_unicast_slave_table_clear
    114  *      bcm_esw_ptp_signaling_arbiter_register
    115  *      bcm_esw_ptp_signaling_arbiter_unregister
    116  *      bcm_esw_ptp_stack_create
    117  *      bcm_esw_ptp_static_unicast_master_add
    118  *      bcm_esw_ptp_static_unicast_master_list
    119  *      bcm_esw_ptp_static_unicast_master_table_clear
    120  *      bcm_esw_ptp_static_unicast_master_table_size_get
    121  *      bcm_esw_ptp_static_unicast_slave_add
    122  *      bcm_esw_ptp_static_unicast_slave_list
    123  *      bcm_esw_ptp_static_unicast_slave_remove
    124  *      bcm_esw_ptp_static_unicast_slave_table_clear
    125  *      bcm_esw_ptp_sync_phy
    126  *      bcm_esw_ptp_telecom_g8265_init
    127  *      bcm_esw_ptp_telecom_g8265_network_option_get
    128  *      bcm_esw_ptp_telecom_g8265_network_option_set
    129  *      bcm_esw_ptp_telecom_g8265_packet_master_add
    130  *      bcm_esw_ptp_telecom_g8265_packet_master_best_get
    131  *      bcm_esw_ptp_telecom_g8265_packet_master_get
    132  *      bcm_esw_ptp_telecom_g8265_packet_master_list
    133  *      bcm_esw_ptp_telecom_g8265_packet_master_lockout_set
    134  *      bcm_esw_ptp_telecom_g8265_packet_master_non_reversion_set
    135  *      bcm_esw_ptp_telecom_g8265_packet_master_priority_override
    136  *      bcm_esw_ptp_telecom_g8265_packet_master_priority_set
    137  *      bcm_esw_ptp_telecom_g8265_packet_master_remove
    138  *      bcm_esw_ptp_telecom_g8265_packet_master_wait_duration_set
    139  *      bcm_esw_ptp_telecom_g8265_pktstats_thresholds_get
    140  *      bcm_esw_ptp_telecom_g8265_pktstats_thresholds_set
    141  *      bcm_esw_ptp_telecom_g8265_quality_level_set
    142  *      bcm_esw_ptp_telecom_g8265_receipt_timeout_get
    143  *      bcm_esw_ptp_telecom_g8265_receipt_timeout_set
    144  *      bcm_esw_ptp_telecom_g8265_shutdown
    145  *      bcm_esw_ptp_time_format_set
    146  *      bcm_esw_ptp_timesource_input_status_get
    147  *      bcm_esw_ptp_tod_input_sources_get
    148  *      bcm_esw_ptp_tod_input_sources_set
    149  *      bcm_esw_ptp_tod_output_get
    150  *      bcm_esw_ptp_tod_output_remove
    151  *      bcm_esw_ptp_tod_output_set
    152  *      bcm_esw_ptp_transparent_clock_default_dataset_get
    153  *      bcm_esw_ptp_transparent_clock_port_dataset_get
    154  *      bcm_esw_ptp_unicast_request_duration_get
    155  *      bcm_esw_ptp_unicast_request_duration_max_get
    156  *      bcm_esw_ptp_unicast_request_duration_max_set
    157  *      bcm_esw_ptp_unicast_request_duration_min_get
    158  *      bcm_esw_ptp_unicast_request_duration_min_set
    159  *      bcm_esw_ptp_unicast_request_duration_set
    160  *      bcm_esw_ptp_clock_peer_age_timer_set
    161  *      bcm_esw_ptp_clock_peer_age_timer_get
    162  *      bcm_esw_tdpll_input_clock_ql_change_callback_register
    163  *      bcm_esw_tdpll_input_clock_ql_change_callback_unregister
    164  *      bcm_esw_esmc_tx
    165  *      bcm_esw_esmc_rx_callback_register
    166  *      bcm_esw_esmc_rx_callback_unregister
    167  *      bcm_esw_esmc_tunnel_get
    168  *      bcm_esw_esmc_tunnel_set
    169  *      bcm_esw_esmc_g781_option_get()
    170  *      bcm_esw_esmc_g781_option_set()
    171  *      bcm_esw_esmc_QL_SSM_map
    172  *      bcm_esw_esmc_SSM_QL_map
    173  *      bcm_esw_tdpll_dpll_bindings_get
    174  *      bcm_esw_tdpll_dpll_bindings_set
    175  *      bcm_esw_tdpll_dpll_reference_get
    176  *      bcm_esw_tdpll_dpll_bandwidth_get
    177  *      bcm_esw_tdpll_dpll_bandwidth_set
    178  *      bcm_esw_tdpll_dpll_phase_control_get
    179  *      bcm_esw_tdpll_dpll_phase_control_set
    180  *      bcm_esw_tdpll_input_clock_control
    181  *      bcm_esw_tdpll_input_clock_mac_get
    182  *      bcm_esw_tdpll_input_clock_mac_set
    183  *      bcm_esw_tdpll_input_clock_frequency_error_get
    184  *      bcm_esw_tdpll_input_clock_threshold_state_get
    185  *      bcm_esw_tdpll_input_clock_enable_get
    186  *      bcm_esw_tdpll_input_clock_enable_set
    187  *      bcm_esw_tdpll_input_clock_l1mux_get
    188  *      bcm_esw_tdpll_input_clock_l1mux_set
    189  *      bcm_esw_tdpll_input_clock_valid_get
    190  *      bcm_esw_tdpll_input_clock_valid_set
    191  *      bcm_esw_tdpll_input_clock_frequency_get
    192  *      bcm_esw_tdpll_input_clock_frequency_set
    193  *      bcm_esw_tdpll_input_clock_ql_get
    194  *      bcm_esw_tdpll_input_clock_ql_set
    195  *      bcm_esw_tdpll_input_clock_priority_get
    196  *      bcm_esw_tdpll_input_clock_priority_set
    197  *      bcm_esw_tdpll_input_clock_lockout_get
    198  *      bcm_esw_tdpll_input_clock_lockout_set
    199  *      bcm_esw_tdpll_input_clock_monitor_interval_get
    200  *      bcm_esw_tdpll_input_clock_monitor_interval_set
    201  *      bcm_esw_tdpll_input_clock_monitor_threshold_get
    202  *      bcm_esw_tdpll_input_clock_monitor_threshold_set
    203  *      bcm_esw_tdpll_input_clock_ql_enabled_get
    204  *      bcm_esw_tdpll_input_clock_ql_enabled_set
    205  *      bcm_esw_tdpll_input_clock_revertive_get
    206  *      bcm_esw_tdpll_input_clock_revertive_set
    207  *      bcm_esw_tdpll_input_clock_best_get
    208  *      bcm_esw_tdpll_input_clock_monitor_cb_register
    209  *      bcm_esw_tdpll_input_clock_monitor_cb_unregister
    210  *      bcm_esw_tdpll_input_clock_selector_cb_register
    211  *      bcm_esw_tdpll_input_clock_selector_cb_unregister
    212  *      bcm_esw_tdpll_output_clock_enable_get
    213  *      bcm_esw_tdpll_output_clock_enable_set
    214  *      bcm_esw_tdpll_output_clock_synth_frequency_get
    215  *      bcm_esw_tdpll_output_clock_synth_frequency_set
    216  *      bcm_esw_tdpll_output_clock_deriv_frequency_get
    217  *      bcm_esw_tdpll_output_clock_deriv_frequency_set
    218  *      bcm_esw_tdpll_output_clock_holdover_data_get
    219  *      bcm_esw_tdpll_output_clock_holdover_frequency_set
    220  *      bcm_esw_tdpll_output_clock_holdover_mode_get
    221  *      bcm_esw_tdpll_output_clock_holdover_mode_set
    222  *      bcm_esw_tdpll_output_clock_holdover_reset
    223  *      bcm_esw_tdpll_esmc_rx_state_machine
    224  *      bcm_esw_tdpll_esmc_ql_get
    225  *      bcm_esw_tdpll_esmc_ql_set
    226  *      bcm_esw_tdpll_esmc_holdover_ql_get
    227  *      bcm_esw_tdpll_esmc_holdover_ql_set
    228  *      bcm_esw_tdpll_esmc_mac_get
    229  *      bcm_esw_tdpll_esmc_mac_set
    230  *      bcm_esw_tdpll_esmc_rx_enable_get
    231  *      bcm_esw_tdpll_esmc_rx_enable_set
    232  *      bcm_esw_tdpll_esmc_tx_enable_get
    233  *      bcm_esw_tdpll_esmc_tx_enable_set
    234  *      bcm_esw_tdpll_esmc_rx_portbitmap_get
    235  *      bcm_esw_tdpll_esmc_rx_portbitmap_set
    236  *      bcm_esw_tdpll_esmc_tx_portbitmap_get
    237  *      bcm_esw_tdpll_esmc_tx_portbitmap_set
    238  *      
    239  *      Private Interface functions
    240  *     _bcm_esw_ptp_hw_clear(int unit)
    241  */
    242 
    243 
    244 #if defined(INCLUDE_PTP)
    245 
    246 #include <soc/defs.h>
    247 #include <soc/drv.h>
    248 
    249 #include <sal/core/dpc.h>
    250 
    251 #include <bcm/ptp.h>
    252 #include <bcm_int/esw_dispatch.h>
    253 #include <bcm_int/common/ptp.h>
    254 #include <bcm_int/ptp_common.h>
    255 #include <bcm/error.h>
    256 
    257 /****************************************************************************/
    258 /*                     Internal functions implementation                    */
    259 /****************************************************************************/
    260 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
    261     defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_HELIX4_SUPPORT) || \
    262     defined(BCM_HURRICANE2_SUPPORT) || defined(BCM_GREYHOUND_SUPPORT) || \
    263     defined(BCM_SABER2_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT)
    264 STATIC int
    265 _bcm_esw_ptp_hw_clear(int unit);
    266 #endif
    267 
    268 /*
    269  * Function:
    270  *    _bcm_esw_ptp_hw_clear
    271  * Purpose:
    272  *    Internal routine used to clear all TimeSync Interrupt
    273  *    registers and table to default values
    274  * Parameters:
    275  *    unit           - (IN) BCM device number.
    276  * Returns:
    277  *    BCM_E_XXX
    278  */
    279 STATIC int 
    280 _bcm_esw_ptp_hw_clear(int unit)
    281 {
    282 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
    283     defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_HELIX4_SUPPORT) || \
    284     defined(BCM_HURRICANE2_SUPPORT) || defined(BCM_GREYHOUND_SUPPORT) || \
    285     defined(BCM_SABER2_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT)
    286     if (!SOC_IS_TRIDENT2PLUS(unit) && !SOC_IS_TRIDENT2(unit) &&
    287         !SOC_IS_KATANA(unit) && !SOC_IS_TRIUMPH3(unit)) {
    288         WRITE_CMIC_TIMESYNC_TIME_CAPTURE_MODEr(unit, 0);
    289         if (soc_feature(unit, soc_feature_time_v3)) {
    290             WRITE_CMIC_TIMESYNC_INTERRUPT_ENABLEr(unit, 0);
    291         }
    292     }
    293 #endif
    294     return BCM_E_NONE;
    295 }
    296 
    297 /*
    298  * Function:
    299  *      bcm_esw_ptp_acceptable_master_add
    300  * Purpose:
    301  *      Add an entry to the acceptable master table of a PTP clock.
    302  * Parameters:
    303  *      unit - Unit number
    304  *      ptp_id - PTP stack ID
    305  *      clock_num - PTP clock number
    306  *      port_num - PTP clock port number
    307  *      priority1_alt_value - Alternate priority1
    308  *      *master_info - Acceptable master address
    309  * Returns:
    310  *      int
    311  * Notes:
    312  */
    313 int
    314 bcm_esw_ptp_acceptable_master_add(
    315     int unit,
    316     bcm_ptp_stack_id_t ptp_id,
    317     int clock_num,
    318     int port_num,
    319     int priority1_alt_value,
    320     bcm_ptp_clock_peer_address_t *master_info)
    321 {
    322     int rc;
    323 
    324     rc = bcm_common_ptp_acceptable_master_add(unit, ptp_id, clock_num, port_num, 
    325              priority1_alt_value, master_info);
    326 
    327     return (rc);
    328 }
    329 
    330 /*
    331  * Function:
    332  *      bcm_esw_ptp_acceptable_master_enabled_get
    333  * Purpose:
    334  *      Get maximum number of acceptable master table entries of a PTP clock.
    335  * Parameters:
    336  *      unit - Unit number 
    337  *      ptp_id - PTP stack ID
    338  *      clock_num - PTP clock number
    339  *      port_num - PTP clock port number
    340  *      *enabled - Acceptable master table enabled Boolean
    341  * Returns:
    342  *      int
    343  * Notes:
    344  */
    345 int
    346 bcm_esw_ptp_acceptable_master_enabled_get(
    347     int unit,
    348     bcm_ptp_stack_id_t ptp_id,
    349     int clock_num,
    350     int port_num,
    351     uint8 *enabled)
    352 {
    353     int rc;
    354 
    355     rc = bcm_common_ptp_acceptable_master_enabled_get(unit, ptp_id, clock_num, port_num, 
    356              enabled);
    357 
    358     return (rc);
    359 }
    360 
    361 /*
    362  * Function:
    363  *      bcm_esw_ptp_acceptable_master_enabled_set
    364  * Purpose:
    365  *      
    366  * Parameters:
    367  *      unit - Unit number 
    368  *      ptp_id - PTP stack ID
    369  *      clock_num - PTP clock number
    370  *      port_num - PTP clock port number
    371  *      enabled - Acceptable master table enabled Boolean
    372  * Returns:
    373  *      int
    374  * Notes:
    375  */
    376 int
    377 bcm_esw_ptp_acceptable_master_enabled_set(
    378     int unit,
    379     bcm_ptp_stack_id_t ptp_id,
    380     int clock_num,
    381     int port_num,
    382     uint8 enabled)
    383 {
    384     int rc;
    385 
    386     rc = bcm_common_ptp_acceptable_master_enabled_set(unit, ptp_id, clock_num, port_num, 
    387              enabled);
    388 
    389     return (rc);
    390 }
    391 
    392 /*
    393  * Function:
    394  *      bcm_esw_ptp_acceptable_master_list
    395  * Purpose:
    396  *      List the acceptable master table of a PTP clock.
    397  * Parameters:
    398  *      unit - Unit number 
    399  *      ptp_id - PTP stack ID
    400  *      clock_num - PTP clock number
    401  *      port_num - PTP clock port number
    402  *      max_num_masters - Maximum number of acceptable master table entries
    403  *      *num_masters - Number of acceptable master table entries
    404  *      *master_addr - Acceptable master table
    405  * Returns:
    406  *      int
    407  * Notes:
    408  */
    409 int
    410 bcm_esw_ptp_acceptable_master_list(
    411     int unit,
    412     bcm_ptp_stack_id_t ptp_id,
    413     int clock_num,
    414     int port_num,
    415     int max_num_masters,
    416     int *num_masters,
    417     bcm_ptp_clock_peer_address_t *master_addr)
    418 {
    419     int rc;
    420 
    421     rc = bcm_common_ptp_acceptable_master_list(unit, ptp_id, clock_num, port_num, 
    422              max_num_masters, num_masters, master_addr);
    423 
    424     return (rc);
    425 }
    426 
    427 /*
    428  * Function:
    429  *      bcm_esw_ptp_acceptable_master_remove
    430  * Purpose:
    431  *      Remove an entry from the acceptable master table of a PTP clock.
    432  * Parameters:
    433  *      unit - Unit number 
    434  *      ptp_id - PTP stack ID
    435  *      clock_num - PTP clock number
    436  *      port_num - PTP clock port number
    437  *      *master_info - Acceptable master address
    438  * Returns:
    439  *      int
    440  * Notes:
    441  */
    442 int
    443 bcm_esw_ptp_acceptable_master_remove(
    444     int unit,
    445     bcm_ptp_stack_id_t ptp_id,
    446     int clock_num,
    447     int port_num,
    448     bcm_ptp_clock_peer_address_t *master_info)
    449 {
    450     int rc;
    451 
    452     rc = bcm_common_ptp_acceptable_master_remove(unit, ptp_id, clock_num, port_num, 
    453              master_info);
    454 
    455     return (rc);
    456 }
    457 
    458 /*
    459  * Function:
    460  *      bcm_esw_ptp_acceptable_master_table_clear
    461  * Purpose:
    462  *      Clear (i.e. remove all entries from) the acceptable master table of a PTP clock.
    463  * Parameters:
    464  *      unit - Unit number 
    465  *      ptp_id - PTP stack ID
    466  *      clock_num - PTP clock number
    467  *      port_num - PTP clock port number
    468  * Returns:
    469  *      int
    470  * Notes:
    471  */
    472 int
    473 bcm_esw_ptp_acceptable_master_table_clear(
    474     int unit,
    475     bcm_ptp_stack_id_t ptp_id,
    476     int clock_num,
    477     int port_num)
    478 {
    479     int rc;
    480 
    481     rc = bcm_common_ptp_acceptable_master_table_clear(unit, ptp_id, clock_num, port_num);
    482 
    483     return (rc);
    484 }
    485 
    486 /*
    487  * Function:
    488  *      bcm_esw_ptp_acceptable_master_table_size_get
    489  * Purpose:
    490  *      Get maximum number of acceptable master table entries of a PTP clock.
    491  * Parameters:
    492  *      unit - Unit number 
    493  *      ptp_id - PTP stack ID
    494  *      clock_num - PTP clock number
    495  *      port_num - PTP clock port number
    496  *      *max_table_entries - Maximum number of acceptable master table entries
    497  * Returns:
    498  *      int
    499  * Notes:
    500  */
    501 int
    502 bcm_esw_ptp_acceptable_master_table_size_get(
    503     int unit,
    504     bcm_ptp_stack_id_t ptp_id,
    505     int clock_num,
    506     int port_num,
    507     int *max_table_entries)
    508 {
    509     int rc;
    510 
    511     rc = bcm_common_ptp_acceptable_master_table_size_get(unit, ptp_id, clock_num, port_num, 
    512              max_table_entries);
    513 
    514     return (rc);
    515 }
    516 
    517 /*
    518  * Function:
    519  *      bcm_esw_ptp_cb_register
    520  * Purpose:
    521  *      Register a callback for handling PTP events.
    522  * Parameters:
    523  *      unit - Unit number 
    524  *      cb_types - The set of PTP callbacks types for which the specified callback should be called
    525  *      cb - A pointer to the callback function to call for the specified PTP events
    526  *      *user_data - Pointer to user data to supply in the callback
    527  * Returns:
    528  *      int
    529  * Notes:
    530  */
    531 int
    532 bcm_esw_ptp_cb_register(
    533     int unit,
    534     bcm_ptp_cb_types_t cb_types,
    535     bcm_ptp_cb cb,
    536     void *user_data)
    537 {
    538     int rc;
    539 
    540     rc = bcm_common_ptp_cb_register(unit, cb_types, cb, user_data);
    541 
    542     return (rc);
    543 }
    544 
    545 /*
    546  * Function:
    547  *      bcm_esw_ptp_cb_unregister
    548  * Purpose:
    549  *      Unregister a callback for handling PTP events.
    550  * Parameters:
    551  *      unit - Unit number 
    552  *      cb_types - The set of PTP events to unregister for the specified callback
    553  *      cb - A pointer to the callback function to unregister from the specified PTP events
    554  * Returns:
    555  *      int
    556  * Notes:
    557  */
    558 int
    559 bcm_esw_ptp_cb_unregister(
    560     int unit,
    561     bcm_ptp_cb_types_t cb_types,
    562     bcm_ptp_cb cb)
    563 {
    564     int rc;
    565 
    566     rc = bcm_common_ptp_cb_unregister(unit, cb_types, cb);
    567 
    568     return (rc);
    569 }
    570 
    571 /*
    572  * Function:
    573  *      bcm_esw_ptp_clock_accuracy_get
    574  * Purpose:
    575  *      Get clock quality, clock accuracy member of a PTP clock default dataset.
    576  * Parameters:
    577  *      unit - Unit number 
    578  *      ptp_id - PTP stack ID
    579  *      clock_num - PTP clock number
    580  *      *accuracy - PTP clock accuracy
    581  * Returns:
    582  *      int
    583  * Notes:
    584  */
    585 int
    586 bcm_esw_ptp_clock_accuracy_get(
    587     int unit,
    588     bcm_ptp_stack_id_t ptp_id,
    589     int clock_num,
    590     bcm_ptp_clock_accuracy_t *accuracy)
    591 {
    592     int rc;
    593 
    594     rc = bcm_common_ptp_clock_accuracy_get(unit, ptp_id, clock_num, accuracy);
    595 
    596     return (rc);
    597 }
    598 
    599 /*
    600  * Function:
    601  *      bcm_esw_ptp_clock_accuracy_set
    602  * Purpose:
    603  *      Set clock quality, clock accuracy member of a PTP clock default dataset.
    604  * Parameters:
    605  *      unit - Unit number 
    606  *      ptp_id - PTP stack ID
    607  *      clock_num - PTP clock number
    608  *      *accuracy - PTP clock accuracy
    609  * Returns:
    610  *      int
    611  * Notes:
    612  */
    613 int
    614 bcm_esw_ptp_clock_accuracy_set(
    615     int unit,
    616     bcm_ptp_stack_id_t ptp_id,
    617     int clock_num,
    618     bcm_ptp_clock_accuracy_t *accuracy)
    619 {
    620     int rc;
    621 
    622     rc = bcm_common_ptp_clock_accuracy_set(unit, ptp_id, clock_num, accuracy);
    623 
    624     return (rc);
    625 }
    626 
    627 /*
    628  * Function:
    629  *      bcm_esw_ptp_clock_max_steps_removed_get
    630  * Purpose:
    631  *      Get maxStepsRemoved configured for the PTP clock.
    632  * Parameters:
    633  *      unit - Unit number
    634  *      ptp_id - PTP stack ID
    635  *      clock_num - PTP clock number
    636  *      *max_steps_removed - max steps removed for the PTP clock
    637  * Returns:
    638  *      int
    639  * Notes:
    640  */
    641 int
    642 bcm_esw_ptp_clock_max_steps_removed_get(
    643     int unit,
    644     bcm_ptp_stack_id_t ptp_id,
    645     int clock_num,
    646     uint8 *max_steps_removed)
    647 {
    648     int rc;
    649 
    650     rc = bcm_common_ptp_clock_max_steps_removed_get(unit, ptp_id, clock_num, max_steps_removed);
    651 
    652     return (rc);
    653 }
    654 
    655 /*
    656  * Function:
    657  *     bcm_esw_ptp_clock_max_steps_removed_set
    658  * Purpose:
    659  *     Set max steps removed for the PTP clock.
    660  * Parameters:
    661  *      unit - Unit number
    662  *      ptp_id - PTP stack ID
    663  *      clock_num - PTP clock number
    664  *      max_steps_removed - max acceptable steps removed
    665  * Returns:
    666  *      int
    667  * Notes:
    668  */
    669 int bcm_esw_ptp_clock_max_steps_removed_set
    670 (
    671     int unit,
    672     bcm_ptp_stack_id_t ptp_id,
    673     int clock_num,
    674     uint8 max_steps_removed)
    675 {
    676     int rc;
    677 
    678     rc = bcm_common_ptp_clock_max_steps_removed_set(unit, ptp_id, clock_num, max_steps_removed);
    679 
    680     return (rc);
    681 }
    682 
    683 /*
    684  * Function:
    685  *      bcm_esw_ptp_clock_quality_get
    686  * Purpose:
    687  *      Get clock quality information a PTP clock default dataset.
    688  * Parameters:
    689  *      unit - Unit number 
    690  *      ptp_id - PTP stack ID
    691  *      clock_num - PTP clock number
    692  *      *clock_quality - PTP clock quality
    693  *      flags - identify fields of bcm_ptp_clock_quality_t to get
    694  * Returns:
    695  *      int
    696  * Notes:
    697  */
    698 int
    699 bcm_esw_ptp_clock_quality_get(
    700     int unit,
    701     bcm_ptp_stack_id_t ptp_id,
    702     int clock_num,
    703     bcm_ptp_clock_quality_t *clock_quality,
    704     uint32 flags)
    705 {
    706     int rc;
    707 
    708     rc = bcm_common_ptp_clock_quality_get(unit, ptp_id, clock_num, clock_quality, flags);
    709 
    710     return (rc);
    711 }
    712 
    713 /*
    714  * Function:
    715  *      bcm_esw_ptp_clock_quality_set
    716  * Purpose:
    717  *      Set clock quality information of a PTP clock default dataset.
    718  * Parameters:
    719  *      unit - Unit number 
    720  *      ptp_id - PTP stack ID
    721  *      clock_num - PTP clock number
    722  *      clock_quality - PTP clock quality
    723  *      flags - identify fields of bcm_ptp_clock_quality_t to configure
    724  * Returns:
    725  *      int
    726  * Notes:
    727  */
    728 int
    729 bcm_esw_ptp_clock_quality_set(
    730     int unit,
    731     bcm_ptp_stack_id_t ptp_id,
    732     int clock_num,
    733     bcm_ptp_clock_quality_t clock_quality,
    734     uint32 flags)
    735 {
    736     int rc;
    737 
    738     rc = bcm_common_ptp_clock_quality_set(unit, ptp_id, clock_num, clock_quality, flags);
    739 
    740     return (rc);
    741 }
    742 
    743 /*
    744  * Function:
    745  *      bcm_esw_ptp_g8275p1_traceability_info_clock_class_map
    746  * Purpose:
    747  *      Retrieve applicable clock class value for given clock traceability information
    748  * Parameters:
    749  *      unit - Unit number 
    750  *      ptp_id - PTP stack ID
    751  *      clock_num - PTP clock number
    752  *      traceability_info - clock traceability information
    753  *      clock_class - clock class applicable to the provided traceability information as per G8275.1
    754  * Returns:
    755  *      int
    756  * Notes:
    757  */
    758 int
    759 bcm_esw_ptp_g8275p1_traceability_info_clock_class_map(
    760     int unit,
    761     bcm_ptp_stack_id_t ptp_id,
    762     int clock_num,
    763     bcm_ptp_g8275p1_clock_traceability_info_t traceability_info,
    764     uint8 *clock_class)
    765 {
    766     int rc;
    767 
    768     rc = bcm_common_ptp_g8275p1_traceability_info_clock_class_map(unit, ptp_id, clock_num, traceability_info, clock_class);
    769 
    770     return (rc);
    771 }
    772 
    773 /*
    774  * Function:
    775  *      bcm_esw_ptp_clock_local_priority_get
    776  * Purpose:
    777  *      Get local priority of a PTP clock.
    778  * Parameters:
    779  *      unit - Unit number
    780  *      ptp_id - PTP stack ID
    781  *      clock_num - PTP clock number
    782  *      *local_priority - PTP clock local priority
    783  * Returns:
    784  *      int
    785  * Notes:
    786  */
    787 int
    788 bcm_esw_ptp_clock_local_priority_get(
    789     int unit,
    790     bcm_ptp_stack_id_t ptp_id,
    791     int clock_num,
    792     uint8 *local_priority)
    793 {
    794     int rc;
    795 
    796     rc = bcm_common_ptp_clock_local_priority_get(unit, ptp_id, clock_num, local_priority);
    797 
    798     return (rc);
    799 }
    800 
    801 /*
    802  * Function:
    803  *      bcm_esw_ptp_clock_local_priority_set
    804  * Purpose:
    805  *      Set local priority of a PTP clock.
    806  * Parameters:
    807  *      unit - Unit number
    808  *      ptp_id - PTP stack ID
    809  *      clock_num - PTP clock number
    810  *      local_priority - PTP clock local priority
    811  * Returns:
    812  *      int
    813  * Notes:
    814  */
    815 int
    816 bcm_esw_ptp_clock_local_priority_set(
    817     int unit,
    818     bcm_ptp_stack_id_t ptp_id,
    819     int clock_num,
    820     uint8 local_priority)
    821 {
    822     int rc;
    823 
    824     rc = bcm_common_ptp_clock_local_priority_set(unit, ptp_id, clock_num, local_priority);
    825 
    826     return (rc);
    827 }
    828 
    829 /*
    830  * Function:
    831  *      bcm_esw_ptp_clock_peer_age_timer_get
    832  * Purpose:
    833  *      Get slave peer aging time for PTP clock
    834  * Parameters:
    835  *      unit - Unit number
    836  *      ptp_id - PTP stack ID
    837  *      clock_num - PTP clock number
    838  *      *aging_time - PTP clock peer aging time
    839  * Returns:
    840  *      int
    841  * Notes:
    842  */
    843 int
    844 bcm_esw_ptp_clock_peer_age_timer_get(
    845     int unit,
    846     bcm_ptp_stack_id_t ptp_id,
    847     int clock_num,
    848     uint8 *aging_time)
    849 {
    850     int rc;
    851 
    852     rc = bcm_common_ptp_clock_peer_age_timer_get(unit, ptp_id, clock_num, aging_time);
    853 
    854     return (rc);
    855 }
    856 
    857 /*
    858  * Function:
    859  *      bcm_esw_ptp_clock_peer_age_timer_set
    860  * Purpose:
    861  *      Set slave peer aging time for PTP clock
    862  * Parameters:
    863  *      unit - Unit number
    864  *      ptp_id - PTP stack ID
    865  *      clock_num - PTP clock number
    866  *      aging_time - PTP clock peer aging time
    867  * Returns:
    868  *      int
    869  * Notes:
    870  */
    871 int
    872 bcm_esw_ptp_clock_peer_age_timer_set(
    873     int unit,
    874     bcm_ptp_stack_id_t ptp_id,
    875     int clock_num,
    876     uint8 aging_time)
    877 {
    878     int rc;
    879 
    880     rc = bcm_common_ptp_clock_peer_age_timer_set(unit, ptp_id, clock_num, aging_time);
    881 
    882     return (rc);
    883 }
    884 
    885 
    886 /*
    887  * Function:
    888  *      bcm_esw_ptp_pkt_flags_override_get
    889  * Purpose:
    890  *      Get Override Mask/Value of flags for PTP clock
    891  * Parameters:
    892  *      unit - Unit number
    893  *      ptp_id - PTP stack ID
    894  *      clock_num - PTP clock number
    895  *      override_flag - Override Mask for flags to set
    896  *      override_value - Override Value for flags to set
    897  * Returns:
    898  *      int
    899  * Notes:
    900  */
    901 int
    902 bcm_esw_ptp_pkt_flags_override_get(
    903     int unit,
    904     bcm_ptp_stack_id_t ptp_id,
    905     int clock_num,
    906     uint32 *override_flag,
    907     uint32 *override_value)
    908 {
    909     int rc;
    910 
    911     rc = bcm_common_ptp_pkt_flags_override_get(unit, ptp_id, clock_num, override_flag, override_value);
    912 
    913     return (rc);
    914 }
    915 
    916 /*
    917  * Function:
    918  *      bcm_esw_ptp_pkt_flags_override_set 
    919  * Purpose:
    920  *      Set Override Mask/Value of flags for PTP clock
    921  * Parameters:
    922  *      unit - Unit number
    923  *      ptp_id - PTP stack ID
    924  *      clock_num - PTP clock number
    925  *      override_flag - Override Mask for flags to set
    926  *      override_value - Override Value for flags to set
    927  * Returns:
    928  *      int
    929  * Notes:
    930  */
    931 int
    932 bcm_esw_ptp_pkt_flags_override_set(
    933     int unit,
    934     bcm_ptp_stack_id_t ptp_id,
    935     int clock_num,
    936     uint32 override_flag,
    937     uint32 override_value)
    938 {
    939     int rc;
    940 
    941     rc = bcm_common_ptp_pkt_flags_override_set(unit, ptp_id, clock_num, override_flag, override_value);
    942 
    943     return (rc);
    944 }
    945 
    946 
    947 /*
    948  * Function:
    949  *      bcm_esw_ptp_clock_create
    950  * Purpose:
    951  *      Create a PTP clock.
    952  * Parameters:
    953  *      unit - Unit number 
    954  *      ptp_id - PTP stack ID
    955  *      *clock_info - PTP clock information
    956  * Returns:
    957  *      int
    958  * Notes:
    959  */
    960 int
    961 bcm_esw_ptp_clock_create(
    962     int unit,
    963     bcm_ptp_stack_id_t ptp_id,
    964     bcm_ptp_clock_info_t *clock_info)
    965 {
    966     int rc;
    967 
    968     rc = bcm_common_ptp_clock_create(unit, ptp_id, clock_info);
    969 
    970     return (rc);
    971 }
    972 
    973 /*
    974  * Function:
    975  *      bcm_esw_ptp_clock_current_dataset_get
    976  * Purpose:
    977  *      Get PTP clock current dataset.
    978  * Parameters:
    979  *      unit - Unit number 
    980  *      ptp_id - PTP stack ID
    981  *      clock_num - PTP clock number
    982  *      *dataset - Current dataset
    983  * Returns:
    984  *      int
    985  * Notes:
    986  */
    987 int
    988 bcm_esw_ptp_clock_current_dataset_get(
    989     int unit,
    990     bcm_ptp_stack_id_t ptp_id,
    991     int clock_num,
    992     bcm_ptp_current_dataset_t *dataset)
    993 {
    994     int rc;
    995 
    996     rc = bcm_common_ptp_clock_current_dataset_get(unit, ptp_id, clock_num, dataset);
    997 
    998     return (rc);
    999 }
   1000 
   1001 /*
   1002  * Function:
   1003  *      bcm_esw_ptp_clock_default_dataset_get
   1004  * Purpose:
   1005  *      Get PTP clock current dataset.
   1006  * Parameters:
   1007  *      unit - Unit number 
   1008  *      ptp_id - PTP stack ID
   1009  *      clock_num - PTP clock number
   1010  *      *dataset - Current dataset
   1011  * Returns:
   1012  *      int
   1013  * Notes:
   1014  */
   1015 int
   1016 bcm_esw_ptp_clock_default_dataset_get(
   1017     int unit,
   1018     bcm_ptp_stack_id_t ptp_id,
   1019     int clock_num,
   1020     bcm_ptp_default_dataset_t *dataset)
   1021 {
   1022     int rc;
   1023 
   1024     rc = bcm_common_ptp_clock_default_dataset_get(unit, ptp_id, clock_num, dataset);
   1025 
   1026     return (rc);
   1027 }
   1028 
   1029 /*
   1030  * Function:
   1031  *      bcm_esw_ptp_clock_domain_get
   1032  * Purpose:
   1033  *      Get PTP domain member of a PTP clock default dataset.
   1034  * Parameters:
   1035  *      unit - Unit number 
   1036  *      ptp_id - PTP stack ID
   1037  *      clock_num - PTP clock number
   1038  *      *domain - PTP clock domain
   1039  * Returns:
   1040  *      int
   1041  * Notes:
   1042  */
   1043 int
   1044 bcm_esw_ptp_clock_domain_get(
   1045     int unit,
   1046     bcm_ptp_stack_id_t ptp_id,
   1047     int clock_num,
   1048     uint32 *domain)
   1049 {
   1050     int rc;
   1051 
   1052     rc = bcm_common_ptp_clock_domain_get(unit, ptp_id, clock_num, domain);
   1053 
   1054     return (rc);
   1055 }
   1056 
   1057 /*
   1058  * Function:
   1059  *      bcm_esw_ptp_clock_domain_set
   1060  * Purpose:
   1061  *      Set PTP domain member of a PTP clock default dataset.
   1062  * Parameters:
   1063  *      unit - Unit number 
   1064  *      ptp_id - PTP stack ID
   1065  *      clock_num - PTP clock number
   1066  *      domain - PTP clock domain
   1067  * Returns:
   1068  *      int
   1069  * Notes:
   1070  */
   1071 int
   1072 bcm_esw_ptp_clock_domain_set(
   1073     int unit,
   1074     bcm_ptp_stack_id_t ptp_id,
   1075     int clock_num,
   1076     uint32 domain)
   1077 {
   1078     int rc;
   1079 
   1080     rc = bcm_common_ptp_clock_domain_set(unit, ptp_id, clock_num, domain);
   1081 
   1082     return (rc);
   1083 }
   1084 
   1085 /*
   1086  * Function:
   1087  *      bcm_esw_ptp_clock_get
   1088  * Purpose:
   1089  *      Get configuration information (data and metadata) of a PTP clock.
   1090  * Parameters:
   1091  *      unit - Unit number 
   1092  *      ptp_id - PTP stack ID
   1093  *      clock_num - PTP clock number
   1094  *      *clock_info - PTP clock information
   1095  * Returns:
   1096  *      int
   1097  * Notes:
   1098  */
   1099 int
   1100 bcm_esw_ptp_clock_get(
   1101     int unit,
   1102     bcm_ptp_stack_id_t ptp_id,
   1103     int clock_num,
   1104     bcm_ptp_clock_info_t *clock_info)
   1105 {
   1106     int rc;
   1107 
   1108     rc = bcm_common_ptp_clock_get(unit, ptp_id, clock_num, clock_info);
   1109 
   1110     return (rc);
   1111 }
   1112 
   1113 /*
   1114  * Function:
   1115  *      bcm_esw_ptp_clock_parent_dataset_get
   1116  * Purpose:
   1117  *      Get PTP clock parent dataset.
   1118  * Parameters:
   1119  *      unit - Unit number 
   1120  *      ptp_id - PTP stack ID
   1121  *      clock_num - PTP clock number
   1122  *      *dataset - Current dataset
   1123  * Returns:
   1124  *      int
   1125  * Notes:
   1126  */
   1127 int
   1128 bcm_esw_ptp_clock_parent_dataset_get(
   1129     int unit,
   1130     bcm_ptp_stack_id_t ptp_id,
   1131     int clock_num,
   1132     bcm_ptp_parent_dataset_t *dataset)
   1133 {
   1134     int rc;
   1135 
   1136     rc = bcm_common_ptp_clock_parent_dataset_get(unit, ptp_id, clock_num, dataset);
   1137 
   1138     return (rc);
   1139 }
   1140 
   1141 
   1142 /*
   1143  * Function:
   1144  *      bcm_esw_ptp_phase_offset_set
   1145  * Purpose:
   1146  *      Set phase offsets for path asymmetry compensation
   1147  * Parameters:
   1148  *      unit - Unit number 
   1149  *      ptp_id - PTP stack ID
   1150  *      clock_num - PTP clock number
   1151  *      *offset - PTP servo phase holdover state offsets
   1152  * Returns:
   1153  *      int
   1154  * Notes:
   1155  */
   1156 
   1157 int
   1158 bcm_esw_ptp_phase_offset_set(
   1159      int unit,
   1160      bcm_ptp_stack_id_t ptp_id,
   1161      int clock_num,
   1162      const bcm_ptp_phase_offset_t *offset) 
   1163 {
   1164     int rc;
   1165 
   1166     rc = bcm_common_ptp_phase_offset_set(unit, ptp_id, clock_num, offset);
   1167     
   1168     return (rc);
   1169 }
   1170 
   1171 /*
   1172  * Function:
   1173  *      bcm_esw_ptp_phase_offset_get
   1174  * Purpose:
   1175  *      Get phase offsets for path asymmetry compensation
   1176  * Parameters:
   1177  *      unit - Unit number 
   1178  *      ptp_id - PTP stack ID
   1179  *      clock_num - PTP clock number
   1180  *      *offset - PTP servo phase holdover state offsets
   1181  * Returns:
   1182  *      int
   1183  * Notes:
   1184  */
   1185 
   1186 int
   1187 bcm_esw_ptp_phase_offset_get(
   1188      int unit,
   1189      bcm_ptp_stack_id_t ptp_id,
   1190      int clock_num,
   1191      bcm_ptp_phase_offset_t *offset) 
   1192 {
   1193     int rc;
   1194 
   1195     rc = bcm_common_ptp_phase_offset_get(unit, ptp_id, clock_num, offset);
   1196 
   1197     return (rc);
   1198 }
   1199 
   1200 /*
   1201  * Function:
   1202  *      bcm_esw_ptp_clock_port_announce_receipt_timeout_get
   1203  * Purpose:
   1204  *      Get announce receipt timeout member of a PTP clock port dataset.
   1205  * Parameters:
   1206  *      unit - Unit number 
   1207  *      ptp_id - PTP stack ID
   1208  *      clock_num - PTP clock number
   1209  *      clock_port - PTP clock port number
   1210  *      *timeout - PTP clock port announce receipt timeout
   1211  * Returns:
   1212  *      int
   1213  * Notes:
   1214  */
   1215 int
   1216 bcm_esw_ptp_clock_port_announce_receipt_timeout_get(
   1217     int unit,
   1218     bcm_ptp_stack_id_t ptp_id,
   1219     int clock_num,
   1220     uint32 clock_port,
   1221     uint32 *timeout)
   1222 {
   1223     int rc;
   1224 
   1225     rc = bcm_common_ptp_clock_port_announce_receipt_timeout_get(unit, ptp_id, clock_num, 
   1226              clock_port, timeout);
   1227 
   1228     return (rc);
   1229 }
   1230 
   1231 /*
   1232  * Function:
   1233  *      bcm_esw_ptp_clock_port_announce_receipt_timeout_set
   1234  * Purpose:
   1235  *      Set announce receipt timeout member of a PTP clock port dataset.
   1236  * Parameters:
   1237  *      unit - Unit number 
   1238  *      ptp_id - PTP stack ID
   1239  *      clock_num - PTP clock number
   1240  *      clock_port - PTP clock port number
   1241  *      timeout - PTP clock port announce receipt timeout
   1242  * Returns:
   1243  *      int
   1244  * Notes:
   1245  */
   1246 int
   1247 bcm_esw_ptp_clock_port_announce_receipt_timeout_set(
   1248     int unit,
   1249     bcm_ptp_stack_id_t ptp_id,
   1250     int clock_num,
   1251     uint32 clock_port,
   1252     uint32 timeout)
   1253 {
   1254     int rc;
   1255 
   1256     rc = bcm_common_ptp_clock_port_announce_receipt_timeout_set(unit, ptp_id, clock_num, 
   1257              clock_port, timeout);
   1258 
   1259     return (rc);
   1260 }
   1261 
   1262 /*
   1263  * Function:
   1264  *      bcm_esw_ptp_clock_port_configure
   1265  * Purpose:
   1266  *      Configure a PTP clock port.
   1267  * Parameters:
   1268  *      unit - Unit number 
   1269  *      ptp_id - PTP stack ID
   1270  *      clock_num - PTP clock number
   1271  *      clock_port - PTP clock port number
   1272  *      *info - PTP clock port configuration information
   1273  * Returns:
   1274  *      int
   1275  * Notes:
   1276  */
   1277 int
   1278 bcm_esw_ptp_clock_port_configure(
   1279     int unit,
   1280     bcm_ptp_stack_id_t ptp_id,
   1281     int clock_num,
   1282     uint32 clock_port,
   1283     bcm_ptp_clock_port_info_t *info)
   1284 {
   1285     int rc;
   1286 
   1287     rc = bcm_common_ptp_clock_port_configure(unit, ptp_id, clock_num, clock_port, info);
   1288 
   1289     return (rc);
   1290 }
   1291 
   1292 /*
   1293  * Function:
   1294  *      bcm_esw_ptp_clock_port_dataset_get
   1295  * Purpose:
   1296  *      Get PTP clock port dataset.
   1297  * Parameters:
   1298  *      unit - Unit number 
   1299  *      ptp_id - PTP stack ID
   1300  *      clock_num - PTP clock number
   1301  *      clock_port - PTP clock port number
   1302  *      *dataset - Current dataset
   1303  * Returns:
   1304  *      int
   1305  * Notes:
   1306  */
   1307 int
   1308 bcm_esw_ptp_clock_port_dataset_get(
   1309     int unit,
   1310     bcm_ptp_stack_id_t ptp_id,
   1311     int clock_num,
   1312     uint32 clock_port,
   1313     bcm_ptp_port_dataset_t *dataset)
   1314 {
   1315     int rc;
   1316 
   1317     rc = bcm_common_ptp_clock_port_dataset_get(unit, ptp_id, clock_num, clock_port, dataset);
   1318 
   1319     return (rc);
   1320 }
   1321 
   1322 /*
   1323  * Function:
   1324  *      bcm_esw_ptp_clock_port_delay_mechanism_get
   1325  * Purpose:
   1326  *      Get delay mechanism member of a PTP clock port dataset.
   1327  * Parameters:
   1328  *      unit - Unit number 
   1329  *      ptp_id - PTP stack ID
   1330  *      clock_num - PTP clock number
   1331  *      clock_port - PTP clock port number
   1332  *      *delay_mechanism - PTP clock port delay mechanism
   1333  * Returns:
   1334  *      int
   1335  * Notes:
   1336  */
   1337 int
   1338 bcm_esw_ptp_clock_port_delay_mechanism_get(
   1339     int unit,
   1340     bcm_ptp_stack_id_t ptp_id,
   1341     int clock_num,
   1342     uint32 clock_port,
   1343     uint32 *delay_mechanism)
   1344 {
   1345     int rc;
   1346 
   1347     rc = bcm_common_ptp_clock_port_delay_mechanism_get(unit, ptp_id, clock_num, clock_port, 
   1348              delay_mechanism);
   1349 
   1350     return (rc);
   1351 }
   1352 
   1353 /*
   1354  * Function:
   1355  *      bcm_esw_ptp_clock_port_delay_mechanism_set
   1356  * Purpose:
   1357  *      Set delay mechanism member of a PTP clock port dataset.
   1358  * Parameters:
   1359  *      unit - Unit number 
   1360  *      ptp_id - PTP stack ID
   1361  *      clock_num - PTP clock number
   1362  *      clock_port - PTP clock port number
   1363  *      delay_mechanism - PTP clock port delay mechanism
   1364  * Returns:
   1365  *      int
   1366  * Notes:
   1367  */
   1368 int
   1369 bcm_esw_ptp_clock_port_delay_mechanism_set(
   1370     int unit,
   1371     bcm_ptp_stack_id_t ptp_id,
   1372     int clock_num,
   1373     uint32 clock_port,
   1374     uint32 delay_mechanism)
   1375 {
   1376     int rc;
   1377 
   1378     rc = bcm_common_ptp_clock_port_delay_mechanism_set(unit, ptp_id, clock_num, clock_port, 
   1379              delay_mechanism);
   1380 
   1381     return (rc);
   1382 }
   1383 
   1384 /*
   1385  * Function:
   1386  *      bcm_esw_ptp_clock_port_disable
   1387  * Purpose:
   1388  *      Disable a PTP clock port of an ordinary clock (OC) or a boundary clock (BC).
   1389  * Parameters:
   1390  *      unit - Unit number 
   1391  *      ptp_id - PTP stack ID
   1392  *      clock_num - PTP clock number
   1393  *      clock_port - PTP clock port number
   1394  * Returns:
   1395  *      int
   1396  * Notes:
   1397  */
   1398 int
   1399 bcm_esw_ptp_clock_port_disable(
   1400     int unit,
   1401     bcm_ptp_stack_id_t ptp_id,
   1402     int clock_num,
   1403     uint32 clock_port)
   1404 {
   1405     int rc;
   1406 
   1407     rc = bcm_common_ptp_clock_port_disable(unit, ptp_id, clock_num, clock_port);
   1408 
   1409     return (rc);
   1410 }
   1411 
   1412 /*
   1413  * Function:
   1414  *      bcm_esw_ptp_clock_port_enable
   1415  * Purpose:
   1416  *      Enable a PTP clock port of an ordinary clock (OC) or a boundary clock (BC).
   1417  * Parameters:
   1418  *      unit - Unit number 
   1419  *      ptp_id - PTP stack ID
   1420  *      clock_num - PTP clock number
   1421  *      clock_port - PTP clock port number
   1422  * Returns:
   1423  *      int
   1424  * Notes:
   1425  */
   1426 int
   1427 bcm_esw_ptp_clock_port_enable(
   1428     int unit,
   1429     bcm_ptp_stack_id_t ptp_id,
   1430     int clock_num,
   1431     uint32 clock_port)
   1432 {
   1433     int rc;
   1434 
   1435     rc = bcm_common_ptp_clock_port_enable(unit, ptp_id, clock_num, clock_port);
   1436 
   1437     return (rc);
   1438 }
   1439 
   1440 /*
   1441  * Function:
   1442  *      bcm_esw_ptp_clock_port_identity_get
   1443  * Purpose:
   1444  *      Get port identity of a PTP clock port.
   1445  * Parameters:
   1446  *      unit - Unit number 
   1447  *      ptp_id - PTP stack ID
   1448  *      clock_num - PTP clock number
   1449  *      clock_port - PTP clock port number
   1450  *      *identity - PTP port identity
   1451  * Returns:
   1452  *      int
   1453  * Notes:
   1454  */
   1455 int
   1456 bcm_esw_ptp_clock_port_identity_get(
   1457     int unit,
   1458     bcm_ptp_stack_id_t ptp_id,
   1459     int clock_num,
   1460     uint32 clock_port,
   1461     bcm_ptp_port_identity_t *identity)
   1462 {
   1463     int rc;
   1464 
   1465     rc = bcm_common_ptp_clock_port_identity_get(unit, ptp_id, clock_num, clock_port, identity);
   1466 
   1467     return (rc);
   1468 }
   1469 
   1470 /*
   1471  * Function:
   1472  *      bcm_esw_ptp_clock_port_info_get
   1473  * Purpose:
   1474  *      Get configuration information (data and metadata) of a PTP clock port.
   1475  * Parameters:
   1476  *      unit - Unit number 
   1477  *      ptp_id - PTP stack ID
   1478  *      clock_num - PTP clock number
   1479  *      clock_port - PTP clock port number
   1480  *      *info - PTP clock port configuration information
   1481  * Returns:
   1482  *      int
   1483  * Notes:
   1484  */
   1485 int
   1486 bcm_esw_ptp_clock_port_info_get(
   1487     int unit,
   1488     bcm_ptp_stack_id_t ptp_id,
   1489     int clock_num,
   1490     uint32 clock_port,
   1491     bcm_ptp_clock_port_info_t *info)
   1492 {
   1493     int rc;
   1494 
   1495     rc = bcm_common_ptp_clock_port_info_get(unit, ptp_id, clock_num, clock_port, info);
   1496 
   1497     return (rc);
   1498 }
   1499 
   1500 /*
   1501  * Function:
   1502  *      bcm_esw_ptp_clock_port_latency_get
   1503  * Purpose:
   1504  *      Get PTP clock port expected asymmetric latencies.
   1505  * Parameters:
   1506  *      unit - Unit number 
   1507  *      ptp_id - PTP stack ID
   1508  *      clock_num - PTP clock number
   1509  *      clock_port - PTP clock port number
   1510  *      *latency_in - PTP clock port inbound latency (ns)
   1511  *      *latency_out - PTP clock port outbound latency (ns)
   1512  * Returns:
   1513  *      int
   1514  * Notes:
   1515  */
   1516 int
   1517 bcm_esw_ptp_clock_port_latency_get(
   1518     int unit,
   1519     bcm_ptp_stack_id_t ptp_id,
   1520     int clock_num,
   1521     uint32 clock_port,
   1522     uint32 *latency_in,
   1523     uint32 *latency_out)
   1524 {
   1525     int rc;
   1526 
   1527     rc = bcm_common_ptp_clock_port_latency_get(unit, ptp_id, clock_num, clock_port, latency_in, 
   1528              latency_out);
   1529 
   1530     return (rc);
   1531 }
   1532 
   1533 /*
   1534  * Function:
   1535  *      bcm_esw_ptp_clock_port_latency_set
   1536  * Purpose:
   1537  *      Set PTP clock port expected asymmetric latencies.
   1538  * Parameters:
   1539  *      unit - Unit number 
   1540  *      ptp_id - PTP stack ID
   1541  *      clock_num - PTP clock number
   1542  *      clock_port - PTP clock port number
   1543  *      latency_in - PTP clock port inbound latency (ns)
   1544  *      latency_out - PTP clock port outbound latency (ns)
   1545  * Returns:
   1546  *      int
   1547  * Notes:
   1548  */
   1549 int
   1550 bcm_esw_ptp_clock_port_latency_set(
   1551     int unit,
   1552     bcm_ptp_stack_id_t ptp_id,
   1553     int clock_num,
   1554     uint32 clock_port,
   1555     uint32 latency_in,
   1556     uint32 latency_out)
   1557 {
   1558     int rc;
   1559 
   1560     rc = bcm_common_ptp_clock_port_latency_set(unit, ptp_id, clock_num, clock_port, latency_in, 
   1561              latency_out);
   1562 
   1563     return (rc);
   1564 }
   1565 
   1566 /*
   1567  * Function:
   1568  *      bcm_esw_ptp_clock_port_log_announce_interval_get
   1569  * Purpose:
   1570  *      Get log announce interval of a PTP clock port dataset.
   1571  * Parameters:
   1572  *      unit - Unit number 
   1573  *      ptp_id - PTP stack ID
   1574  *      clock_num - PTP clock number
   1575  *      clock_port - PTP clock port number
   1576  *      *interval - PTP clock port log announce interval
   1577  * Returns:
   1578  *      int
   1579  * Notes:
   1580  */
   1581 int
   1582 bcm_esw_ptp_clock_port_log_announce_interval_get(
   1583     int unit,
   1584     bcm_ptp_stack_id_t ptp_id,
   1585     int clock_num,
   1586     uint32 clock_port,
   1587     int *interval)
   1588 {
   1589     int rc;
   1590 
   1591     rc = bcm_common_ptp_clock_port_log_announce_interval_get(unit, ptp_id, clock_num, clock_port, 
   1592              interval);
   1593 
   1594     return (rc);
   1595 }
   1596 
   1597 /*
   1598  * Function:
   1599  *      bcm_esw_ptp_clock_port_log_announce_interval_set
   1600  * Purpose:
   1601  *      Set log announce interval of a PTP clock port dataset.
   1602  * Parameters:
   1603  *      unit - Unit number 
   1604  *      ptp_id - PTP stack ID
   1605  *      clock_num - PTP clock number
   1606  *      clock_port - PTP clock port number
   1607  *      interval - PTP clock port log announce interval
   1608  * Returns:
   1609  *      int
   1610  * Notes:
   1611  */
   1612 int
   1613 bcm_esw_ptp_clock_port_log_announce_interval_set(
   1614     int unit,
   1615     bcm_ptp_stack_id_t ptp_id,
   1616     int clock_num,
   1617     uint32 clock_port,
   1618     int interval)
   1619 {
   1620     int rc;
   1621 
   1622     rc = bcm_common_ptp_clock_port_log_announce_interval_set(unit, ptp_id, clock_num, clock_port, 
   1623              interval);
   1624 
   1625     return (rc);
   1626 }
   1627 
   1628 /*
   1629  * Function:
   1630  *      bcm_esw_ptp_clock_port_log_min_delay_req_interval_get
   1631  * Purpose:
   1632  *      Get log minimum delay request interval member of a PTP clock port dataset.
   1633  * Parameters:
   1634  *      unit - Unit number 
   1635  *      ptp_id - PTP stack ID
   1636  *      clock_num - PTP clock number
   1637  *      clock_port - PTP clock port number
   1638  *      *interval - PTP clock port log minimum delay request interval
   1639  * Returns:
   1640  *      int
   1641  * Notes:
   1642  */
   1643 int
   1644 bcm_esw_ptp_clock_port_log_min_delay_req_interval_get(
   1645     int unit,
   1646     bcm_ptp_stack_id_t ptp_id,
   1647     int clock_num,
   1648     uint32 clock_port,
   1649     int *interval)
   1650 {
   1651     int rc;
   1652 
   1653     rc = bcm_common_ptp_clock_port_log_min_delay_req_interval_get(unit, ptp_id, clock_num, 
   1654              clock_port, interval);
   1655 
   1656     return (rc);
   1657 }
   1658 
   1659 /*
   1660  * Function:
   1661  *      bcm_esw_ptp_clock_port_log_min_delay_req_interval_set
   1662  * Purpose:
   1663  *      Set log minimum delay request interval member of a PTP clock port dataset.
   1664  * Parameters:
   1665  *      unit - Unit number 
   1666  *      ptp_id - PTP stack ID
   1667  *      clock_num - PTP clock number
   1668  *      clock_port - PTP clock port number
   1669  *      interval - PTP clock port log minimum delay request interval
   1670  * Returns:
   1671  *      int
   1672  * Notes:
   1673  */
   1674 int
   1675 bcm_esw_ptp_clock_port_log_min_delay_req_interval_set(
   1676     int unit,
   1677     bcm_ptp_stack_id_t ptp_id,
   1678     int clock_num,
   1679     uint32 clock_port,
   1680     int interval)
   1681 {
   1682     int rc;
   1683 
   1684     rc = bcm_common_ptp_clock_port_log_min_delay_req_interval_set(unit, ptp_id, clock_num, 
   1685              clock_port, interval);
   1686 
   1687     return (rc);
   1688 }
   1689 
   1690 /*
   1691  * Function:
   1692  *      bcm_esw_ptp_clock_port_log_min_pdelay_req_interval_get
   1693  * Purpose:
   1694  *      Get log minimum peer delay (PDelay) request interval member of a PTP clock port dataset.
   1695  * Parameters:
   1696  *      unit - Unit number 
   1697  *      ptp_id - PTP stack ID
   1698  *      clock_num - PTP clock number
   1699  *      clock_port - PTP clock port number
   1700  *      *interval - PTP clock port log minimum peer delay (PDelay) request interval
   1701  * Returns:
   1702  *      int
   1703  * Notes:
   1704  */
   1705 int
   1706 bcm_esw_ptp_clock_port_log_min_pdelay_req_interval_get(
   1707     int unit,
   1708     bcm_ptp_stack_id_t ptp_id,
   1709     int clock_num,
   1710     uint32 clock_port,
   1711     int *interval)
   1712 {
   1713     int rc;
   1714 
   1715     rc = bcm_common_ptp_clock_port_log_min_pdelay_req_interval_get(unit, ptp_id, clock_num, 
   1716              clock_port, interval);
   1717 
   1718     return (rc);
   1719 }
   1720 
   1721 /*
   1722  * Function:
   1723  *      bcm_esw_ptp_clock_port_log_min_pdelay_req_interval_set
   1724  * Purpose:
   1725  *      Set log minimum peer delay (PDelay) request interval member of a PTP
   1726  *      clock port dataset.
   1727  * Parameters:
   1728  *      unit - Unit number 
   1729  *      ptp_id - PTP stack ID
   1730  *      clock_num - PTP clock number
   1731  *      clock_port - PTP clock port number
   1732  *      interval - PTP clock port log minimum peer delay (PDelay) request interval
   1733  * Returns:
   1734  *      int
   1735  * Notes:
   1736  */
   1737 int
   1738 bcm_esw_ptp_clock_port_log_min_pdelay_req_interval_set(
   1739     int unit,
   1740     bcm_ptp_stack_id_t ptp_id,
   1741     int clock_num,
   1742     uint32 clock_port,
   1743     int interval)
   1744 {
   1745     int rc;
   1746 
   1747     rc = bcm_common_ptp_clock_port_log_min_pdelay_req_interval_set(unit, ptp_id, clock_num, 
   1748              clock_port, interval);
   1749 
   1750     return (rc);
   1751 }
   1752 
   1753 /*
   1754  * Function:
   1755  *      bcm_esw_ptp_clock_port_log_sync_interval_get
   1756  * Purpose:
   1757  *      Get log sync interval member of a PTP clock port dataset.
   1758  * Parameters:
   1759  *      unit - Unit number 
   1760  *      ptp_id - PTP stack ID
   1761  *      clock_num - PTP clock number
   1762  *      clock_port - PTP clock port number
   1763  *      *interval - PTP clock port log sync interval
   1764  * Returns:
   1765  *      int
   1766  * Notes:
   1767  */
   1768 int
   1769 bcm_esw_ptp_clock_port_log_sync_interval_get(
   1770     int unit,
   1771     bcm_ptp_stack_id_t ptp_id,
   1772     int clock_num,
   1773     uint32 clock_port,
   1774     int *interval)
   1775 {
   1776     int rc;
   1777 
   1778     rc = bcm_common_ptp_clock_port_log_sync_interval_get(unit, ptp_id, clock_num, clock_port, 
   1779              interval);
   1780 
   1781     return (rc);
   1782 }
   1783 
   1784 /*
   1785  * Function:
   1786  *      bcm_esw_ptp_clock_port_log_sync_interval_set
   1787  * Purpose:
   1788  *      Set log sync interval member of a PTP clock port dataset.
   1789  * Parameters:
   1790  *      unit - Unit number 
   1791  *      ptp_id - PTP stack ID
   1792  *      clock_num - PTP clock number
   1793  *      clock_port - PTP clock port number
   1794  *      interval - PTP clock port log sync interval
   1795  * Returns:
   1796  *      int
   1797  * Notes:
   1798  */
   1799 int
   1800 bcm_esw_ptp_clock_port_log_sync_interval_set(
   1801     int unit,
   1802     bcm_ptp_stack_id_t ptp_id,
   1803     int clock_num,
   1804     uint32 clock_port,
   1805     int interval)
   1806 {
   1807     int rc;
   1808 
   1809     rc = bcm_common_ptp_clock_port_log_sync_interval_set(unit, ptp_id, clock_num, clock_port, 
   1810              interval);
   1811 
   1812     return (rc);
   1813 }
   1814 
   1815 /*
   1816  * Function:
   1817  *      bcm_esw_ptp_clock_port_mac_get
   1818  * Purpose:
   1819  *      Get MAC address of a PTP clock port.
   1820  * Parameters:
   1821  *      unit - Unit number 
   1822  *      ptp_id - PTP stack ID
   1823  *      clock_num - PTP clock number
   1824  *      clock_port - PTP clock port number
   1825  *      *mac - PTP clock port MAC address
   1826  * Returns:
   1827  *      int
   1828  * Notes:
   1829  */
   1830 int
   1831 bcm_esw_ptp_clock_port_mac_get(
   1832     int unit,
   1833     bcm_ptp_stack_id_t ptp_id,
   1834     int clock_num,
   1835     uint32 clock_port,
   1836     bcm_mac_t *mac)
   1837 {
   1838     int rc;
   1839 
   1840     rc = bcm_common_ptp_clock_port_mac_get(unit, ptp_id, clock_num, clock_port, mac);
   1841 
   1842     return (rc);
   1843 }
   1844 
   1845 /*
   1846  * Function:
   1847  *      bcm_esw_ptp_clock_port_protocol_get
   1848  * Purpose:
   1849  *      Get network protocol of a PTP clock port.
   1850  * Parameters:
   1851  *      unit - Unit number 
   1852  *      ptp_id - PTP stack ID
   1853  *      clock_num - PTP clock number
   1854  *      clock_port - PTP clock port number
   1855  *      *protocol - PTP clock port network protocol
   1856  * Returns:
   1857  *      int
   1858  * Notes:
   1859  */
   1860 int
   1861 bcm_esw_ptp_clock_port_protocol_get(
   1862     int unit,
   1863     bcm_ptp_stack_id_t ptp_id,
   1864     int clock_num,
   1865     uint32 clock_port,
   1866     bcm_ptp_protocol_t *protocol)
   1867 {
   1868     int rc;
   1869 
   1870     rc = bcm_common_ptp_clock_port_protocol_get(unit, ptp_id, clock_num, clock_port, protocol);
   1871 
   1872     return (rc);
   1873 }
   1874 
   1875 /*
   1876  * Function:
   1877  *      bcm_esw_ptp_clock_port_type_get
   1878  * Purpose:
   1879  *      Get port type of a PTP clock port.
   1880  * Parameters:
   1881  *      unit - Unit number 
   1882  *      ptp_id - PTP stack ID
   1883  *      clock_num - PTP clock number
   1884  *      clock_port - PTP clock port number
   1885  *      *type - PTP clock port type
   1886  * Returns:
   1887  *      int
   1888  * Notes:
   1889  */
   1890 int
   1891 bcm_esw_ptp_clock_port_type_get(
   1892     int unit,
   1893     bcm_ptp_stack_id_t ptp_id,
   1894     int clock_num,
   1895     uint32 clock_port,
   1896     bcm_ptp_port_type_t *type)
   1897 {
   1898     int rc;
   1899 
   1900     rc = bcm_common_ptp_clock_port_type_get(unit, ptp_id, clock_num, clock_port, type);
   1901 
   1902     return (rc);
   1903 }
   1904 
   1905 /*
   1906  * Function:
   1907  *      bcm_esw_ptp_clock_port_version_number_get
   1908  * Purpose:
   1909  *      Get PTP version number member of a PTP clock port dataset.
   1910  * Parameters:
   1911  *      unit - Unit number 
   1912  *      ptp_id - PTP stack ID
   1913  *      clock_num - PTP clock number
   1914  *      clock_port - PTP clock port number
   1915  *      *version - PTP clock port PTP version number
   1916  * Returns:
   1917  *      int
   1918  * Notes:
   1919  */
   1920 int
   1921 bcm_esw_ptp_clock_port_version_number_get(
   1922     int unit,
   1923     bcm_ptp_stack_id_t ptp_id,
   1924     int clock_num,
   1925     uint32 clock_port,
   1926     uint32 *version)
   1927 {
   1928     int rc;
   1929 
   1930     rc = bcm_common_ptp_clock_port_version_number_get(unit, ptp_id, clock_num, clock_port, 
   1931              version);
   1932 
   1933     return (rc);
   1934 }
   1935 
   1936 /*
   1937  * Function:
   1938  *      bcm_esw_ptp_clock_priority1_get
   1939  * Purpose:
   1940  *      Get priority1 member of a PTP clock default dataset.
   1941  * Parameters:
   1942  *      unit - Unit number 
   1943  *      ptp_id - PTP stack ID
   1944  *      clock_num - PTP clock number
   1945  *      *priority1 - PTP clock priority1.
   1946  * Returns:
   1947  *      int
   1948  * Notes:
   1949  */
   1950 int
   1951 bcm_esw_ptp_clock_priority1_get(
   1952     int unit,
   1953     bcm_ptp_stack_id_t ptp_id,
   1954     int clock_num,
   1955     uint32 *priority1)
   1956 {
   1957     int rc;
   1958 
   1959     rc = bcm_common_ptp_clock_priority1_get(unit, ptp_id, clock_num, priority1);
   1960 
   1961     return (rc);
   1962 }
   1963 
   1964 /*
   1965  * Function:
   1966  *      bcm_esw_ptp_clock_priority1_set
   1967  * Purpose:
   1968  *      Set priority1 member of a PTP clock default dataset.
   1969  * Parameters:
   1970  *      unit - Unit number 
   1971  *      ptp_id - PTP stack ID
   1972  *      clock_num - PTP clock number
   1973  *      priority1 - PTP clock priority1
   1974  * Returns:
   1975  *      int
   1976  * Notes:
   1977  */
   1978 int
   1979 bcm_esw_ptp_clock_priority1_set(
   1980     int unit,
   1981     bcm_ptp_stack_id_t ptp_id,
   1982     int clock_num,
   1983     uint32 priority1)
   1984 {
   1985     int rc;
   1986 
   1987     rc = bcm_common_ptp_clock_priority1_set(unit, ptp_id, clock_num, priority1);
   1988 
   1989     return (rc);
   1990 }
   1991 
   1992 /*
   1993  * Function:
   1994  *      bcm_esw_ptp_clock_priority2_get
   1995  * Purpose:
   1996  *      Get priority2 member of a PTP clock default dataset.
   1997  * Parameters:
   1998  *      unit - Unit number 
   1999  *      ptp_id - PTP stack ID
   2000  *      clock_num - PTP clock number
   2001  *      *priority2 - PTP clock priority2
   2002  * Returns:
   2003  *      int
   2004  * Notes:
   2005  */
   2006 int
   2007 bcm_esw_ptp_clock_priority2_get(
   2008     int unit,
   2009     bcm_ptp_stack_id_t ptp_id,
   2010     int clock_num,
   2011     uint32 *priority2)
   2012 {
   2013     int rc;
   2014 
   2015     rc = bcm_common_ptp_clock_priority2_get(unit, ptp_id, clock_num, priority2);
   2016 
   2017     return (rc);
   2018 }
   2019 
   2020 /*
   2021  * Function:
   2022  *      bcm_esw_ptp_clock_priority2_set
   2023  * Purpose:
   2024  *      Set priority2 member of a PTP clock default dataset.
   2025  * Parameters:
   2026  *      unit - Unit number 
   2027  *      ptp_id - PTP stack ID
   2028  *      clock_num - PTP clock number
   2029  *      priority2 - PTP clock priority2
   2030  * Returns:
   2031  *      int
   2032  * Notes:
   2033  */
   2034 int
   2035 bcm_esw_ptp_clock_priority2_set(
   2036     int unit,
   2037     bcm_ptp_stack_id_t ptp_id,
   2038     int clock_num,
   2039     uint32 priority2)
   2040 {
   2041     int rc;
   2042 
   2043     rc = bcm_common_ptp_clock_priority2_set(unit, ptp_id, clock_num, priority2);
   2044 
   2045     return (rc);
   2046 }
   2047 
   2048 /*
   2049  * Function:
   2050  *      bcm_esw_ptp_clock_slaveonly_get
   2051  * Purpose:
   2052  *      Get slave-only (SO) flag of a PTP clock default dataset.
   2053  * Parameters:
   2054  *      unit - Unit number 
   2055  *      ptp_id - PTP stack ID
   2056  *      clock_num - PTP clock number
   2057  *      *slaveonly - PTP clock slave-only (SO) flag
   2058  * Returns:
   2059  *      int
   2060  * Notes:
   2061  */
   2062 int
   2063 bcm_esw_ptp_clock_slaveonly_get(
   2064     int unit,
   2065     bcm_ptp_stack_id_t ptp_id,
   2066     int clock_num,
   2067     uint32 *slaveonly)
   2068 {
   2069     int rc;
   2070 
   2071     rc = bcm_common_ptp_clock_slaveonly_get(unit, ptp_id, clock_num, slaveonly);
   2072 
   2073     return (rc);
   2074 }
   2075 
   2076 /*
   2077  * Function:
   2078  *      bcm_esw_ptp_clock_slaveonly_set
   2079  * Purpose:
   2080  *      Set slave-only (SO) flag of a PTP clock default dataset.
   2081  * Parameters:
   2082  *      unit - Unit number 
   2083  *      ptp_id - PTP stack ID
   2084  *      clock_num - PTP clock number
   2085  *      slaveonly - PTP clock slave-only (SO) flag.
   2086  * Returns:
   2087  *      int
   2088  * Notes:
   2089  */
   2090 int
   2091 bcm_esw_ptp_clock_slaveonly_set(
   2092     int unit,
   2093     bcm_ptp_stack_id_t ptp_id,
   2094     int clock_num,
   2095     uint32 slaveonly)
   2096 {
   2097     int rc;
   2098 
   2099     rc = bcm_common_ptp_clock_slaveonly_set(unit, ptp_id, clock_num, slaveonly);
   2100 
   2101     return (rc);
   2102 }
   2103 
   2104 #ifdef BCM_GREYHOUND2_SUPPORT
   2105 static bcm_time_if_t time_if_id[BCM_MAX_NUM_UNITS] = {-1};
   2106 #endif /* BCM_GREYHOUND2_SUPPORT */
   2107 /*
   2108  * Function:
   2109  *      bcm_esw_ptp_clock_time_get
   2110  * Purpose:
   2111  *      Get local time of a PTP node.
   2112  * Parameters:
   2113  *      unit - Unit number 
   2114  *      ptp_id - PTP stack ID
   2115  *      clock_num - PTP clock number
   2116  *      *time - PTP timestamp
   2117  * Returns:
   2118  *      int
   2119  * Notes:
   2120  */
   2121 int
   2122 bcm_esw_ptp_clock_time_get(
   2123     int unit,
   2124     bcm_ptp_stack_id_t ptp_id,
   2125     int clock_num,
   2126     bcm_ptp_timestamp_t *time)
   2127 {
   2128     int rc;
   2129 
   2130 #ifdef BCM_GREYHOUND2_SUPPORT
   2131     if (soc_feature(unit, soc_feature_use_local_1588)) {
   2132 #ifdef BCM_WARM_BOOT_SUPPORT
   2133         if (SOC_WARM_BOOT(unit)) {
   2134             time_if_id[unit] = 0;
   2135         }
   2136 #endif /* BCM_WARM_BOOT_SUPPORT */
   2137         if (_bcm_ptp_running(unit) != BCM_E_NONE) {
   2138             bcm_time_capture_t time1;
   2139 
   2140             bcm_time_capture_t_init(&time1);
   2141             BCM_IF_ERROR_RETURN(
   2142                 bcm_esw_time_capture_get(unit, time_if_id[unit], &time1));
   2143             time->nanoseconds = time1.free.nanoseconds;
   2144             COMPILER_64_COPY(time->seconds,time1.free.seconds);
   2145             return BCM_E_NONE;
   2146         }
   2147     }
   2148 #endif /* BCM_GREYHOUND2_SUPPORT */
   2149 
   2150     rc = bcm_common_ptp_clock_time_get(unit, ptp_id, clock_num, time);
   2151 
   2152     return (rc);
   2153 }
   2154 
   2155 /*
   2156  * Function:
   2157  *      bcm_esw_ptp_clock_time_properties_get
   2158  * Purpose:
   2159  *      Get PTP clock time properties dataset.
   2160  * Parameters:
   2161  *      unit - Unit number 
   2162  *      ptp_id - PTP stack ID
   2163  *      clock_num - PTP clock number
   2164  *      *data - Time properties dataset
   2165  * Returns:
   2166  *      int
   2167  * Notes:
   2168  */
   2169 int
   2170 bcm_esw_ptp_clock_time_properties_get(
   2171     int unit,
   2172     bcm_ptp_stack_id_t ptp_id,
   2173     int clock_num,
   2174     bcm_ptp_time_properties_t *data)
   2175 {
   2176     int rc;
   2177 
   2178     rc = bcm_common_ptp_clock_time_properties_get(unit, ptp_id, clock_num, data);
   2179 
   2180     return (rc);
   2181 }
   2182 
   2183 /*
   2184  * Function:
   2185  *      bcm_esw_ptp_clock_time_set
   2186  * Purpose:
   2187  *      Set local time of a PTP node.
   2188  * Parameters:
   2189  *      unit - Unit number 
   2190  *      ptp_id - PTP stack ID
   2191  *      clock_num - PTP clock number
   2192  *      *time - PTP timestamp
   2193  * Returns:
   2194  *      int
   2195  * Notes:
   2196  */
   2197 int
   2198 bcm_esw_ptp_clock_time_set(
   2199     int unit,
   2200     bcm_ptp_stack_id_t ptp_id,
   2201     int clock_num,
   2202     bcm_ptp_timestamp_t *time)
   2203 {
   2204     int rc;
   2205 
   2206 #ifdef BCM_GREYHOUND2_SUPPORT
   2207     if (soc_feature(unit, soc_feature_use_local_1588)) {
   2208         bcm_time_interface_t    time_if;
   2209         uint32                  sec, regval = 0;
   2210         uint64                  val64;
   2211 
   2212         if (_bcm_ptp_running(unit) != BCM_E_NONE) {
   2213             if (time_if_id[unit] != -1) {
   2214                 (void)bcm_esw_time_interface_delete(unit, time_if_id[unit]);
   2215             }
   2216             bcm_time_interface_t_init(&time_if);
   2217             BCM_IF_ERROR_RETURN(bcm_esw_time_interface_add(unit, &time_if));
   2218             time_if_id[unit] = time_if.id;
   2219 
   2220             WRITE_TS_TO_CORE_SYNC_ENABLEr(unit, 1);
   2221             sec = COMPILER_64_LO(time->seconds);
   2222             soc_reg_field_set(unit, IEEE1588_TIME_SECr, &regval,
   2223                               ONE_SECf, sec % 2);
   2224             sec = (sec >> 1) & 0x7FFFFFFF;
   2225             soc_reg_field_set(unit, IEEE1588_TIME_SECr, &regval,
   2226                               UPPER_SECf, sec);
   2227             BCM_IF_ERROR_RETURN(
   2228                 WRITE_IEEE1588_TIME_SECr(unit, sec));
   2229             BCM_IF_ERROR_RETURN(
   2230                 WRITE_IEEE1588_TIME_FRAC_SEC_UPPERr(unit,
   2231                                                     time->nanoseconds >> 6));
   2232             BCM_IF_ERROR_RETURN(
   2233                 WRITE_IEEE1588_TIME_FRAC_SEC_LOWERr(unit,
   2234                                                     time->nanoseconds << 26));
   2235             BCM_IF_ERROR_RETURN(
   2236                 READ_IEEE1588_TIME_CONTROLr(unit, &regval));
   2237             regval |= 0x1f;    /* Set load-enable bits, |B04...B00|. */
   2238             BCM_IF_ERROR_RETURN(
   2239                 WRITE_IEEE1588_TIME_CONTROLr(unit, regval));
   2240             regval &= ~(0x1f); /* Clear load-enable bits, |B04...B00|. */
   2241             BCM_IF_ERROR_RETURN(
   2242                 WRITE_IEEE1588_TIME_FREQ_CONTROLr(unit, 0x010000000));
   2243             regval |= 0x20;    /* Set count-enable bit, |B05|. */
   2244             BCM_IF_ERROR_RETURN(
   2245                 WRITE_IEEE1588_TIME_CONTROLr(unit, regval));
   2246             COMPILER_64_COPY(val64, time->seconds);
   2247             COMPILER_64_UMUL_32(val64, 1000000000);
   2248             COMPILER_64_ADD_32(val64, time->nanoseconds);
   2249             /* coverity[result_independent_of_operands] */
   2250             BCM_IF_ERROR_RETURN(
   2251                 WRITE_CMIC_TIMESYNC_TS0_FREQ_CTRL_UPPERr(unit,
   2252                                                          COMPILER_64_HI(val64)));
   2253             /* coverity[result_independent_of_operands] */
   2254             BCM_IF_ERROR_RETURN(
   2255                 WRITE_CMIC_TIMESYNC_TS0_FREQ_CTRL_LOWERr(unit,
   2256                                                          COMPILER_64_LO(val64)));
   2257             return BCM_E_NONE;
   2258         }
   2259     }
   2260 #endif /* BCM_GREYHOUND2_SUPPORT */
   2261     rc = bcm_common_ptp_clock_time_set(unit, ptp_id, clock_num, time);
   2262 
   2263     return (rc);
   2264 }
   2265 
   2266 /*
   2267  * Function:
   2268  *      bcm_esw_ptp_clock_timescale_get
   2269  * Purpose:
   2270  *      Get timescale members of a PTP clock time properties dataset.
   2271  * Parameters:
   2272  *      unit - Unit number 
   2273  *      ptp_id - PTP stack ID
   2274  *      clock_num - PTP clock number
   2275  *      *timescale - PTP clock timescale properties
   2276  * Returns:
   2277  *      int
   2278  * Notes:
   2279  */
   2280 int
   2281 bcm_esw_ptp_clock_timescale_get(
   2282     int unit,
   2283     bcm_ptp_stack_id_t ptp_id,
   2284     int clock_num,
   2285     bcm_ptp_timescale_t *timescale)
   2286 {
   2287     int rc;
   2288 
   2289     rc = bcm_common_ptp_clock_timescale_get(unit, ptp_id, clock_num, timescale);
   2290 
   2291     return (rc);
   2292 }
   2293 
   2294 /*
   2295  * Function:
   2296  *      bcm_esw_ptp_clock_timescale_set
   2297  * Purpose:
   2298  *      Set timescale members of a PTP clock time properties dataset.
   2299  * Parameters:
   2300  *      unit - Unit number 
   2301  *      ptp_id - PTP stack ID
   2302  *      clock_num - PTP clock number
   2303  *      *timescale - PTP clock timescale properties
   2304  * Returns:
   2305  *      int
   2306  * Notes:
   2307  */
   2308 int
   2309 bcm_esw_ptp_clock_timescale_set(
   2310     int unit,
   2311     bcm_ptp_stack_id_t ptp_id,
   2312     int clock_num,
   2313     bcm_ptp_timescale_t *timescale)
   2314 {
   2315     int rc;
   2316 
   2317     rc = bcm_common_ptp_clock_timescale_set(unit, ptp_id, clock_num, timescale);
   2318 
   2319     return (rc);
   2320 }
   2321 
   2322 /*
   2323  * Function:
   2324  *      bcm_esw_ptp_clock_traceability_get
   2325  * Purpose:
   2326  *      Get traceability members of a PTP clock time properties dataset.
   2327  * Parameters:
   2328  *      unit - Unit number 
   2329  *      ptp_id - PTP stack ID
   2330  *      clock_num - PTP clock number
   2331  *      *trace - PTP clock traceability properties
   2332  * Returns:
   2333  *      int
   2334  * Notes:
   2335  */
   2336 int
   2337 bcm_esw_ptp_clock_traceability_get(
   2338     int unit,
   2339     bcm_ptp_stack_id_t ptp_id,
   2340     int clock_num,
   2341     bcm_ptp_trace_t *trace)
   2342 {
   2343     int rc;
   2344 
   2345     rc = bcm_common_ptp_clock_traceability_get(unit, ptp_id, clock_num, trace);
   2346 
   2347     return (rc);
   2348 }
   2349 
   2350 /*
   2351  * Function:
   2352  *      bcm_esw_ptp_clock_traceability_set
   2353  * Purpose:
   2354  *      Set traceability members of a PTP clock time properties dataset.
   2355  * Parameters:
   2356  *      unit - Unit number 
   2357  *      ptp_id - PTP stack ID
   2358  *      clock_num - PTP clock number
   2359  *      *trace - PTP clock traceability properties.
   2360  * Returns:
   2361  *      int
   2362  * Notes:
   2363  */
   2364 int
   2365 bcm_esw_ptp_clock_traceability_set(
   2366     int unit,
   2367     bcm_ptp_stack_id_t ptp_id,
   2368     int clock_num,
   2369     bcm_ptp_trace_t *trace)
   2370 {
   2371     int rc;
   2372 
   2373     rc = bcm_common_ptp_clock_traceability_set(unit, ptp_id, clock_num, trace);
   2374 
   2375     return (rc);
   2376 }
   2377 
   2378 /*
   2379  * Function:
   2380  *      bcm_esw_ptp_clock_user_description_set
   2381  * Purpose:
   2382  *      Set user description member of the default dataset.
   2383  * Parameters:
   2384  *      unit - Unit number 
   2385  *      ptp_id - PTP stack ID
   2386  *      clock_num - PTP clock number
   2387  *      *desc - User description
   2388  * Returns:
   2389  *      int
   2390  * Notes:
   2391  */
   2392 int
   2393 bcm_esw_ptp_clock_user_description_set(
   2394     int unit,
   2395     bcm_ptp_stack_id_t ptp_id,
   2396     int clock_num,
   2397     uint8 *desc)
   2398 {
   2399     int rc;
   2400 
   2401     rc = bcm_common_ptp_clock_user_description_set(unit, ptp_id, clock_num, desc);
   2402 
   2403     return (rc);
   2404 }
   2405 
   2406 /*
   2407  * Function:
   2408  *      bcm_esw_ptp_clock_utc_get
   2409  * Purpose:
   2410  *      Get UTC members of a PTP clock time properties dataset.
   2411  * Parameters:
   2412  *      unit - Unit number 
   2413  *      ptp_id - PTP stack ID
   2414  *      clock_num - PTP clock number
   2415  *      *utc - PTP clock coordinated universal time (UTC) properties
   2416  * Returns:
   2417  *      int
   2418  * Notes:
   2419  */
   2420 int
   2421 bcm_esw_ptp_clock_utc_get(
   2422     int unit,
   2423     bcm_ptp_stack_id_t ptp_id,
   2424     int clock_num,
   2425     bcm_ptp_utc_t *utc)
   2426 {
   2427     int rc;
   2428 
   2429     rc = bcm_common_ptp_clock_utc_get(unit, ptp_id, clock_num, utc);
   2430 
   2431     return (rc);
   2432 }
   2433 
   2434 /*
   2435  * Function:
   2436  *      bcm_esw_ptp_clock_utc_set
   2437  * Purpose:
   2438  *      Set UTC members of a PTP clock time properties dataset.
   2439  * Parameters:
   2440  *      unit - Unit number 
   2441  *      ptp_id - PTP stack ID
   2442  *      clock_num - PTP clock number
   2443  *      *utc - PTP clock coordinated universal time (UTC) properties
   2444  * Returns:
   2445  *      int
   2446  * Notes:
   2447  */
   2448 int
   2449 bcm_esw_ptp_clock_utc_set(
   2450     int unit,
   2451     bcm_ptp_stack_id_t ptp_id,
   2452     int clock_num,
   2453     bcm_ptp_utc_t *utc)
   2454 {
   2455     int rc;
   2456 
   2457     rc = bcm_common_ptp_clock_utc_set(unit, ptp_id, clock_num, utc);
   2458 
   2459     return (rc);
   2460 }
   2461 
   2462 /*
   2463  * Function:
   2464  *      bcm_esw_ptp_ctdev_alarm_callback_register
   2465  * Purpose:
   2466  *      Register a C-TDEV alarm callback function.
   2467  * Parameters:
   2468  *      unit - Unit number 
   2469  *      ptp_id - PTP stack ID
   2470  *      clock_num - PTP clock number
   2471  *      alarm_cb - pointer to C-TDEV alarm callback function
   2472  * Returns:
   2473  *      int
   2474  * Notes:
   2475  */
   2476 int
   2477 bcm_esw_ptp_ctdev_alarm_callback_register(
   2478     int unit,
   2479     bcm_ptp_stack_id_t ptp_id,
   2480     int clock_num,
   2481     bcm_ptp_ctdev_alarm_cb alarm_cb)
   2482 {
   2483     int rc;
   2484 
   2485     rc = bcm_common_ptp_ctdev_alarm_callback_register(unit, ptp_id, clock_num, alarm_cb);
   2486 
   2487     return (rc);
   2488 }
   2489 
   2490 /*
   2491  * Function:
   2492  *      bcm_esw_ptp_ctdev_alarm_callback_unregister
   2493  * Purpose:
   2494  *      Unregister a C-TDEV alarm callback function.
   2495  * Parameters:
   2496  *      unit - Unit number 
   2497  *      ptp_id - PTP stack ID
   2498  *      clock_num - PTP clock number
   2499  * Returns:
   2500  *      int
   2501  * Notes:
   2502  */
   2503 int
   2504 bcm_esw_ptp_ctdev_alarm_callback_unregister(
   2505     int unit,
   2506     bcm_ptp_stack_id_t ptp_id,
   2507     int clock_num)
   2508 {
   2509     int rc;
   2510 
   2511     rc = bcm_common_ptp_ctdev_alarm_callback_unregister(unit, ptp_id, clock_num);
   2512 
   2513     return (rc);
   2514 }
   2515 
   2516 /*
   2517  * Function:
   2518  *      bcm_esw_ptp_ctdev_alpha_get
   2519  * Purpose:
   2520  *      Get C-TDEV recursive algorithm forgetting factor (alpha).
   2521  * Parameters:
   2522  *      unit - Unit number 
   2523  *      ptp_id - PTP stack ID
   2524  *      clock_num - PTP clock number
   2525  *      *alpha_numerator - Forgetting factor numerator
   2526  *      *alpha_denominator - Forgetting factor denominator
   2527  * Returns:
   2528  *      int
   2529  * Notes:
   2530  */
   2531 int
   2532 bcm_esw_ptp_ctdev_alpha_get(
   2533     int unit,
   2534     bcm_ptp_stack_id_t ptp_id,
   2535     int clock_num,
   2536     uint16 *alpha_numerator,
   2537     uint16 *alpha_denominator)
   2538 {
   2539     int rc;
   2540 
   2541     rc = bcm_common_ptp_ctdev_alpha_get(unit, ptp_id, clock_num, alpha_numerator, 
   2542              alpha_denominator);
   2543 
   2544     return (rc);
   2545 }
   2546 
   2547 /*
   2548  * Function:
   2549  *      bcm_esw_ptp_ctdev_alpha_set
   2550  * Purpose:
   2551  *      Set C-TDEV recursive algorithm forgetting factor (alpha).
   2552  * Parameters:
   2553  *      unit - Unit number 
   2554  *      ptp_id - PTP stack ID
   2555  *      clock_num - PTP clock number
   2556  *      alpha_numerator - Forgetting factor numerator
   2557  *      alpha_denominator - Forgetting factor denominator
   2558  * Returns:
   2559  *      int
   2560  * Notes:
   2561  */
   2562 int
   2563 bcm_esw_ptp_ctdev_alpha_set(
   2564     int unit,
   2565     bcm_ptp_stack_id_t ptp_id,
   2566     int clock_num,
   2567     uint16 alpha_numerator,
   2568     uint16 alpha_denominator)
   2569 {
   2570     int rc;
   2571 
   2572     rc = bcm_common_ptp_ctdev_alpha_set(unit, ptp_id, clock_num, alpha_numerator, 
   2573              alpha_denominator);
   2574 
   2575     return (rc);
   2576 }
   2577 
   2578 /*
   2579  * Function:
   2580  *      bcm_esw_ptp_ctdev_enable_get
   2581  * Purpose:
   2582  *      Get enable/disable state of C-TDEV processing.
   2583  * Parameters:
   2584  *      unit - Unit number 
   2585  *      ptp_id - PTP stack ID
   2586  *      clock_num - PTP clock number
   2587  *      *enable - Enable Boolean
   2588  *      *flags - C-TDEV control flags (UNUSED)
   2589  * Returns:
   2590  *      int
   2591  * Notes:
   2592  */
   2593 int
   2594 bcm_esw_ptp_ctdev_enable_get(
   2595     int unit,
   2596     bcm_ptp_stack_id_t ptp_id,
   2597     int clock_num,
   2598     int *enable,
   2599     uint32 *flags)
   2600 {
   2601     int rc;
   2602 
   2603     rc = bcm_common_ptp_ctdev_enable_get(unit, ptp_id, clock_num, enable, flags);
   2604 
   2605     return (rc);
   2606 }
   2607 
   2608 /*
   2609  * Function:
   2610  *      bcm_esw_ptp_ctdev_enable_set
   2611  * Purpose:
   2612  *      Set enable/disable state of C-TDEV processing.
   2613  * Parameters:
   2614  *      unit - Unit number 
   2615  *      ptp_id - PTP stack ID
   2616  *      clock_num - PTP clock number
   2617  *      enable - Enable Boolean
   2618  *      flags - C-TDEV control flags (UNUSED)
   2619  * Returns:
   2620  *      int
   2621  * Notes:
   2622  */
   2623 int
   2624 bcm_esw_ptp_ctdev_enable_set(
   2625     int unit,
   2626     bcm_ptp_stack_id_t ptp_id,
   2627     int clock_num,
   2628     int enable,
   2629     uint32 flags)
   2630 {
   2631     int rc;
   2632 
   2633     rc = bcm_common_ptp_ctdev_enable_set(unit, ptp_id, clock_num, enable, flags);
   2634 
   2635     return (rc);
   2636 }
   2637 
   2638 /*
   2639  * Function:
   2640  *      bcm_esw_ptp_ctdev_verbose_get
   2641  * Purpose:
   2642  *      Get verbose program control option of C-TDEV processing.
   2643  * Parameters:
   2644  *      unit - Unit number 
   2645  *      ptp_id - PTP stack ID
   2646  *      clock_num - PTP clock number
   2647  *      *verbose - Verbose Boolean
   2648  * Returns:
   2649  *      int
   2650  * Notes:
   2651  */
   2652 int
   2653 bcm_esw_ptp_ctdev_verbose_get(
   2654     int unit,
   2655     bcm_ptp_stack_id_t ptp_id,
   2656     int clock_num,
   2657     int *verbose)
   2658 {
   2659     int rc;
   2660 
   2661     rc = bcm_common_ptp_ctdev_verbose_get(unit, ptp_id, clock_num, verbose);
   2662 
   2663     return (rc);
   2664 }
   2665 
   2666 /*
   2667  * Function:
   2668  *      bcm_esw_ptp_ctdev_verbose_set
   2669  * Purpose:
   2670  *      Set verbose program control option of C-TDEV processing.
   2671  * Parameters:
   2672  *      unit - Unit number 
   2673  *      ptp_id - PTP stack ID
   2674  *      clock_num - PTP clock number
   2675  *      verbose - Verbose Boolean
   2676  * Returns:
   2677  *      int
   2678  * Notes:
   2679  */
   2680 int
   2681 bcm_esw_ptp_ctdev_verbose_set(
   2682     int unit,
   2683     bcm_ptp_stack_id_t ptp_id,
   2684     int clock_num,
   2685     int verbose)
   2686 {
   2687     int rc;
   2688 
   2689     rc = bcm_common_ptp_ctdev_verbose_set(unit, ptp_id, clock_num, verbose);
   2690 
   2691     return (rc);
   2692 }
   2693 
   2694 /*
   2695  * Function:
   2696  *      bcm_esw_ptp_detach
   2697  * Purpose:
   2698  *      Shut down the PTP subsystem
   2699  * Parameters:
   2700  *      unit - Unit number 
   2701  * Returns:
   2702  *      int
   2703  * Notes:
   2704  */
   2705 int
   2706 bcm_esw_ptp_detach(
   2707     int unit)
   2708 {
   2709     int rc;
   2710 
   2711     rc = bcm_common_ptp_detach(unit);
   2712 
   2713     return (rc);
   2714 }
   2715 
   2716 /*
   2717  * Function:
   2718  *      bcm_esw_ptp_foreign_master_dataset_get
   2719  * Purpose:
   2720  *      Get the foreign master dataset of a PTP clock port.
   2721  * Parameters:
   2722  *      unit - Unit number 
   2723  *      ptp_id - PTP stack ID
   2724  *      clock_num - PTP clock number
   2725  *      port_num - PTP clock port number
   2726  *      *data_set - Foreign master dataset
   2727  * Returns:
   2728  *      int
   2729  * Notes:
   2730  */
   2731 int
   2732 bcm_esw_ptp_foreign_master_dataset_get(
   2733     int unit,
   2734     bcm_ptp_stack_id_t ptp_id,
   2735     int clock_num,
   2736     int port_num,
   2737     bcm_ptp_foreign_master_dataset_t *data_set)
   2738 {
   2739     int rc;
   2740 
   2741     rc = bcm_common_ptp_foreign_master_dataset_get(unit, ptp_id, clock_num, port_num, data_set);
   2742 
   2743     return (rc);
   2744 }
   2745 
   2746 
   2747 /*
   2748  * Function:
   2749  *      bcm_esw_ptp_lock
   2750  * Purpose:
   2751  *      Locks the unit mutex
   2752  * Parameters:
   2753  *      unit - Unit number
   2754  * Returns:
   2755  *      int
   2756  * Notes:
   2757  */
   2758 int bcm_esw_ptp_lock(
   2759    int unit)
   2760 {
   2761     int rc;
   2762 
   2763     rc = bcm_common_ptp_lock(unit);
   2764 
   2765     return (rc);
   2766 }
   2767 
   2768 /*
   2769  * Function:
   2770  *      bcm_esw_ptp_unlock
   2771  * Purpose:
   2772  *      UnLocks the unit mutex
   2773  * Parameters:
   2774  *      unit - Unit number
   2775  * Returns:
   2776  *      int
   2777  * Notes:
   2778  */
   2779 int bcm_esw_ptp_unlock(
   2780    int unit)
   2781 {
   2782     int rc;
   2783 
   2784     rc = bcm_common_ptp_unlock(unit);
   2785 
   2786     return (rc);
   2787 }
   2788 
   2789 /*
   2790  * Function:
   2791  *      bcm_esw_ptp_init
   2792  * Purpose:
   2793  *      Initialize the PTP subsystem
   2794  * Parameters:
   2795  *      unit - Unit number 
   2796  * Returns:
   2797  *      int
   2798  * Notes:
   2799  */
   2800 int
   2801 bcm_esw_ptp_init(
   2802     int unit)
   2803 {
   2804     int rc;
   2805 
   2806 #if defined(INCLUDE_PTP)
   2807 #if defined(BCM_HURRICANE2_SUPPORT)
   2808     if (!SOC_WARM_BOOT(unit)  && 
   2809          (SOC_IS_HURRICANE2(unit) || SOC_IS_GREYHOUND(unit))) {
   2810         int i;
   2811         int ptp_app = 0;
   2812         bcm_field_qset_t qset;
   2813     					
   2814         for (i = 0; i < SOC_CMCS_NUM(unit); i++) {
   2815             if (i == SOC_PCI_CMC(unit)) {
   2816                 /* Skip CPU queue */
   2817                 continue;
   2818             }
   2819             if (NUM_CPU_ARM_COSQ(unit, i)) {
   2820                 /* uC application exists */
   2821                 ptp_app = 1;
   2822                 break;
   2823             }
   2824         }
   2825         																	
   2826         if (ptp_app) {
   2827             BCM_FIELD_QSET_INIT(qset);
   2828             BCM_FIELD_QSET_ADD(qset, bcmFieldQualifyStageIngress);
   2829             BCM_FIELD_QSET_ADD(qset, bcmFieldQualifyL4DstPort);
   2830             BCM_FIELD_QSET_ADD(qset, bcmFieldQualifyEtherType);
   2831             BCM_IF_ERROR_RETURN(
   2832                 bcm_esw_field_group_create_id(unit, qset, 
   2833                                               BCM_FIELD_GROUP_PRIO_ANY, 1));
   2834             BCM_IF_ERROR_RETURN(
   2835                 bcm_esw_field_entry_create_id(unit, 1, 0));
   2836             
   2837             BCM_IF_ERROR_RETURN(
   2838                 bcm_esw_field_action_ports_add(unit, 0, bcmFieldActionEgressMask,
   2839             				PBMP_CMIC(unit)));
   2840             BCM_IF_ERROR_RETURN(
   2841                 bcm_esw_field_entry_install(unit, 0));
   2842         }
   2843     }
   2844 #endif /* BCM_HURRICANE2_SUPPORT */
   2845 #endif /* INCLUDE_PTP */
   2846 
   2847     rc = bcm_common_ptp_init(unit);
   2848 
   2849     return (rc);
   2850 }
   2851 
   2852 /*
   2853  * Function:
   2854  *      bcm_esw_ptp_input_channel_precedence_mode_set
   2855  * Purpose:
   2856  *      Set PTP input channels precedence mode.
   2857  * Parameters:
   2858  *      unit - Unit number 
   2859  *      ptp_id - PTP stack ID
   2860  *      clock_num - PTP clock number
   2861  *      channel_select_mode - Input channel precedence mode selector
   2862  * Returns:
   2863  *      int
   2864  * Notes:
   2865  */
   2866 int
   2867 bcm_esw_ptp_input_channel_precedence_mode_set(
   2868     int unit,
   2869     bcm_ptp_stack_id_t ptp_id,
   2870     int clock_num,
   2871     int channel_select_mode)
   2872 {
   2873     int rc;
   2874 
   2875     rc = bcm_common_ptp_input_channel_precedence_mode_set(unit, ptp_id, clock_num, 
   2876              channel_select_mode);
   2877 
   2878     return (rc);
   2879 }
   2880 
   2881 /*
   2882  * Function:
   2883  *      bcm_esw_ptp_input_channel_switching_mode_set
   2884  * Purpose:
   2885  *      Set PTP input channels switching mode.
   2886  * Parameters:
   2887  *      unit - Unit number 
   2888  *      ptp_id - PTP stack ID
   2889  *      clock_num - PTP clock number
   2890  *      channel_switching_mode - Channel switching mode selector
   2891  * Returns:
   2892  *      int
   2893  * Notes:
   2894  */
   2895 int
   2896 bcm_esw_ptp_input_channel_switching_mode_set(
   2897     int unit,
   2898     bcm_ptp_stack_id_t ptp_id,
   2899     int clock_num,
   2900     int channel_switching_mode)
   2901 {
   2902     int rc;
   2903 
   2904     rc = bcm_common_ptp_input_channel_switching_mode_set(unit, ptp_id, clock_num, 
   2905              channel_switching_mode);
   2906 
   2907     return (rc);
   2908 }
   2909 
   2910 /*
   2911  * Function:
   2912  *      bcm_esw_ptp_input_channels_get
   2913  * Purpose:
   2914  *      Set PTP input channels.
   2915  * Parameters:
   2916  *      unit - Unit number 
   2917  *      ptp_id - PTP stack ID
   2918  *      clock_num - PTP clock number
   2919  *      *num_channels - (IN) Max number of channels (time sources)
   2920  *                      (OUT) Number of returned channels (time sources).
   2921  *      *channels - Channels (time sources)
   2922  * Returns:
   2923  *      int
   2924  * Notes:
   2925  */
   2926 int
   2927 bcm_esw_ptp_input_channels_get(
   2928     int unit,
   2929     bcm_ptp_stack_id_t ptp_id,
   2930     int clock_num,
   2931     int *num_channels,
   2932     bcm_ptp_channel_t *channels)
   2933 {
   2934     int rc;
   2935 
   2936     rc = bcm_common_ptp_input_channels_get(unit, ptp_id, clock_num, num_channels, channels);
   2937 
   2938     return (rc);
   2939 }
   2940 
   2941 /*
   2942  * Function:
   2943  *      bcm_esw_ptp_input_channels_set
   2944  * Purpose:
   2945  *      Set PTP input channels.
   2946  * Parameters:
   2947  *      unit - Unit number 
   2948  *      ptp_id - PTP stack ID
   2949  *      clock_num - PTP clock number
   2950  *      num_channels - (IN)  Max number of channels (time sources)
   2951  *                     (OUT) Number of returned channels (time sources).
   2952  *      *channels - Channels (time sources)
   2953  * Returns:
   2954  *      int
   2955  * Notes:
   2956  */
   2957 int
   2958 bcm_esw_ptp_input_channels_set(
   2959     int unit,
   2960     bcm_ptp_stack_id_t ptp_id,
   2961     int clock_num,
   2962     int num_channels,
   2963     bcm_ptp_channel_t *channels)
   2964 {
   2965     int rc;
   2966 
   2967     rc = bcm_common_ptp_input_channels_set(unit, ptp_id, clock_num, num_channels, channels);
   2968 
   2969     return (rc);
   2970 }
   2971 
   2972 /*
   2973  * Function:
   2974  *      bcm_esw_ptp_synce_output_get
   2975  * Purpose:
   2976  *      Gets SyncE output control state.
   2977  * Parameters:
   2978  *      unit - Unit number.
   2979  *      ptp_id - PTP stack ID
   2980  *      clock_num - PTP clock number
   2981  *      state - Non-zero to indicate that SyncE output should be controlled by TOP
   2982  * Returns:
   2983  *      int
   2984  * Notes:
   2985  */
   2986 int
   2987 bcm_esw_ptp_synce_output_get(
   2988     int unit,
   2989     bcm_ptp_stack_id_t ptp_id,
   2990     int clock_num,
   2991     int *state)
   2992 {
   2993   int rc;
   2994 
   2995   rc = bcm_common_ptp_synce_output_get(unit, ptp_id, clock_num, state);
   2996 
   2997   return (rc);
   2998 }
   2999 /*
   3000  * Function:
   3001  *      bcm_esw_ptp_synce_output_set
   3002  * Purpose:
   3003  *      Set SyncE output control on/off.
   3004  * Parameters:
   3005  *      unit  - Unit number.
   3006  *      ptp_id  - PTP stack ID
   3007  *      clock_num - PTP clock number
   3008  *      synce_port - PTP SyncE clock port
   3009  *      state - Non-zero to indicate that SyncE output should be controlled by TOP
   3010  * Returns:
   3011  *      int
   3012  * Notes:
   3013  */
   3014 int
   3015 bcm_esw_ptp_synce_output_set(
   3016     int unit,
   3017     bcm_ptp_stack_id_t ptp_id,
   3018     int clock_num,
   3019     int synce_port,
   3020     int state)
   3021 {
   3022   int rc;
   3023 
   3024   rc = bcm_common_ptp_synce_output_set(unit, ptp_id, clock_num, synce_port, state);
   3025 
   3026   return (rc);
   3027 }
   3028 
   3029 /*
   3030  * Function:
   3031  *      bcm_esw_ptp_modular_enable_get
   3032  * Purpose:
   3033  *      Get enable/disable state of modular system functionality.
   3034  * Parameters:
   3035  *      unit - Unit number 
   3036  *      ptp_id - PTP stack ID
   3037  *      clock_num - PTP clock number
   3038  *      *enable - Enable Boolean
   3039  *      *flags - Modular system control flags (UNUSED)
   3040  * Returns:
   3041  *      int
   3042  * Notes:
   3043  */
   3044 int
   3045 bcm_esw_ptp_modular_enable_get(
   3046     int unit,
   3047     bcm_ptp_stack_id_t ptp_id,
   3048     int clock_num,
   3049     int *enable,
   3050     uint32 *flags)
   3051 {
   3052     int rc;
   3053 
   3054     rc = bcm_common_ptp_modular_enable_get(unit, ptp_id, clock_num, enable, flags);
   3055 
   3056     return (rc);
   3057 }
   3058 
   3059 /*
   3060  * Function:
   3061  *      bcm_esw_ptp_modular_enable_set
   3062  * Purpose:
   3063  *      Set enable/disable state of modular system functionality.
   3064  * Parameters:
   3065  *      unit - Unit number 
   3066  *      ptp_id - PTP stack ID
   3067  *      clock_num - PTP clock number
   3068  *      enable - Enable Boolean
   3069  *      flags - Modular system control flags (UNUSED)
   3070  * Returns:
   3071  *      int
   3072  * Notes:
   3073  */
   3074 int
   3075 bcm_esw_ptp_modular_enable_set(
   3076     int unit,
   3077     bcm_ptp_stack_id_t ptp_id,
   3078     int clock_num,
   3079     int enable,
   3080     uint32 flags)
   3081 {
   3082     int rc;
   3083 
   3084     rc = bcm_common_ptp_modular_enable_set(unit, ptp_id, clock_num, enable, flags);
   3085 
   3086     return (rc);
   3087 }
   3088 
   3089 /*
   3090  * Function:
   3091  *      bcm_esw_ptp_modular_phyts_get
   3092  * Purpose:
   3093  *      Get PHY timestamping configuration state and data.
   3094  * Parameters:
   3095  *      unit - Unit number 
   3096  *      ptp_id - PTP stack ID
   3097  *      clock_num - PTP clock number
   3098  *      *phyts - PHY timestamping Boolean
   3099  *      *framesync_pin - Framesync GPIO pin
   3100  * Returns:
   3101  *      int
   3102  * Notes:
   3103  */
   3104 int
   3105 bcm_esw_ptp_modular_phyts_get(
   3106     int unit,
   3107     bcm_ptp_stack_id_t ptp_id,
   3108     int clock_num,
   3109     int *phyts,
   3110     int *framesync_pin)
   3111 {
   3112     int rc;
   3113 
   3114     rc = bcm_common_ptp_modular_phyts_get(unit, ptp_id, clock_num, phyts, framesync_pin);
   3115 
   3116     return (rc);
   3117 }
   3118 
   3119 /*
   3120  * Function:
   3121  *      bcm_esw_ptp_modular_phyts_set
   3122  * Purpose:
   3123  *      Set PHY timestamping configuration state and data.
   3124  * Parameters:
   3125  *      unit - Unit number 
   3126  *      ptp_id - PTP stack ID
   3127  *      clock_num - PTP clock number
   3128  *      phyts - PHY timestamping Boolean
   3129  *      framesync_pin - Framesync GPIO pin
   3130  * Returns:
   3131  *      int
   3132  * Notes:
   3133  */
   3134 int
   3135 bcm_esw_ptp_modular_phyts_set(
   3136     int unit,
   3137     bcm_ptp_stack_id_t ptp_id,
   3138     int clock_num,
   3139     int phyts,
   3140     int framesync_pin)
   3141 {
   3142     int rc;
   3143 
   3144     rc = bcm_common_ptp_modular_phyts_set(unit, ptp_id, clock_num, phyts, framesync_pin);
   3145 
   3146     return (rc);
   3147 }
   3148 
   3149 /*
   3150  * Function:
   3151  *      bcm_esw_ptp_modular_portbitmap_get
   3152  * Purpose:
   3153  *      Get PHY port bitmap.
   3154  * Parameters:
   3155  *      unit - Unit number 
   3156  *      ptp_id - PTP stack ID
   3157  *      clock_num - PTP clock number
   3158  *      *pbmp - Port bitmap
   3159  * Returns:
   3160  *      int
   3161  * Notes:
   3162  */
   3163 int
   3164 bcm_esw_ptp_modular_portbitmap_get(
   3165     int unit,
   3166     bcm_ptp_stack_id_t ptp_id,
   3167     int clock_num,
   3168     bcm_pbmp_t *pbmp)
   3169 {
   3170     int rc;
   3171 
   3172     rc = bcm_common_ptp_modular_portbitmap_get(unit, ptp_id, clock_num, pbmp);
   3173 
   3174     return (rc);
   3175 }
   3176 
   3177 /*
   3178  * Function:
   3179  *      bcm_esw_ptp_modular_portbitmap_set
   3180  * Purpose:
   3181  *      Set PHY port bitmap.
   3182  * Parameters:
   3183  *      unit - Unit number 
   3184  *      ptp_id - PTP stack ID
   3185  *      clock_num - PTP clock number
   3186  *      pbmp - Port bitmap
   3187  * Returns:
   3188  *      int
   3189  * Notes:
   3190  */
   3191 int
   3192 bcm_esw_ptp_modular_portbitmap_set(
   3193     int unit,
   3194     bcm_ptp_stack_id_t ptp_id,
   3195     int clock_num,
   3196     bcm_pbmp_t pbmp)
   3197 {
   3198     int rc;
   3199 
   3200     rc = bcm_common_ptp_modular_portbitmap_set(unit, ptp_id, clock_num, pbmp);
   3201 
   3202     return (rc);
   3203 }
   3204 
   3205 /*
   3206  * Function:
   3207  *      bcm_esw_ptp_modular_verbose_get
   3208  * Purpose:
   3209  *      Get verbose program control option of modular system functionality.
   3210  * Parameters:
   3211  *      unit - Unit number 
   3212  *      ptp_id - PTP stack ID
   3213  *      clock_num - PTP clock number
   3214  *      *verbose - Verbose Boolean
   3215  * Returns:
   3216  *      int
   3217  * Notes:
   3218  */
   3219 int
   3220 bcm_esw_ptp_modular_verbose_get(
   3221     int unit,
   3222     bcm_ptp_stack_id_t ptp_id,
   3223     int clock_num,
   3224     int *verbose)
   3225 {
   3226     int rc;
   3227 
   3228     rc = bcm_common_ptp_modular_verbose_get(unit, ptp_id, clock_num, verbose);
   3229 
   3230     return (rc);
   3231 }
   3232 
   3233 /*
   3234  * Function:
   3235  *      bcm_esw_ptp_modular_verbose_set
   3236  * Purpose:
   3237  *      Set verbose program control option of modular system functionality.
   3238  * Parameters:
   3239  *      unit - Unit number 
   3240  *      ptp_id - PTP stack ID
   3241  *      clock_num - PTP clock number
   3242  *      verbose - Verbose Boolean
   3243  * Returns:
   3244  *      int
   3245  * Notes:
   3246  */
   3247 int
   3248 bcm_esw_ptp_modular_verbose_set(
   3249     int unit,
   3250     bcm_ptp_stack_id_t ptp_id,
   3251     int clock_num,
   3252     int verbose)
   3253 {
   3254     int rc;
   3255 
   3256     rc = bcm_common_ptp_modular_verbose_set(unit, ptp_id, clock_num, verbose);
   3257 
   3258     return (rc);
   3259 }
   3260 
   3261 /*
   3262  * Function:
   3263  *      bcm_esw_ptp_packet_counters_get
   3264  * Purpose:
   3265  *      Get packet counters.
   3266  * Parameters:
   3267  *      unit - Unit number 
   3268  *      ptp_id - PTP stack ID
   3269  *      clock_num - PTP clock number
   3270  *      *counters - Packet counts/statistics
   3271  * Returns:
   3272  *      int
   3273  * Notes:
   3274  */
   3275 int
   3276 bcm_esw_ptp_packet_counters_get(
   3277     int unit,
   3278     bcm_ptp_stack_id_t ptp_id,
   3279     int clock_num,
   3280     bcm_ptp_packet_counters_t *counters)
   3281 {
   3282     int rc;
   3283 
   3284     rc = bcm_common_ptp_packet_counters_get(unit, ptp_id, clock_num, counters);
   3285 
   3286     return (rc);
   3287 }
   3288 
   3289 /*
   3290  * Function:
   3291  *      bcm_esw_ptp_packet_counters_clear
   3292  * Purpose:
   3293  *      Reset packet counters.
   3294  * Parameters:
   3295  *      unit           - Unit number
   3296  *      ptp_id         - PTP stack ID
   3297  *      clock_num      - PTP clock number
   3298  *      port_num       - PTP clock port number (to clear port-specific stats)
   3299  *      counter_bitmap - counter bitmap
   3300  * Returns:
   3301  *      int
   3302  * Notes:
   3303  */
   3304 int
   3305 bcm_esw_ptp_packet_counters_clear(
   3306     int unit,
   3307     bcm_ptp_stack_id_t ptp_id,
   3308     int clock_num,
   3309     int port_num,
   3310     uint32 counter_bitmap)
   3311 {
   3312     int rc;
   3313 
   3314     rc = bcm_common_ptp_packet_counters_clear(unit, ptp_id, clock_num, port_num, counter_bitmap);
   3315 
   3316     return (rc);
   3317 }
   3318 
   3319 int
   3320 bcm_esw_ptp_clock_port_drop_counters_get(
   3321     int unit,
   3322     bcm_ptp_stack_id_t ptp_id,
   3323     int clock_num,
   3324     uint32 clock_port,
   3325     bcm_ptp_clock_port_packet_drop_counters_t *counters)
   3326 {
   3327     int rc;
   3328 
   3329     rc = bcm_common_ptp_clock_port_drop_counters_get(unit, ptp_id, clock_num, clock_port, counters);
   3330 
   3331     return (rc);
   3332 }
   3333 
   3334 int
   3335 bcm_esw_ptp_clock_port_drop_counters_enable_set(
   3336     int unit,
   3337     bcm_ptp_stack_id_t ptp_id,
   3338     int clock_num,
   3339     uint32 clock_port,
   3340     int enable)
   3341 {
   3342     int rc;
   3343     rc = bcm_common_ptp_clock_port_drop_counters_enable_set( unit,ptp_id,clock_num,clock_port,enable);
   3344     return (rc);
   3345 }
   3346 /*
   3347  * Function:
   3348  *      bcm_esw_ptp_peer_dataset_get
   3349  * Purpose:
   3350  *      Get Peer Dataset
   3351  * Parameters:
   3352  *      unit - Unit number
   3353  *      ptp_id - PTP stack ID
   3354  *      clock_num - PTP clock number
   3355  *      port_num - PTP port number
   3356  *      max_num_peers -
   3357  *      peers - list of peer entries
   3358  *      *num_peers - # of peer entries returned in peers
   3359  * Returns:
   3360  *      int
   3361  * Notes:
   3362  */
   3363 int
   3364 bcm_esw_ptp_peer_dataset_get(
   3365     int unit,
   3366     bcm_ptp_stack_id_t ptp_id,
   3367     int clock_num,
   3368     int port_num,
   3369     int max_num_peers,
   3370     bcm_ptp_peer_entry_t *peers,
   3371     int *num_peers)
   3372 {
   3373     int rc;
   3374 
   3375     rc = bcm_common_ptp_peer_dataset_get(unit, ptp_id, clock_num, port_num, max_num_peers, peers, num_peers);
   3376 
   3377     return (rc);
   3378 }
   3379 
   3380 /*
   3381  * Function:
   3382  *      bcm_esw_ptp_primary_domain_get
   3383  * Purpose:
   3384  *      Get primary domain member of a PTP transparent clock default dataset.
   3385  * Parameters:
   3386  *      unit - Unit number 
   3387  *      ptp_id - PTP stack ID
   3388  *      clock_num - PTP clock number
   3389  *      *primary_domain - PTP transparent clock primary domain
   3390  * Returns:
   3391  *      int
   3392  * Notes:
   3393  */
   3394 int
   3395 bcm_esw_ptp_primary_domain_get(
   3396     int unit,
   3397     bcm_ptp_stack_id_t ptp_id,
   3398     int clock_num,
   3399     int *primary_domain)
   3400 {
   3401     int rc;
   3402 
   3403     rc = bcm_common_ptp_primary_domain_get(unit, ptp_id, clock_num, primary_domain);
   3404 
   3405     return (rc);
   3406 }
   3407 
   3408 /*
   3409  * Function:
   3410  *      bcm_esw_ptp_primary_domain_set
   3411  * Purpose:
   3412  *      Set primary domain member of a PTP transparent clock default dataset.
   3413  * Parameters:
   3414  *      unit - Unit number 
   3415  *      ptp_id - PTP stack ID
   3416  *      clock_num - PTP clock number
   3417  *      primary_domain - PTP transparent clock primary domain.
   3418  * Returns:
   3419  *      int
   3420  * Notes:
   3421  */
   3422 int
   3423 bcm_esw_ptp_primary_domain_set(
   3424     int unit,
   3425     bcm_ptp_stack_id_t ptp_id,
   3426     int clock_num,
   3427     int primary_domain)
   3428 {
   3429     int rc;
   3430 
   3431     rc = bcm_common_ptp_primary_domain_set(unit, ptp_id, clock_num, primary_domain);
   3432 
   3433     return (rc);
   3434 }
   3435 
   3436 /*
   3437  * Function:
   3438  *      bcm_esw_ptp_servo_configuration_get
   3439  * Purpose:
   3440  *      Get PTP servo configuration properties.
   3441  * Parameters:
   3442  *      unit - Unit number 
   3443  *      ptp_id - PTP stack ID
   3444  *      clock_num - PTP clock number
   3445  *      *config - PTP servo configuration properties
   3446  * Returns:
   3447  *      int
   3448  * Notes:
   3449  */
   3450 int
   3451 bcm_esw_ptp_servo_configuration_get(
   3452     int unit,
   3453     bcm_ptp_stack_id_t ptp_id,
   3454     int clock_num,
   3455     bcm_ptp_servo_config_t *config)
   3456 {
   3457     int rc;
   3458 
   3459     rc = bcm_common_ptp_servo_configuration_get(unit, ptp_id, clock_num, config);
   3460 
   3461     return (rc);
   3462 }
   3463 
   3464 /*
   3465  * Function:
   3466  *      bcm_esw_ptp_servo_configuration_set
   3467  * Purpose:
   3468  *      Set PTP servo configuration properties.
   3469  * Parameters:
   3470  *      unit - Unit number 
   3471  *      ptp_id - PTP stack ID
   3472  *      clock_num - PTP clock number
   3473  *      *config - PTP servo configuration properties
   3474  * Returns:
   3475  *      int
   3476  * Notes:
   3477  */
   3478 int
   3479 bcm_esw_ptp_servo_configuration_set(
   3480     int unit,
   3481     bcm_ptp_stack_id_t ptp_id,
   3482     int clock_num,
   3483     bcm_ptp_servo_config_t *config)
   3484 {
   3485     int rc;
   3486 
   3487     rc = bcm_common_ptp_servo_configuration_set(unit, ptp_id, clock_num, config);
   3488 
   3489     return (rc);
   3490 }
   3491 
   3492 /*
   3493  * Function:
   3494  *      bcm_esw_ptp_servo_status_get
   3495  * Purpose:
   3496  *      Get PTP servo state and status information.
   3497  * Parameters:
   3498  *      unit - Unit number 
   3499  *      ptp_id - PTP stack ID
   3500  *      clock_num - PTP clock number
   3501  *      *status - PTP servo state and status information
   3502  * Returns:
   3503  *      int
   3504  * Notes:
   3505  */
   3506 int
   3507 bcm_esw_ptp_servo_status_get(
   3508     int unit,
   3509     bcm_ptp_stack_id_t ptp_id,
   3510     int clock_num,
   3511     bcm_ptp_servo_status_t *status)
   3512 {
   3513     int rc;
   3514 
   3515     rc = bcm_common_ptp_servo_status_get(unit, ptp_id, clock_num, status);
   3516 
   3517     return (rc);
   3518 }
   3519 
   3520 /*
   3521  * Function:
   3522  *      bcm_esw_ptp_servo_threshold_get
   3523  * Purpose:
   3524  *      Get PTP servo threshold information.
   3525  * Parameters:
   3526  *      unit - Unit number
   3527  *      ptp_id - PTP stack ID
   3528  *      clock_num - PTP clock number
   3529  *      *threshold - PTP servo threshold
   3530  * Returns:
   3531  *      int
   3532  * Notes:
   3533  */
   3534 int
   3535 bcm_esw_ptp_servo_threshold_get(
   3536     int unit,
   3537     bcm_ptp_stack_id_t ptp_id,
   3538     int clock_num,
   3539     bcm_ptp_servo_threshold_t *threshold)
   3540 {
   3541     int rc;
   3542 
   3543     rc = bcm_common_ptp_servo_threshold_get(unit, ptp_id, clock_num, threshold);
   3544 
   3545     return (rc);
   3546 }
   3547 
   3548 /*
   3549  * Function:
   3550  *      bcm_esw_ptp_servo_threshold_set
   3551  * Purpose:
   3552  *      Set PTP servo threshold information.
   3553  * Parameters:
   3554  *      unit - Unit number
   3555  *      ptp_id - PTP stack ID
   3556  *      clock_num - PTP clock number
   3557  *      *threshold - PTP servo threshold
   3558  * Returns:
   3559  *      int
   3560  * Notes:
   3561  */
   3562 int
   3563 bcm_esw_ptp_servo_threshold_set(
   3564     int unit,
   3565     bcm_ptp_stack_id_t ptp_id,
   3566     int clock_num,
   3567     bcm_ptp_servo_threshold_t *threshold)
   3568 {
   3569     int rc;
   3570 
   3571     rc = bcm_common_ptp_servo_threshold_set(unit, ptp_id, clock_num, threshold);
   3572 
   3573     return (rc);
   3574 }
   3575 
   3576 /*
   3577  * Function:
   3578  *      bcm_esw_ptp_signal_output_get
   3579  * Purpose:
   3580  *      Get PTP signal output.
   3581  * Parameters:
   3582  *      unit - Unit number 
   3583  *      ptp_id - PTP stack ID
   3584  *      clock_num - PTP clock number
   3585  *      *signal_output_count - (IN)  Max number of signal outputs
   3586  *                             (OUT) Number signal outputs returned
   3587  *      *signal_output_id - Array of signal outputs
   3588  * Returns:
   3589  *      int
   3590  * Notes:
   3591  */
   3592 int
   3593 bcm_esw_ptp_signal_output_get(
   3594     int unit,
   3595     bcm_ptp_stack_id_t ptp_id,
   3596     int clock_num,
   3597     int *signal_output_count,
   3598     bcm_ptp_signal_output_t *signal_output_id)
   3599 {
   3600     int rc;
   3601 
   3602     rc = bcm_common_ptp_signal_output_get(unit, ptp_id, clock_num, signal_output_count, 
   3603              signal_output_id);
   3604 
   3605     return (rc);
   3606 }
   3607 
   3608 /*
   3609  * Function:
   3610  *      bcm_esw_ptp_signal_output_remove
   3611  * Purpose:
   3612  *      Remove PTP signal output.
   3613  * Parameters:
   3614  *      unit - Unit number 
   3615  *      ptp_id - PTP stack ID
   3616  *      clock_num - PTP clock number
   3617  *      signal_output_id - Signal to remove/invalidate
   3618  * Returns:
   3619  *      int
   3620  * Notes:
   3621  */
   3622 int
   3623 bcm_esw_ptp_signal_output_remove(
   3624     int unit,
   3625     bcm_ptp_stack_id_t ptp_id,
   3626     int clock_num,
   3627     int signal_output_id)
   3628 {
   3629     int rc;
   3630 
   3631     rc = bcm_common_ptp_signal_output_remove(unit, ptp_id, clock_num, signal_output_id);
   3632 
   3633     return (rc);
   3634 }
   3635 
   3636 /*
   3637  * Function:
   3638  *      bcm_esw_ptp_signal_output_set
   3639  * Purpose:
   3640  *      Set PTP signal output.
   3641  * Parameters:
   3642  *      unit - Unit number 
   3643  *      ptp_id - PTP stack ID
   3644  *      clock_num - PTP clock number
   3645  *      *signal_output_id - ID of signal
   3646  *      *output_info - Signal information
   3647  * Returns:
   3648  *      int
   3649  * Notes:
   3650  */
   3651 int
   3652 bcm_esw_ptp_signal_output_set(
   3653     int unit,
   3654     bcm_ptp_stack_id_t ptp_id,
   3655     int clock_num,
   3656     int *signal_output_id,
   3657     bcm_ptp_signal_output_t *output_info)
   3658 {
   3659     int rc;
   3660 
   3661     rc = bcm_common_ptp_signal_output_set(unit, ptp_id, clock_num, signal_output_id, 
   3662              output_info);
   3663 
   3664     return (rc);
   3665 }
   3666 
   3667 /*
   3668  * Function:
   3669  *      bcm_esw_ptp_signaled_unicast_master_add
   3670  * Purpose:
   3671  *      Add an entry to the signaled unicast master table.
   3672  * Parameters:
   3673  *      unit - Unit number 
   3674  *      ptp_id - PTP stack ID
   3675  *      clock_num - PTP clock number
   3676  *      port_num - PTP clock port number
   3677  *      *master_info - Acceptable master address
   3678  *      mask - Signaled unicast master configuration flags
   3679  * Returns:
   3680  *      int
   3681  * Notes:
   3682  */
   3683 int
   3684 bcm_esw_ptp_signaled_unicast_master_add(
   3685     int unit,
   3686     bcm_ptp_stack_id_t ptp_id,
   3687     int clock_num,
   3688     int port_num,
   3689     bcm_ptp_clock_unicast_master_t *master_info,
   3690     uint32 mask)
   3691 {
   3692     int rc;
   3693 
   3694     rc = bcm_common_ptp_signaled_unicast_master_add(unit, ptp_id, clock_num, port_num, 
   3695              master_info, mask);
   3696 
   3697     return (rc);
   3698 }
   3699 
   3700 /*
   3701  * Function:
   3702  *      bcm_esw_ptp_signaled_unicast_master_remove
   3703  * Purpose:
   3704  *      Remove an entry from the signaled unicast master table.
   3705  * Parameters:
   3706  *      unit - Unit number 
   3707  *      ptp_id - PTP stack ID
   3708  *      clock_num - PTP clock number
   3709  *      port_num - PTP clock port number
   3710  *      *master_info - Acceptable master address
   3711  * Returns:
   3712  *      int
   3713  * Notes:
   3714  */
   3715 int
   3716 bcm_esw_ptp_signaled_unicast_master_remove(
   3717     int unit,
   3718     bcm_ptp_stack_id_t ptp_id,
   3719     int clock_num,
   3720     int port_num,
   3721     bcm_ptp_clock_peer_address_t *master_info)
   3722 {
   3723     int rc;
   3724 
   3725     rc = bcm_common_ptp_signaled_unicast_master_remove(unit, ptp_id, clock_num, port_num, 
   3726              master_info);
   3727 
   3728     return (rc);
   3729 }
   3730 
   3731 /*
   3732  * Function:
   3733  *      bcm_esw_ptp_signaled_unicast_slave_list
   3734  * Purpose:
   3735  *      List the signaled unicast slaves.
   3736  * Parameters:
   3737  *      unit - Unit number 
   3738  *      ptp_id - PTP stack ID
   3739  *      clock_num - PTP clock number
   3740  *      port_num - PTP clock port number
   3741  *      max_num_slaves - Maximum number of signaled unicast slaves
   3742  *      *num_slaves - Number of signaled unicast slaves
   3743  *      *slave_info - Signaled unicast slave table
   3744  * Returns:
   3745  *      int
   3746  * Notes:
   3747  */
   3748 int
   3749 bcm_esw_ptp_signaled_unicast_slave_list(
   3750     int unit,
   3751     bcm_ptp_stack_id_t ptp_id,
   3752     int clock_num,
   3753     int port_num,
   3754     int max_num_slaves,
   3755     int *num_slaves,
   3756     bcm_ptp_clock_peer_t *slave_info)
   3757 {
   3758     int rc;
   3759 
   3760     rc = bcm_common_ptp_signaled_unicast_slave_list(unit, ptp_id, clock_num, port_num, 
   3761              max_num_slaves, num_slaves, slave_info);
   3762 
   3763     return (rc);
   3764 }
   3765 
   3766 /*
   3767  * Function:
   3768  *      bcm_esw_ptp_signaled_unicast_slave_table_clear
   3769  * Purpose:
   3770  *      Cancel active unicast services for slaves and clear signaled unicast
   3771  *      slave table entries that correspond to caller-specified master port.
   3772  * Parameters:
   3773  *      unit - Unit number 
   3774  *      ptp_id - PTP stack ID
   3775  *      clock_num - PTP clock number
   3776  *      port_num - PTP clock port number
   3777  *      callstack - Boolean to unsubscribe/unregister unicast services.
   3778  *          TRUE : Cancellation message to slave and PTP stack.
   3779  *          FALSE: Cancellation message tunneled to slave only.
   3780  * Returns:
   3781  *      int
   3782  * Notes:
   3783  */
   3784 int
   3785 bcm_esw_ptp_signaled_unicast_slave_table_clear(
   3786     int unit,
   3787     bcm_ptp_stack_id_t ptp_id,
   3788     int clock_num,
   3789     int port_num,
   3790     int callstack)
   3791 {
   3792     int rc;
   3793 
   3794     rc = bcm_common_ptp_signaled_unicast_slave_table_clear(unit, ptp_id, clock_num, port_num, 
   3795              callstack);
   3796 
   3797     return (rc);
   3798 }
   3799 
   3800 /*
   3801  * Function:
   3802  *      bcm_esw_ptp_signaling_arbiter_register
   3803  * Purpose:
   3804  *      Register a signaling arbiter function that contains the accept/reject logic
   3805  *      for incoming signaling messages
   3806  * Parameters:
   3807  *      unit - Unit number
   3808  *      ptp_id - PTP stack ID
   3809  *      clock_num - PTP clock number
   3810  *      arb       - (IN) PTP signaling message arbiter function pointer.
   3811  *      user_data - (IN) User data.
   3812  * Returns:
   3813  *      BCM_E_xx : Function status
   3814  * Notes:
   3815  */
   3816 int
   3817 bcm_esw_ptp_signaling_arbiter_register(
   3818     int unit,
   3819     bcm_ptp_stack_id_t ptp_id,
   3820     int clock_num,
   3821     bcm_ptp_signaling_arbiter_t arb,
   3822     void *user_data)
   3823 {
   3824     int rc;
   3825 
   3826     rc = _bcm_ptp_register_signaling_arbiter(unit, arb, user_data);
   3827 
   3828     return (rc);
   3829 }
   3830 
   3831 /*
   3832  * Function:
   3833  *      bcm_esw_ptp_signaling_arbiter_unregister
   3834  * Purpose:
   3835  *      Unregister a signaling arbiter function that contains the accept/reject logic
   3836  *      for incoming signaling messages
   3837  * Parameters:
   3838  *      unit - Unit number
   3839  *      ptp_id - PTP stack ID
   3840  *      clock_num - PTP clock number
   3841  *      arb       - (IN) PTP signaling message arbiter function pointer.
   3842  *      user_data - (IN) User data.
   3843  * Returns:
   3844  *      BCM_E_xx : Function status
   3845  * Notes:
   3846  */
   3847 int
   3848 bcm_esw_ptp_signaling_arbiter_unregister(
   3849     int unit,
   3850     bcm_ptp_stack_id_t ptp_id,
   3851     int clock_num)
   3852 {
   3853     int rc;
   3854 
   3855     rc = _bcm_ptp_unregister_signaling_arbiter(unit);
   3856 
   3857     return (rc);
   3858 }
   3859 
   3860 /*
   3861  * Function:
   3862  *      bcm_esw_ptp_stack_create
   3863  * Purpose:
   3864  *      Create a PTP stack instance
   3865  * Parameters:
   3866  *      unit - Unit number 
   3867  *      *ptp_info - Pointer to an PTP Stack Info structure
   3868  * Returns:
   3869  *      int
   3870  * Notes:
   3871  */
   3872 int
   3873 bcm_esw_ptp_stack_create(
   3874     int unit,
   3875     bcm_ptp_stack_info_t *ptp_info)
   3876 {
   3877     int rc;
   3878 
   3879     rc = bcm_common_ptp_stack_create(unit, ptp_info);
   3880 
   3881     return (rc);
   3882 }
   3883 
   3884 /*
   3885  * Function:
   3886  *      bcm_esw_ptp_stack_destroy
   3887  * Purpose:
   3888  *      Destroy a PTP stack instance
   3889  * Parameters:
   3890  *      unit - Unit number 
   3891  *      ptp_id - ID of stack to destroy
   3892  * Returns:
   3893  *      int
   3894  * Notes:
   3895  */
   3896 int
   3897 bcm_esw_ptp_stack_destroy(
   3898     int unit,
   3899     bcm_ptp_stack_id_t ptp_id)
   3900 {
   3901     int rc;
   3902 
   3903     rc = bcm_common_ptp_stack_destroy(unit, ptp_id);
   3904     /* Clear HW interrup registers */
   3905     _bcm_esw_ptp_hw_clear(unit);
   3906 
   3907     return (rc);
   3908 }
   3909 
   3910 /*
   3911  * Function:
   3912  *      bcm_esw_ptp_stack_get
   3913  * Purpose:
   3914  *      Get a PTP stack instance
   3915  * Parameters:
   3916  *      unit - Unit number
   3917  *      ptp_id - ID of stack to get
   3918  *      ptp_info - info structs for stack
   3919  * Returns:
   3920  *      int
   3921  * Notes:
   3922  */
   3923 int
   3924 bcm_esw_ptp_stack_get(
   3925     int unit,
   3926     bcm_ptp_stack_id_t ptp_id,
   3927     bcm_ptp_stack_info_t *ptp_info)
   3928 {
   3929     int rc;
   3930 
   3931     rc = bcm_common_ptp_stack_get(unit, ptp_id, ptp_info);
   3932 
   3933     return (rc);
   3934 }
   3935 
   3936 /*
   3937  * Function:
   3938  *      bcm_esw_ptp_stack_get_all
   3939  * Purpose:
   3940  *      Gets all PTP stack instances
   3941  * Parameters:
   3942  *      unit - Unit number
   3943  *      max_size - maximum number of stacks to return
   3944  *      ptp_info - info structs for stacks
   3945  *      no_of_stacks - actual number of stacks that can be returned
   3946  * Returns:
   3947  *      int
   3948  * Notes:
   3949  */
   3950 int
   3951 bcm_esw_ptp_stack_get_all(
   3952     int unit,
   3953     int max_size, 
   3954     bcm_ptp_stack_info_t *ptp_info,
   3955     int *no_of_stacks)
   3956 {
   3957     int rc;
   3958 
   3959     rc = bcm_common_ptp_stack_get_all(unit, max_size, ptp_info, no_of_stacks);
   3960 
   3961     return (rc);
   3962 }
   3963 
   3964 /*
   3965  * Function:
   3966  *      bcm_esw_ptp_static_unicast_master_add
   3967  * Purpose:
   3968  *      Add an entry to the unicast master table of a PTP clock.
   3969  * Parameters:
   3970  *      unit - Unit number 
   3971  *      ptp_id - PTP stack ID
   3972  *      clock_num - PTP clock number
   3973  *      port_num - PTP clock port number
   3974  *      *master_info - Acceptable master address
   3975  * Returns:
   3976  *      int
   3977  * Notes:
   3978  */
   3979 int
   3980 bcm_esw_ptp_static_unicast_master_add(
   3981     int unit,
   3982     bcm_ptp_stack_id_t ptp_id,
   3983     int clock_num,
   3984     int port_num,
   3985     bcm_ptp_clock_unicast_master_t *master_info)
   3986 {
   3987     int rc;
   3988 
   3989     rc = bcm_common_ptp_static_unicast_master_add(unit, ptp_id, clock_num, port_num, 
   3990              master_info);
   3991 
   3992     return (rc);
   3993 }
   3994 
   3995 /*
   3996  * Function:
   3997  *      bcm_esw_ptp_static_unicast_master_list
   3998  * Purpose:
   3999  *      List the unicast master table of a PTP clock.
   4000  * Parameters:
   4001  *      unit - Unit number 
   4002  *      ptp_id - PTP stack ID
   4003  *      clock_num - PTP clock number
   4004  *      port_num - PTP clock port number
   4005  *      max_num_masters - Maximum number of unicast master table entries
   4006  *      *num_masters - Number of unicast master table entries
   4007  *      *master_addr - Unicast master table
   4008  * Returns:
   4009  *      int
   4010  * Notes:
   4011  */
   4012 int
   4013 bcm_esw_ptp_static_unicast_master_list(
   4014     int unit,
   4015     bcm_ptp_stack_id_t ptp_id,
   4016     int clock_num,
   4017     int port_num,
   4018     int max_num_masters,
   4019     int *num_masters,
   4020     bcm_ptp_clock_peer_address_t *master_addr)
   4021 {
   4022     int rc;
   4023 
   4024     rc = bcm_common_ptp_static_unicast_master_list(unit, ptp_id, clock_num, port_num, 
   4025              max_num_masters, num_masters, master_addr);
   4026 
   4027     return (rc);
   4028 }
   4029 
   4030 /*
   4031  * Function:
   4032  *      bcm_esw_ptp_static_unicast_master_remove
   4033  * Purpose:
   4034  *      Remove an entry from the static unicast master table.
   4035  * Parameters:
   4036  *      unit - Unit number 
   4037  *      ptp_id - PTP stack ID
   4038  *      clock_num - PTP clock number
   4039  *      port_num - PTP clock port number
   4040  *      *master_addr - Unicast master table
   4041  * Returns:
   4042  *      int
   4043  * Notes:
   4044  */
   4045 int
   4046 bcm_esw_ptp_static_unicast_master_remove(
   4047     int unit,
   4048     bcm_ptp_stack_id_t ptp_id,
   4049     int clock_num,
   4050     int port_num,
   4051     bcm_ptp_clock_peer_address_t *master_addr)
   4052 {
   4053     int rc;
   4054 
   4055     rc = bcm_common_ptp_static_unicast_master_remove(unit, ptp_id, clock_num, port_num, 
   4056              master_addr);
   4057 
   4058     return (rc);
   4059 }
   4060 
   4061 /*
   4062  * Function:
   4063  *      bcm_esw_ptp_static_unicast_master_table_clear
   4064  * Purpose:
   4065  *      Clear (i.e. remove all entries from) the unicast master table 
   4066  *      of a PTP clock.
   4067  * Parameters:
   4068  *      unit - Unit number 
   4069  *      ptp_id - PTP stack ID
   4070  *      clock_num - PTP clock number
   4071  *      port_num - PTP clock port number
   4072  * Returns:
   4073  *      int
   4074  * Notes:
   4075  */
   4076 int
   4077 bcm_esw_ptp_static_unicast_master_table_clear(
   4078     int unit,
   4079     bcm_ptp_stack_id_t ptp_id,
   4080     int clock_num,
   4081     int port_num)
   4082 {
   4083     int rc;
   4084 
   4085     rc = bcm_common_ptp_static_unicast_master_table_clear(unit, ptp_id, clock_num, port_num);
   4086 
   4087     return (rc);
   4088 }
   4089 
   4090 /*
   4091  * Function:
   4092  *      bcm_esw_ptp_static_unicast_master_table_size_get
   4093  * Purpose:
   4094  *      Get maximum number of unicast master table entries of a PTP clock.
   4095  * Parameters:
   4096  *      unit - Unit number 
   4097  *      ptp_id - PTP stack ID
   4098  *      clock_num - PTP clock number
   4099  *      port_num - PTP clock port number
   4100  *      *max_table_entries - Maximum number of unicast master table entries
   4101  * Returns:
   4102  *      int
   4103  * Notes:
   4104  */
   4105 int
   4106 bcm_esw_ptp_static_unicast_master_table_size_get(
   4107     int unit,
   4108     bcm_ptp_stack_id_t ptp_id,
   4109     int clock_num,
   4110     int port_num,
   4111     int *max_table_entries)
   4112 {
   4113     int rc;
   4114 
   4115     rc = bcm_common_ptp_static_unicast_master_table_size_get(unit, ptp_id, clock_num, port_num, 
   4116              max_table_entries);
   4117 
   4118     return (rc);
   4119 }
   4120 
   4121 /*
   4122  * Function:
   4123  *      bcm_esw_ptp_static_unicast_slave_add
   4124  * Purpose:
   4125  *      Add a unicast slave to a PTP clock port.
   4126  * Parameters:
   4127  *      unit - Unit number 
   4128  *      ptp_id - PTP stack ID
   4129  *      clock_num - PTP clock number
   4130  *      port_num - PTP clock port number
   4131  *      *slave_info - Unicast slave information.
   4132  * Returns:
   4133  *      int
   4134  * Notes:
   4135  */
   4136 int
   4137 bcm_esw_ptp_static_unicast_slave_add(
   4138     int unit,
   4139     bcm_ptp_stack_id_t ptp_id,
   4140     int clock_num,
   4141     int port_num,
   4142     bcm_ptp_clock_peer_t *slave_info)
   4143 {
   4144     int rc;
   4145 
   4146     rc = bcm_common_ptp_static_unicast_slave_add(unit, ptp_id, clock_num, port_num, slave_info);
   4147 
   4148     return (rc);
   4149 }
   4150 
   4151 /*
   4152  * Function:
   4153  *      bcm_esw_ptp_static_unicast_slave_list
   4154  * Purpose:
   4155  *      List the unicast slaves of a PTP clock port.
   4156  * Parameters:
   4157  *      unit - Unit number 
   4158  *      ptp_id - PTP stack ID
   4159  *      clock_num - PTP clock number
   4160  *      port_num - PTP clock port number
   4161  *      max_num_slaves - Maximum number of unicast slave table entries
   4162  *      *num_slaves - Number of unicast slave table entries
   4163  *      *slave_info - Unicast slave table
   4164  * Returns:
   4165  *      int
   4166  * Notes:
   4167  */
   4168 int
   4169 bcm_esw_ptp_static_unicast_slave_list(
   4170     int unit,
   4171     bcm_ptp_stack_id_t ptp_id,
   4172     int clock_num,
   4173     int port_num,
   4174     int max_num_slaves,
   4175     int *num_slaves,
   4176     bcm_ptp_clock_peer_t *slave_info)
   4177 {
   4178     int rc;
   4179 
   4180     rc = bcm_common_ptp_static_unicast_slave_list(unit, ptp_id, clock_num, port_num, 
   4181              max_num_slaves, num_slaves, slave_info);
   4182 
   4183     return (rc);
   4184 }
   4185 
   4186 /*
   4187  * Function:
   4188  *      bcm_esw_ptp_static_unicast_slave_remove
   4189  * Purpose:
   4190  *      Remove a unicast slave of a PTP clock port.
   4191  * Parameters:
   4192  *      unit - Unit number 
   4193  *      ptp_id - PTP stack ID
   4194  *      clock_num - PTP clock number
   4195  *      port_num - PTP clock port number
   4196  *      *slave_info - Unicast slave information
   4197  * Returns:
   4198  *      int
   4199  * Notes:
   4200  */
   4201 int
   4202 bcm_esw_ptp_static_unicast_slave_remove(
   4203     int unit,
   4204     bcm_ptp_stack_id_t ptp_id,
   4205     int clock_num,
   4206     int port_num,
   4207     bcm_ptp_clock_peer_t *slave_info)
   4208 {
   4209     int rc;
   4210 
   4211     rc = bcm_common_ptp_static_unicast_slave_remove(unit, ptp_id, clock_num, port_num, 
   4212              slave_info);
   4213 
   4214     return (rc);
   4215 }
   4216 
   4217 /*
   4218  * Function:
   4219  *      bcm_esw_ptp_static_unicast_slave_table_clear
   4220  * Purpose:
   4221  *      Clear (i.e. remove all) unicast slaves of a PTP clock port.
   4222  * Parameters:
   4223  *      unit - Unit number 
   4224  *      ptp_id - PTP stack ID
   4225  *      clock_num - PTP clock number
   4226  *      port_num - PTP clock port number
   4227  * Returns:
   4228  *      int
   4229  * Notes:
   4230  */
   4231 int
   4232 bcm_esw_ptp_static_unicast_slave_table_clear(
   4233     int unit,
   4234     bcm_ptp_stack_id_t ptp_id,
   4235     int clock_num,
   4236     int port_num)
   4237 {
   4238     int rc;
   4239 
   4240     rc = bcm_common_ptp_static_unicast_slave_table_clear(unit, ptp_id, clock_num, port_num);
   4241 
   4242     return (rc);
   4243 }
   4244 
   4245 /*
   4246  * Function:
   4247  *      bcm_esw_ptp_sync_phy
   4248  * Purpose:
   4249  *      Instruct TOP to send a PHY Sync pulse, and mark the time that the PHYs are now synced to.
   4250  * Parameters:
   4251  *      unit - Unit number 
   4252  *      ptp_id - PTP stack ID
   4253  *      clock_num - PTP clock number
   4254  *      sync_input - PTP PHY SYNC inputs
   4255  * Returns:
   4256  *      int
   4257  * Notes:
   4258  */
   4259 int
   4260 bcm_esw_ptp_sync_phy(
   4261     int unit,
   4262     bcm_ptp_stack_id_t ptp_id,
   4263     int clock_num,
   4264     bcm_ptp_sync_phy_input_t sync_input)
   4265 {
   4266     int rc;
   4267 
   4268     rc = bcm_common_ptp_sync_phy(unit, ptp_id, clock_num, sync_input);
   4269 
   4270     return (rc);
   4271 }
   4272 
   4273 /*
   4274  * Function:
   4275  *      bcm_esw_ptp_bs_time_info_get
   4276  * Purpose:
   4277  *      Instruct TOP to send a PHY Sync pulse, and mark the time that the PHYs are now synced to.
   4278  * Parameters:
   4279  *      unit - Unit number
   4280  *      ptp_id - PTP stack ID
   4281  *      clock_num - PTP clock number
   4282  *      *time - BSHB time output
   4283  * Returns:
   4284  *      int
   4285  * Notes:
   4286  */
   4287 int
   4288 bcm_esw_ptp_bs_time_info_get(
   4289     int unit,
   4290     bcm_ptp_stack_id_t ptp_id,
   4291     int clock_num,
   4292     bcm_ptp_bs_time_info_t *time)
   4293 {
   4294     int rc;
   4295     rc = bcm_common_ptp_bs_time_info_get(unit, ptp_id, clock_num, time);
   4296 
   4297     return (rc);
   4298 }
   4299 
   4300 /*
   4301  * Function:
   4302  *      bcm_esw_ptp_telecom_g8265_init
   4303  * Purpose:
   4304  *      Initialize the telecom profile.
   4305  * Parameters:
   4306  *      unit - Unit number 
   4307  *      ptp_id - PTP stack ID
   4308  *      clock_num - PTP clock number
   4309  * Returns:
   4310  *      int
   4311  * Notes:
   4312  */
   4313 int
   4314 bcm_esw_ptp_telecom_g8265_init(
   4315     int unit,
   4316     bcm_ptp_stack_id_t ptp_id,
   4317     int clock_num)
   4318 {
   4319     int rc;
   4320 
   4321     rc = bcm_common_ptp_telecom_g8265_init(unit, ptp_id, clock_num);
   4322 
   4323     return (rc);
   4324 }
   4325 
   4326 /*
   4327  * Function:
   4328  *      bcm_esw_ptp_telecom_g8265_network_option_get
   4329  * Purpose:
   4330  *      Get telecom profile ITU-T G.781 network option.
   4331  * Parameters:
   4332  *      unit - Unit number 
   4333  *      ptp_id - PTP stack ID
   4334  *      clock_num - PTP clock number
   4335  *      *network_option - Telecom profile ITU-T G.781 network option
   4336  *          | Disable | Option I | Option II | Option III |
   4337  * Returns:
   4338  *      int
   4339  * Notes:
   4340  */
   4341 int
   4342 bcm_esw_ptp_telecom_g8265_network_option_get(
   4343     int unit,
   4344     bcm_ptp_stack_id_t ptp_id,
   4345     int clock_num,
   4346     bcm_ptp_telecom_g8265_network_option_t *network_option)
   4347 {
   4348     int rc;
   4349 
   4350     rc = bcm_common_ptp_telecom_g8265_network_option_get(unit, ptp_id, clock_num, network_option);
   4351 
   4352     return (rc);
   4353 }
   4354 
   4355 /*
   4356  * Function:
   4357  *      bcm_esw_ptp_telecom_g8265_network_option_set
   4358  * Purpose:
   4359  *      Set telecom profile ITU-T G.781 network option.
   4360  * Parameters:
   4361  *      unit - Unit number 
   4362  *      ptp_id - PTP stack ID
   4363  *      clock_num - PTP clock number
   4364  *      network_option - Telecom profile ITU-T G.781 network option.
   4365  *          | Disable | Option I | Option II | Option III |
   4366  * Returns:
   4367  *      int
   4368  * Notes:
   4369  */
   4370 int
   4371 bcm_esw_ptp_telecom_g8265_network_option_set(
   4372     int unit,
   4373     bcm_ptp_stack_id_t ptp_id,
   4374     int clock_num,
   4375     bcm_ptp_telecom_g8265_network_option_t network_option)
   4376 {
   4377     int rc;
   4378 
   4379     rc = bcm_common_ptp_telecom_g8265_network_option_set(unit, ptp_id, clock_num, network_option);
   4380 
   4381     return (rc);
   4382 }
   4383 
   4384 /*
   4385  * Function:
   4386  *      bcm_esw_ptp_telecom_g8265_packet_master_add
   4387  * Purpose:
   4388  *      Add a packet master.
   4389  * Parameters:
   4390  *      unit - Unit number 
   4391  *      ptp_id - PTP stack ID
   4392  *      clock_num - PTP clock number
   4393  *      port_num - PTP clock port number
   4394  *      *address - Packet master address
   4395  * Returns:
   4396  *      int
   4397  * Notes:
   4398  */
   4399 int
   4400 bcm_esw_ptp_telecom_g8265_packet_master_add(
   4401     int unit,
   4402     bcm_ptp_stack_id_t ptp_id,
   4403     int clock_num,
   4404     int port_num,
   4405     bcm_ptp_clock_port_address_t *address)
   4406 {
   4407     int rc;
   4408 
   4409     rc = bcm_common_ptp_telecom_g8265_packet_master_add(unit, ptp_id, clock_num, port_num, 
   4410              address);
   4411 
   4412     return (rc);
   4413 }
   4414 
   4415 /*
   4416  * Function:
   4417  *      bcm_esw_ptp_telecom_g8265_packet_master_best_get
   4418  * Purpose:
   4419  *      Get current best packet master clock as defined by telecom profile
   4420  *      master selection logic.
   4421  * Parameters:
   4422  *      unit - Unit number 
   4423  *      ptp_id - PTP stack ID
   4424  *      clock_num - PTP clock number
   4425  *      *pktmaster - Best packet master clock
   4426  * Returns:
   4427  *      int
   4428  * Notes:
   4429  */
   4430 int
   4431 bcm_esw_ptp_telecom_g8265_packet_master_best_get(
   4432     int unit,
   4433     bcm_ptp_stack_id_t ptp_id,
   4434     int clock_num,
   4435     bcm_ptp_telecom_g8265_pktmaster_t *pktmaster)
   4436 {
   4437     int rc;
   4438 
   4439     rc = bcm_common_ptp_telecom_g8265_packet_master_best_get(unit, ptp_id, clock_num, pktmaster);
   4440 
   4441     return (rc);
   4442 }
   4443 
   4444 /*
   4445  * Function:
   4446  *      bcm_esw_ptp_telecom_g8265_packet_master_get
   4447  * Purpose:
   4448  *      Get packet master by address.
   4449  * Parameters:
   4450  *      unit - Unit number 
   4451  *      ptp_id - PTP stack ID
   4452  *      clock_num - PTP clock number
   4453  *      *address - Packet master address
   4454  *      *pktmaster - Packet master
   4455  * Returns:
   4456  *      int
   4457  * Notes:
   4458  */
   4459 int
   4460 bcm_esw_ptp_telecom_g8265_packet_master_get(
   4461     int unit,
   4462     bcm_ptp_stack_id_t ptp_id,
   4463     int clock_num,
   4464     bcm_ptp_clock_port_address_t *address,
   4465     bcm_ptp_telecom_g8265_pktmaster_t *pktmaster)
   4466 {
   4467     int rc;
   4468 
   4469     rc = bcm_common_ptp_telecom_g8265_packet_master_get(unit, ptp_id, clock_num, address, 
   4470              pktmaster);
   4471 
   4472     return (rc);
   4473 }
   4474 
   4475 /*
   4476  * Function:
   4477  *      bcm_esw_ptp_telecom_g8265_packet_master_list
   4478  * Purpose:
   4479  *      Get list of in-use packet masters.
   4480  * Parameters:
   4481  *      unit - Unit number 
   4482  *      ptp_id - PTP stack ID
   4483  *      clock_num - PTP clock number
   4484  *      max_master_count - Maximum number of packet masters
   4485  *      *num_masters - Number of in-use packet masters
   4486  *      *best_master - Best packet master list index
   4487  *      *pktmaster - Packet masters
   4488  * Returns:
   4489  *      int
   4490  * Notes:
   4491  */
   4492 int
   4493 bcm_esw_ptp_telecom_g8265_packet_master_list(
   4494     int unit,
   4495     bcm_ptp_stack_id_t ptp_id,
   4496     int clock_num,
   4497     int max_master_count,
   4498     int *num_masters,
   4499     int *best_master,
   4500     bcm_ptp_telecom_g8265_pktmaster_t *pktmaster)
   4501 {
   4502     int rc;
   4503 
   4504     rc = bcm_common_ptp_telecom_g8265_packet_master_list(unit, ptp_id, clock_num, 
   4505              max_master_count, num_masters, best_master, pktmaster);
   4506 
   4507     return (rc);
   4508 }
   4509 
   4510 /*
   4511  * Function:
   4512  *      bcm_esw_ptp_telecom_g8265_packet_master_lockout_set
   4513  * Purpose:
   4514  *      Set packet master lockout to exclude from master selection process.
   4515  * Parameters:
   4516  *      unit - Unit number 
   4517  *      ptp_id - PTP stack ID
   4518  *      clock_num - PTP clock number
   4519  *      lockout - Packet master lockout Boolean
   4520  *      *address - Packet master address
   4521  * Returns:
   4522  *      int
   4523  * Notes:
   4524  */
   4525 int
   4526 bcm_esw_ptp_telecom_g8265_packet_master_lockout_set(
   4527     int unit,
   4528     bcm_ptp_stack_id_t ptp_id,
   4529     int clock_num,
   4530     uint8 lockout,
   4531     bcm_ptp_clock_port_address_t *address)
   4532 {
   4533     int rc;
   4534 
   4535     rc = bcm_common_ptp_telecom_g8265_packet_master_lockout_set(unit, ptp_id, clock_num, lockout, 
   4536              address);
   4537 
   4538     return (rc);
   4539 }
   4540 
   4541 /*
   4542  * Function:
   4543  *      bcm_esw_ptp_telecom_g8265_packet_master_non_reversion_set
   4544  * Purpose:
   4545  *      Set packet master non-reversion to control master selection process
   4546  *      if master fails or is unavailable.
   4547  * Parameters:
   4548  *      unit - Unit number 
   4549  *      ptp_id - PTP stack ID
   4550  *      clock_num - PTP clock number
   4551  *      nonres - Packet master non-reversion Boolean
   4552  *      *address - Packet master address
   4553  * Returns:
   4554  *      int
   4555  * Notes:
   4556  */
   4557 int
   4558 bcm_esw_ptp_telecom_g8265_packet_master_non_reversion_set(
   4559     int unit,
   4560     bcm_ptp_stack_id_t ptp_id,
   4561     int clock_num,
   4562     uint8 nonres,
   4563     bcm_ptp_clock_port_address_t *address)
   4564 {
   4565     int rc;
   4566 
   4567     rc = bcm_common_ptp_telecom_g8265_packet_master_non_reversion_set(unit, ptp_id, clock_num, 
   4568              nonres, address);
   4569 
   4570     return (rc);
   4571 }
   4572 
   4573 /*
   4574  * Function:
   4575  *      bcm_esw_ptp_telecom_g8265_packet_master_priority_override
   4576  * Purpose:
   4577  *      Set priority override of packet master.
   4578  * Parameters:
   4579  *      unit - Unit number 
   4580  *      ptp_id - PTP stack ID
   4581  *      clock_num - PTP clock number
   4582  *      override - Packet master priority override Boolean.
   4583  *      *address - Packet master address
   4584  * Returns:
   4585  *      int
   4586  * Notes: 
   4587  *      Priority override controls whether a packet master's priority value
   4588  *      is set automatically using grandmaster priority1 / priority2 in PTP
   4589  *      announce message (i.e., override equals TRUE) or via host API calls
   4590  *      (i.e., override equals FALSE).
   4591  */
   4592 int
   4593 bcm_esw_ptp_telecom_g8265_packet_master_priority_override(
   4594     int unit,
   4595     bcm_ptp_stack_id_t ptp_id,
   4596     int clock_num,
   4597     uint8 override,
   4598     bcm_ptp_clock_port_address_t *address)
   4599 {
   4600     int rc;
   4601 
   4602     rc = bcm_common_ptp_telecom_g8265_packet_master_priority_override(unit, ptp_id, clock_num, 
   4603              override, address);
   4604 
   4605     return (rc);
   4606 }
   4607 
   4608 /*
   4609  * Function:
   4610  *      bcm_esw_ptp_telecom_g8265_packet_master_priority_set
   4611  * Purpose:
   4612  *      Set priority of packet master.
   4613  * Parameters:
   4614  *      unit - Unit number 
   4615  *      ptp_id - PTP stack ID
   4616  *      clock_num - PTP clock number
   4617  *      priority - Packet master priority
   4618  *      *address - Packet master address
   4619  * Returns:
   4620  *      int
   4621  * Notes:
   4622  */
   4623 int
   4624 bcm_esw_ptp_telecom_g8265_packet_master_priority_set(
   4625     int unit,
   4626     bcm_ptp_stack_id_t ptp_id,
   4627     int clock_num,
   4628     uint16 priority,
   4629     bcm_ptp_clock_port_address_t *address)
   4630 {
   4631     int rc;
   4632 
   4633     rc = bcm_common_ptp_telecom_g8265_packet_master_priority_set(unit, ptp_id, clock_num, 
   4634              priority, address);
   4635 
   4636     return (rc);
   4637 }
   4638 
   4639 /*
   4640  * Function:
   4641  *      bcm_esw_ptp_telecom_g8265_packet_master_remove
   4642  * Purpose:
   4643  *      Remove a packet master.
   4644  * Parameters:
   4645  *      unit - Unit number 
   4646  *      ptp_id - PTP stack ID
   4647  *      clock_num - PTP clock number
   4648  *      port_num - PTP clock port number
   4649  *      *address - Packet master address
   4650  * Returns:
   4651  *      int
   4652  * Notes:
   4653  */
   4654 int
   4655 bcm_esw_ptp_telecom_g8265_packet_master_remove(
   4656     int unit,
   4657     bcm_ptp_stack_id_t ptp_id,
   4658     int clock_num,
   4659     int port_num,
   4660     bcm_ptp_clock_port_address_t *address)
   4661 {
   4662     int rc;
   4663 
   4664     rc = bcm_common_ptp_telecom_g8265_packet_master_remove(unit, ptp_id, clock_num, port_num, 
   4665              address);
   4666 
   4667     return (rc);
   4668 }
   4669 
   4670 /*
   4671  * Function:
   4672  *      bcm_esw_ptp_telecom_g8265_packet_master_wait_duration_set
   4673  * Purpose:
   4674  *      Set packet master wait-to-restore duration to control master selection
   4675  *      process if master fails or is unavailable.
   4676  * Parameters:
   4677  *      unit - Unit number 
   4678  *      ptp_id - PTP stack ID
   4679  *      clock_num - PTP clock number
   4680  *      wait_sec - Packet master wait-to-restore duration
   4681  *      *address - Packet master address
   4682  * Returns:
   4683  *      int
   4684  * Notes:
   4685  */
   4686 int
   4687 bcm_esw_ptp_telecom_g8265_packet_master_wait_duration_set(
   4688     int unit,
   4689     bcm_ptp_stack_id_t ptp_id,
   4690     int clock_num,
   4691     uint64 wait_sec,
   4692     bcm_ptp_clock_port_address_t *address)
   4693 {
   4694     int rc;
   4695 
   4696     rc = bcm_common_ptp_telecom_g8265_packet_master_wait_duration_set(unit, ptp_id, clock_num, 
   4697              wait_sec, address);
   4698 
   4699     return (rc);
   4700 }
   4701 
   4702 /*
   4703  * Function:
   4704  *      bcm_esw_ptp_telecom_g8265_pktstats_thresholds_get
   4705  * Purpose:
   4706  *      Get packet timing and PDV statistics thresholds req'd for packet timing
   4707  *      signal fail (PTSF) analysis.
   4708  * Parameters:
   4709  *      unit - Unit number 
   4710  *      ptp_id - PTP stack ID
   4711  *      clock_num - PTP clock number
   4712  *      *thresholds - Packet timing and PDV statistics thresholds
   4713  * Returns:
   4714  *      int
   4715  * Notes:
   4716  */
   4717 int
   4718 bcm_esw_ptp_telecom_g8265_pktstats_thresholds_get(
   4719     int unit,
   4720     bcm_ptp_stack_id_t ptp_id,
   4721     int clock_num,
   4722     bcm_ptp_telecom_g8265_pktstats_t *thresholds)
   4723 {
   4724     int rc;
   4725 
   4726     rc = bcm_common_ptp_telecom_g8265_pktstats_thresholds_get(unit, ptp_id, clock_num, 
   4727              thresholds);
   4728 
   4729     return (rc);
   4730 }
   4731 
   4732 /*
   4733  * Function:
   4734  *      bcm_esw_ptp_telecom_g8265_pktstats_thresholds_set
   4735  * Purpose:
   4736  *      Set packet timing and PDV statistics thresholds req'd for packet timing
   4737  *      signal fail (PTSF) analysis.
   4738  * Parameters:
   4739  *      unit - Unit number 
   4740  *      ptp_id - PTP stack ID
   4741  *      clock_num - PTP clock number
   4742  *      thresholds - Packet timing and PDV statistics thresholds
   4743  * Returns:
   4744  *      int
   4745  * Notes:
   4746  */
   4747 int
   4748 bcm_esw_ptp_telecom_g8265_pktstats_thresholds_set(
   4749     int unit,
   4750     bcm_ptp_stack_id_t ptp_id,
   4751     int clock_num,
   4752     bcm_ptp_telecom_g8265_pktstats_t thresholds)
   4753 {
   4754     int rc;
   4755 
   4756     rc = bcm_common_ptp_telecom_g8265_pktstats_thresholds_set(unit, ptp_id, clock_num, 
   4757              thresholds);
   4758 
   4759     return (rc);
   4760 }
   4761 
   4762 /*
   4763  * Function:
   4764  *      bcm_esw_ptp_telecom_g8265_quality_level_set
   4765  * Purpose:
   4766  *      Set the ITU-T G.781 quality level (QL) of local clock.
   4767  * Parameters:
   4768  *      unit - Unit number 
   4769  *      ptp_id - PTP stack ID
   4770  *      clock_num - PTP clock number
   4771  *      ql - Quality level
   4772  * Returns:
   4773  *      int
   4774  * Notes: 
   4775  *      Ref. ITU-T G.781 and ITU-T G.8265.1.
   4776  *      Quality level is mapped to PTP clockClass.
   4777  *      Quality level is used to infer ITU-T G.781 synchronization network
   4778  *      option. ITU-T G.781 synchronization network option must be uniform
   4779  *      among slave and its packet masters.
   4780  */
   4781 int
   4782 bcm_esw_ptp_telecom_g8265_quality_level_set(
   4783     int unit,
   4784     bcm_ptp_stack_id_t ptp_id,
   4785     int clock_num,
   4786     bcm_ptp_telecom_g8265_quality_level_t ql)
   4787 {
   4788     int rc;
   4789 
   4790     rc = bcm_common_ptp_telecom_g8265_quality_level_set(unit, ptp_id, clock_num, ql);
   4791 
   4792     return (rc);
   4793 }
   4794 
   4795 /*
   4796  * Function:
   4797  *      bcm_esw_ptp_telecom_g8265_receipt_timeout_get
   4798  * Purpose:
   4799  *      Get PTP |Announce|Sync|Delay_Resp| message receipt timeout req'd for
   4800  *      packet timing signal fail (PTSF) analysis.
   4801  * Parameters:
   4802  *      unit - Unit number 
   4803  *      ptp_id - PTP stack ID
   4804  *      clock_num - PTP clock number
   4805  *      message_type - PTP message type
   4806  *      *receipt_timeout - PTP |Announce|Sync|Delay_Resp| message receipt timeout
   4807  * Returns:
   4808  *      int
   4809  * Notes:
   4810  */
   4811 int
   4812 bcm_esw_ptp_telecom_g8265_receipt_timeout_get(
   4813     int unit,
   4814     bcm_ptp_stack_id_t ptp_id,
   4815     int clock_num,
   4816     bcm_ptp_message_type_t message_type,
   4817     uint32 *receipt_timeout)
   4818 {
   4819     int rc;
   4820 
   4821     rc = bcm_common_ptp_telecom_g8265_receipt_timeout_get(unit, ptp_id, clock_num, message_type, 
   4822              receipt_timeout);
   4823 
   4824     return (rc);
   4825 }
   4826 
   4827 /*
   4828  * Function:
   4829  *      bcm_esw_ptp_telecom_g8265_receipt_timeout_set
   4830  * Purpose:
   4831  *      Set PTP |Announce|Sync|Delay_Resp| message receipt timeout req'd for
   4832  *      packet timing signal fail (PTSF) analysis.
   4833  * Parameters:
   4834  *      unit - Unit number 
   4835  *      ptp_id - PTP stack ID
   4836  *      clock_num - PTP clock number
   4837  *      message_type - PTP message type
   4838  *      receipt_timeout - PTP |Announce|Sync|Delay_Resp| message receipt timeout
   4839  * Returns:
   4840  *      int
   4841  * Notes:
   4842  */
   4843 int
   4844 bcm_esw_ptp_telecom_g8265_receipt_timeout_set(
   4845     int unit,
   4846     bcm_ptp_stack_id_t ptp_id,
   4847     int clock_num,
   4848     bcm_ptp_message_type_t message_type,
   4849     uint32 receipt_timeout)
   4850 {
   4851     int rc;
   4852 
   4853     rc = bcm_common_ptp_telecom_g8265_receipt_timeout_set(unit, ptp_id, clock_num, message_type, 
   4854              receipt_timeout);
   4855 
   4856     return (rc);
   4857 }
   4858 
   4859 /*
   4860  * Function:
   4861  *      bcm_esw_ptp_telecom_g8265_shutdown
   4862  * Purpose:
   4863  *      Shut down the telecom profile.
   4864  * Parameters:
   4865  *      unit - Unit number 
   4866  * Returns:
   4867  *      int
   4868  * Notes:
   4869  */
   4870 int
   4871 bcm_esw_ptp_telecom_g8265_shutdown(
   4872     int unit)
   4873 {
   4874     int rc;
   4875 
   4876     rc = bcm_common_ptp_telecom_g8265_shutdown(unit);
   4877 
   4878     return (rc);
   4879 }
   4880 
   4881 /*
   4882  * Function:
   4883  *      bcm_esw_ptp_time_format_set
   4884  * Purpose:
   4885  *      Set Time Of Day format for PTP stack instance.
   4886  * Parameters:
   4887  *      unit - Unit number 
   4888  *      ptp_id - PTP stack ID
   4889  *      type - Time of Day format
   4890  * Returns:
   4891  *      int
   4892  * Notes:
   4893  */
   4894 int
   4895 bcm_esw_ptp_time_format_set(
   4896     int unit,
   4897     bcm_ptp_stack_id_t ptp_id,
   4898     bcm_ptp_time_type_t type)
   4899 {
   4900     int rc;
   4901 
   4902     rc = bcm_common_ptp_time_format_set(unit, ptp_id, type);
   4903 
   4904     return (rc);
   4905 }
   4906 
   4907 /*
   4908  * Function:
   4909  *      bcm_esw_ptp_timesource_input_status_get
   4910  * Purpose:
   4911  *      Get time source status.
   4912  * Parameters:
   4913  *      unit - Unit number 
   4914  *      ptp_id - PTP stack ID
   4915  *      clock_num - PTP clock number
   4916  *      *status - Time source status
   4917  * Returns:
   4918  *      int
   4919  * Notes:
   4920  */
   4921 int
   4922 bcm_esw_ptp_timesource_input_status_get(
   4923     int unit,
   4924     bcm_ptp_stack_id_t ptp_id,
   4925     int clock_num,
   4926     bcm_ptp_timesource_status_t *status)
   4927 {
   4928     int rc;
   4929 
   4930     rc = bcm_common_ptp_timesource_input_status_get(unit, ptp_id, clock_num, status);
   4931 
   4932     return (rc);
   4933 }
   4934 
   4935 /*
   4936  * Function:
   4937  *      bcm_esw_ptp_tod_input_sources_get
   4938  * Purpose:
   4939  *      Get PTP ToD input source(s).
   4940  * Parameters:
   4941  *      unit - Unit number 
   4942  *      ptp_id - PTP stack ID
   4943  *      clock_num - PTP clock number
   4944  *      *num_tod_sources - (IN) Maximum Number of ToD inputs
   4945  *                         (OUT) Number of ToD inputs
   4946  *      *tod_sources - Array of ToD inputs
   4947  * Returns:
   4948  *      int
   4949  * Notes:
   4950  */
   4951 int
   4952 bcm_esw_ptp_tod_input_sources_get(
   4953     int unit,
   4954     bcm_ptp_stack_id_t ptp_id,
   4955     int clock_num,
   4956     int *num_tod_sources,
   4957     bcm_ptp_tod_input_t *tod_sources)
   4958 {
   4959     int rc;
   4960 
   4961     rc = bcm_common_ptp_tod_input_sources_get(unit, ptp_id, clock_num, num_tod_sources, 
   4962              tod_sources);
   4963 
   4964     return (rc);
   4965 }
   4966 
   4967 /*
   4968  * Function:
   4969  *      bcm_esw_ptp_tod_input_sources_set
   4970  * Purpose:
   4971  *      Set PTP TOD input(s).
   4972  * Parameters:
   4973  *      unit - Unit number 
   4974  *      ptp_id - PTP stack ID
   4975  *      clock_num - PTP clock number
   4976  *      num_tod_sources - Number of ToD inputs
   4977  *      *tod_sources - PTP ToD input configuration
   4978  * Returns:
   4979  *      int
   4980  * Notes:
   4981  */
   4982 int
   4983 bcm_esw_ptp_tod_input_sources_set(
   4984     int unit,
   4985     bcm_ptp_stack_id_t ptp_id,
   4986     int clock_num,
   4987     int num_tod_sources,
   4988     bcm_ptp_tod_input_t *tod_sources)
   4989 {
   4990     int rc;
   4991 
   4992     rc = bcm_common_ptp_tod_input_sources_set(unit, ptp_id, clock_num, num_tod_sources, 
   4993              tod_sources);
   4994 
   4995     return (rc);
   4996 }
   4997 
   4998 /*
   4999  * Function:
   5000  *      bcm_esw_ptp_tod_output_get
   5001  * Purpose:
   5002  *      Get PTP TOD output(s).
   5003  * Parameters:
   5004  *      unit - Unit number 
   5005  *      ptp_id - PTP stack ID
   5006  *      clock_num - PTP clock number
   5007  *      *tod_output_count - (IN)  Max number of ToD outputs
   5008  *                          (OUT) Number ToD outputs returned
   5009  *      *tod_output - Array of ToD outputs
   5010  * Returns:
   5011  *      int
   5012  * Notes:
   5013  */
   5014 int
   5015 bcm_esw_ptp_tod_output_get(
   5016     int unit,
   5017     bcm_ptp_stack_id_t ptp_id,
   5018     int clock_num,
   5019     int *tod_output_count,
   5020     bcm_ptp_tod_output_t *tod_output)
   5021 {
   5022     int rc;
   5023 
   5024     rc = bcm_common_ptp_tod_output_get(unit, ptp_id, clock_num, tod_output_count, tod_output);
   5025 
   5026     return (rc);
   5027 }
   5028 
   5029 /*
   5030  * Function:
   5031  *      bcm_esw_ptp_tod_output_remove
   5032  * Purpose:
   5033  *      Remove a ToD output.
   5034  * Parameters:
   5035  *      unit - Unit number 
   5036  *      ptp_id - PTP stack ID
   5037  *      clock_num - PTP clock number
   5038  *      tod_output_id - ToD output ID
   5039  * Returns:
   5040  *      int
   5041  * Notes:
   5042  */
   5043 int
   5044 bcm_esw_ptp_tod_output_remove(
   5045     int unit,
   5046     bcm_ptp_stack_id_t ptp_id,
   5047     int clock_num,
   5048     int tod_output_id)
   5049 {
   5050     int rc;
   5051 
   5052     rc = bcm_common_ptp_tod_output_remove(unit, ptp_id, clock_num, tod_output_id);
   5053 
   5054     return (rc);
   5055 }
   5056 
   5057 /*
   5058  * Function:
   5059  *      bcm_esw_ptp_tod_output_set
   5060  * Purpose:
   5061  *      Set PTP ToD output.
   5062  * Parameters:
   5063  *      unit - Unit number 
   5064  *      ptp_id - PTP stack ID
   5065  *      clock_num - PTP clock number
   5066  *      *tod_output_id - ToD output ID
   5067  *      *output_info - ToD output configuration
   5068  * Returns:
   5069  *      int
   5070  * Notes:
   5071  */
   5072 int
   5073 bcm_esw_ptp_tod_output_set(
   5074     int unit,
   5075     bcm_ptp_stack_id_t ptp_id,
   5076     int clock_num,
   5077     int *tod_output_id,
   5078     bcm_ptp_tod_output_t *output_info)
   5079 {
   5080     int rc;
   5081 
   5082     rc = bcm_common_ptp_tod_output_set(unit, ptp_id, clock_num, tod_output_id, output_info);
   5083 
   5084     return (rc);
   5085 }
   5086 
   5087 /*
   5088  * Function:
   5089  *      bcm_esw_ptp_transparent_clock_default_dataset_get
   5090  * Purpose:
   5091  *      Get PTP Transparent clock default dataset
   5092  * Parameters:
   5093  *      unit - Unit number 
   5094  *      ptp_id - PTP stack ID
   5095  *      clock_num - PTP clock number
   5096  *      *data_set - PTP transparent clock default dataset
   5097  * Returns:
   5098  *      int
   5099  * Notes:
   5100  */
   5101 int
   5102 bcm_esw_ptp_transparent_clock_default_dataset_get(
   5103     int unit,
   5104     bcm_ptp_stack_id_t ptp_id,
   5105     int clock_num,
   5106     bcm_ptp_transparent_clock_default_dataset_t *data_set)
   5107 {
   5108     int rc;
   5109 
   5110     rc = bcm_common_ptp_transparent_clock_default_dataset_get(unit, ptp_id, clock_num, data_set);
   5111 
   5112     return (rc);
   5113 }
   5114 
   5115 /*
   5116  * Function:
   5117  *      bcm_esw_ptp_transparent_clock_port_dataset_get
   5118  * Purpose:
   5119  *      Get PTP transparent clock port dataset
   5120  * Parameters:
   5121  *      unit - Unit number 
   5122  *      ptp_id - PTP stack ID
   5123  *      clock_num - PTP clock number
   5124  *      clock_port - PTP clock port number
   5125  *      *data_set - PTP transparent clock port dataset
   5126  * Returns:
   5127  *      int
   5128  * Notes:
   5129  */
   5130 int
   5131 bcm_esw_ptp_transparent_clock_port_dataset_get(
   5132     int unit,
   5133     bcm_ptp_stack_id_t ptp_id,
   5134     int clock_num,
   5135     uint16 clock_port,
   5136     bcm_ptp_transparent_clock_port_dataset_t *data_set)
   5137 {
   5138     int rc;
   5139 
   5140     rc = bcm_common_ptp_transparent_clock_port_dataset_get(unit, ptp_id, clock_num, clock_port, 
   5141              data_set);
   5142 
   5143     return (rc);
   5144 }
   5145 
   5146 /*
   5147  * Function:
   5148  *      bcm_esw_ptp_unicast_request_duration_get
   5149  * Purpose:
   5150  *      Get durationField of REQUEST_UNICAST_TRANSMISSION TLV.
   5151  * Parameters:
   5152  *      unit - Unit number 
   5153  *      ptp_id - PTP stack ID
   5154  *      clock_num - PTP clock number
   5155  *      port_num - PTP clock port number
   5156  *      *duration - durationField (sec)
   5157  * Returns:
   5158  *      int
   5159  * Notes:
   5160  */
   5161 int
   5162 bcm_esw_ptp_unicast_request_duration_get(
   5163     int unit,
   5164     bcm_ptp_stack_id_t ptp_id,
   5165     int clock_num,
   5166     int port_num,
   5167     uint32 *duration)
   5168 {
   5169     int rc;
   5170 
   5171     rc = bcm_common_ptp_unicast_request_duration_get(unit, ptp_id, clock_num, port_num, 
   5172              duration);
   5173 
   5174     return (rc);
   5175 }
   5176 
   5177 /*
   5178  * Function:
   5179  *      bcm_esw_ptp_unicast_request_duration_max_get
   5180  * Purpose:
   5181  *      Get maximum durationField of REQUEST_UNICAST_TRANSMISSION TLV.
   5182  * Parameters:
   5183  *      unit - Unit number 
   5184  *      ptp_id - PTP stack ID
   5185  *      clock_num - PTP clock number
   5186  *      port_num - PTP clock port number
   5187  *      *duration_max - maximum durationField (sec)
   5188  * Returns:
   5189  *      int
   5190  * Notes:
   5191  */
   5192 int
   5193 bcm_esw_ptp_unicast_request_duration_max_get(
   5194     int unit,
   5195     bcm_ptp_stack_id_t ptp_id,
   5196     int clock_num,
   5197     int port_num,
   5198     uint32 *duration_max)
   5199 {
   5200     int rc;
   5201 
   5202     rc = bcm_common_ptp_unicast_request_duration_max_get(unit, ptp_id, clock_num, port_num, 
   5203              duration_max);
   5204 
   5205     return (rc);
   5206 }
   5207 
   5208 /*
   5209  * Function:
   5210  *      bcm_esw_ptp_unicast_request_duration_max_set
   5211  * Purpose:
   5212  *      Set maximum durationField of REQUEST_UNICAST_TRANSMISSION TLV.
   5213  * Parameters:
   5214  *      unit - Unit number 
   5215  *      ptp_id - PTP stack ID
   5216  *      clock_num - PTP clock number
   5217  *      port_num - PTP clock port number
   5218  *      duration_max - maximum durationField (sec)
   5219  * Returns:
   5220  *      int
   5221  * Notes:
   5222  */
   5223 int
   5224 bcm_esw_ptp_unicast_request_duration_max_set(
   5225     int unit,
   5226     bcm_ptp_stack_id_t ptp_id,
   5227     int clock_num,
   5228     int port_num,
   5229     uint32 duration_max)
   5230 {
   5231     int rc;
   5232 
   5233     rc = bcm_common_ptp_unicast_request_duration_max_set(unit, ptp_id, clock_num, port_num, 
   5234              duration_max);
   5235 
   5236     return (rc);
   5237 }
   5238 
   5239 /*
   5240  * Function:
   5241  *      bcm_esw_ptp_unicast_request_duration_min_get
   5242  * Purpose:
   5243  *      Set minimum durationField of REQUEST_UNICAST_TRANSMISSION TLV.
   5244  * Parameters:
   5245  *      unit - Unit number 
   5246  *      ptp_id - PTP stack ID
   5247  *      clock_num - PTP clock number
   5248  *      port_num - PTP clock port number
   5249  *      *duration_min - minimum durationField (sec)
   5250  * Returns:
   5251  *      int
   5252  * Notes:
   5253  */
   5254 int
   5255 bcm_esw_ptp_unicast_request_duration_min_get(
   5256     int unit,
   5257     bcm_ptp_stack_id_t ptp_id,
   5258     int clock_num,
   5259     int port_num,
   5260     uint32 *duration_min)
   5261 {
   5262     int rc;
   5263 
   5264     rc = bcm_common_ptp_unicast_request_duration_min_get(unit, ptp_id, clock_num, port_num, 
   5265              duration_min);
   5266 
   5267     return (rc);
   5268 }
   5269 
   5270 /*
   5271  * Function:
   5272  *      bcm_esw_ptp_unicast_request_duration_min_set
   5273  * Purpose:
   5274  *      Set minimum durationField of REQUEST_UNICAST_TRANSMISSION TLV.
   5275  * Parameters:
   5276  *      unit - Unit number 
   5277  *      ptp_id - PTP stack ID
   5278  *      clock_num - PTP clock number
   5279  *      port_num - PTP clock port number
   5280  *      duration_min - minimum durationField (sec)
   5281  * Returns:
   5282  *      int
   5283  * Notes:
   5284  */
   5285 int
   5286 bcm_esw_ptp_unicast_request_duration_min_set(
   5287     int unit,
   5288     bcm_ptp_stack_id_t ptp_id,
   5289     int clock_num,
   5290     int port_num,
   5291     uint32 duration_min)
   5292 {
   5293     int rc;
   5294 
   5295     rc = bcm_common_ptp_unicast_request_duration_min_set(unit, ptp_id, clock_num, port_num, 
   5296              duration_min);
   5297 
   5298     return (rc);
   5299 }
   5300 
   5301 /*
   5302  * Function:
   5303  *      bcm_esw_ptp_unicast_request_duration_set
   5304  * Purpose:
   5305  *      Set durationField of REQUEST_UNICAST_TRANSMISSION TLV.
   5306  * Parameters:
   5307  *      unit - Unit number 
   5308  *      ptp_id - PTP stack ID
   5309  *      clock_num - PTP clock number
   5310  *      port_num - PTP clock port number
   5311  *      duration - durationField (sec)
   5312  * Returns:
   5313  *      int
   5314  * Notes:
   5315  */
   5316 int
   5317 bcm_esw_ptp_unicast_request_duration_set(
   5318     int unit,
   5319     bcm_ptp_stack_id_t ptp_id,
   5320     int clock_num,
   5321     int port_num,
   5322     uint32 duration)
   5323 {
   5324     int rc;
   5325 
   5326     rc = bcm_common_ptp_unicast_request_duration_set(unit, ptp_id, clock_num, port_num, 
   5327              duration);
   5328 
   5329     return (rc);
   5330 }
   5331 
   5332 
   5333 /*
   5334  * Function:
   5335  *      bcm_esmc_tx()
   5336  * Purpose:
   5337  *      ESMC PDU transmit (Tx).
   5338  * Parameters:
   5339  *      unit          - (IN) Unit number.
   5340  *      stack_id      - (IN) Stack identifier index.
   5341  *      pbmp          - (IN) Tx port bitmap.
   5342  *      esmc_pdu_data - (IN) ESMC PDU data.
   5343  * Returns:
   5344  *      BCM_E_XXX - Function status.
   5345  * Notes:
   5346  */
   5347 int
   5348 bcm_esw_esmc_tx(
   5349     int unit,
   5350     int stack_id,
   5351     bcm_pbmp_t pbmp,
   5352     bcm_esmc_pdu_data_t *esmc_pdu_data)
   5353 {
   5354     int rv;
   5355 
   5356     rv = bcm_common_esmc_tx(unit, stack_id, pbmp, esmc_pdu_data);
   5357 
   5358     return rv;
   5359 }
   5360 
   5361 /*
   5362  * Function:
   5363  *      bcm_esmc_rx_callback_register()
   5364  * Purpose:
   5365  *      Register ESMC PDU Rx callback.
   5366  * Parameters:
   5367  *      unit     - (IN) Unit number.
   5368  *      stack_id - (IN) Stack identifier index.
   5369  *      rx_cb    - (IN) ESMC PDU Rx callback function pointer.
   5370  * Returns:
   5371  *      BCM_E_XXX - Function status.
   5372  * Notes:
   5373  */
   5374 int
   5375 bcm_esw_esmc_rx_callback_register(
   5376     int unit,
   5377     int stack_id,
   5378     bcm_esmc_rx_cb rx_cb)
   5379 {
   5380     int rv;
   5381 
   5382     rv = bcm_common_esmc_rx_callback_register(unit, stack_id, rx_cb);
   5383 
   5384     return rv;
   5385 }
   5386 
   5387 /*
   5388  * Function:
   5389  *      bcm_esmc_rx_callback_unregister()
   5390  * Purpose:
   5391  *      Unregister ESMC PDU Rx callback.
   5392  * Parameters:
   5393  *      unit     - (IN) Unit number.
   5394  *      stack_id - (IN) Stack identifier index.
   5395  * Returns:
   5396  *      BCM_E_XXX - Function status.
   5397  * Notes:
   5398  */
   5399 int
   5400 bcm_esw_esmc_rx_callback_unregister(
   5401     int unit,
   5402     int stack_id)
   5403 {
   5404     int rv;
   5405 
   5406     rv = bcm_common_esmc_rx_callback_unregister(unit, stack_id);
   5407 
   5408     return rv;
   5409 }
   5410 
   5411 /*
   5412  * Function:
   5413  *      bcm_esw_tdpll_input_clock_ql_change_callback_register()
   5414  * Purpose:
   5415  *      Register input clock esmc quality change callback.
   5416  * Parameters:
   5417  *      unit        - (IN) Unit number.
   5418  *      stack_id    - (IN) Stack identifier index.
   5419  *      ql_change_cb - (IN) Input clock esmc QL change callback function pointer.
   5420  * Returns:
   5421  *      BCM_E_XXX - Function status.
   5422  * Notes:
   5423  *      QL change callback generates an event to notify user if a
   5424  *      QL level change happens to take necessary action if required. 
   5425  */
   5426 int
   5427 bcm_esw_tdpll_input_clock_ql_change_callback_register(
   5428     int unit,
   5429     int stack_id,
   5430     bcm_tdpll_input_clock_ql_change_cb ql_change_cb)
   5431 {
   5432     int rv;
   5433 
   5434     rv = bcm_common_tdpll_input_clock_ql_change_callback_register(unit, stack_id, ql_change_cb);
   5435 
   5436     return rv;
   5437 }
   5438 
   5439 /*
   5440  * Function:
   5441  *      bcm_esw_tdpll_input_clock_ql_change_callback_unregister()
   5442  * Purpose:
   5443  *      Un-register input clock esmc quality change callback.
   5444  * Parameters:
   5445  *      unit        - (IN) Unit number.
   5446  *      stack_id    - (IN) Stack identifier index.
   5447  * Returns:
   5448  *      BCM_E_XXX - Function status.
   5449  * Notes:
   5450  *      QL change callback generates an event to notify user if a
   5451  *      QL level change happens to take necessary action if required. 
   5452  */
   5453 
   5454 int
   5455 bcm_esw_tdpll_input_clock_ql_change_callback_unregister(
   5456     int unit,
   5457     int stack_id)
   5458 {
   5459     int rv;
   5460 
   5461     rv = bcm_common_tdpll_input_clock_ql_change_callback_unregister(unit, stack_id);
   5462 
   5463     return rv;
   5464 }
   5465 
   5466 
   5467 /*
   5468  * Function:
   5469  *      bcm_esmc_tunnel_get()
   5470  * Purpose:
   5471  *      Get ESMC PDU tunneling-enabled Boolean.
   5472  * Parameters:
   5473  *      unit     - (IN)  Unit number.
   5474  *      stack_id - (IN)  PTP stack ID.
   5475  *      enable   - (OUT) Enable Boolean.
   5476  * Returns:
   5477  *      BCM_E_XXX - Function status.
   5478  * Notes:
   5479  *      Boolean controls whether ToP tunnels slow-protocol Ethertype packets
   5480  *      - which include ESMC PDUs - to host for processing.
   5481  */
   5482 int
   5483 bcm_esw_esmc_tunnel_get(
   5484     int unit,
   5485     int stack_id,
   5486     int *enable)
   5487 {
   5488     int rv;
   5489 
   5490     rv = bcm_common_esmc_tunnel_get(unit, stack_id, enable);
   5491 
   5492     return rv;
   5493 }
   5494 
   5495 /*
   5496  * Function:
   5497  *      bcm_esmc_tunnel_set()
   5498  * Purpose:
   5499  *      Set ESMC PDU tunneling-enabled Boolean.
   5500  * Parameters:
   5501  *      unit     - (IN)  Unit number.
   5502  *      stack_id - (IN)  PTP stack ID.
   5503  *      enable   - (OUT) Enable Boolean.
   5504  * Returns:
   5505  *      BCM_E_XXX - Function status.
   5506  * Notes:
   5507  *      Boolean controls whether ToP tunnels slow-protocol Ethertype packets
   5508  *      - which include ESMC PDUs - to host for processing.
   5509  */
   5510 int
   5511 bcm_esw_esmc_tunnel_set(
   5512     int unit,
   5513     int stack_id,
   5514     int enable)
   5515 {
   5516     int rv;
   5517 
   5518     rv = bcm_common_esmc_tunnel_set(unit, stack_id, enable);
   5519 
   5520     return rv;
   5521 }
   5522 
   5523 /*
   5524  * Function:
   5525  *      bcm_esmc_g781_option_get()
   5526  * Purpose:
   5527  *      Get ITU-T G.781 networking option for SyncE.
   5528  * Parameters:
   5529  *      unit        - (IN) Unit number.
   5530  *      stack_id    - (IN) Stack identifier index.
   5531  *      g781_option - (OUT) ITU-T G.781 networking option.
   5532  * Returns:
   5533  *      BCM_E_XXX - Function status.
   5534  * Notes:
   5535  */
   5536 int
   5537 bcm_esw_esmc_g781_option_get(
   5538     int unit,
   5539     int stack_id,
   5540     bcm_esmc_network_option_t *g781_option)
   5541 {
   5542     int rv;
   5543 
   5544     rv = bcm_common_esmc_g781_option_get(unit, stack_id, g781_option);
   5545 
   5546     return rv;
   5547 }
   5548 
   5549 /*
   5550  * Function:
   5551  *      bcm_esmc_g781_option_set()
   5552  * Purpose:
   5553  *      Set ITU-T G.781 networking option for SyncE.
   5554  * Parameters:
   5555  *      unit        - (IN) Unit number.
   5556  *      stack_id    - (IN) Stack identifier index.
   5557  *      g781_option - (IN) ITU-T G.781 networking option.
   5558  * Returns:
   5559  *      BCM_E_XXX - Function status.
   5560  * Notes:
   5561  */
   5562 int
   5563 bcm_esw_esmc_g781_option_set(
   5564     int unit,
   5565     int stack_id,
   5566     bcm_esmc_network_option_t g781_option)
   5567 {
   5568     int rv;
   5569 
   5570     rv = bcm_common_esmc_g781_option_set(unit, stack_id, g781_option);
   5571 
   5572     return rv;
   5573 }
   5574 
   5575 /*
   5576  * Function:
   5577  *      bcm_esmc_QL_SSM_map()
   5578  * Purpose:
   5579  *      Get synchronization status message (SSM) code corresponding to
   5580  *      ITU-T G.781 quality level (QL).
   5581  * Parameters:
   5582  *      unit     - (IN) Unit number.
   5583  *      opt      - (IN)  ITU-T G.781 networking option.
   5584  *      ql       - (IN)  ITU-T G.781 quality level.
   5585  *      ssm_code - (OUT) SSM code.
   5586  * Returns:
   5587  *      BCM_E_XXX - Function status.
   5588  * Notes:
   5589  */
   5590 int
   5591 bcm_esw_esmc_QL_SSM_map(
   5592     int unit,
   5593     bcm_esmc_network_option_t opt,
   5594     bcm_esmc_quality_level_t ql,
   5595     uint8 *ssm_code)
   5596 {
   5597     int rv;
   5598 
   5599     rv = bcm_common_esmc_QL_SSM_map(unit, opt, ql, ssm_code);
   5600 
   5601     return rv;
   5602 }
   5603 
   5604 /*
   5605  * Function:
   5606  *      bcm_esmc_SSM_QL_map()
   5607  * Purpose:
   5608  *      Get ITU-T G.781 quality level (QL) corresponding to synchronization
   5609  *      status message (SSM) code.
   5610  * Parameters:
   5611  *      unit     - (IN) Unit number.
   5612  *      opt      - (IN)  ITU-T G.781 networking option.
   5613  *      ssm_code - (IN)  SSM code.
   5614  *      ql       - (OUT) ITU-T G.781 quality level.
   5615  * Returns:
   5616  *      BCM_E_XXX - Function status.
   5617  * Notes:
   5618  */
   5619 int
   5620 bcm_esw_esmc_SSM_QL_map(
   5621     int unit,
   5622     bcm_esmc_network_option_t opt,
   5623     uint8 ssm_code,
   5624     bcm_esmc_quality_level_t *ql)
   5625 {
   5626     int rv;
   5627 
   5628     rv = bcm_common_esmc_SSM_QL_map(unit, opt, ssm_code, ql);
   5629 
   5630     return rv;
   5631 }
   5632 
   5633 /*
   5634  * Function:
   5635  *      bcm_tdpll_dpll_bindings_get()
   5636  * Purpose:
   5637  *      Get logical DPLL instance input/output bindings.
   5638  * Parameters:
   5639  *      unit       - (IN) Unit number.
   5640  *      stack_id   - (IN) Stack identifier index.
   5641  *      dpll_index - (IN) DPLL instance number.
   5642  *      bindings   - (OUT) DPLL instance bindings.
   5643  * Returns:
   5644  *      BCM_E_XXX - Function status.
   5645  * Notes:
   5646  */
   5647 int
   5648 bcm_esw_tdpll_dpll_bindings_get(
   5649     int unit,
   5650     int stack_id,
   5651     int dpll_index,
   5652     bcm_tdpll_dpll_bindings_t *bindings)
   5653 {
   5654     int rv;
   5655 
   5656     rv = bcm_common_tdpll_dpll_bindings_get(unit, stack_id, dpll_index, bindings);
   5657 
   5658     return rv;
   5659 }
   5660 
   5661 /*
   5662  * Function:
   5663  *      bcm_tdpll_dpll_bindings_set()
   5664  * Purpose:
   5665  *      Set logical DPLL instance input/output bindings.
   5666  * Parameters:
   5667  *      unit       - (IN) Unit number.
   5668  *      stack_id   - (IN) Stack identifier index.
   5669  *      dpll_index - (IN) DPLL instance number.
   5670  *      bindings   - (IN) DPLL instance bindings.
   5671  * Returns:
   5672  *      BCM_E_XXX - Function status.
   5673  * Notes:
   5674  */
   5675 int
   5676 bcm_esw_tdpll_dpll_bindings_set(
   5677     int unit,
   5678     int stack_id,
   5679     int dpll_index,
   5680     bcm_tdpll_dpll_bindings_t *bindings)
   5681 {
   5682     int rv;
   5683 
   5684     rv = bcm_common_tdpll_dpll_bindings_set(unit, stack_id, dpll_index, bindings);
   5685 
   5686     return rv;
   5687 }
   5688 
   5689 /*
   5690  * Function:
   5691  *      bcm_tdpll_dpll_reference_get()
   5692  * Purpose:
   5693  *      Get reference clocks for DPLL instances.
   5694  * Parameters:
   5695  *      unit         - (IN) Unit number.
   5696  *      stack_id     - (IN) Stack identifier index.
   5697  *      max_num_dpll - (IN) Maximum number of DPLL instances.
   5698  *      dpll_ref     - (OUT) DPLL instance reference clocks.
   5699  *      num_dpll     - (OUT) Number of DPLL instances.
   5700  * Returns:
   5701  *      BCM_E_XXX - Function status.
   5702  * Notes:
   5703  *      Reference switching. Gets current reference clocks of DPLL instances.
   5704  */
   5705 int
   5706 bcm_esw_tdpll_dpll_reference_get(
   5707     int unit,
   5708     int stack_id,
   5709     int max_num_dpll,
   5710     int *dpll_ref,
   5711     int *num_dpll)
   5712 {
   5713     int rv;
   5714 
   5715     rv = bcm_common_tdpll_dpll_reference_get(unit, stack_id, max_num_dpll, dpll_ref, num_dpll);
   5716 
   5717     return rv;
   5718 }
   5719 
   5720 /*
   5721  * Function:
   5722  *      bcm_tdpll_dpll_bandwidth_get()
   5723  * Purpose:
   5724  *      Get DPLL bandwidth.
   5725  * Parameters:
   5726  *      unit       - (IN) Unit number.
   5727  *      stack_id   - (IN) Stack identifier index.
   5728  *      dpll_index - (IN) DPLL instance number.
   5729  *      bandwidth  - (OUT) DPLL bandwidth.
   5730  * Returns:
   5731  *      BCM_E_XXX - Function status.
   5732  * Notes:
   5733  */
   5734 int
   5735 bcm_esw_tdpll_dpll_bandwidth_get(
   5736     int unit,
   5737     int stack_id,
   5738     int dpll_index,
   5739     bcm_tdpll_dpll_bandwidth_t *bandwidth)
   5740 {
   5741     int rv;
   5742 
   5743     rv = bcm_common_tdpll_dpll_bandwidth_get(unit, stack_id, dpll_index, bandwidth);
   5744 
   5745     return rv;
   5746 }
   5747 
   5748 /*
   5749  * Function:
   5750  *      bcm_tdpll_dpll_bandwidth_set()
   5751  * Purpose:
   5752  *      Set DPLL bandwidth.
   5753  * Parameters:
   5754  *      unit       - (IN) Unit number.
   5755  *      stack_id   - (IN) Stack identifier index.
   5756  *      dpll_index - (IN) DPLL instance number.
   5757  *      bandwidth  - (IN) DPLL bandwidth.
   5758  * Returns:
   5759  *      BCM_E_XXX - Function status.
   5760  * Notes:
   5761  */
   5762 int
   5763 bcm_esw_tdpll_dpll_bandwidth_set(
   5764     int unit,
   5765     int stack_id,
   5766     int dpll_index,
   5767     bcm_tdpll_dpll_bandwidth_t *bandwidth)
   5768 {
   5769     int rv;
   5770 
   5771     rv = bcm_common_tdpll_dpll_bandwidth_set(unit, stack_id, dpll_index, bandwidth);
   5772 
   5773     return rv;
   5774 }
   5775 
   5776 /*
   5777  * Function:
   5778  *      bcm_tdpll_dpll_phase_control_get()
   5779  * Purpose:
   5780  *      Get DPLL instance's phase control configuration.
   5781  * Parameters:
   5782  *      unit          - (IN) Unit number.
   5783  *      stack_id      - (IN) Stack identifier index.
   5784  *      dpll_index    - (IN) DPLL instance number.
   5785  *      phase_control - (OUT) Phase control configuration.
   5786  * Returns:
   5787  *      BCM_E_XXX - Function status.
   5788  * Notes:
   5789  */
   5790 int
   5791 bcm_esw_tdpll_dpll_phase_control_get(
   5792     int unit,
   5793     int stack_id,
   5794     int dpll_index,
   5795     bcm_tdpll_dpll_phase_control_t *phase_control)
   5796 {
   5797     int rv;
   5798 
   5799     rv = bcm_common_tdpll_dpll_phase_control_get(unit, stack_id, dpll_index, phase_control);
   5800 
   5801     return rv;
   5802 }
   5803 
   5804 /*
   5805  * Function:
   5806  *      bcm_tdpll_dpll_phase_control_set()
   5807  * Purpose:
   5808  *      Set DPLL instance's phase control configuration.
   5809  * Parameters:
   5810  *      unit          - (IN) Unit number.
   5811  *      stack_id      - (IN) Stack identifier index.
   5812  *      dpll_index    - (IN) DPLL instance number.
   5813  *      phase_control - (IN) Phase control configuration.
   5814  * Returns:
   5815  *      BCM_E_XXX - Function status.
   5816  * Notes:
   5817  */
   5818 int
   5819 bcm_esw_tdpll_dpll_phase_control_set(
   5820     int unit,
   5821     int stack_id,
   5822     int dpll_index,
   5823     bcm_tdpll_dpll_phase_control_t *phase_control)
   5824 {
   5825     int rv;
   5826 
   5827     rv = bcm_common_tdpll_dpll_phase_control_set(unit, stack_id, dpll_index, phase_control);
   5828 
   5829     return rv;
   5830 }
   5831 
   5832 /*
   5833  * Function:
   5834  *      bcm_tdpll_input_clock_control()
   5835  * Purpose:
   5836  *      Start/stop T-DPLL input clock monitoring, reference selection, and switching
   5837  *      state machine.
   5838  * Parameters:
   5839  *      unit     - (IN) Unit number.
   5840  *      stack_id - (IN) Stack identifier index.
   5841  *      enable   - (IN) Enable Boolean.
   5842  * Returns:
   5843  *      BCM_E_XXX - Function status.
   5844  * Notes:
   5845  */
   5846 int
   5847 bcm_esw_tdpll_input_clock_control(
   5848     int unit,
   5849     int stack_id,
   5850     int enable)
   5851 {
   5852     int rv;
   5853 
   5854     rv = bcm_common_tdpll_input_clock_control(unit, stack_id, enable);
   5855 
   5856     return rv;
   5857 }
   5858 
   5859 /*
   5860  * Function:
   5861  *      bcm_tdpll_input_clock_mac_get()
   5862  * Purpose:
   5863  *      Get MAC address of input clock.
   5864  * Parameters:
   5865  *      unit        - (IN) Unit number.
   5866  *      stack_id    - (IN) Stack identifier index.
   5867  *      clock_index - (IN) Input clock index.
   5868  *      mac         - (OUT) Input clock MAC address.
   5869  * Returns:
   5870  *      BCM_E_XXX - Function status.
   5871  * Notes:
   5872  */
   5873 int
   5874 bcm_esw_tdpll_input_clock_mac_get(
   5875     int unit,
   5876     int stack_id,
   5877     int clock_index,
   5878     bcm_mac_t *mac)
   5879 {
   5880     int rv;
   5881 
   5882     rv = bcm_common_tdpll_input_clock_mac_get(unit, stack_id, clock_index, mac);
   5883 
   5884     return rv;
   5885 }
   5886 
   5887 /*
   5888  * Function:
   5889  *      bcm_tdpll_input_clock_mac_set()
   5890  * Purpose:
   5891  *      Set MAC address of input clock.
   5892  * Parameters:
   5893  *      unit        - (IN) Unit number.
   5894  *      stack_id    - (IN) Stack identifier index.
   5895  *      clock_index - (IN) Input clock index.
   5896  *      mac         - (IN) Input clock MAC address.
   5897  * Returns:
   5898  *      BCM_E_XXX - Function status.
   5899  * Notes:
   5900  */
   5901 int
   5902 bcm_esw_tdpll_input_clock_mac_set(
   5903     int unit,
   5904     int stack_id,
   5905     int clock_index,
   5906     bcm_mac_t *mac)
   5907 {
   5908     int rv;
   5909 
   5910     rv = bcm_common_tdpll_input_clock_mac_set(unit, stack_id, clock_index, mac);
   5911 
   5912     return rv;
   5913 }
   5914 
   5915 /*
   5916  * Function:
   5917  *      bcm_tdpll_input_clock_frequency_error_get()
   5918  * Purpose:
   5919  *      Get fractional frequency error of an input clock from input-clock
   5920  *      monitoring process.
   5921  * Parameters:
   5922  *      unit           - (IN) Unit number.
   5923  *      stack_id       - (IN) Stack identifier index.
   5924  *      clock_index    - (IN) Input clock index.
   5925  *      freq_error_ppb - (OUT) Input clock fractional frequency error (ppb).
   5926  * Returns:
   5927  *      BCM_E_XXX - Function status.
   5928  * Notes:
   5929  */
   5930 int
   5931 bcm_esw_tdpll_input_clock_frequency_error_get(
   5932     int unit,
   5933     int stack_id,
   5934     int clock_index,
   5935     int *freq_error_ppb)
   5936 {
   5937     int rv;
   5938 
   5939     rv = bcm_common_tdpll_input_clock_frequency_error_get(unit, stack_id, clock_index, freq_error_ppb);
   5940 
   5941     return rv;
   5942 }
   5943 
   5944 /*
   5945  * Function:
   5946  *      bcm_tdpll_input_clock_threshold_state_get()
   5947  * Purpose:
   5948  *      Get monitor threshold state of an input clock from input-clock
   5949  *      monitoring process.
   5950  * Parameters:
   5951  *      unit            - (IN) Unit number.
   5952  *      stack_id        - (IN) Stack identifier index.
   5953  *      clock_index     - (IN) Input clock index.
   5954  *      threshold_type  - (IN) Input-clock monitoring threshold type.
   5955  *      threshold_state - (OUT) Input-clock monitoring threshold state Boolean.
   5956  * Returns:
   5957  *      BCM_E_XXX - Function status.
   5958  * Notes:
   5959  */
   5960 int
   5961 bcm_esw_tdpll_input_clock_threshold_state_get(
   5962     int unit,
   5963     int stack_id,
   5964     int clock_index,
   5965     bcm_tdpll_input_clock_monitor_type_t threshold_type,
   5966     int *threshold_state)
   5967 {
   5968     int rv;
   5969 
   5970     rv = bcm_common_tdpll_input_clock_threshold_state_get(unit, stack_id, clock_index, threshold_type, threshold_state);
   5971 
   5972     return rv;
   5973 }
   5974 
   5975 /*
   5976  * Function:
   5977  *      bcm_tdpll_input_clock_enable_get()
   5978  * Purpose:
   5979  *      Get input clock enable Boolean.
   5980  * Parameters:
   5981  *      unit        - (IN) Unit number.
   5982  *      stack_id    - (IN) Stack identifier index.
   5983  *      clock_index - (IN) Input clock index.
   5984  *      enable      - (OUT) Input clock enable Boolean.
   5985  * Returns:
   5986  *      BCM_E_XXX - Function status.
   5987  * Notes:
   5988  */
   5989 int
   5990 bcm_esw_tdpll_input_clock_enable_get(
   5991     int unit,
   5992     int stack_id,
   5993     int clock_index,
   5994     int *enable)
   5995 {
   5996     int rv;
   5997 
   5998     rv = bcm_common_tdpll_input_clock_enable_get(unit, stack_id, clock_index, enable);
   5999 
   6000     return rv;
   6001 }
   6002 
   6003 /*
   6004  * Function:
   6005  *      bcm_tdpll_input_clock_enable_set()
   6006  * Purpose:
   6007  *      Set input-clock enable Boolean.
   6008  * Parameters:
   6009  *      unit        - (IN) Unit number.
   6010  *      stack_id    - (IN) Stack identifier index.
   6011  *      clock_index - (IN) Input clock index.
   6012  *      enable      - (IN) Input clock enable Boolean.
   6013  * Returns:
   6014  *      BCM_E_XXX - Function status.
   6015  * Notes:
   6016  */
   6017 int
   6018 bcm_esw_tdpll_input_clock_enable_set(
   6019     int unit,
   6020     int stack_id,
   6021     int clock_index,
   6022     int enable)
   6023 {
   6024     int rv;
   6025 
   6026     rv = bcm_common_tdpll_input_clock_enable_set(unit, stack_id, clock_index, enable);
   6027 
   6028     return rv;
   6029 }
   6030 
   6031 /*
   6032  * Function:
   6033  *      bcm_tdpll_input_clock_l1mux_get()
   6034  * Purpose:
   6035  *      Get L1 mux mapping (mux index and port number) of input clock.
   6036  * Parameters:
   6037  *      unit        - (IN) Unit number.
   6038  *      stack_id    - (IN) Stack identifier index.
   6039  *      clock_index - (IN) Input clock index.
   6040  *      l1mux       - (OUT) L1 mux mapping.
   6041  * Returns:
   6042  *      BCM_E_XXX - Function status.
   6043  * Notes:
   6044  */
   6045 int
   6046 bcm_esw_tdpll_input_clock_l1mux_get(
   6047     int unit,
   6048     int stack_id,
   6049     int clock_index,
   6050     bcm_tdpll_input_clock_l1mux_t *l1mux)
   6051 {
   6052     int rv;
   6053 
   6054     rv = bcm_common_tdpll_input_clock_l1mux_get(unit, stack_id, clock_index, l1mux);
   6055 
   6056     return rv;
   6057 }
   6058 
   6059 /*
   6060  * Function:
   6061  *      bcm_tdpll_input_clock_l1mux_set()
   6062  * Purpose:
   6063  *      Set L1 mux mapping (mux index and port number) of input clock.
   6064  * Parameters:
   6065  *      unit        - (IN) Unit number.
   6066  *      stack_id    - (IN) Stack identifier index.
   6067  *      clock_index - (IN) Input clock index.
   6068  *      l1mux       - (IN) L1 mux mapping.
   6069  * Returns:
   6070  *      BCM_E_XXX - Function status.
   6071  * Notes:
   6072  */
   6073 int
   6074 bcm_esw_tdpll_input_clock_l1mux_set(
   6075     int unit,
   6076     int stack_id,
   6077     int clock_index,
   6078     bcm_tdpll_input_clock_l1mux_t *l1mux)
   6079 {
   6080     int rv;
   6081 
   6082     rv = bcm_common_tdpll_input_clock_l1mux_set(unit, stack_id, clock_index, l1mux);
   6083 
   6084     return rv;
   6085 }
   6086 
   6087 /*
   6088  * Function:
   6089  *      bcm_tdpll_input_clock_valid_get()
   6090  * Purpose:
   6091  *      Get valid Boolean of an input clock from input-clock monitoring process.
   6092  * Parameters:
   6093  *      unit        - (IN) Unit number.
   6094  *      stack_id    - (IN) Stack identifier index.
   6095  *      clock_index - (IN) Input clock index.
   6096  *      valid       - (OUT) Input clock valid Boolean.
   6097  * Returns:
   6098  *      BCM_E_XXX - Function status.
   6099  * Notes:
   6100  */
   6101 int
   6102 bcm_esw_tdpll_input_clock_valid_get(
   6103     int unit,
   6104     int stack_id,
   6105     int clock_index,
   6106     int *valid)
   6107 {
   6108     int rv;
   6109 
   6110     rv = bcm_common_tdpll_input_clock_valid_get(unit, stack_id, clock_index, valid);
   6111 
   6112     return rv;
   6113 }
   6114 
   6115 /*
   6116  * Function:
   6117  *      bcm_tdpll_input_clock_valid_set()
   6118  * Purpose:
   6119  *      Set input-clock valid Boolean from monitoring process.
   6120  * Parameters:
   6121  *      unit        - (IN) Unit number.
   6122  *      stack_id    - (IN) Stack identifier index.
   6123  *      clock_index - (IN) Input clock index.
   6124  *      valid       - (IN) Input clock valid Boolean.
   6125  * Returns:
   6126  *      BCM_E_XXX - Function status.
   6127  * Notes:
   6128  *      Assignment is transient. Valid Boolean shall be reset by subsequent
   6129  *      input-clock monitoring decision.
   6130  */
   6131 int
   6132 bcm_esw_tdpll_input_clock_valid_set(
   6133     int unit,
   6134     int stack_id,
   6135     int clock_index,
   6136     int valid)
   6137 {
   6138     int rv;
   6139 
   6140     rv = bcm_common_tdpll_input_clock_valid_set(unit, stack_id, clock_index, valid);
   6141 
   6142     return rv;
   6143 }
   6144 
   6145 /*
   6146  * Function:
   6147  *      bcm_tdpll_input_clock_frequency_get()
   6148  * Purpose:
   6149  *      Get input clock frequency.
   6150  * Parameters:
   6151  *      unit              - (IN) Unit number.
   6152  *      stack_id          - (IN) Stack identifier index.
   6153  *      clock_index       - (IN) Input clock index.
   6154  *      clock_frequency   - (OUT) Frequency (Hz).
   6155  *      tsevent_frequency - (OUT) TS event frequency (Hz).
   6156  * Returns:
   6157  *      BCM_E_XXX - Function status.
   6158  * Notes:
   6159  */
   6160 int
   6161 bcm_esw_tdpll_input_clock_frequency_get(
   6162     int unit,
   6163     int stack_id,
   6164     int clock_index,
   6165     uint32 *clock_frequency,
   6166     uint32 *tsevent_frequency)
   6167 {
   6168     int rv;
   6169 
   6170     rv = bcm_common_tdpll_input_clock_frequency_get(unit, stack_id, clock_index, clock_frequency, tsevent_frequency);
   6171 
   6172     return rv;
   6173 }
   6174 
   6175 /*
   6176  * Function:
   6177  *      bcm_tdpll_input_clock_frequency_set()
   6178  * Purpose:
   6179  *      Set input clock frequency.
   6180  * Parameters:
   6181  *      unit              - (IN) Unit number.
   6182  *      stack_id          - (IN) Stack identifier index.
   6183  *      clock_index       - (IN) Input clock index.
   6184  *      clock_frequency   - (IN) Frequency (Hz).
   6185  *      tsevent_frequency - (IN) TS event frequency (Hz).
   6186  * Returns:
   6187  *      BCM_E_XXX - Function status.
   6188  * Notes:
   6189  */
   6190 int
   6191 bcm_esw_tdpll_input_clock_frequency_set(
   6192     int unit,
   6193     int stack_id,
   6194     int clock_index,
   6195     uint32 clock_frequency,
   6196     uint32 tsevent_frequency)
   6197 {
   6198     int rv;
   6199 
   6200     rv = bcm_common_tdpll_input_clock_frequency_set(unit, stack_id, clock_index, clock_frequency, tsevent_frequency);
   6201 
   6202     return rv;
   6203 }
   6204 
   6205 /*
   6206  * Function:
   6207  *      bcm_tdpll_input_clock_ql_get()
   6208  * Purpose:
   6209  *      Get input clock quality level (QL).
   6210  * Parameters:
   6211  *      unit        - (IN) Unit number.
   6212  *      stack_id    - (IN) Stack identifier index.
   6213  *      clock_index - (IN) Input clock index.
   6214  *      ql          - (OUT) QL.
   6215  * Returns:
   6216  *      BCM_E_XXX - Function status.
   6217  * Notes:
   6218  */
   6219 int
   6220 bcm_esw_tdpll_input_clock_ql_get(
   6221     int unit,
   6222     int stack_id,
   6223     int clock_index,
   6224     bcm_esmc_quality_level_t *ql)
   6225 {
   6226     int rv;
   6227 
   6228     rv = bcm_common_tdpll_input_clock_ql_get(unit, stack_id, clock_index, ql);
   6229 
   6230     return rv;
   6231 }
   6232 
   6233 /*
   6234  * Function:
   6235  *      bcm_tdpll_input_clock_ql_set()
   6236  * Purpose:
   6237  *      Set input clock quality level (QL).
   6238  * Parameters:
   6239  *      unit        - (IN) Unit number.
   6240  *      stack_id    - (IN) Stack identifier index.
   6241  *      clock_index - (IN) Input clock index.
   6242  *      ql          - (IN) QL.
   6243  * Returns:
   6244  *      BCM_E_XXX - Function status.
   6245  * Notes:
   6246  */
   6247 int
   6248 bcm_esw_tdpll_input_clock_ql_set(
   6249     int unit,
   6250     int stack_id,
   6251     int clock_index,
   6252     bcm_esmc_quality_level_t ql)
   6253 {
   6254     int rv;
   6255 
   6256     rv = bcm_common_tdpll_input_clock_ql_set(unit, stack_id, clock_index, ql);
   6257 
   6258     return rv;
   6259 }
   6260 
   6261 /*
   6262  * Function:
   6263  *      bcm_tdpll_input_clock_priority_get()
   6264  * Purpose:
   6265  *      Get input clock priority for reference selection.
   6266  * Parameters:
   6267  *      unit        - (IN) Unit number.
   6268  *      stack_id    - (IN) Stack identifier index.
   6269  *      clock_index - (IN) Input clock index.
   6270  *      priority    - (OUT) Input clock priority.
   6271  * Returns:
   6272  *      BCM_E_XXX - Function status.
   6273  * Notes:
   6274  */
   6275 int
   6276 bcm_esw_tdpll_input_clock_priority_get(
   6277     int unit,
   6278     int stack_id,
   6279     int clock_index,
   6280     int *priority)
   6281 {
   6282     int rv;
   6283 
   6284     rv = bcm_common_tdpll_input_clock_priority_get(unit, stack_id, clock_index, priority);
   6285 
   6286     return rv;
   6287 }
   6288 
   6289 /*
   6290  * Function:
   6291  *      bcm_tdpll_input_clock_priority_set()
   6292  * Purpose:
   6293  *      Set input clock priority for reference selection.
   6294  * Parameters:
   6295  *      unit        - (IN) Unit number.
   6296  *      stack_id    - (IN) Stack identifier index.
   6297  *      clock_index - (IN) Input clock index.
   6298  *      priority    - (IN) Input clock priority.
   6299  * Returns:
   6300  *      BCM_E_XXX - Function status.
   6301  * Notes:
   6302  */
   6303 int
   6304 bcm_esw_tdpll_input_clock_priority_set(
   6305     int unit,
   6306     int stack_id,
   6307     int clock_index,
   6308     int priority)
   6309 {
   6310     int rv;
   6311 
   6312     rv = bcm_common_tdpll_input_clock_priority_set(unit, stack_id, clock_index, priority);
   6313 
   6314     return rv;
   6315 }
   6316 
   6317 /*
   6318  * Function:
   6319  *      bcm_tdpll_input_clock_lockout_get()
   6320  * Purpose:
   6321  *      Get input clock lockout Boolean for reference selection.
   6322  * Parameters:
   6323  *      unit        - (IN) Unit number.
   6324  *      stack_id    - (IN) Stack identifier index.
   6325  *      clock_index - (IN) Input clock index.
   6326  *      lockout     - (OUT) Input clock lockout Boolean.
   6327  * Returns:
   6328  *      BCM_E_XXX - Function status.
   6329  * Notes:
   6330  */
   6331 int
   6332 bcm_esw_tdpll_input_clock_lockout_get(
   6333     int unit,
   6334     int stack_id,
   6335     int clock_index,
   6336     int *lockout)
   6337 {
   6338     int rv;
   6339 
   6340     rv = bcm_common_tdpll_input_clock_lockout_get(unit, stack_id, clock_index, lockout);
   6341 
   6342     return rv;
   6343 }
   6344 
   6345 /*
   6346  * Function:
   6347  *      bcm_tdpll_input_clock_lockout_set()
   6348  * Purpose:
   6349  *      Set input clock lockout Boolean for reference selection.
   6350  * Parameters:
   6351  *      unit        - (IN) Unit number.
   6352  *      stack_id    - (IN) Stack identifier index.
   6353  *      clock_index - (IN) Input clock index.
   6354  *      lockout     - (IN) Input clock lockout Boolean.
   6355  * Returns:
   6356  *      BCM_E_XXX - Function status.
   6357  * Notes:
   6358  */
   6359 int
   6360 bcm_esw_tdpll_input_clock_lockout_set(
   6361     int unit,
   6362     int stack_id,
   6363     int clock_index,
   6364     int lockout)
   6365 {
   6366     int rv;
   6367 
   6368     rv = bcm_common_tdpll_input_clock_lockout_set(unit, stack_id, clock_index, lockout);
   6369 
   6370     return rv;
   6371 }
   6372 
   6373 /*
   6374  * Function:
   6375  *      bcm_tdpll_input_clock_monitor_interval_get()
   6376  * Purpose:
   6377  *      Get input clock monitoring interval.
   6378  * Parameters:
   6379  *      unit             - (IN) Unit number.
   6380  *      stack_id         - (IN) Stack identifier index.
   6381  *      monitor_interval - (OUT) Input clock monitoring interval (sec).
   6382  * Returns:
   6383  *      BCM_E_XXX - Function status.
   6384  * Notes:
   6385  *      Monitoring interval defines the period over which fractional frequency error
   6386  *      of an input clock is calculated for purposes of threshold-based comparison /
   6387  *      validation.
   6388  */
   6389 int
   6390 bcm_esw_tdpll_input_clock_monitor_interval_get(
   6391     int unit,
   6392     int stack_id,
   6393     uint32 *monitor_interval)
   6394 {
   6395     int rv;
   6396 
   6397     rv = bcm_common_tdpll_input_clock_monitor_interval_get(unit, stack_id, monitor_interval);
   6398 
   6399     return rv;
   6400 }
   6401 
   6402 /*
   6403  * Function:
   6404  *      bcm_tdpll_input_clock_monitor_interval_set()
   6405  * Purpose:
   6406  *      Set input clock monitoring interval.
   6407  * Parameters:
   6408  *      unit             - (IN) Unit number.
   6409  *      stack_id         - (IN) Stack identifier index.
   6410  *      monitor_interval - (IN) Input clock monitoring interval (sec).
   6411  * Returns:
   6412  *      BCM_E_XXX - Function status.
   6413  * Notes:
   6414  *      Monitoring interval defines the period over which fractional frequency error
   6415  *      of an input clock is calculated for purposes of threshold-based comparison /
   6416  *      validation.
   6417  */
   6418 int
   6419 bcm_esw_tdpll_input_clock_monitor_interval_set(
   6420     int unit,
   6421     int stack_id,
   6422     uint32 monitor_interval)
   6423 {
   6424     int rv;
   6425 
   6426     rv = bcm_common_tdpll_input_clock_monitor_interval_set(unit, stack_id, monitor_interval);
   6427 
   6428     return rv;
   6429 }
   6430 
   6431 /*
   6432  * Function:
   6433  *      bcm_tdpll_input_clock_monitor_threshold_get()
   6434  * Purpose:
   6435  *      Get monitor threshold for input-clock valid classification required
   6436  *      in reference selection.
   6437  * Parameters:
   6438  *      unit           - (IN) Unit number.
   6439  *      stack_id       - (IN) Stack identifier index.
   6440  *      threshold_type - (IN) Input clock monitoring threshold type.
   6441  *      threshold      - (OUT) Input clock monitoring threshold (ppb).
   6442  * Returns:
   6443  *      BCM_E_XXX - Function status.
   6444  * Notes:
   6445  */
   6446 int
   6447 bcm_esw_tdpll_input_clock_monitor_threshold_get(
   6448     int unit,
   6449     int stack_id,
   6450     bcm_tdpll_input_clock_monitor_type_t threshold_type,
   6451     uint32 *threshold)
   6452 {
   6453     int rv;
   6454 
   6455     rv = bcm_common_tdpll_input_clock_monitor_threshold_get(unit, stack_id, threshold_type, threshold);
   6456 
   6457     return rv;
   6458 }
   6459 
   6460 /*
   6461  * Function:
   6462  *      bcm_tdpll_input_clock_monitor_threshold_set()
   6463  * Purpose:
   6464  *      Set monitor threshold for input-clock valid classification required
   6465  *      in reference selection.
   6466  * Parameters:
   6467  *      unit           - (IN) Unit number.
   6468  *      stack_id       - (IN) Stack identifier index.
   6469  *      threshold_type - (IN) Input-clock monitoring threshold type.
   6470  *      threshold      - (IN) Input-clock monitoring threshold (ppb).
   6471  * Returns:
   6472  *      BCM_E_XXX - Function status.
   6473  * Notes:
   6474  */
   6475 int
   6476 bcm_esw_tdpll_input_clock_monitor_threshold_set(
   6477     int unit,
   6478     int stack_id,
   6479     bcm_tdpll_input_clock_monitor_type_t threshold_type,
   6480     uint32 threshold)
   6481 {
   6482     int rv;
   6483 
   6484     rv = bcm_common_tdpll_input_clock_monitor_threshold_set(unit, stack_id, threshold_type, threshold);
   6485 
   6486     return rv;
   6487 }
   6488 
   6489 /*
   6490  * Function:
   6491  *      bcm_tdpll_input_clock_ql_enabled_get()
   6492  * Purpose:
   6493  *      Get QL-enabled Boolean for reference selection.
   6494  * Parameters:
   6495  *      unit       - (IN) Unit number.
   6496  *      stack_id   - (IN) Stack identifier index.
   6497  *      dpll_index - (IN) DPLL instance number.
   6498  *      ql_enabled - (OUT) QL-enabled Boolean.
   6499  * Returns:
   6500  *      BCM_E_XXX - Function status.
   6501  * Notes:
   6502  */
   6503 int
   6504 bcm_esw_tdpll_input_clock_ql_enabled_get(
   6505     int unit,
   6506     int stack_id,
   6507     int dpll_index,
   6508     int *ql_enabled)
   6509 {
   6510     int rv;
   6511 
   6512     rv = bcm_common_tdpll_input_clock_ql_enabled_get(unit, stack_id, dpll_index, ql_enabled);
   6513 
   6514     return rv;
   6515 }
   6516 
   6517 /*
   6518  * Function:
   6519  *      bcm_tdpll_input_clock_ql_enabled_set()
   6520  * Purpose:
   6521  *      Set QL-enabled Boolean for reference selection.
   6522  * Parameters:
   6523  *      unit       - (IN) Unit number.
   6524  *      stack_id   - (IN) Stack identifier index.
   6525  *      dpll_index - (IN) DPLL instance number.
   6526  *      ql_enabled - (IN) QL-enabled Boolean.
   6527  * Returns:
   6528  *      BCM_E_XXX - Function status.
   6529  * Notes:
   6530  */
   6531 int
   6532 bcm_esw_tdpll_input_clock_ql_enabled_set(
   6533     int unit,
   6534     int stack_id,
   6535     int dpll_index,
   6536     int ql_enabled)
   6537 {
   6538     int rv;
   6539 
   6540     rv = bcm_common_tdpll_input_clock_ql_enabled_set(unit, stack_id, dpll_index, ql_enabled);
   6541 
   6542     return rv;
   6543 }
   6544 
   6545 /*
   6546  * Function:
   6547  *      bcm_tdpll_input_clock_revertive_get()
   6548  * Purpose:
   6549  *      Get revertive mode Boolean for reference selection and switching.
   6550  * Parameters:
   6551  *      unit       - (IN) Unit number.
   6552  *      stack_id   - (IN) Stack identifier index.
   6553  *      dpll_index - (IN) DPLL instance number.
   6554  *      revertive  - (OUT) Revertive mode Boolean.
   6555  * Returns:
   6556  *      BCM_E_XXX - Function status.
   6557  * Notes:
   6558  */
   6559 int
   6560 bcm_esw_tdpll_input_clock_revertive_get(
   6561     int unit,
   6562     int stack_id,
   6563     int dpll_index,
   6564     int *revertive)
   6565 {
   6566     int rv;
   6567 
   6568     rv = bcm_common_tdpll_input_clock_revertive_get(unit, stack_id, dpll_index, revertive);
   6569 
   6570     return rv;
   6571 }
   6572 
   6573 /*
   6574  * Function:
   6575  *      bcm_tdpll_input_clock_revertive_set()
   6576  * Purpose:
   6577  *      Set revertive mode Boolean for reference selection and switching.
   6578  * Parameters:
   6579  *      unit       - (IN) Unit number.
   6580  *      stack_id   - (IN) Stack identifier index.
   6581  *      dpll_index - (IN) DPLL instance number.
   6582  *      revertive  - (IN) Revertive mode Boolean.
   6583  * Returns:
   6584  *      BCM_E_XXX - Function status.
   6585  * Notes:
   6586  */
   6587 int
   6588 bcm_esw_tdpll_input_clock_revertive_set(
   6589     int unit,
   6590     int stack_id,
   6591     int dpll_index,
   6592     int revertive)
   6593 {
   6594     int rv;
   6595 
   6596     rv = bcm_common_tdpll_input_clock_revertive_set(unit, stack_id, dpll_index, revertive);
   6597 
   6598     return rv;
   6599 }
   6600 
   6601 /*
   6602  * Function:
   6603  *      bcm_tdpll_input_clock_best_get()
   6604  * Purpose:
   6605  *      Get best (i.e. selected) reference for a DPLL instance.
   6606  * Parameters:
   6607  *      unit       - (IN) Unit number.
   6608  *      stack_id   - (IN) Stack identifier index.
   6609  *      dpll_index - (IN) DPLL instance number.
   6610  *      best_clock - (OUT) Best / preferred input clock index.
   6611  * Returns:
   6612  *      BCM_E_XXX - Function status.
   6613  * Notes:
   6614  *      Best / preferred input clock might not be active reference of DPLL
   6615  *      instance, e.g. if revertive option is not set.
   6616  */
   6617 int
   6618 bcm_esw_tdpll_input_clock_best_get(
   6619     int unit,
   6620     int stack_id,
   6621     int dpll_index,
   6622     int *best_clock)
   6623 {
   6624     int rv;
   6625 
   6626     rv = bcm_common_tdpll_input_clock_best_get(unit, stack_id, dpll_index, best_clock);
   6627 
   6628     return rv;
   6629 }
   6630 
   6631 /*
   6632  * Function:
   6633  *      bcm_tdpll_input_clock_monitor_callback_register()
   6634  * Purpose:
   6635  *      Register input clock monitoring callback.
   6636  * Parameters:
   6637  *      unit       - (IN) Unit number.
   6638  *      stack_id   - (IN) Stack identifier index.
   6639  *      monitor_cb - (IN) Input clock monitoring callback function pointer.
   6640  * Returns:
   6641  *      BCM_E_XXX - Function status.
   6642  * Notes:
   6643  *      Input clock monitoring callback generates an event to notify user if
   6644  *      state has changed w.r.t. a threshold criterion.
   6645  */
   6646 int
   6647 bcm_esw_tdpll_input_clock_monitor_callback_register(
   6648     int unit,
   6649     int stack_id,
   6650     bcm_tdpll_input_clock_monitor_cb monitor_cb)
   6651 {
   6652     int rv;
   6653 
   6654     rv = bcm_common_tdpll_input_clock_monitor_callback_register(unit, stack_id, monitor_cb);
   6655 
   6656     return rv;
   6657 }
   6658 
   6659 /*
   6660  * Function:
   6661  *      bcm_tdpll_input_clock_monitor_callback_unregister()
   6662  * Purpose:
   6663  *      Unregister input clock monitoring callback.
   6664  * Parameters:
   6665  *      unit     - (IN) Unit number.
   6666  *      stack_id - (IN) Stack identifier index.
   6667  * Returns:
   6668  *      BCM_E_XXX - Function status.
   6669  * Notes:
   6670  *      Input clock monitoring callback generates an event to notify user if
   6671  *      state has changed w.r.t. a threshold criterion.
   6672  */
   6673 int
   6674 bcm_esw_tdpll_input_clock_monitor_callback_unregister(
   6675     int unit,
   6676     int stack_id)
   6677 {
   6678     int rv;
   6679 
   6680     rv = bcm_common_tdpll_input_clock_monitor_callback_unregister(unit, stack_id);
   6681 
   6682     return rv;
   6683 }
   6684 
   6685 /*
   6686  * Function:
   6687  *      bcm_tdpll_input_clock_selector_callback_register()
   6688  * Purpose:
   6689  *      Register input clock reference selection callback.
   6690  * Parameters:
   6691  *      unit        - (IN) Unit number.
   6692  *      stack_id    - (IN) Stack identifier index.
   6693  *      selector_cb - (IN) Input clock reference selection callback function pointer.
   6694  * Returns:
   6695  *      BCM_E_XXX - Function status.
   6696  * Notes:
   6697  *      Reference selection callback generates an event to notify user if a
   6698  *      new reference is selected but automatic switching to it is deferred,
   6699  *      because revertive option is not enabled.
   6700  */
   6701 int
   6702 bcm_esw_tdpll_input_clock_selector_callback_register(
   6703     int unit,
   6704     int stack_id,
   6705     bcm_tdpll_input_clock_selector_cb selector_cb)
   6706 {
   6707     int rv;
   6708 
   6709     rv = bcm_common_tdpll_input_clock_selector_callback_register(unit, stack_id, selector_cb);
   6710 
   6711     return rv;
   6712 }
   6713 
   6714 /*
   6715  * Function:
   6716  *      bcm_tdpll_input_clock_selector_callback_unregister()
   6717  * Purpose:
   6718  *      Unregister input clock reference selection callback.
   6719  * Parameters:
   6720  *      unit     - (IN) Unit number.
   6721  *      stack_id - (IN) Stack identifier index.
   6722  * Returns:
   6723  *      BCM_E_XXX - Function status.
   6724  * Notes:
   6725  *      Reference selection callback generates an event to notify user if a
   6726  *      new reference is selected but automatic switching to it is deferred,
   6727  *      because revertive option is not enabled.
   6728  */
   6729 int
   6730 bcm_esw_tdpll_input_clock_selector_callback_unregister(
   6731     int unit,
   6732     int stack_id)
   6733 {
   6734     int rv;
   6735 
   6736     rv = bcm_common_tdpll_input_clock_selector_callback_unregister(unit, stack_id);
   6737 
   6738     return rv;
   6739 }
   6740 
   6741 /*
   6742  * Function:
   6743  *      bcm_tdpll_input_clock_callback_register()
   6744  * Purpose:
   6745  *      Register input clock callback.
   6746  * Parameters:
   6747  *      unit       - (IN) Unit number.
   6748  *      stack_id   - (IN) Stack identifier index.
   6749  *      type       - (IN) callback type.
   6750  *      callback   - (IN) Input clock callback function pointer.
   6751  * Returns:
   6752  *      BCM_E_XXX - Function status.
   6753  */
   6754 int
   6755 bcm_esw_tdpll_input_clock_callback_register(
   6756     int unit,
   6757     int stack_id,
   6758     bcm_tdpll_callback_type_t type,
   6759     bcm_tdpll_input_clock_cb callback)
   6760 {
   6761     int rv;
   6762 
   6763     rv = bcm_common_tdpll_input_clock_callback_register(unit, stack_id, type, callback);
   6764 
   6765     return rv;
   6766 }
   6767 
   6768 /*
   6769  * Function:
   6770  *      bcm_tdpll_input_clock_callback_unregister()
   6771  * Purpose:
   6772  *      Unregister input clock callback.
   6773  * Parameters:
   6774  *      unit     - (IN) Unit number.
   6775  *      stack_id - (IN) Stack identifier index.
   6776  *      type       - (IN) callback type.
   6777  * Returns:
   6778  *      BCM_E_XXX - Function status.
   6779  */
   6780 int
   6781 bcm_esw_tdpll_input_clock_callback_unregister(
   6782     int unit,
   6783     int stack_id,
   6784     bcm_tdpll_callback_type_t type)
   6785 {
   6786     int rv;
   6787 
   6788     rv = bcm_common_tdpll_input_clock_callback_unregister(unit, stack_id, type);
   6789 
   6790     return rv;
   6791 }
   6792 
   6793 
   6794 /*
   6795  * Function:
   6796  *      bcm_tdpll_output_clock_enable_get()
   6797  * Purpose:
   6798  *      Get output clock enable Boolean.
   6799  * Parameters:
   6800  *      unit        - (IN) Unit number.
   6801  *      stack_id    - (IN) Stack identifier index.
   6802  *      clock_index - (IN) Output clock index.
   6803  *      enable      - (OUT) Output clock enable Boolean.
   6804  * Returns:
   6805  *      BCM_E_XXX - Function status.
   6806  * Notes:
   6807  */
   6808 int
   6809 bcm_esw_tdpll_output_clock_enable_get(
   6810     int unit,
   6811     int stack_id,
   6812     int clock_index,
   6813     int *enable)
   6814 {
   6815     int rv;
   6816 
   6817     rv = bcm_common_tdpll_output_clock_enable_get(unit, stack_id, clock_index, enable);
   6818 
   6819     return rv;
   6820 }
   6821 
   6822 /*
   6823  * Function:
   6824  *      bcm_tdpll_output_clock_enable_set()
   6825  * Purpose:
   6826  *      Set output clock enable Boolean.
   6827  * Parameters:
   6828  *      unit        - (IN) Unit number.
   6829  *      stack_id    - (IN) Stack identifier index.
   6830  *      clock_index - (IN) Output clock index.
   6831  *      enable      - (IN) Output clock enable Boolean.
   6832  * Returns:
   6833  *      BCM_E_XXX - Function status.
   6834  * Notes:
   6835  */
   6836 int
   6837 bcm_esw_tdpll_output_clock_enable_set(
   6838     int unit,
   6839     int stack_id,
   6840     int clock_index,
   6841     int enable)
   6842 {
   6843     int rv;
   6844 
   6845     rv = bcm_common_tdpll_output_clock_enable_set(unit, stack_id, clock_index, enable);
   6846 
   6847     return rv;
   6848 }
   6849 
   6850 /*
   6851  * Function:
   6852  *      bcm_tdpll_output_clock_synth_frequency_get()
   6853  * Purpose:
   6854  *      Get output-clock (synthesizer) frequency.
   6855  * Parameters:
   6856  *      unit              - (IN) Unit number.
   6857  *      stack_id          - (IN) Stack identifier index.
   6858  *      clock_index       - (IN) Output clock index.
   6859  *      synth_frequency   - (OUT) Synthesizer frequency (Hz).
   6860  *      tsevent_frequency - (OUT) TS event frequency (Hz).
   6861  * Returns:
   6862  *      BCM_E_XXX - Function status.
   6863  * Notes:
   6864  */
   6865 int
   6866 bcm_esw_tdpll_output_clock_synth_frequency_get(
   6867     int unit,
   6868     int stack_id,
   6869     int clock_index,
   6870     uint32 *synth_frequency,
   6871     uint32 *tsevent_frequency)
   6872 {
   6873     int rv;
   6874 
   6875     rv = bcm_common_tdpll_output_clock_synth_frequency_get(unit, stack_id, clock_index, synth_frequency, tsevent_frequency);
   6876 
   6877     return rv;
   6878 }
   6879 
   6880 /*
   6881  * Function:
   6882  *      bcm_tdpll_output_clock_synth_frequency_set()
   6883  * Purpose:
   6884  *      Set output-clock (synthesizer) frequency.
   6885  * Parameters:
   6886  *      unit              - (IN) Unit number.
   6887  *      stack_id          - (IN) Stack identifier index.
   6888  *      clock_index       - (IN) Output clock index.
   6889  *      synth_frequency   - (IN) Synthesizer frequency (Hz).
   6890  *      tsevent_frequency - (IN) TS event frequency (Hz).
   6891  * Returns:
   6892  *      BCM_E_XXX - Function status.
   6893  * Notes:
   6894  */
   6895 int
   6896 bcm_esw_tdpll_output_clock_synth_frequency_set(
   6897     int unit,
   6898     int stack_id,
   6899     int clock_index,
   6900     uint32 synth_frequency,
   6901     uint32 tsevent_frequency)
   6902 {
   6903     int rv;
   6904 
   6905     rv = bcm_common_tdpll_output_clock_synth_frequency_set(unit, stack_id, clock_index, synth_frequency, tsevent_frequency);
   6906 
   6907     return rv;
   6908 }
   6909 
   6910 /*
   6911  * Function:
   6912  *      bcm_tdpll_output_clock_deriv_frequency_get()
   6913  * Purpose:
   6914  *      Get synthesizer derivative-clock frequency.
   6915  * Parameters:
   6916  *      unit            - (IN) Unit number.
   6917  *      stack_id        - (IN) Stack identifier index.
   6918  *      clock_index     - (IN) Output clock index.
   6919  *      deriv_frequency - (OUT) Derivative clock frequency (Hz).
   6920  * Returns:
   6921  *      BCM_E_XXX - Function status.
   6922  * Notes:
   6923  */
   6924 int
   6925 bcm_esw_tdpll_output_clock_deriv_frequency_get(
   6926     int unit,
   6927     int stack_id,
   6928     int clock_index,
   6929     uint32 *deriv_frequency)
   6930 {
   6931     int rv;
   6932 
   6933     rv = bcm_common_tdpll_output_clock_deriv_frequency_get(unit, stack_id, clock_index, deriv_frequency);
   6934 
   6935     return rv;
   6936 }
   6937 
   6938 /*
   6939  * Function:
   6940  *      bcm_tdpll_output_clock_deriv_frequency_set()
   6941  * Purpose:
   6942  *      Set synthesizer derivative clock frequency.
   6943  * Parameters:
   6944  *      unit            - (IN) Unit number.
   6945  *      stack_id        - (IN) Stack identifier index.
   6946  *      clock_index     - (IN) Output clock index.
   6947  *      deriv_frequency - (IN) Derivative clock frequency (Hz).
   6948  * Returns:
   6949  *      BCM_E_XXX - Function status.
   6950  * Notes:
   6951  */
   6952 int
   6953 bcm_esw_tdpll_output_clock_deriv_frequency_set(
   6954     int unit,
   6955     int stack_id,
   6956     int clock_index,
   6957     uint32 deriv_frequency)
   6958 {
   6959     int rv;
   6960 
   6961     rv = bcm_common_tdpll_output_clock_deriv_frequency_set(unit, stack_id, clock_index, deriv_frequency);
   6962 
   6963     return rv;
   6964 }
   6965 
   6966 /*
   6967  * Function:
   6968  *      bcm_tdpll_output_clock_holdover_data_get()
   6969  * Purpose:
   6970  *      Get holdover configuration data.
   6971  * Parameters:
   6972  *      unit        - (IN)  Unit number.
   6973  *      stack_id    - (IN) Stack identifier index.
   6974  *      clock_index - (IN) Output clock index.
   6975  *      hdata       - (OUT) Holdover configuration data.
   6976  * Returns:
   6977  *      BCM_E_XXX - Function status.
   6978  * Notes:
   6979  */
   6980 int
   6981 bcm_esw_tdpll_output_clock_holdover_data_get(
   6982     int unit,
   6983     int stack_id,
   6984     int clock_index,
   6985     bcm_tdpll_holdover_data_t *hdata)
   6986 {
   6987     int rv;
   6988 
   6989     rv = bcm_common_tdpll_output_clock_holdover_data_get(unit, stack_id, clock_index, hdata);
   6990 
   6991     return rv;
   6992 }
   6993 
   6994 /*
   6995  * Function:
   6996  *      bcm_tdpll_output_clock_holdover_frequency_set()
   6997  * Purpose:
   6998  *      Set manual holdover frequency correction.
   6999  * Parameters:
   7000  *      unit        - (IN) Unit number.
   7001  *      stack_id    - (IN) Stack identifier index.
   7002  *      clock_index - (IN) Output clock index.
   7003  *      hfreq       - (IN) Holdover frequency correction (ppt).
   7004  * Returns:
   7005  *      BCM_E_XXX - Function status.
   7006  * Notes:
   7007  *      Manual frequency correction is used if holdover mode is manual.
   7008  */
   7009 int
   7010 bcm_esw_tdpll_output_clock_holdover_frequency_set(
   7011     int unit,
   7012     int stack_id,
   7013     int clock_index,
   7014     bcm_tdpll_frequency_correction_t hfreq)
   7015 {
   7016     int rv;
   7017 
   7018     rv = bcm_common_tdpll_output_clock_holdover_frequency_set(unit, stack_id, clock_index, hfreq);
   7019 
   7020     return rv;
   7021 }
   7022 
   7023 /*
   7024  * Function:
   7025  *      bcm_tdpll_output_clock_holdover_mode_get()
   7026  * Purpose:
   7027  *      Get holdover mode.
   7028  *      |Manual|Instantaneous|One-Second|Fast Average|Slow Average|
   7029  * Parameters:
   7030  *      unit        - (IN)  Unit number.
   7031  *      stack_id    - (IN) Stack identifier index.
   7032  *      clock_index - (IN) Output clock index.
   7033  *      hmode       - (OUT) Holdover mode.
   7034  * Returns:
   7035  *      BCM_E_XXX - Function status.
   7036  * Notes:
   7037  */
   7038 int
   7039 bcm_esw_tdpll_output_clock_holdover_mode_get(
   7040     int unit,
   7041     int stack_id,
   7042     int clock_index,
   7043     bcm_tdpll_holdover_mode_t *hmode)
   7044 {
   7045     int rv;
   7046 
   7047     rv = bcm_common_tdpll_output_clock_holdover_mode_get(unit, stack_id, clock_index, hmode);
   7048 
   7049     return rv;
   7050 }
   7051 
   7052 /*
   7053  * Function:
   7054  *      bcm_tdpll_output_clock_holdover_mode_set()
   7055  * Purpose:
   7056  *      Set holdover mode.
   7057  *      |Manual|Instantaneous|Fast Average|Slow Average|
   7058  * Parameters:
   7059  *      unit        - (IN) Unit number.
   7060  *      stack_id    - (IN) Stack identifier index.
   7061  *      clock_index - (IN) Output clock index.
   7062  *      hmode       - (IN) Holdover mode.
   7063  * Returns:
   7064  *      BCM_E_XXX - Function status.
   7065  * Notes:
   7066  */
   7067 int
   7068 bcm_esw_tdpll_output_clock_holdover_mode_set(
   7069     int unit,
   7070     int stack_id,
   7071     int clock_index,
   7072     bcm_tdpll_holdover_mode_t hmode)
   7073 {
   7074     int rv;
   7075 
   7076     rv = bcm_common_tdpll_output_clock_holdover_mode_set(unit, stack_id, clock_index, hmode);
   7077 
   7078     return rv;
   7079 }
   7080 
   7081 /*
   7082  * Function:
   7083  *      bcm_tdpll_output_clock_holdover_reset()
   7084  * Purpose:
   7085  *      Reset holdover frequency calculations.
   7086  * Parameters:
   7087  *      unit        - (IN) Unit number.
   7088  *      stack_id    - (IN) Stack identifier index.
   7089  *      clock_index - (IN) Output clock index.
   7090  * Returns:
   7091  *      BCM_E_XXX - Function status.
   7092  * Notes:
   7093  */
   7094 int
   7095 bcm_esw_tdpll_output_clock_holdover_reset(
   7096     int unit,
   7097     int stack_id,
   7098     int clock_index)
   7099 {
   7100     int rv;
   7101 
   7102     rv = bcm_common_tdpll_output_clock_holdover_reset(unit, stack_id, clock_index);
   7103 
   7104     return rv;
   7105 }
   7106 
   7107 /*
   7108  * Function:
   7109  *      bcm_tdpll_esmc_rx_state_machine()
   7110  * Purpose:
   7111  *      Execute state machine for Rx ESMC PDU.
   7112  * Parameters:
   7113  *      unit          - (IN) Unit number.
   7114  *      stack_id      - (IN) Stack identifier index.
   7115  *      ingress_port  - (IN) Ingress port.
   7116  *      esmc_pdu_data - (IN) ESMC PDU.
   7117  * Returns:
   7118  *      BCM_E_XXX - Function status.
   7119  * Notes:
   7120  *      State machine updates the SSM/QL of a T-DPLL input clock, transmits an
   7121  *      ESMC event PDU upon change to SSM/QL of selected reference clock, etc.
   7122  */
   7123 int
   7124 bcm_esw_tdpll_esmc_rx_state_machine(
   7125     int unit,
   7126     int stack_id,
   7127     int ingress_port,
   7128     bcm_esmc_pdu_data_t *esmc_pdu_data)
   7129 {
   7130     int rv;
   7131 
   7132     rv = bcm_common_tdpll_esmc_rx_state_machine(unit, stack_id, ingress_port, esmc_pdu_data);
   7133 
   7134     return rv;
   7135 }
   7136 
   7137 /*
   7138  * Function:
   7139  *      bcm_tdpll_esmc_ql_get()
   7140  * Purpose:
   7141  *      Get quality level (QL) for ESMC.
   7142  * Parameters:
   7143  *      unit       - (IN) Unit number.
   7144  *      stack_id   - (IN) Stack identifier index.
   7145  *      dpll_index - (IN) DPLL instance number.
   7146  *      ql         - (OUT) QL.
   7147  * Returns:
   7148  *      BCM_E_XXX - Function status.
   7149  * Notes:
   7150  */
   7151 int
   7152 bcm_esw_tdpll_esmc_ql_get(
   7153     int unit,
   7154     int stack_id,
   7155     int dpll_index,
   7156     bcm_esmc_quality_level_t *ql)
   7157 {
   7158     int rv;
   7159 
   7160     rv = bcm_common_tdpll_esmc_ql_get(unit, stack_id, dpll_index, ql);
   7161 
   7162     return rv;
   7163 }
   7164 
   7165 /*
   7166  * Function:
   7167  *      bcm_tdpll_esmc_ql_set()
   7168  * Purpose:
   7169  *      Set quality level (QL) for ESMC.
   7170  * Parameters:
   7171  *      unit       - (IN) Unit number.
   7172  *      stack_id   - (IN) Stack identifier index.
   7173  *      dpll_index - (IN) DPLL instance number.
   7174  *      ql         - (IN) QL.
   7175  * Returns:
   7176  *      BCM_E_XXX - Function status.
   7177  * Notes:
   7178  *      Assignment is transient. QL shall be overwritten by subsequent
   7179  *      ESMC PDUs received from a T-DPLL selected reference clock.
   7180  */
   7181 int
   7182 bcm_esw_tdpll_esmc_ql_set(
   7183     int unit,
   7184     int stack_id,
   7185     int dpll_index,
   7186     bcm_esmc_quality_level_t ql)
   7187 {
   7188     int rv;
   7189 
   7190     rv = bcm_common_tdpll_esmc_ql_set(unit, stack_id, dpll_index, ql);
   7191 
   7192     return rv;
   7193 }
   7194 
   7195 /*
   7196  * Function:
   7197  *      bcm_tdpll_esmc_holdover_ql_get()
   7198  * Purpose:
   7199  *      Get quality level (QL) for ESMC during holdover.
   7200  * Parameters:
   7201  *      unit       - (IN) Unit number.
   7202  *      stack_id   - (IN) Stack identifier index.
   7203  *      dpll_index - (IN) DPLL instance number.
   7204  *      ql         - (OUT) QL.
   7205  * Returns:
   7206  *      BCM_E_XXX - Function status.
   7207  * Notes:
   7208  */
   7209 int
   7210 bcm_esw_tdpll_esmc_holdover_ql_get(
   7211     int unit,
   7212     int stack_id,
   7213     int dpll_index,
   7214     bcm_esmc_quality_level_t *ql)
   7215 {
   7216     int rv;
   7217 
   7218     rv = bcm_common_tdpll_esmc_holdover_ql_get(unit, stack_id, dpll_index, ql);
   7219 
   7220     return rv;
   7221 }
   7222 
   7223 /*
   7224  * Function:
   7225  *      bcm_tdpll_esmc_holdover_ql_set()
   7226  * Purpose:
   7227  *      Set quality level (QL) for ESMC during holdover.
   7228  * Parameters:
   7229  *      unit       - (IN) Unit number.
   7230  *      stack_id   - (IN) Stack identifier index.
   7231  *      dpll_index - (IN) DPLL instance number.
   7232  *      ql         - (IN) QL.
   7233  * Returns:
   7234  *      BCM_E_XXX - Function status.
   7235  * Notes:
   7236  */
   7237 int
   7238 bcm_esw_tdpll_esmc_holdover_ql_set(
   7239     int unit,
   7240     int stack_id,
   7241     int dpll_index,
   7242     bcm_esmc_quality_level_t ql)
   7243 {
   7244     int rv;
   7245 
   7246     rv = bcm_common_tdpll_esmc_holdover_ql_set(unit, stack_id, dpll_index, ql);
   7247 
   7248     return rv;
   7249 }
   7250 
   7251 /*
   7252  * Function:
   7253  *      bcm_tdpll_esmc_mac_get()
   7254  * Purpose:
   7255  *      Get MAC address for ESMC.
   7256  * Parameters:
   7257  *      unit       - (IN) Unit number.
   7258  *      stack_id   - (IN) Stack identifier index.
   7259  *      dpll_index - (IN) DPLL instance number.
   7260  *      mac        - (OUT) Local port MAC address.
   7261  * Returns:
   7262  *      BCM_E_XXX - Function status.
   7263  * Notes:
   7264  *      MAC address is used as source MAC in Tx'd ESMC info and event PDUs.
   7265  *      MAC address is used in discard-from-self logic for reflected PDUs.
   7266  */
   7267 int
   7268 bcm_esw_tdpll_esmc_mac_get(
   7269     int unit,
   7270     int stack_id,
   7271     int dpll_index,
   7272     bcm_mac_t *mac)
   7273 {
   7274     int rv;
   7275 
   7276     rv = bcm_common_tdpll_esmc_mac_get(unit, stack_id, dpll_index, mac);
   7277 
   7278     return rv;
   7279 }
   7280 
   7281 /*
   7282  * Function:
   7283  *      bcm_tdpll_esmc_mac_set()
   7284  * Purpose:
   7285  *      Set MAC address for ESMC.
   7286  * Parameters:
   7287  *      unit       - (IN) Unit number.
   7288  *      stack_id   - (IN) Stack identifier index.
   7289  *      dpll_index - (IN) DPLL instance number.
   7290  *      mac        - (IN) Local port MAC address.
   7291  * Returns:
   7292  *      BCM_E_XXX - Function status.
   7293  * Notes:
   7294  *      MAC address is used as source MAC in Tx'd ESMC info and event PDUs.
   7295  *      MAC address is used in discard-from-self logic for reflected PDUs.
   7296  */
   7297 int
   7298 bcm_esw_tdpll_esmc_mac_set(
   7299     int unit,
   7300     int stack_id,
   7301     int dpll_index,
   7302     bcm_mac_t *mac)
   7303 {
   7304     int rv;
   7305 
   7306     rv = bcm_common_tdpll_esmc_mac_set(unit, stack_id, dpll_index, mac);
   7307 
   7308     return rv;
   7309 }
   7310 
   7311 /*
   7312  * Function:
   7313  *      bcm_tdpll_esmc_rx_enable_get()
   7314  * Purpose:
   7315  *      Get ESMC PDU receive (Rx) enable state.
   7316  * Parameters:
   7317  *      unit     - (IN) Unit number.
   7318  *      stack_id - (IN) Stack identifier index.
   7319  *      enable   - (OUT) ESMC PDU receive enable Boolean.
   7320  * Returns:
   7321  *      BCM_E_XXX - Function status.
   7322  * Notes:
   7323  */
   7324 int
   7325 bcm_esw_tdpll_esmc_rx_enable_get(
   7326     int unit,
   7327     int stack_id,
   7328     int *enable)
   7329 {
   7330     int rv;
   7331 
   7332     rv = bcm_common_tdpll_esmc_rx_enable_get(unit, stack_id, enable);
   7333 
   7334     return rv;
   7335 }
   7336 
   7337 /*
   7338  * Function:
   7339  *      bcm_tdpll_esmc_rx_enable_set()
   7340  * Purpose:
   7341  *      Set ESMC PDU receive (Rx) enable state.
   7342  * Parameters:
   7343  *      unit     - (IN) Unit number.
   7344  *      stack_id - (IN) Stack identifier index.
   7345  *      enable   - (IN) ESMC PDU receive enable Boolean.
   7346  * Returns:
   7347  *      BCM_E_XXX - Function status.
   7348  * Notes:
   7349  */
   7350 int
   7351 bcm_esw_tdpll_esmc_rx_enable_set(
   7352     int unit,
   7353     int stack_id,
   7354     int enable)
   7355 {
   7356     int rv;
   7357 
   7358     rv = bcm_common_tdpll_esmc_rx_enable_set(unit, stack_id, enable);
   7359 
   7360     return rv;
   7361 }
   7362 
   7363 /*
   7364  * Function:
   7365  *      bcm_tdpll_esmc_tx_enable_get()
   7366  * Purpose:
   7367  *      Get ESMC PDU transmit (Tx) enable state.
   7368  * Parameters:
   7369  *      unit       - (IN) Unit number.
   7370  *      stack_id   - (IN) Stack identifier index.
   7371  *      dpll_index - (IN) DPLL instance number.
   7372  *      enable     - (OUT) ESMC PDU transmit enable Boolean.
   7373  * Returns:
   7374  *      BCM_E_XXX - Function status.
   7375  * Notes:
   7376  */
   7377 int
   7378 bcm_esw_tdpll_esmc_tx_enable_get(
   7379     int unit,
   7380     int stack_id,
   7381     int dpll_index,
   7382     int *enable)
   7383 {
   7384     int rv;
   7385 
   7386     rv = bcm_common_tdpll_esmc_tx_enable_get(unit, stack_id, dpll_index, enable);
   7387 
   7388     return rv;
   7389 }
   7390 
   7391 /*
   7392  * Function:
   7393  *      bcm_tdpll_esmc_tx_enable_set()
   7394  * Purpose:
   7395  *      Set ESMC PDU transmit (Tx) enable state.
   7396  * Parameters:
   7397  *      unit       - (IN) Unit number.
   7398  *      stack_id   - (IN) Stack identifier index.
   7399  *      dpll_index - (IN) DPLL instance number.
   7400  *      enable     - (IN) ESMC PDU transmit enable Boolean.
   7401  * Returns:
   7402  *      BCM_E_XXX - Function status.
   7403  * Notes:
   7404  */
   7405 int
   7406 bcm_esw_tdpll_esmc_tx_enable_set(
   7407     int unit,
   7408     int stack_id,
   7409     int dpll_index,
   7410     int enable)
   7411 {
   7412     int rv;
   7413 
   7414     rv = bcm_common_tdpll_esmc_tx_enable_set(unit, stack_id, dpll_index, enable);
   7415 
   7416     return rv;
   7417 }
   7418 
   7419 /*
   7420  * Function:
   7421  *      bcm_tdpll_esmc_rx_portbitmap_get()
   7422  * Purpose:
   7423  *      Get port bitmap for ESMC Rx.
   7424  * Parameters:
   7425  *      unit       - (IN) Unit number.
   7426  *      stack_id   - (IN) Stack identifier index.
   7427  *      dpll_index - (IN) DPLL instance number.
   7428  *      pbmp       - (OUT) Rx port bitmap.
   7429  * Returns:
   7430  *      BCM_E_XXX - Function status.
   7431  * Notes:
   7432  */
   7433 int
   7434 bcm_esw_tdpll_esmc_rx_portbitmap_get(
   7435     int unit,
   7436     int stack_id,
   7437     int dpll_index,
   7438     bcm_pbmp_t *pbmp)
   7439 {
   7440     int rv;
   7441 
   7442     rv = bcm_common_tdpll_esmc_rx_portbitmap_get(unit, stack_id, dpll_index, pbmp);
   7443 
   7444     return rv;
   7445 }
   7446 
   7447 /*
   7448  * Function:
   7449  *      bcm_tdpll_esmc_rx_portbitmap_set()
   7450  * Purpose:
   7451  *      Set port bitmap for ESMC Rx.
   7452  * Parameters:
   7453  *      unit       - (IN) Unit number.
   7454  *      stack_id   - (IN) Stack identifier index.
   7455  *      dpll_index - (IN) DPLL instance number.
   7456  *      pbmp       - (IN) Rx port bitmap.
   7457  * Returns:
   7458  *      BCM_E_XXX - Function status.
   7459  * Notes:
   7460  */
   7461 int
   7462 bcm_esw_tdpll_esmc_rx_portbitmap_set(
   7463     int unit,
   7464     int stack_id,
   7465     int dpll_index,
   7466     bcm_pbmp_t pbmp)
   7467 {
   7468     int rv;
   7469 
   7470     rv = bcm_common_tdpll_esmc_rx_portbitmap_set(unit, stack_id, dpll_index, pbmp);
   7471 
   7472     return rv;
   7473 }
   7474 
   7475 /*
   7476  * Function:
   7477  *      bcm_tdpll_esmc_tx_portbitmap_get()
   7478  * Purpose:
   7479  *      Get port bitmap for ESMC Tx.
   7480  * Parameters:
   7481  *      unit       - (IN) Unit number.
   7482  *      stack_id   - (IN) Stack identifier index.
   7483  *      dpll_index - (IN) DPLL instance number.
   7484  *      pbmp       - (OUT) Tx port bitmap.
   7485  * Returns:
   7486  *      BCM_E_XXX - Function status.
   7487  * Notes:
   7488  */
   7489 int
   7490 bcm_esw_tdpll_esmc_tx_portbitmap_get(
   7491     int unit,
   7492     int stack_id,
   7493     int dpll_index,
   7494     bcm_pbmp_t *pbmp)
   7495 {
   7496     int rv;
   7497 
   7498     rv = bcm_common_tdpll_esmc_tx_portbitmap_get(unit, stack_id, dpll_index, pbmp);
   7499 
   7500     return rv;
   7501 }
   7502 
   7503 /*
   7504  * Function:
   7505  *      bcm_tdpll_esmc_tx_portbitmap_set()
   7506  * Purpose:
   7507  *      Set port bitmap for ESMC Tx.
   7508  * Parameters:
   7509  *      unit       - (IN) Unit number.
   7510  *      stack_id   - (IN) Stack identifier index.
   7511  *      dpll_index - (IN) DPLL instance number.
   7512  *      pbmp       - (IN) Tx port bitmap.
   7513  * Returns:
   7514  *      BCM_E_XXX - Function status.
   7515  * Notes:
   7516  */
   7517 int
   7518 bcm_esw_tdpll_esmc_tx_portbitmap_set(
   7519     int unit,
   7520     int stack_id,
   7521     int dpll_index,
   7522     bcm_pbmp_t pbmp)
   7523 {
   7524     int rv;
   7525 
   7526     rv = bcm_common_tdpll_esmc_tx_portbitmap_set(unit, stack_id, dpll_index, pbmp);
   7527 
   7528     return rv;
   7529 }
   7530 
   7531 /*
   7532  * Function:
   7533  *      bcm_esw_tdpll_esmc_essm_code_set()
   7534  * Purpose:
   7535  *      Get port bitmap for ESMC Tx.
   7536  * Parameters:
   7537  *      unit       - (IN) Unit number.
   7538  *      stack_id   - (IN) Stack identifier index.
   7539  *      dpll_index - (IN) DPLL instance number.
   7540  *      essm code - (IN) synce clock type .
   7541  * Returns:
   7542  *      BCM_E_XXX - Function status.
   7543  * Notes:
   7544  */
   7545 int
   7546 bcm_esw_tdpll_esmc_essm_code_set(
   7547     int unit,
   7548     int stack_id,
   7549     int dpll_index,
   7550     bcm_esmc_essm_code_t essm_code)
   7551 {
   7552     int rv;
   7553 
   7554     rv = bcm_common_tdpll_esmc_essm_code_set(unit, stack_id, dpll_index, essm_code);
   7555 
   7556     return rv;
   7557 }
   7558 
   7559 /*
   7560  * Function:
   7561  *      bcm_esw_tdpll_esmc_essm_code_get()
   7562  * Purpose:
   7563  *      Set port bitmap for ESMC Tx.
   7564  * Parameters:
   7565  *      unit       - (IN) Unit number.
   7566  *      stack_id   - (IN) Stack identifier index.
   7567  *      dpll_index - (IN) DPLL instance number.
   7568  *      essm_code    - (OUT) synce clock type .
   7569  * Returns:
   7570  *      BCM_E_XXX - Function status.
   7571  * Notes:
   7572  */
   7573 int
   7574 bcm_esw_tdpll_esmc_essm_code_get(
   7575     int unit,
   7576     int stack_id,
   7577     int dpll_index,
   7578     bcm_esmc_essm_code_t *essm_code)
   7579 {
   7580     int rv;
   7581 
   7582     rv = bcm_common_tdpll_esmc_essm_code_get(unit, stack_id, dpll_index, essm_code);
   7583 
   7584     return rv;
   7585 }
   7586 
   7587 /* Set flags to be used for overriding BMCA */
   7588 int bcm_esw_ptp_clock_bmca_override_set(
   7589     int unit,
   7590     bcm_ptp_stack_id_t ptp_id,
   7591     int clock_num,
   7592     uint32 flags,
   7593     uint32 enable_mask)
   7594 {
   7595     int rv;
   7596 
   7597     rv = bcm_common_clock_bmca_override_set(unit, ptp_id, clock_num, flags, enable_mask);
   7598 
   7599     return rv;
   7600 }
   7601 
   7602 /* Get flags to be used for overriding BMCA */
   7603 int bcm_esw_ptp_clock_bmca_override_get(
   7604     int unit,
   7605     bcm_ptp_stack_id_t ptp_id,
   7606     int clock_num,
   7607     uint32 *flags,
   7608     uint32 *enable_mask)
   7609 {
   7610     int rv;
   7611 
   7612     rv = bcm_common_clock_bmca_override_get(unit, ptp_id, clock_num, flags, enable_mask);
   7613 
   7614     return rv;
   7615 }
   7616 
   7617 /*
   7618  * This API is used to enable/disable the APTS automatic switching
   7619  * feature.
   7620  */
   7621 int bcm_esw_ptp_clock_apts_enable_get(
   7622     int unit,
   7623     bcm_ptp_stack_id_t ptp_id,
   7624     int clock_num,
   7625     int *enable)
   7626 {
   7627     int rv;
   7628     rv = bcm_common_ptp_clock_apts_enable_get(unit, ptp_id, clock_num, enable);
   7629     return rv;
   7630 }
   7631 
   7632 /*
   7633  * This API is used to enable/disable the APTS automatic switching
   7634  * feature.
   7635  */
   7636 int bcm_esw_ptp_clock_apts_enable_set(
   7637     int unit,
   7638     bcm_ptp_stack_id_t ptp_id,
   7639     int clock_num,
   7640     int enable)
   7641 {
   7642     int rv;
   7643     rv = bcm_common_ptp_clock_apts_enable_set(unit, ptp_id, clock_num, enable);
   7644     return rv;
   7645 }
   7646 
   7647 /*
   7648  * This API is used to get the priority order for time and frequency
   7649  * sources.
   7650  */
   7651 int bcm_esw_ptp_clock_apts_source_prio_get(
   7652     int unit,
   7653     bcm_ptp_stack_id_t ptp_id,
   7654     int clock_num,
   7655     int *num_sources,
   7656     bcm_ptp_clock_apts_source_t *priority_list)
   7657 {
   7658     int rv;
   7659     rv = bcm_common_ptp_clock_apts_source_prio_get(unit, ptp_id, clock_num,
   7660             num_sources, priority_list);
   7661     return rv;
   7662 }
   7663 
   7664 /*
   7665  * This API is used to get the priority order for time and frequency
   7666  * sources.
   7667  */
   7668 int bcm_esw_ptp_clock_apts_source_prio_set(
   7669     int unit,
   7670     bcm_ptp_stack_id_t ptp_id,
   7671     int clock_num,
   7672     int num_sources,
   7673     bcm_ptp_clock_apts_source_t *priority_list)
   7674 {
   7675     int rv;
   7676     rv = bcm_common_ptp_clock_apts_source_prio_set(unit, ptp_id, clock_num,
   7677                 num_sources, priority_list);
   7678     return rv;
   7679 }
   7680 
   7681 /*
   7682  *  This API can be used by the user application to retrieve the current
   7683  * operating mode of the APTS system.
   7684  */
   7685 int bcm_esw_ptp_clock_apts_mode_get(
   7686     int unit,
   7687     bcm_ptp_stack_id_t ptp_id,
   7688     int clock_num,
   7689     bcm_ptp_clock_apts_mode_t *current_mode)
   7690 {
   7691     int rv;
   7692     rv = bcm_common_ptp_clock_apts_mode_get(unit, ptp_id, clock_num,
   7693             current_mode);
   7694     return rv;
   7695 }
   7696 
   7697 /*
   7698  * This API is used by the to indicate if a time and/or frequency source
   7699  * is available or not.
   7700  */
   7701 int bcm_esw_ptp_clock_apts_source_enable_get(
   7702     int unit,
   7703     bcm_ptp_stack_id_t ptp_id,
   7704     int clock_num,
   7705     bcm_ptp_clock_apts_source_t source,
   7706     int *enable)
   7707 {
   7708     int rv;
   7709     rv = bcm_common_ptp_clock_apts_source_enable_get(unit, ptp_id, clock_num,
   7710             source, enable);
   7711     return rv;
   7712 }
   7713 
   7714 /*
   7715  * This API is used by the to indicate if a time and/or frequency source
   7716  * is available or not.
   7717  */
   7718 int bcm_esw_ptp_clock_apts_source_enable_set(
   7719     int unit,
   7720     bcm_ptp_stack_id_t ptp_id,
   7721     int clock_num,
   7722     bcm_ptp_clock_apts_source_t source,
   7723     int enable)
   7724 {
   7725     int rv;
   7726     rv = bcm_common_ptp_clock_apts_source_enable_set(unit, ptp_id, clock_num,
   7727             source, enable);
   7728     return rv;
   7729 }
   7730 
   7731 /*
   7732  * Function:
   7733  *      bcm_esw_ptp_external_phy_synchronize()
   7734  * Purpose:
   7735  *      Run state machine to synchronize CMIC time with external PHY time.
   7736  * Parameters:
   7737  *      unit       - (IN) Unit number.
   7738  *      stack_id   - (IN) Stack identifier index.
   7739  *      clock_num - (IN) clock index.
   7740  *      extphy_config - (IN) external PHY config.
   7741  * Returns:
   7742  *      BCM_E_XXX - Function status.
   7743  * Notes:
   7744  */
   7745 int
   7746 bcm_esw_ptp_external_phy_synchronize(
   7747     int unit,
   7748     int stack_id,
   7749     int clock_num,
   7750     bcm_ptp_external_phy_config_t extphy_config)
   7751 {
   7752     int rv;
   7753 
   7754     rv = bcm_common_ptp_external_phy_synchronize(unit, stack_id, clock_num, extphy_config);
   7755     return rv;
   7756 }
   7757 
   7758 int 
   7759 bcm_esw_tdpll_event_callback_register(
   7760     int unit, 
   7761     int ptp_id, 
   7762     bcm_tdpll_event_cb_f callback)
   7763 {
   7764     int rv;
   7765     rv = bcm_common_tdpll_event_callback_register(unit, ptp_id, callback);
   7766     return rv;
   7767 }
   7768 
   7769 int 
   7770 bcm_esw_tdpll_event_callback_unregister(
   7771     int unit, 
   7772     int ptp_id)
   7773 {
   7774     int rv;
   7775     rv = bcm_common_tdpll_event_callback_unregister(unit, ptp_id);
   7776     return rv;
   7777 }
   7778 #endif /* defined(INCLUDE_PTP)*/
   7779