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.h (135967B)


      1 /*
      2  * 
      3  * 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      7  *
      8  */
      9 
     10 #ifndef __BCM_PTP_H__
     11 #define __BCM_PTP_H__
     12 
     13 #if defined(INCLUDE_PTP)
     14 
     15 #include <bcm/types.h>
     16 
     17 /* Miscellaneous PTP defines */
     18 #define BCM_PTP_CLOCK_EUID_IEEE1588_SIZE    8          /* Clock EUID size per
     19                                                           IEEE 1588 standard. */
     20 #define BCM_PTP_MAX_L2_HEADER_LENGTH        64         /* Maximum L2 Header
     21                                                           length. */
     22 #define BCM_PTP_MAX_NETW_ADDR_SIZE          16         /* Maximum Network
     23                                                           Address Size. */
     24 #define BCM_PTP_MAX_TOD_FORMAT_STRING       128        /* Maximum Network
     25                                                           Address Size. */
     26 #define BCM_PTP_EXT_STACK_FAULT_INFO_DEFAULT_MAX_SIZE 1024       /* Recommended maximum
     27                                                           buffer size for fault
     28                                                           info. */
     29 #define BCM_PTP_TRACEABILITY_NO_OVERRIDE    0xFF       /* Flag used to clear the
     30                                                           traceability override
     31                                                           configuration. */
     32 #define BCM_PTP_IEEE1588_ALL_PORTS          0xFFFF     /* All ports identifier
     33                                                           (as defined in IEEE
     34                                                           1588-2008 std,
     35                                                           sections 7.5.2.3,
     36                                                           13.12.1 and 15.3.1). */
     37 
     38 /* PTP Stack info flags */
     39 #define BCM_PTP_STACK_WITH_ID               0x0001     /* Use the specified PTP
     40                                                           Stack ID */
     41 #define BCM_PTP_STACK_EXTERNAL_TOP          0x0002     /* Specifies PTP stack
     42                                                           instance runs on
     43                                                           external processor */
     44 #define BCM_PTP_STACK_TIMESTAMPER_COMBINED_MODE 0x0004     /* Flag to enable TS0 and
     45                                                           TS1 timestamper in
     46                                                           combined mode */
     47 
     48 /* PTP Clock info flags */
     49 #define BCM_PTP_CLOCK_WITH_ID   0x0001     /* Use the specified PTP Clock ID */
     50 
     51 /* Maximum Number of Unicast Masters */
     52 #define BCM_PTP_MAX_UNICAST_MASTER_TABLE_ENTRIES 10         
     53 
     54 /* Number of Telecom G8265 Profile Packet Masters */
     55 #define BCM_PTP_TELECOM_MAX_NUMBER_PKTMASTERS BCM_PTP_MAX_UNICAST_MASTER_TABLE_ENTRIES 
     56 
     57 /* 
     58  * Specifies PTP PHY clock synchronization is performed on a modular
     59  * system
     60  */
     61 #define BCM_PTP_SYNC_PHY_MODULAR    0x0001     
     62 
     63 /* Bits in servo configuration flags. */
     64 #define BCM_PTP_SERVO_PHASE_ONLY        (0x01)     /* Phase-only bit. */
     65 #define BCM_PTP_SERVO_LOCK_SWITCH_FREQ  (0x02)     /* Switch-frequency lock bit. */
     66 #define BCM_PTP_SERVO_IGNORE_FREQ       (0x04)     /* Ignore-frequency bit. */
     67 #define BCM_PTP_SERVO_PHASE_HOLDOVER    (0x08)     /* Servo phase holdover bit. */
     68 #define BCM_PTP_SERVO_FREQUENCY_ONLY    (0x10)     /* Frequency only mode */
     69 
     70 /* Maximum number of C-TDEV timescales. */
     71 #define BCM_PTP_CTDEV_NUM_TIMESCALES_MAX    (12)       
     72 
     73 /* PTP message flag fields bit postition */
     74 #define BCM_PTP_PKT_FLAG_LI_61              0          
     75 #define BCM_PTP_PKT_FLAG_59                 1          
     76 #define BCM_PTP_PKT_FLAG_CUR_UTCOFFS_VAL    2          
     77 #define BCM_PTP_PKT_FLAG_TIMESCALE          3          
     78 #define BCM_PTP_PKT_FLAG_TIME_TRACEABLE     4          
     79 #define BCM_PTP_PKT_FLAG_FREQ_TRACEABLE     5          
     80 #define BCM_PTP_PKT_FLAG_SYNC_UNCERTAIN     6          
     81 #define BCM_PTP_PKT_FLAG_ALT_MASTER         8          
     82 #define BCM_PTP_PKT_FLAG_TWO_STEP           9          
     83 #define BCM_PTP_PKT_FLAG_UNICAST            10         
     84 #define BCM_PTP_PKT_FLAG_PROF_SPEC1         13         
     85 #define BCM_PTP_PKT_FLAG_PROF_SPEC2         14         
     86 #define BCM_PTP_PKT_FLAG_SECURITY           15         
     87 
     88 /* PTP Stack ID type */
     89 typedef int bcm_ptp_stack_id_t;
     90 
     91 /* PTP Clock Identity type */
     92 typedef uint8 bcm_ptp_clock_identity_t[8];
     93 
     94 /* PTP Time of Day Format Types */
     95 typedef enum bcm_ptp_time_type_e {
     96     bcmPTPTimeDefault   /* Default */
     97 } bcm_ptp_time_type_t;
     98 
     99 /* PTP Timesource Types */
    100 typedef enum bcm_ptp_time_source_e {
    101     bcmPTPTimeSourceAtomicClock = 0x10, /* Atomic Clock */
    102     bcmPTPTimeSourceGPS = 0x20,         /* Global Positioning System */
    103     bcmPTPTimeSourceTerRadio = 0x30,    /* Terrestrial Radio */
    104     bcmPTPTimeSourcePtp = 0x40,         /* PTP-based source */
    105     bcmPTPTimeSourceNTP = 0x50,         /* Network Time Protocol source */
    106     bcmPTPTimeSourceHandSet = 0x60,     /* Handset */
    107     bcmPTPTimeSourceOther = 0x90,       /* Other timesource */
    108     bcmPTPTimeSourceInternalOsc = 0xA0  /* Internal Oscillator */
    109 } bcm_ptp_time_source_t;
    110 
    111 /* PTP Clock Accuracy */
    112 typedef enum bcm_ptp_clock_accuracy_e {
    113     bcmPTPClockAccuracy25ns = 0x0020,   /* Time is accurate to with 25 ns */
    114     bcmPTPClockAccuracy100ns = 0x0021,  /* Time is accurate to with 100 ns */
    115     bcmPTPClockAccuracy250ns = 0x0022,  /* Time is accurate to with 250 ns */
    116     bcmPTPClockAccuracy1us = 0x0023,    /* Time is accurate to with 1 us */
    117     bcmPTPClockAccuracy2500ns = 0x0024, /* Time is accurate to with 2500 ns */
    118     bcmPTPClockAccuracy10us = 0x0025,   /* Time is accurate to with 10 us */
    119     bcmPTPClockAccuracy25us = 0x0026,   /* Time is accurate to with 25 us */
    120     bcmPTPClockAccuracy100us = 0x0027,  /* Time is accurate to with 100 us */
    121     bcmPTPClockAccuracy250us = 0x0028,  /* Time is accurate to with 250 us */
    122     bcmPTPClockAccuracy1ms = 0x0029,    /* Time is accurate to with 1 ms */
    123     bcmPTPClockAccuracy2500us = 0x002a, /* Time is accurate to with 2500 us */
    124     bcmPTPClockAccuracy10ms = 0x002b,   /* Time is accurate to with 10 ms */
    125     bcmPTPClockAccuracy25ms = 0x002c,   /* Time is accurate to with 25 ms */
    126     bcmPTPClockAccuracy100ms = 0x002d,  /* Time is accurate to with 100 ms */
    127     bcmPTPClockAccuracy250ms = 0x002e,  /* Time is accurate to with 250 ms */
    128     bcmPTPClockAccuracy1s = 0x002f,     /* Time is accurate to with 1 s */
    129     bcmPTPClockAccuracy10s = 0x0030,    /* Time is accurate to with 10 s */
    130     bcmPTPClockAccuracyL10s = 0x0031,   /* Time is accurate to > 10 s */
    131     bcmPTPClockAccuracyUnknown = 0x00FE, /* Time accuracy is unknown */
    132     bcmPTPClockAccuracyReserved = 0x00FF /* Reserved */
    133 } bcm_ptp_clock_accuracy_t;
    134 
    135 /* 
    136  * Flags to indicate the fields of bcm_ptp_clock_quality_t in
    137  * bcm_ptp_clock_quality_set/get
    138  */
    139 #define BCM_PTP_CLOCK_QUALITY_CLASS         (0x1)      
    140 #define BCM_PTP_CLOCK_QUALITY_ACCURACY      (0x2)      
    141 #define BCM_PTP_CLOCK_QUALITY_OFFSET_SCALED_LOG_VARIANCE (0x4)      
    142 
    143 /* PTP callback types */
    144 typedef enum bcm_ptp_cb_type_e {
    145     bcmPTPCallbackTypeManagement, 
    146     bcmPTPCallbackTypeEvent, 
    147     bcmPTPCallbackTypeSignal, 
    148     bcmPTPCallbackTypeFault, 
    149     bcmPTPCallbackTypeCheckPeers, 
    150     bcmPTPCallbackCount 
    151 } bcm_ptp_cb_type_t;
    152 
    153 /* PTP Clock types */
    154 typedef enum bcm_ptp_clock_type_e {
    155     bcmPTPClockTypeOrdinary = 1,    /* PTP/1588 Ordinaly Clock, a.k.a OC */
    156     bcmPTPClockTypeBoundary = 2,    /* PTP/1588 Boundary Clock, a.k.a BC */
    157     bcmPTPClockTypeTransparent = 3  /* PTP/1588 Transparent Clock, a.k.a TC */
    158 } bcm_ptp_clock_type_t;
    159 
    160 /* PTP TOD Source */
    161 typedef enum bcm_ptp_tod_source_e {
    162     bcmPTPTODSourceNone,        /* TOD Source None */
    163     bcmPTPTODSourceSerial,      /* TOD Source is UART-0 */
    164     bcmPTPTODSourceEthernet,    /* TOD Source is Ethernet */
    165     bcmPTPTODSourceSerial1,     /* TOD Source is UART-1 */
    166     bcmPTPTODSourceSerial2,     /* TOD Source is UART-2 */
    167     bcmPTPTODSourceSerial3,     /* TOD Source is UART-3 */
    168     bcmPTPTODSourceMaster       /* TOD Source is master */
    169 } bcm_ptp_tod_source_t;
    170 
    171 /* PTP TOD Formats */
    172 typedef enum bcm_ptp_tod_format_e {
    173     bcmPTPTODFormatString,      /* PTP TOD format is user specified string */
    174     bcmPTPTODFormatUBlox,       /* PTP TOD format is as defined in U-Blox spec */
    175     bcmPTPTODFormatChinaTcom,   /* PTP TOD format is as defined in China Mobile
    176                                    or China Telecom spec */
    177     bcmPTPTODFormatBCM,         /* PTP TOD format is BCM */
    178     bcmPTPTODFormatBCMTS,       /* PTP TOD format is BCMTS */
    179     bcmPTPTODFormatG8271        /* PTP TOD format is as specified in ITU-T
    180                                    G.8271 Annexure A */
    181 } bcm_ptp_tod_format_t;
    182 
    183 /* PTP Source Types */
    184 typedef enum bcm_ptp_source_type_e {
    185     bcmPTPSourceTypePTP,            /* Time source is ptp */
    186     bcmPTPSourceTypeGpsTimestamp,   /* Time source is GPS */
    187     bcmPTPSourceTypeSyncETimestamp, /* Time source is Sync-E */
    188     bcmPTPSourceTypeE1Timestamp,    /* Time source is E1 Timestamp */
    189     bcmPTPSourceTypeT1Timestamp,    /* Time source is T1 Timestamp */
    190     bcmPTPSourceTypeRedundancy,     /* Redundant time source */
    191     bcmPTPSourceTypeFrequencyOnly,  /* Frequency only source */
    192     bcmPTPSourceTypeModular = 133   /* Modular time source */
    193 } bcm_ptp_source_type_t;
    194 
    195 /* PTP Timestamp Source */
    196 typedef int bcm_ptp_timestamp_source_t;
    197 
    198 /* PTP SyncE port */
    199 typedef int bcm_ptp_synce_port_t;
    200 
    201 /* PTP Delay Mechanism types */
    202 typedef enum bcm_ptp_delay_mechanism_e {
    203     bcmPTPDelayMechanismEnd2End = 1,    /* PTP Delay mechanism: End to End */
    204     bcmPTPDelayMechanismPeer2Peer = 2,  /* PTP Delay mechanism: Peer to Peer */
    205     bcmPTPDelayMechansimDisabled = 0xFE /* PTP Delay mechanism: Disabled */
    206 } bcm_ptp_delay_mechanism_t;
    207 
    208 /* PTP messageType  IEEE Std. 1588-2008 */
    209 typedef enum bcm_ptp_message_type_e {
    210     bcmPTP_MESSAGE_TYPE_SYNC = 0x0,     /* Sync Message */
    211     bcmPTP_MESSAGE_TYPE_DELAY_REQ = 0x1, /* Delay Request Message */
    212     bcmPTP_MESSAGE_TYPE_PDELAY_REQ = 0x2, /* Peer Delay Request Message */
    213     bcmPTP_MESSAGE_TYPE_PDELAY_RESP = 0x3, /* Peer Delay Response Message */
    214     bcmPTP_MESSAGE_TYPE_FOLLOW_UP = 0x8, /* Follow Up Message */
    215     bcmPTP_MESSAGE_TYPE_DELAY_RESP = 0x9, /* Delay Response Message */
    216     bcmPTP_MESSAGE_TYPE_PDELAY_RESP_FOLLOW_UP = 0xA, /* Peer Delay Response Follow Up Message */
    217     bcmPTP_MESSAGE_TYPE_ANNOUNCE = 0xB, /* Announce Message */
    218     bcmPTP_MESSAGE_TYPE_SIGNALING = 0xC, /* Signaling Message */
    219     bcmPTP_MESSAGE_TYPE_MANAGEMENT = 0xD, /* Management Message */
    220     bcmPTP_MESSAGE_TYPE_ARP = 0xFF      /* ARP Message not in PTP Standard */
    221 } bcm_ptp_message_type_t;
    222 
    223 /* PTP tlvType enumeration. Ref. IEEE Std. 1588-2008, Chapter 14.1.1. */
    224 typedef enum bcm_ptp_tlv_type_e {
    225     bcmPTPTlvTypeManagement = 0x0001,   /* Management TLV type. */
    226     bcmPTPTlvTypeManagementErrorStatus = 0x0002, /* Management error status TLV type. */
    227     bcmPTPTlvTypeOrganizationExtension = 0x0003, /* Organization extension TLV type. */
    228     bcmPTPTlvTypeRequestUnicastTransmission = 0x0004, /* Request unicast transmission TLV
    229                                            type. */
    230     bcmPTPTlvTypeGrantUnicastTransmission = 0x0005, /* Grant unicast transmission TLV type. */
    231     bcmPTPTlvTypeCancelUnicastTransmission = 0x0006, /* Cancel unicast transmission TLV type. */
    232     bcmPTPTlvTypeAckCancelUnicastTransmission = 0x0007 /* Acknowledge cancel unicast
    233                                            transmission TLV type. */
    234 } bcm_ptp_tlv_type_t;
    235 
    236 typedef struct bcm_ptp_cb_types_s {
    237     SHR_BITDCL w[_SHR_BITDCLSIZE(bcmPTPCallbackCount)]; 
    238 } bcm_ptp_cb_types_t;
    239 
    240 typedef int (*bcm_ptp_ext_stack_io_wr_fn_ptr)(
    241     void *cookie, 
    242     uint32 address, 
    243     uint32 value);
    244 
    245 typedef int (*bcm_ptp_ext_stack_io_rd_fn_ptr)(
    246     void *cookie, 
    247     uint32 address, 
    248     uint32 *value);
    249 
    250 /* PTP External Stack Processor Info object */
    251 typedef struct bcm_ptp_external_stack_info_s {
    252     uint32 flags;                       /* Control flags */
    253     bcm_ptp_stack_id_t id;              /* PTP stack identifier */
    254     uint16 ethertype;                   /* RCPU EtherType */
    255     uint16 signature;                   /* RCPU signature */
    256     uint16 tpid;                        /* RCPU tpid */
    257     uint16 vlan;                        /* RCPU vlan */
    258     uint8 vlan_pri;                     /* VLAN priority. External Stack
    259                                            Processor Only. */
    260     uint16 reflected_ethertype;         /* RCPU reflected EtherType */
    261     bcm_mac_t switch_mac;               /* Switch MAC address */
    262     bcm_mac_t host_mac;                 /* Host MAC address. External Stack
    263                                            Processor Only. */
    264     bcm_mac_t top_mac;                  /* ToP stack MAC address. External Stack
    265                                            Processor Only. */
    266     bcm_ip_t host_ip_addr;              /* host IPv4 address. External Stack
    267                                            Processor Only. */
    268     bcm_ip_t top_ip_addr;               /* ToP IPv4 address. External Stack
    269                                            Processor Only. */
    270     bcm_port_t port;                    /* ToP port. External Stack Processor
    271                                            Only. */
    272     bcm_ptp_ext_stack_io_rd_fn_ptr read_fn; /* PCI Read Function */
    273     bcm_ptp_ext_stack_io_wr_fn_ptr write_fn; /* PCI Write Function */
    274     void *cookie;                       /* User-specified identifer for external
    275                                            stack */
    276 } bcm_ptp_external_stack_info_t;
    277 
    278 /* PTP Stack Info object */
    279 typedef struct bcm_ptp_stack_info_s {
    280     uint32 flags;                       /* control flags */
    281     bcm_ptp_stack_id_t id;              /* PTP stack identifier */
    282     bcm_ptp_external_stack_info_t *ext_stack_info; /* External Stack Info. External Stack
    283                                            Processor Only. */
    284 } bcm_ptp_stack_info_t;
    285 
    286 /* Clock Quality */
    287 typedef struct bcm_ptp_clock_quality_s {
    288     uint8 clock_class;                  /* Clock Class */
    289     bcm_ptp_clock_accuracy_t clock_accuracy; /* Clock Accuracy */
    290     uint16 offset_scaled_log_variance;  /* Offset Scaled Log Variance */
    291 } bcm_ptp_clock_quality_t;
    292 
    293 /* PTP Port Identity Structure */
    294 typedef struct bcm_ptp_port_identity_s {
    295     bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */
    296     uint16 port_number;                 /* Port Number */
    297 } bcm_ptp_port_identity_t;
    298 
    299 /* Clock Instance Information */
    300 typedef struct bcm_ptp_clock_info_s {
    301     uint32 flags;                       /* Flags */
    302     int clock_num;                      /* Clock Identifier (numeric) */
    303     bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */
    304     bcm_ptp_clock_type_t type;          /* PTP Clock Type */
    305     uint16 num_ports;                   /* Number of Ports */
    306     uint8 clock_class;                  /* Clock Class */
    307     uint8 domain_number;                /* Domain Number */
    308     uint16 scaled_log_variance;         /* Scaled Log Variance */
    309     uint8 priority1;                    /* Priority 1 */
    310     uint8 priority2;                    /* Priority 2 */
    311     uint8 slaveonly;                    /* Slave Only */
    312     uint8 twostep;                      /* Two Step */
    313     uint8 tc_primary_domain;            /* Transparent Clock Primary Domain */
    314     bcm_ptp_delay_mechanism_t tc_delay_mechanism; /* Transparent Clock Delay Mechanism */
    315     uint8 announce_receipt_timeout_minimum; /* Announce Receipt Timeout Minimum */
    316     uint8 announce_receipt_timeout_default; /* Announce Receipt Timeout Default */
    317     uint8 announce_receipt_timeout_maximum; /* Announce Receipt Timeout Maximum */
    318     int log_announce_interval_minimum;  /* Log Announce Interval Minimum */
    319     int log_announce_interval_default;  /* Log Announce Interval Default */
    320     int log_announce_interval_maximum;  /* Log Announce Interval Maximum */
    321     int log_sync_interval_minimum;      /* Log Sync Interval Minimum */
    322     int log_sync_interval_default;      /* Log Sync Interval Default */
    323     int log_sync_interval_maximum;      /* Log Sync Interval Maximum */
    324     int log_min_delay_req_interval_minimum; /* Log min PDelay request interval or
    325                                            log min delay request interval
    326                                            minimum */
    327     int log_min_delay_req_interval_default; /* Log min PDelay request interval or
    328                                            log min delay request interval
    329                                            default */
    330     int log_min_delay_req_interval_maximum; /* Log min PDelay request interval or
    331                                            log min delay request interval
    332                                            maximum */
    333     uint8 domain_number_minimum;        /* Domain Number minimum */
    334     uint8 domain_number_default;        /* Domain Number default */
    335     uint8 domain_number_maximum;        /* Domain Number maximum */
    336     uint8 priority1_minimum;            /* Priority 1 minimum */
    337     uint8 priority1_default;            /* Priority 1 default */
    338     uint8 priority1_maximum;            /* Priority 1 maximum */
    339     uint8 priority2_minimum;            /* Priority 2 minimum */
    340     uint8 priority2_default;            /* Priority 2 default */
    341     uint8 priority2_maximum;            /* Priority 2 maximum */
    342     uint8 number_virtual_interfaces;    /* unused */
    343     uint8 local_priority;               /* Local priority of the clock */
    344     uint8 max_steps_removed;            /* maxStepsRemoved for the PTP clock */
    345     uint32 holdover_in_spec_secs;       /* Holdover In-Spec time for the PTP
    346                                            clock in seconds */
    347 } bcm_ptp_clock_info_t;
    348 
    349 /* PTP Clock Dataset flags */
    350 #define BCM_PTP_DATASET_TWOSTEP_ONLY    0x0001     /* Specifies Two-step only */
    351 #define BCM_PTP_DATASET_SLAVE_ONLY      0x0002     /* Specifies Slave Only */
    352 
    353 /* PTP Default Dataset */
    354 typedef struct bcm_ptp_default_dataset_s {
    355     uint32 flags;                       /* Flags */
    356     uint16 number_ports;                /* Number of ports */
    357     uint8 priority1;                    /* Priority 1 */
    358     uint8 priority2;                    /* Priority 2 */
    359     uint8 domain_number;                /* Domain number */
    360     bcm_ptp_clock_quality_t clock_quality; /* Clock quality */
    361     bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */
    362     uint8 local_priority;               /* local priority of clock */
    363     uint8 max_steps_removed;            /* maxStepsRemoved for the PTP clock */
    364 } bcm_ptp_default_dataset_t;
    365 
    366 /* PTP Current Dataset */
    367 typedef struct bcm_ptp_current_dataset_s {
    368     uint16 steps_removed;       /* Steps Removed from Master */
    369     uint64 offset_from_master;  /* Offset from Master in timeinterval (scaled
    370                                    nanoseconds) */
    371     uint64 mean_path_delay;     /* Mean Path Delay in nanoseconds */
    372 } bcm_ptp_current_dataset_t;
    373 
    374 /* PTP Parent Dataset */
    375 typedef struct bcm_ptp_parent_dataset_s {
    376     bcm_ptp_port_identity_t parent_port_identity; /* Parent Port Identity */
    377     uint8 ps;                           /* ps */
    378     uint16 observed_parent_offset_scaled_log_variance; /* Observed Parent Offset Scaled Log
    379                                            Variance */
    380     uint32 observed_parent_clock_phase_change_rate; /* Observed Parent Clock Phase Change
    381                                            Rate */
    382     uint8 grandmaster_priority1;        /* Grandmaster Priority 1 */
    383     bcm_ptp_clock_quality_t grandmaster_clock_quality; /* Grandmaster Clock quality */
    384     uint8 grandmaster_priority2;        /* Grandmaster Priority 2 */
    385     bcm_ptp_clock_identity_t grandmaster_identity; /* Grandmaster Identity */
    386 } bcm_ptp_parent_dataset_t;
    387 
    388 /* PTP Transparent Clock Default Dataset */
    389 typedef struct bcm_ptp_transparent_clock_default_dataset_s {
    390     bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */
    391     uint16 number_ports;                /* Number Of Ports */
    392     bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */
    393     uint8 primary_domain;               /* Primary Domain */
    394 } bcm_ptp_transparent_clock_default_dataset_t;
    395 
    396 /* PTP Transparent Clock Default Dataset */
    397 typedef struct bcm_ptp_transparent_clock_port_dataset_s {
    398     bcm_ptp_port_identity_t port_identity; /* Clock Port identity */
    399     uint8 faulty;                       /* Faulty */
    400     int log_min_pdelay_req_interval;    /* Log Minimun Peer Delay Interval */
    401     uint64 peer_mean_path_delay;        /* Peer Mean Path Delay in Nanoseconds */
    402 } bcm_ptp_transparent_clock_port_dataset_t;
    403 
    404 /* Coordinated Universal Time (UTC) dataset definiton */
    405 typedef struct bcm_ptp_utc_s {
    406     uint16 utc_offset;  /* Current UTC offset */
    407     uint8 leap61;       /* 1-> Plus one second, 0-> No leap second. */
    408     uint8 leap59;       /* 1-> Minus one second, 0-> No leap second. */
    409     uint8 utc_valid;    /* 1-> Correct offset to UTC, 0-> No sync to UTC. */
    410 } bcm_ptp_utc_t;
    411 
    412 /* Clock data traceability */
    413 typedef struct bcm_ptp_trace_s {
    414     uint8 time_traceable;           /* Time traceable */
    415     uint8 frequency_traceable;      /* Frequency traceable */
    416     uint8 check_trc_flag_enable;    /* Time tracability flag of announce message
    417                                        will be checked for valid time channel
    418                                        when enable */
    419 } bcm_ptp_trace_t;
    420 
    421 /* PTP Timescale properties */
    422 typedef struct bcm_ptp_timescale_s {
    423     bcm_ptp_time_source_t time_source;  /* PTP time source */
    424     uint8 ptp_timescale;                /* PTP timescale */
    425 } bcm_ptp_timescale_t;
    426 
    427 /* PTP Time Properties Dataset */
    428 typedef struct bcm_ptp_time_properties_s {
    429     bcm_ptp_utc_t utc_info;             /* UTC properties */
    430     bcm_ptp_trace_t trace_info;         /* Trace properties */
    431     bcm_ptp_timescale_t timescale_info; /* Timescale properties */
    432     uint32 ptp_pkt_flags;               /* PTP packet flags */
    433 } bcm_ptp_time_properties_t;
    434 
    435 /* PTP Network Protocol enumeration (See IEEE 1588, Chapter 7.4.1) */
    436 typedef enum bcm_ptp_protocol_e {
    437     bcmPTPUDPIPv4 = 1,  /* Ethernet / UDP / IPv4 */
    438     bcmPTPUDPIPv6 = 2,  /* Ethernet / UDP / IPv6 */
    439     bcmPTPIEEE8023 = 3  /* Ethernet Layer 2 */
    440 } bcm_ptp_protocol_t;
    441 
    442 /* PTP Clock Port Type enumeration. */
    443 typedef enum bcm_ptp_port_type_e {
    444     bcmPTPPortTypeStandard = 1,         /* Master-or-Slave port type */
    445     bcmPTPPortTypeMasterOnly = 2,       /* Master-only port type */
    446     bcmPTPPortTypeSlaveOnly = 3,        /* Slave-only port type */
    447     bcmPTPPortTypeVirtual = 4,          /* Virtual port type as defined in
    448                                            G.8275.1(Annex-C) */
    449     bcmPTPPortTypeCustomizedVirtual = 5 /* Customized virtual port type */
    450 } bcm_ptp_port_type_t;
    451 
    452 /* PTP Timestamp Source enumeration. */
    453 typedef enum bcm_ptp_timestamp_mechanism_e {
    454     bcmPTPToPTimestamps = 0x01,         /* Internal ToP timestamps */
    455     bcmPTPRCPUTimestamps = 0x02,        /* Timestamps from switch */
    456     bcmPTPPhyCorrectionTimestamps = 0x11, /* Timestamps from PHY CF update */
    457     bcmPTPMac32CorrectionTimestamps = 0x12, /* Timestamps from Unimac 32-bit update */
    458     bcmPTPMac48CorrectionTimestamps = 0x14 /* Timestamps from Unimac 48-bit update */
    459 } bcm_ptp_timestamp_mechanism_t;
    460 
    461 /* PTP Clock Port address */
    462 typedef struct bcm_ptp_clock_port_address_s {
    463     bcm_ptp_protocol_t addr_type;       /* Clock Port address type */
    464     uint8 address[BCM_PTP_MAX_NETW_ADDR_SIZE]; /* Address */
    465 } bcm_ptp_clock_port_address_t;
    466 
    467 /* Bits in Port Rx Packets Criteria Mask */
    468 #define BCM_PTP_RXMAP_ACCEPT_MULTICAST      (0x01)     /* Port should accept
    469                                                           packets with PTP
    470                                                           multicast destination
    471                                                           address */
    472 #define BCM_PTP_RXMAP_MATCH_OUTER_VLAN      (0x02)     /* Port should check
    473                                                           incoming packet outer
    474                                                           VLAN vs
    475                                                           rx_packets_vlan */
    476 #define BCM_PTP_RXMAP_MATCH_INNER_VLAN      (0x04)     /* Port should check
    477                                                           incoming packet inner
    478                                                           VLAN vs
    479                                                           rx_packets_vlan */
    480 #define BCM_PTP_RXMAP_MATCH_INGRESS_PORT    (0x08)     /* Port should check
    481                                                           incoming ingress port
    482                                                           vs
    483                                                           rx_packets_port_mask */
    484 #define BCM_PTP_RXMAP_MATCH_ANY_ADDR        (0x10)     /* Port should NOT check
    485                                                           incoming destination
    486                                                           address vs port
    487                                                           address */
    488 
    489 /* PTP TOD UART Parity */
    490 typedef enum bcm_ptp_tod_parity_e {
    491     bcmPTPTODUartParityNone,    /* TOD UART Parity None */
    492     bcmPTPTODUartParityOdd,     /* TOD UART Parity Odd */
    493     bcmPTPTODUartParityEven     /* TOD UART Parity Even */
    494 } bcm_ptp_tod_parity_t;
    495 
    496 /* virtual PTP port information */
    497 typedef struct bcm_ptp_clock_port_virtual_info_s {
    498     uint8 clock_class;                  /* clock class */
    499     bcm_ptp_clock_accuracy_t clock_accuracy; /* clock accuracy */
    500     uint16 offset_scaled_log_variance;  /* offset scaled log variance */
    501     uint16 steps_removed;               /* steps removed */
    502     uint8 GM_prio2;                     /* GM priority2 */
    503     int tod_offset_sec;                 /* PTP Offset Seconds Added */
    504     int tod_offset_ns;                  /* PTP Offset Nanoseconds Added */
    505     bcm_ptp_tod_format_t format;        /* PTP TOD Format */
    506     uint8 format_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Format String (null terminated) */
    507     uint8 mask_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Mask String (null terminated) */
    508     uint16 ether_type;                  /* EtherType for TOD pkts */
    509     uint8 onepps_in_gpio;               /* GPIO pin for 1PPS input/output.
    510                                            Required only for
    511                                            bcmPTPPortTypeCustomizedVirtual */
    512     bcm_ptp_tod_source_t tod_source;    /* PTP TOD Source */
    513     uint32 tod_baud_rate;               /* PTP ToD baud rate */
    514     int ts_sync_enable;                 /* Enable timestamper sync feature */
    515     bcm_ptp_tod_parity_t tod_parity;    /* TOD UART PARITY enum value
    516                                            NONE|ODD|EVEN */
    517 } bcm_ptp_clock_port_virtual_info_t;
    518 
    519 /* PTP Clock Port information */
    520 typedef struct bcm_ptp_clock_port_info_s {
    521     bcm_ptp_clock_port_address_t port_address; /* Clock Port address */
    522     bcm_mac_t mac;                      /* MAC address */
    523     uint8 multicast_l2_size;            /* Multicast L2 header size (octets) */
    524     uint8 multicast_l2[BCM_PTP_MAX_L2_HEADER_LENGTH]; /* Multicast L2 header */
    525     uint8 multicast_pdelay_l2_size;     /* Multicast Peer-Delay L2 header size
    526                                            (octets) */
    527     uint8 multicast_pdelay_l2[BCM_PTP_MAX_L2_HEADER_LENGTH]; /* Multicast Peer-Delay L2 header */
    528     uint8 multicast_tx_enable;          /* Multicast transmit enable */
    529     bcm_ptp_port_type_t port_type;      /* Port Type */
    530     uint8 announce_receipt_timeout;     /* Announce receipt timeout */
    531     int log_announce_interval;          /* Log Announce interval */
    532     int log_sync_interval;              /* Log Sync interval */
    533     int log_min_delay_req_interval;     /* Log Minimum Delay Request interval */
    534     bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */
    535     bcm_ptp_timestamp_mechanism_t rx_timestamp_mechanism; /* Receive Timestamp Mechanism */
    536     uint16 rx_packets_vlan;             /* Port Rx Packets Vlan */
    537     uint32 rx_packets_port_mask_high32; /* Port Rx Packets Mask High bits */
    538     uint32 rx_packets_port_mask_low32;  /* Port Rx Packets Mask Low bits */
    539     uint8 rx_packets_criteria_mask;     /* Port Rx Packets Criteria Mask */
    540     uint8 local_priority;               /* Local priority of the clock port */
    541     bcm_ptp_clock_port_virtual_info_t vport_info; /*  configuration of virtual port */
    542     uint8 ttl;                          /* time-to-live or hop-count 1-255 */
    543     uint8 ip_dscp;                      /* DSCP value 0-63 */
    544 } bcm_ptp_clock_port_info_t;
    545 
    546 /* PTP Clock Port Dataset */
    547 typedef struct bcm_ptp_port_dataset_s {
    548     bcm_ptp_port_identity_t port_identity; /* Clock Port identity */
    549     uint8 port_state;                   /* Port state. */
    550     int log_min_delay_req_interval;     /* Log minimum delay request interval */
    551     uint64 peer_mean_path_delay;        /* Peer Mean path delay (nanoseconds) */
    552     int log_announce_interval;          /* Log Announce interval */
    553     uint8 announce_receipt_timeout;     /* Announce receipt timeout */
    554     int log_sync_interval;              /* Log synchronization interval */
    555     bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */
    556     int log_min_pdelay_req_interval;    /* Log minimum peer delay request
    557                                            interval */
    558     uint8 version_number;               /* Version Number */
    559     uint8 local_priority;               /* clock port's local priority */
    560     uint8 not_slave;                    /* notSlave config of the clock port */
    561     int signal_fail;                    /* Boolean indicating signal_fail for a
    562                                            port */
    563 } bcm_ptp_port_dataset_t;
    564 
    565 /* PTP Clock Peer address */
    566 typedef struct bcm_ptp_clock_peer_address_s {
    567     uint8 raw_l2_header_length;         /* Raw L2 Header Length */
    568     uint8 raw_l2_header[BCM_PTP_MAX_L2_HEADER_LENGTH]; /* Raw L2 Header */
    569     bcm_ptp_protocol_t addr_type;       /* Peer Port address type */
    570     bcm_ip_t ipv4_addr;                 /* Peer IPv4 address */
    571     bcm_ip6_t ipv6_addr;                /* Peer IPv6 address */
    572 } bcm_ptp_clock_peer_address_t;
    573 
    574 /* PTP Peer Info Structure */
    575 typedef struct bcm_ptp_clock_peer_s {
    576     bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */
    577     uint16 remote_port_number;          /* Remote Clock Port Number */
    578     uint16 local_port_number;           /* Local Clock Port Number */
    579     bcm_ptp_clock_peer_address_t peer_address; /* Peer Port address */
    580     bcm_ptp_timestamp_mechanism_t tx_timestamp_mech; /* Send Timestamp Mechanism */
    581     int log_peer_delay_request_interval; /* Log Peer Delay Request Interval */
    582     int log_sync_interval;              /* Log Sync Interval */
    583     int announce_receive_timeout;       /* Announce Receive Timeout */
    584     int log_announce_interval;          /* Log Announce Interval */
    585     int log_delay_request_interval;     /* Log Delay Request Interval */
    586     bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */
    587 } bcm_ptp_clock_peer_t;
    588 
    589 /* PTP Peer Unicast Master Entry */
    590 typedef struct bcm_ptp_clock_unicast_master_s {
    591     int log_sync_interval;              /* PTP Clock Log Sync Interval */
    592     int log_announce_interval;          /* PTP Clock Log Announce Interval */
    593     int log_query_interval;             /* PTP Clock Log Query Interval */
    594     int log_min_delay_request_interval; /* PTP Clock Log Minimun Delay Request
    595                                            Interval */
    596     bcm_ptp_clock_peer_address_t address; /* PTP Clock Master address */
    597 } bcm_ptp_clock_unicast_master_t;
    598 
    599 /* PTP TOD IN */
    600 typedef struct bcm_ptp_tod_input_s {
    601     bcm_ptp_tod_source_t source;        /* PTP TOD Source */
    602     bcm_ptp_clock_peer_address_t peer_address; /* Peer Address For TOD Over Ethernet */
    603     int tod_offset_sec;                 /* PTP Offset Seconds Added */
    604     int tod_offset_ns;                  /* PTP Offset Nanoseconds Added */
    605     bcm_ptp_tod_format_t format;        /* PTP TOD Format */
    606     uint8 format_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Format String (null terminated) */
    607     uint8 mask_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Mask String (null terminated) */
    608     uint32 tod_baud_rate;               /* PTP ToD baud rate */
    609     int ts_sync_enable;                 /* Enable timestamper sync feature */
    610     bcm_ptp_tod_parity_t tod_parity;    /* TOD UART PARITY enum value
    611                                            NONE|ODD|EVEN */
    612 } bcm_ptp_tod_input_t;
    613 
    614 /* ptp channel configuration flags */
    615 #define BCM_PTP_CHANNEL_SYNCE_CONFIG_NO_L1MUX_SELECT 0x0        /* SyncE input config
    616                                                           will be done without
    617                                                           L1 mux config */
    618 
    619 /* PTP SyncE Clock type enumeration. */
    620 typedef enum bcm_ptp_synce_clock_type_e {
    621     bcmPTPSynceClockPrimary = 0x00,     /* PTP SyncE Clock Primary */
    622     bcmPTPSynceClockSecondary = 0x01    /* PTP SyncE Clock Secondary */
    623 } bcm_ptp_synce_clock_type_t;
    624 
    625 /* PTP TOD Channel */
    626 typedef struct bcm_ptp_channel_s {
    627     bcm_ptp_source_type_t type;         /* PTP Channel Source Type */
    628     bcm_ptp_timestamp_source_t source;  /* TSGPIO pin index or syncE port index */
    629     int frequency;                      /* PTP Channel Frequency */
    630     int tod_index;                      /* PTP Channel Index */
    631     int freq_priority;                  /* PTP Channel Frequency Priority */
    632     int freq_enabled;                   /* PTP Channel Frequency Enabled */
    633     int time_prio;                      /* PTP Channel Time Priority */
    634     int time_enabled;                   /* PTP Channel Time Enabled */
    635     int freq_assumed_QL;                /* PTP Channel Requency Assumed QL */
    636     int time_assumed_QL;                /* PTP Channel Time Assumed QL */
    637     int assumed_QL_enabled;             /* PTP Channel Assumed QL Enabled */
    638     int resolution;                     /* PTP Channel Resolution */
    639     bcm_ptp_synce_port_t synce_input_port; /* PTP SyncE input port */
    640     bcm_ptp_synce_clock_type_t synce_input_clk_type; /* PTP SyncE Input Clock type */
    641     uint32 synce_config_flags;          /* PTP synce configuration flags */
    642 } bcm_ptp_channel_t;
    643 
    644 /* PTP GPIO PIN */
    645 typedef int bcm_ptp_gpio_pin_t;
    646 
    647 /* PTP Signal Out */
    648 typedef struct bcm_ptp_signal_output_s {
    649     bcm_ptp_gpio_pin_t pin;             /* PTP Signal GPIO pin */
    650     int frequency;                      /* PTP Signal Frequency */
    651     int phase_lock;                     /* PTP Phase Lock */
    652     int pulse_width_ns;                 /* PTP Pulse Width */
    653     int pulse_offset_ns;                /* PTP Pulse Offset */
    654     bcm_ptp_synce_port_t synce_output_port; /* PTP SyncE output port */
    655 } bcm_ptp_signal_output_t;
    656 
    657 /* PTP TOD OUT */
    658 typedef struct bcm_ptp_tod_output_s {
    659     bcm_ptp_tod_source_t source;        /* PTP TOD Source */
    660     bcm_ptp_clock_peer_address_t peer_address; /* Peer Address For TOD Over Ethernet */
    661     int tod_offset_src;                 /* PTP Offset Seconds Added */
    662     int tod_offset_ns;                  /* PTP Offset Nanoseconds Added */
    663     uint32 tod_delay_ns;                /* PTP Delay Added in Nanoseconds */
    664     bcm_ptp_tod_format_t format;        /* PTP TOD Format */
    665     int frequency;                      /* PTP Signal Frequency */
    666     int format_str_len;                 /* PTP Format String Length */
    667     uint8 format_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Format String (null terminated) */
    668     uint32 tod_baud_rate;               /* PTP ToD baud rate */
    669     int pps_out_pin;                    /* GPIO pin [0..5] assoiciated with TOD
    670                                            out */
    671     int ts_sync_enable;                 /* Enable timestamper sync feature */
    672     bcm_ptp_tod_parity_t tod_parity;    /* TOD UART PARITY enum value
    673                                            NONE|ODD|EVEN */
    674 } bcm_ptp_tod_output_t;
    675 
    676 /* PTP Timesource Status */
    677 typedef struct bcm_ptp_timesource_status_s {
    678     int tod_status;         /* PTP Timesource TOD Status */
    679     int phase_status;       /* PTP Timesource Phase Status */
    680     int frequency_status;   /* PTP Timesource Frequency Status */
    681 } bcm_ptp_timesource_status_t;
    682 
    683 /* PTP Call Back Function Message Data Type */
    684 typedef struct bcm_ptp_cb_msg_s {
    685     uint32 flags;                   /* Flags */
    686     bcm_ptp_protocol_t protocol;    /* PTP Protocol Type */
    687     int src_addr_offset;            /* Source Address Offset */
    688     int msg_offset;                 /* Offset to the Start of Message */
    689     uint32 length;                  /* Length of the Message */
    690     uint8 *data;                    /* Pointer to addtional data */
    691 } bcm_ptp_cb_msg_t;
    692 
    693 /* PTP PHY Sync Function Input Data Type */
    694 typedef struct bcm_ptp_sync_phy_input_s {
    695     uint32 flags;           /* Flags */
    696     int framesync_pin;      /* Pin to be used for PHY Framesync (SYNC_IN1) */
    697     int freq_pin;           /* Pin configured for PHY 4KHz reference.  -1 for BS
    698                                HB */
    699     uint64 reference_time;  /* DPLL Reference time to be programmed into PHYs */
    700 } bcm_ptp_sync_phy_input_t;
    701 
    702 /* PTP BS TIME INFO GET Function output Data Type */
    703 typedef struct bcm_ptp_bs_time_info_s {
    704     uint64 bshb0_time;      /* BS0HB TS0 time to be programmed into PHY */
    705     uint64 bshb1_time;      /* BS1HB TS0 time to be programmed into PHY */
    706     int64 systime_bs0_sec;  /* BS0HB ptp systime seconds to be programmed into
    707                                PHY */
    708     int systime_bs0_nsec;   /* BS0HB ptp systime nseconds to be programmed into
    709                                PHY */
    710     int64 systime_bs1_sec;  /* BS1HB ptp systime seconds to be programmed into
    711                                PHY */
    712     int systime_bs1_nsec;   /* BS1HB ptp systime nseconds to be programmed into
    713                                PHY */
    714 } bcm_ptp_bs_time_info_t;
    715 
    716 /* PTP Servo Types. */
    717 typedef enum bcm_ptp_servo_type_e {
    718     bcmPTPServoTypeExt = 0, /* 3rd-party servo. */
    719     bcmPTPServoTypeBCM = 1  /* Broadcom Phase Profile Servo. */
    720 } bcm_ptp_servo_type_t;
    721 
    722 /* PTP Servo FLL State. */
    723 typedef enum bcm_ptp_fll_state_e {
    724     bcmPTPFLLStateAcquiring,    /* FLL acquiring lock. */
    725     bcmPTPFLLStateWarmup,       /* FLL warmup state. */
    726     bcmPTPFLLStateFastLoop,     /* FLL fast loop. */
    727     bcmPTPFLLStateNormal,       /* FLL normal loop. */
    728     bcmPTPFLLStateBridge,       /* FLL bridge state. */
    729     bcmPTPFLLStateHoldover      /* FLL holdover state. */
    730 } bcm_ptp_fll_state_t;
    731 
    732 /* PTP Servo State. */
    733 typedef enum bcm_ptp_servo_state_e {
    734     bcmPtpServoStateAcquiring = bcmPTPFLLStateAcquiring, /*  acquiring lock. */
    735     bcmPtpServoStateWarmup = bcmPTPFLLStateWarmup, /*  warmup state. */
    736     bcmPtpServoStateFastLoop = bcmPTPFLLStateFastLoop, /*  fast loop. */
    737     bcmPtpServoStateNormal = bcmPTPFLLStateNormal, /*  normal loop. */
    738     bcmPtpServoStateBridge = bcmPTPFLLStateBridge, /*  bridge state. */
    739     bcmPtpServoStateHoldover = bcmPTPFLLStateHoldover, /*  holdover state. */
    740     bcmPtpServoStateInitial,            /*  initial state. */
    741     bcmPtpServoStateUnqualified,        /*  unqualified. */
    742     bcmPtpServoStateFreqLocked,         /*  freq locked. */
    743     bcmPtpServoStateTimeLocked,         /*  time locked. */
    744     bcmPtpServoStateHoldoverInSpec,     /*  holdover in spec. */
    745     bcmPtpServoStateHoldoverOutOfSpec,  /*  holdover out of spec */
    746     bcmPtpServoStateFreerun,            /*  free-run. */
    747     bcmPtpServoStateLast                /*  Last. */
    748 } bcm_ptp_servo_state_t;
    749 
    750 /* PTP Servo Locked Status. */
    751 typedef enum bcm_ptp_servo_lock_status_e {
    752     bcmPTPServoStatusUnlocked,          /* Servo in Unlocked State. */
    753     bcmPTPServoStatusFreqLocked,        /* Servo only Frequency locked. */
    754     bcmPTPServoStatusPhaseLocked,       /* Servo only Phase locked. */
    755     bcmPTPServoStatusFreqPhaseLocked    /* Servo Frequency and Phase both
    756                                            locked. */
    757 } bcm_ptp_servo_lock_status_t;
    758 
    759 /* PTP Timesource Redundant Status */
    760 typedef enum bcm_ptp_redundant_status_e {
    761     bcm_ptp_redundant_active = 0, 
    762     bcm_ptp_redundant_standby = 1, 
    763     bcm_ptp_redundant_transition_to_active = 2, 
    764     bcm_ptp_redundant_transition_to_standby = 3 
    765 } bcm_ptp_redundant_status_t;
    766 
    767 /* Telecom clock type as defined in Table.1 of ITU-T G8275.1 */
    768 typedef enum bcm_ptp_g8275p1_clock_type_e {
    769     bcmPtpG8275P1ClockTypeTelecomGM = 0, /* Telecom GM - Master-only OC/BC. */
    770     bcmPtpG8275P1ClockTypeTelecomBC = 1, /* Telecom BC -Boundary clock. */
    771     bcmPtpG8275P1ClockTypeTelecomTSC = 2 /* Telecom SC - Slave-only OC . */
    772 } bcm_ptp_g8275p1_clock_type_t;
    773 
    774 /* Telecom clock state as defined in ITU-T G8275.1 */
    775 typedef enum bcm_ptp_g8275p1_clock_state_e {
    776     bcmPtpG8275P1ClockStateFreeRun = 0, /* clock not synchronized/synchronizing
    777                                            to a time source. */
    778     bcmPtpG8275P1ClockStateLocked = 1,  /* clock synchronized to a time source
    779                                            with acceptable accuracy. */
    780     bcmPtpG8275P1ClockStateHoldoverInSpec = 2, /* clock no-longer synchronized to a
    781                                            time source but with performance
    782                                            within desired specification. */
    783     bcmPtpG8275P1ClockStateHoldoverOutOfSpec = 3 /* clock no-longer synchronized to a
    784                                            time source and performance NOT
    785                                            within desired specification. */
    786 } bcm_ptp_g8275p1_clock_state_t;
    787 
    788 /* 
    789  * G781 Quality level values that can be mapped to ITU-T G8275.1 specific
    790  * frequency source category
    791  */
    792 typedef enum bcm_ptp_g8275p1_quality_level_e {
    793     bcmPtpG8275P1QlInvalid = 0,         /* Invalid QL. */
    794     bcmPtpG8275P1QlOptIPrc = 0x10,      /* ITU-T G.781 QL Option I. */
    795     bcmPtpG8275P1QlOptISsua = 0x11,     /* ITU-T G.781 QL Option I. */
    796     bcmPtpG8275P1QlOptISsub = 0x12,     /* ITU-T G.781 QL Option I. */
    797     bcmPtpG8275P1QlOptIIPrs = 0x20,     /* ITU-T G.781 QL Option II. */
    798     bcmPtpG8275P1QlOptIISt2 = 0x21,     /* ITU-T G.781 QL Option II. */
    799     bcmPtpG8275P1QlOptIISt3e = 0x22,    /* ITU-T G.781 QL Option II. */
    800     bcmPtpG8275P1QlNaSlv = 0xff         /* Not Applicable (packet slave). */
    801 } bcm_ptp_g8275p1_quality_level_t;
    802 
    803 /* clock traceability information */
    804 typedef struct bcm_ptp_g8275p1_clock_traceability_info_s {
    805     bcm_ptp_g8275p1_clock_type_t clock_type; /* Telecom clock type */
    806     bcm_ptp_g8275p1_clock_state_t clock_state; /* Telecom clock state */
    807     bcm_ptp_g8275p1_quality_level_t ql; /* Clock quality level */
    808     int freq_traceable;                 /* Boolean value - 1:traceable
    809                                            0:non-traceable */
    810 } bcm_ptp_g8275p1_clock_traceability_info_t;
    811 
    812 /* PTP Telecom G8265 Profile Pktmaster State */
    813 typedef enum bcm_ptp_telecom_g8265_pktmaster_state_e {
    814     bcm_ptp_telecom_g8265_pktmaster_state_unused = 0, 
    815     bcm_ptp_telecom_g8265_pktmaster_state_init = 1, 
    816     bcm_ptp_telecom_g8265_pktmaster_state_valid = 2 
    817 } bcm_ptp_telecom_g8265_pktmaster_state_t;
    818 
    819 /* PTP ITU-T G.781 synchronization network options */
    820 typedef enum bcm_ptp_telecom_g8265_network_option_e {
    821     bcm_ptp_telecom_g8265_network_option_disable = 0, 
    822     bcm_ptp_telecom_g8265_network_option_I = 1, 
    823     bcm_ptp_telecom_g8265_network_option_II = 2, 
    824     bcm_ptp_telecom_g8265_network_option_III = 3 
    825 } bcm_ptp_telecom_g8265_network_option_t;
    826 
    827 /* PTP ITU-T G.781 Quality Levels */
    828 typedef enum bcm_ptp_telecom_g8265_quality_level_e {
    829     bcm_ptp_telecom_g8265_ql_invalid = 0, 
    830     bcm_ptp_telecom_g8265_ql_I_prc = 0x10, /* ITU-T G.781 QL Option I */
    831     bcm_ptp_telecom_g8265_ql_I_ssua = 0x11, /* ITU-T G.781 QL Option I */
    832     bcm_ptp_telecom_g8265_ql_I_ssub = 0x12, /* ITU-T G.781 QL Option I */
    833     bcm_ptp_telecom_g8265_ql_I_sec = 0x13, /* ITU-T G.781 QL Option I */
    834     bcm_ptp_telecom_g8265_ql_I_dnu = 0x14, /* ITU-T G.781 QL Option I */
    835     bcm_ptp_telecom_g8265_ql_II_prs = 0x20, /* ITU-T G.781 QL Option II */
    836     bcm_ptp_telecom_g8265_ql_II_stu = 0x21, /* ITU-T G.781 QL Option II */
    837     bcm_ptp_telecom_g8265_ql_II_st2 = 0x22, /* ITU-T G.781 QL Option II */
    838     bcm_ptp_telecom_g8265_ql_II_tnc = 0x23, /* ITU-T G.781 QL Option II */
    839     bcm_ptp_telecom_g8265_ql_II_st3e = 0x24, /* ITU-T G.781 QL Option II */
    840     bcm_ptp_telecom_g8265_ql_II_st3 = 0x25, /* ITU-T G.781 QL Option II */
    841     bcm_ptp_telecom_g8265_ql_II_smc = 0x26, /* ITU-T G.781 QL Option II */
    842     bcm_ptp_telecom_g8265_ql_II_prov = 0x28, /* ITU-T G.781 QL Option II */
    843     bcm_ptp_telecom_g8265_ql_II_dus = 0x29, /* ITU-T G.781 QL Option II */
    844     bcm_ptp_telecom_g8265_ql_III_unk = 0x30, /* ITU-T G.781 QL Option III */
    845     bcm_ptp_telecom_g8265_ql_III_sec = 0x31, /* ITU-T G.781 QL Option III */
    846     bcm_ptp_telecom_g8265_ql_na_slv = 0xff /* Not Applicable (packet slave) */
    847 } bcm_ptp_telecom_g8265_quality_level_t;
    848 
    849 /* PTP Telecom G8265 Packet Timing Signal Fail Data */
    850 typedef struct bcm_ptp_telecom_g8265_ptsf_s {
    851     uint8 loss_announce;        /* Count of Announce Message Loss */
    852     uint8 loss_sync;            /* Count of Sync Message Loss */
    853     uint8 unusable; 
    854     uint8 loss_timing_sync;     /* Count of Timing Sync Message Loss */
    855     uint8 loss_timing_sync_ts;  /* Count of Sync Message Timestamps Loss */
    856     uint8 loss_timing_delay;    /* Count of Timing Delay Request Message Loss */
    857     uint32 counter; 
    858     uint64 timestamp; 
    859 } bcm_ptp_telecom_g8265_ptsf_t;
    860 
    861 /* PTP Telecom G8265 Message Receipt Timeouts (msec) */
    862 typedef struct bcm_ptp_telecom_g8265_receipt_timeouts_s {
    863     uint32 announce; 
    864     uint32 sync; 
    865     uint32 delay_resp; 
    866 } bcm_ptp_telecom_g8265_receipt_timeouts_t;
    867 
    868 /* PTP Telecom G8265 Message Elapsed Times (msec) */
    869 typedef struct bcm_ptp_telecom_g8265_elapsed_times_s {
    870     uint32 announce; 
    871     uint32 sync; 
    872     uint32 sync_ts; 
    873     uint32 delay_resp; 
    874 } bcm_ptp_telecom_g8265_elapsed_times_t;
    875 
    876 /* PTP Telecom G8265 Packet timing and PDV statistics */
    877 typedef struct bcm_ptp_telecom_g8265_pktstats_s {
    878     uint64 pdv_scaled_allan_var; 
    879 } bcm_ptp_telecom_g8265_pktstats_t;
    880 
    881 /* PTP Telecom G8265 Priority */
    882 typedef struct bcm_ptp_telecom_g8265_priority_s {
    883     uint8 override; 
    884     uint16 value; 
    885 } bcm_ptp_telecom_g8265_priority_t;
    886 
    887 /* PTP Query Window Statistics */
    888 typedef struct bcm_ptp_window_stats_s {
    889     uint8 min; 
    890     uint16 max; 
    891     uint16 fall_events; 
    892     uint16 rise_events; 
    893 } bcm_ptp_window_stats_t;
    894 
    895 /* PTP Telecom G8265 Pckmaster Historical Information and QL Degradation */
    896 typedef struct bcm_ptp_telecom_g8265_hql_s {
    897     bcm_ptp_window_stats_t clock_class_window; 
    898     uint8 degrade_ql; 
    899     uint32 counter; 
    900     uint64 timestamp; 
    901 } bcm_ptp_telecom_g8265_hql_t;
    902 
    903 /* PTP Telecom G8265 Profile Packet Master Selector Data */
    904 typedef struct bcm_ptp_telecom_g8265_selector_s {
    905     uint8 lockout; 
    906     uint8 non_reversion; 
    907     uint8 wait_to_restore; 
    908     uint64 wait_sec; 
    909 } bcm_ptp_telecom_g8265_selector_t;
    910 
    911 /* PTP Telecom G8265 Profile PacketMaster Data */
    912 typedef struct bcm_ptp_telecom_g8265_pktmaster_s {
    913     bcm_ptp_port_identity_t port_identity; /* Port Identity */
    914     bcm_ptp_clock_port_address_t port_address; /* Clock Port address */
    915     uint8 clock_class;                  /* Clock Class */
    916     bcm_ptp_telecom_g8265_quality_level_t quality_level; /* Quality Level */
    917     uint8 grandmaster_priority1;        /* Grandmaster Priority1 */
    918     uint8 grandmaster_priority2;        /* Grandmaster Priority2 */
    919     bcm_ptp_telecom_g8265_priority_t priority; /* G8265 Priority */
    920     bcm_ptp_telecom_g8265_selector_t selector; /* G8265 Selector */
    921     bcm_ptp_telecom_g8265_ptsf_t ptsf;  /* G8265 Ptsf */
    922     bcm_ptp_telecom_g8265_elapsed_times_t elapsed_times; /* G8265 Elapsed Times */
    923     bcm_ptp_telecom_g8265_pktstats_t pktstats; /* G8265 Packet Stats */
    924     bcm_ptp_telecom_g8265_hql_t hql;    /* G8265 HQL */
    925     bcm_ptp_telecom_g8265_pktmaster_state_t state; /* G8265 Pktmaster State */
    926     uint32 fmds_counter;                /* G8265 FMDS counter */
    927 } bcm_ptp_telecom_g8265_pktmaster_t;
    928 
    929 /* PTP Telecom G8265 Profile Data */
    930 typedef struct bcm_ptp_telecom_g8265_profile_s {
    931     bcm_ptp_telecom_g8265_network_option_t network_option; /* G8265 Packet Network Option */
    932     bcm_ptp_telecom_g8265_receipt_timeouts_t receipt_timeouts; /* G8265 Packet Receipt Timeouts */
    933     bcm_ptp_telecom_g8265_pktstats_t thresholds; /* G8265 Packet Stats Thresholds */
    934     int previous_gm;                    /* Previous Grandmaster */
    935     int selected_gm;                    /* Selected Grandmaster */
    936     bcm_ptp_telecom_g8265_pktmaster_t gm[BCM_PTP_TELECOM_MAX_NUMBER_PKTMASTERS]; /* Grandmaster */
    937 } bcm_ptp_telecom_g8265_profile_t;
    938 
    939 /* PTP foreign master data and metadata. */
    940 typedef struct bcm_ptp_foreign_master_entry_s {
    941     bcm_ptp_port_identity_t port_identity; /* Clock port identity. */
    942     bcm_ptp_clock_port_address_t address; /* Clock port address. */
    943     uint8 clockClass;                   /* PTP clockClass. */
    944     uint8 grandmasterPriority1;         /* GM PTP priority1. */
    945     uint8 grandmasterPriority2;         /* GM PTP priority2. */
    946     bcm_ptp_window_stats_t clockClass_window; /* PTP clockClass query-window
    947                                            statistics. */
    948     uint32 ms_since_sync;               /* Milliseconds since last Sync message. */
    949     uint32 ms_since_sync_ts;            /* Milliseconds since last Sync
    950                                            timestamp message (Sync or
    951                                            Follow_Up). */
    952     uint32 ms_since_del_resp;           /* Milliseconds since last Delay_Resp
    953                                            message. */
    954     uint16 announce_messages;           /* Number of announce messages. */
    955     uint64 pdv_scaled_allan_var;        /* MTSD scaled Allan variance (nsec-sq). */
    956     uint16 offset_scaled_log_variance;  /* log variance field of announce msg. */
    957     bcm_ptp_clock_accuracy_t clock_accuracy; /* Clock Accuracy */
    958     uint16 steps_removed;               /* steps removed field of announce msg. */
    959     bcm_ptp_clock_identity_t grandmaster_identity; /* Grandmaster Id field of announce msg. */
    960     bcm_gport_t phy_port;               /* module num and phy port of card on
    961                                            which foreign master is seen */
    962 } bcm_ptp_foreign_master_entry_t;
    963 
    964 /* PTP foreign master dataset. */
    965 typedef struct bcm_ptp_foreign_master_dataset_s {
    966     uint8 num_foreign_masters;          /* Number of foreign masters. */
    967     uint8 current_best_master;          /* Best foreign master index. */
    968     bcm_ptp_foreign_master_entry_t foreign_master[10]; /* Foreign masters. */
    969 } bcm_ptp_foreign_master_dataset_t;
    970 
    971 /* Peer dataset entry. */
    972 typedef struct bcm_ptp_peer_entry_s {
    973     uint16 local_port_number;           /* Local port number. */
    974     bcm_ptp_clock_identity_t clock_identity; /* Peer clock identity. */
    975     bcm_ptp_clock_port_address_t port_address; /* Peer port address. */
    976     uint64 tx_announces;                /* Tx Announce messages. */
    977     uint64 rx_announces;                /* Rx Announce messages. */
    978     uint64 tx_syncs;                    /* Tx Sync messages. */
    979     uint64 rx_syncs;                    /* Rx Sync messages. */
    980     uint64 tx_followups;                /* Tx Follow_Up messages. */
    981     uint64 rx_followups;                /* Rx Follow_Up messages. */
    982     uint64 tx_delayreqs;                /* Tx Delay_Req messages. */
    983     uint64 rx_delayreqs;                /* Rx Delay_Req messages. */
    984     uint64 tx_delayresps;               /* Tx Delay_Resp messages. */
    985     uint64 rx_delayresps;               /* Rx Delay_Resp messages. */
    986     uint64 tx_mgmts;                    /* Tx Management messages. */
    987     uint64 rx_mgmts;                    /* Rx Management messages. */
    988     uint64 tx_signals;                  /* Tx Signaling messages. */
    989     uint64 rx_signals;                  /* Rx Signaling messages. */
    990     uint64 rejected;                    /* Rejected messages. */
    991     bcm_gport_t phy_port;               /* module num and phy port of card on
    992                                            which peer is seen */
    993 } bcm_ptp_peer_entry_t;
    994 
    995 /* Packet count statistics. */
    996 typedef struct bcm_ptp_packet_counters_s {
    997     uint32 packets_transmitted;         /* Packets transmitted. */
    998     uint32 packets_received;            /* Packets received. */
    999     uint32 packets_discarded;           /* Packets discarded. */
   1000     uint32 rcpu_encap_packets_received; /* RCPU-encapsulated packets received. */
   1001     uint32 ipv4_packets_received;       /* IPv4 packets received. */
   1002     uint32 ipv6_packets_received;       /* IPv6 packets received. */
   1003     uint32 l2_ptp_packets_received;     /* L2 PTP packets received. */
   1004     uint32 udp_ptp_packets_received;    /* UDP PTP packets received. */
   1005     uint32 enduro_sync_packets_transmitted; /* Enduro sync packets transmitted. */
   1006     uint32 enduro_sync_packets_received; /* Enduro sync packets received. */
   1007     uint32 rx_queue_overflows;          /* Rx queue overflows. */
   1008     uint32 port_packets_transmitted[32]; /* Per-port packets transmitted. */
   1009     uint32 port_packets_received[32];   /* Per-port packets received. */
   1010     uint32 port_packets_discarded[32];  /* Per-port packets discarded. */
   1011 } bcm_ptp_packet_counters_t;
   1012 
   1013 /* Phase Offsets for Path Asymmetry. */
   1014 typedef struct bcm_ptp_phase_offset_s {
   1015     int64 reported_phase_offset;    /* Report Phase Offset. */
   1016     int64 delta_phase_offset;       /* Delta Phase Offset. */
   1017     int64 fixed_phase_offset;       /* Fixed Phase Offset. */
   1018     int use_fixed_phase_offset;     /* Flag to use fixed phase offset. */
   1019     int phase_slew_rate_ppb;        /* Max slew rate phase offset is changed. */
   1020     uint32 sync_phase_offset_ns;    /* Max offset to adjust by slew. */
   1021     int64 gps_to_ptp_offset_auto;   /* Switching offset computed by FW. */
   1022     int64 gps_to_ptp_offset_manual; /* Switching offset provided by user. */
   1023     int enable_gps_to_ptp_auto;     /* Enable usage of auto offset. */
   1024 } bcm_ptp_phase_offset_t;
   1025 
   1026 /* PTP callback result/decision. */
   1027 typedef enum bcm_ptp_callback_e {
   1028     bcmPTPCallbackReject,   /* Callback rejects action. */
   1029     bcmPTPCallbackAccept    /* Callback accepts action. */
   1030 } bcm_ptp_callback_t;
   1031 
   1032 /* Signaling arbiter message data. */
   1033 typedef struct bcm_ptp_cb_signaling_arbiter_msg_s {
   1034     int flags;                          /* Flags. */
   1035     bcm_ptp_stack_id_t ptp_id;          /* PTP stack ID. */
   1036     int clock_num;                      /* PTP clock number. */
   1037     int port_num;                       /* PTP clock port number. */
   1038     bcm_ptp_cb_msg_t *msg;              /* Message data and dimensions. */
   1039     bcm_ptp_clock_info_t *clock_info;   /* PTP clock instance information. */
   1040     bcm_ptp_tlv_type_t *tlv_type;       /* Signaling message TLV type. */
   1041     bcm_ptp_message_type_t *messageType; /* PTP message type. */
   1042     int *logInterMessagePeriod;         /* PTP message logInterMessagePeriod. */
   1043     uint32 *durationField;              /* PTP message service duration. */
   1044     bcm_ptp_clock_peer_t *slave;        /* PTP slave. */
   1045 } bcm_ptp_cb_signaling_arbiter_msg_t;
   1046 
   1047 /* Signaling arbiter callback function. */
   1048 typedef bcm_ptp_callback_t (*bcm_ptp_signaling_arbiter_t)(
   1049     int unit, 
   1050     bcm_ptp_cb_signaling_arbiter_msg_t *amsg, 
   1051     void *user_data);
   1052 
   1053 /* C-TDEV alarm callback data. */
   1054 typedef struct bcm_ptp_ctdev_alarm_data_s {
   1055     uint64 freq_corr_ppt;               /* Frequency correction (ppt). */
   1056     int num_tau;                        /* Number of timescales over which
   1057                                            C-TDEV is calculated. */
   1058     int tau_sec[BCM_PTP_CTDEV_NUM_TIMESCALES_MAX]; /* Timescales, tau. */
   1059     uint64 tdev_psec[BCM_PTP_CTDEV_NUM_TIMESCALES_MAX]; /* C-TDEV(tau). */
   1060     uint32 elapsed_sec;                 /* Elapsed data time for C-TDEV
   1061                                            calculations. */
   1062 } bcm_ptp_ctdev_alarm_data_t;
   1063 
   1064 /* C-TDEV alarm callback function. */
   1065 typedef int (*bcm_ptp_ctdev_alarm_cb)(
   1066     int unit, 
   1067     bcm_ptp_stack_id_t ptp_id, 
   1068     int clock_num, 
   1069     bcm_ptp_ctdev_alarm_data_t *ctdev_alarm_data);
   1070 
   1071 /* PTP servo oscillator data types */
   1072 typedef enum bcm_ptp_osc_type_e {
   1073     bcmPTPOscTypeRB,        /* Rubidium Oscillator */
   1074     bcmPTPOscTypeDOCXO,     /* Double oven OCXO */
   1075     bcmPTPOscTypeOCXO,      /* OCXO */
   1076     bcmPTPOscTypeMiniOCXO,  /* Mini OCXO */
   1077     bcmPTPOscTypeTCXO       /* TOCXO */
   1078 } bcm_ptp_osc_type_t;
   1079 
   1080 /* PTP servo transport mode types */
   1081 typedef enum bcm_ptp_transport_mode_e {
   1082     bcmPTPTransportModeEthernet,        /* PTP Ethernet mode */
   1083     bcmPTPTransportModeDSL,             /* PTP DSL mode */
   1084     bcmPTPTransportModeMicrowave,       /* PTP microwave mode */
   1085     bcmPTPTransportModeSONET,           /* PTP SONET mode */
   1086     bcmPTPTransportModeSlowEthernet,    /* PTP Slow Ethernet mode */
   1087     bcmPTPTransportModeHighJitter       /* PTP High Jitter */
   1088 } bcm_ptp_transport_mode_t;
   1089 
   1090 /* PTP Servo Configuration Data Type */
   1091 typedef struct bcm_ptp_servo_config_s {
   1092     bcm_ptp_osc_type_t osc_type;        /* Local oscillator type */
   1093     bcm_ptp_transport_mode_t transport_mode; /* PTP transport mode */
   1094     uint32 ptp_phase_mode;              /* Bit-mapped phase mode of servo loop */
   1095     int freq_corr_hourly;               /* OCXO frequency offset sampled hourly
   1096                                            - (deprecated) */
   1097     bcm_ptp_timestamp_t time_corr_hourly; /* Timestamp for hourly frequency offset
   1098                                            - (deprecated) */
   1099     int freq_calib_factory;             /* OCXO frequency offset at factory -
   1100                                            (deprecated) */
   1101     bcm_ptp_timestamp_t time_calib_factory; /* Timestamp for factory frequency
   1102                                            offset - (deprecated) */
   1103     uint32 bridge_time;                 /* Bridge time in seconds */
   1104     int freq_corr;                      /* OCXO frequency offset. */
   1105     bcm_ptp_timestamp_t freq_corr_time; /* Timestamp for frequency offset. */
   1106     bcm_ptp_servo_type_t servo;         /* Servo type. */
   1107     uint32 flags;                       /* Servo configuration flags. */
   1108     uint32 filter_profile;              /* Servo filter selection. */
   1109 } bcm_ptp_servo_config_t;
   1110 
   1111 /* PTP Servo Status Information. */
   1112 typedef struct bcm_ptp_servo_status_s {
   1113     bcm_ptp_servo_state_t servo_state;  /* servo state enumeration. */
   1114     uint32 servo_state_dur;             /* servo state duration (sec). */
   1115     bcm_ptp_servo_lock_status_t lock_status; /* Servo Locked Status
   1116                                            (Locked/Unlocked). */
   1117 } bcm_ptp_servo_status_t;
   1118 
   1119 /* ESMC definitions and data types. */
   1120 typedef enum bcm_esmc_network_option_e {
   1121     bcm_esmc_network_option_g781_I = 1, 
   1122     bcm_esmc_network_option_g781_II = 2, 
   1123     bcm_esmc_network_option_g781_III = 3 
   1124 } bcm_esmc_network_option_t;
   1125 
   1126 typedef enum bcm_esmc_quality_level_e {
   1127     bcm_esmc_g781_I_ql_prc = 0x0100, 
   1128     bcm_esmc_g781_I_ql_ssua = 0x0101, 
   1129     bcm_esmc_g781_I_ql_ssub = 0x0102, 
   1130     bcm_esmc_g781_I_ql_sec = 0x0103, 
   1131     bcm_esmc_g781_I_ql_dnu = 0x0104, 
   1132     bcm_esmc_g781_I_ql_inv0 = 0x010f, 
   1133     bcm_esmc_g781_I_ql_inv1 = 0x011f, 
   1134     bcm_esmc_g781_I_ql_inv3 = 0x013f, 
   1135     bcm_esmc_g781_I_ql_inv5 = 0x015f, 
   1136     bcm_esmc_g781_I_ql_inv6 = 0x016f, 
   1137     bcm_esmc_g781_I_ql_inv7 = 0x017f, 
   1138     bcm_esmc_g781_I_ql_inv9 = 0x019f, 
   1139     bcm_esmc_g781_I_ql_inv10 = 0x01af, 
   1140     bcm_esmc_g781_I_ql_inv12 = 0x01cf, 
   1141     bcm_esmc_g781_I_ql_inv13 = 0x01df, 
   1142     bcm_esmc_g781_I_ql_inv14 = 0x01ef, 
   1143     bcm_esmc_g781_I_ql_failed = 0x01ff, 
   1144     bcm_esmc_g781_I_ql_nsupp = 0x01ff, 
   1145     bcm_esmc_g781_I_ql_unc = 0x01ff, 
   1146     bcm_esmc_g781_II_ql_prs = 0x0200, 
   1147     bcm_esmc_g781_II_ql_stu = 0x0201, 
   1148     bcm_esmc_g781_II_ql_st2 = 0x0202, 
   1149     bcm_esmc_g781_II_ql_tnc = 0x0203, 
   1150     bcm_esmc_g781_II_ql_st3e = 0x0204, 
   1151     bcm_esmc_g781_II_ql_st3 = 0x0205, 
   1152     bcm_esmc_g781_II_ql_smc = 0x0206, 
   1153     bcm_esmc_g781_II_ql_prov = 0x0207, 
   1154     bcm_esmc_g781_II_ql_dus = 0x0208, 
   1155     bcm_esmc_g781_II_ql_inv2 = 0x022f, 
   1156     bcm_esmc_g781_II_ql_inv3 = 0x023f, 
   1157     bcm_esmc_g781_II_ql_inv5 = 0x025f, 
   1158     bcm_esmc_g781_II_ql_inv6 = 0x026f, 
   1159     bcm_esmc_g781_II_ql_inv8 = 0x028f, 
   1160     bcm_esmc_g781_II_ql_inv9 = 0x029f, 
   1161     bcm_esmc_g781_II_ql_inv11 = 0x02bf, 
   1162     bcm_esmc_g781_II_ql_failed = 0x02ff, 
   1163     bcm_esmc_g781_II_ql_nsupp = 0x02ff, 
   1164     bcm_esmc_g781_II_ql_unc = 0x02ff, 
   1165     bcm_esmc_g781_III_ql_unk = 0x0300, 
   1166     bcm_esmc_g781_III_ql_sec = 0x0301, 
   1167     bcm_esmc_g781_III_ql_inv1 = 0x031f, 
   1168     bcm_esmc_g781_III_ql_inv2 = 0x032f, 
   1169     bcm_esmc_g781_III_ql_inv3 = 0x033f, 
   1170     bcm_esmc_g781_III_ql_inv4 = 0x034f, 
   1171     bcm_esmc_g781_III_ql_inv5 = 0x035f, 
   1172     bcm_esmc_g781_III_ql_inv6 = 0x036f, 
   1173     bcm_esmc_g781_III_ql_inv7 = 0x037f, 
   1174     bcm_esmc_g781_III_ql_inv8 = 0x038f, 
   1175     bcm_esmc_g781_III_ql_inv9 = 0x039f, 
   1176     bcm_esmc_g781_III_ql_inv10 = 0x03af, 
   1177     bcm_esmc_g781_III_ql_inv12 = 0x03cf, 
   1178     bcm_esmc_g781_III_ql_inv13 = 0x03df, 
   1179     bcm_esmc_g781_III_ql_inv14 = 0x03ef, 
   1180     bcm_esmc_g781_III_ql_inv15 = 0x03ff, 
   1181     bcm_esmc_g781_III_ql_failed = 0x03ff, 
   1182     bcm_esmc_g781_III_ql_nsupp = 0x03ff, 
   1183     bcm_esmc_g781_III_ql_unc = 0x03ff, 
   1184     bcm_esmc_ql_unresolvable = 0xffff 
   1185 } bcm_esmc_quality_level_t;
   1186 
   1187 /* 
   1188  * Extended Synchronous Status Message (SSM) codes for various SyncE
   1189  * clock types as per ITU-T G.8264Amd2
   1190  */
   1191 typedef enum bcm_esmc_essm_code_e {
   1192     bcmEsmcEssmCodeNone = 0x0,      /* default operating mode  - no G.8264Amd2
   1193                                        support */
   1194     bcmEsmcEssmCodeEEC = 0xFF,      /* SyncE clock type - EEC/G.781 */
   1195     bcmEsmcEssmCodePRTC = 0x20,     /* SyncE clock type -  PRTC */
   1196     bcmEsmcEssmCodeEPRTC = 0x21,    /* SyncE clock type -  ePRTC */
   1197     bcmEsmcEssmCodeEEEC = 0x22      /* SyncE clock type -  eEEC */
   1198 } bcm_esmc_essm_code_t;
   1199 
   1200 typedef enum bcm_esmc_pdu_type_e {
   1201     bcm_esmc_pdu_type_info, 
   1202     bcm_esmc_pdu_type_event 
   1203 } bcm_esmc_pdu_type_t;
   1204 
   1205 typedef struct bcm_esmc_pdu_data_s {
   1206     bcm_mac_t source_mac; 
   1207     bcm_esmc_pdu_type_t pdu_type; 
   1208     bcm_esmc_quality_level_t ql; 
   1209     uint8 ssm_code; 
   1210     bcm_esmc_essm_code_t essm_code; /* SyncE clock type as per G.8264amd2 */
   1211     uint8 essm_flag;                /* bit 0 means mixed EEC/eEEC and bit 1 mean
   1212                                        partial chain */
   1213     uint8 essm_eec_count;           /* Number of cascaded EEC as per G.8264amd2 */
   1214     uint8 essm_eeec_count;          /* Number of cascaded eEEC as per G.8264amd2 */
   1215 } bcm_esmc_pdu_data_t;
   1216 
   1217 typedef int (*bcm_esmc_rx_cb)(
   1218     int unit, 
   1219     int stack_id, 
   1220     int ingress_port, 
   1221     bcm_esmc_pdu_data_t *pdu_data);
   1222 
   1223 typedef struct bcm_tdpll_input_clock_ql_change_cb_data_s {
   1224     int input_clk_index; 
   1225     bcm_esmc_quality_level_t prior_ql; 
   1226     bcm_esmc_quality_level_t current_ql; 
   1227 } bcm_tdpll_input_clock_ql_change_cb_data_t;
   1228 
   1229 typedef int (*bcm_tdpll_input_clock_ql_change_cb)(
   1230     int unit, 
   1231     int stack_id, 
   1232     bcm_tdpll_input_clock_ql_change_cb_data_t *cb_data);
   1233 
   1234 /* T-DPLL definitions and data types. */
   1235 #define BCM_TDPLL_INPUT_CLOCK_NUM_GPIO  (6)        
   1236 #define BCM_TDPLL_INPUT_CLOCK_NUM_SYNCE (2)        
   1237 #define BCM_TDPLL_INPUT_CLOCK_NUM_1588  (2)        
   1238 #define BCM_TDPLL_INPUT_CLOCK_NUM_MAX   (BCM_TDPLL_INPUT_CLOCK_NUM_GPIO +  \
   1239                            BCM_TDPLL_INPUT_CLOCK_NUM_SYNCE + \
   1240                            BCM_TDPLL_INPUT_CLOCK_NUM_1588) 
   1241 
   1242 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_BROADSYNC (2)        
   1243 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_SYNCE    (4)        
   1244 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_1588     (1)        
   1245 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_GPIO     (6)        
   1246 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_MAX      (BCM_TDPLL_OUTPUT_CLOCK_NUM_BROADSYNC + \
   1247                            BCM_TDPLL_OUTPUT_CLOCK_NUM_SYNCE + \
   1248                            BCM_TDPLL_OUTPUT_CLOCK_NUM_1588 + \
   1249                            BCM_TDPLL_OUTPUT_CLOCK_NUM_GPIO) 
   1250 
   1251 #define BCM_TDPLL_DPLL_INSTANCE_NUM_MAX (BCM_TDPLL_OUTPUT_CLOCK_NUM_MAX - \
   1252                            BCM_TDPLL_OUTPUT_CLOCK_NUM_GPIO) 
   1253 
   1254 typedef enum bcm_tdpll_dpll_bandwidth_units_e {
   1255     bcm_tdpll_dpll_bandwidth_mHz, 
   1256     bcm_tdpll_dpll_bandwidth_Hz, 
   1257     bcm_tdpll_dpll_bandwidth_kHz 
   1258 } bcm_tdpll_dpll_bandwidth_units_t;
   1259 
   1260 typedef struct bcm_tdpll_dpll_bandwidth_s {
   1261     uint32 value; 
   1262     bcm_tdpll_dpll_bandwidth_units_t units; 
   1263 } bcm_tdpll_dpll_bandwidth_t;
   1264 
   1265 typedef enum bcm_tdpll_dpll_phase_mode_e {
   1266     bcm_tdpll_dpll_phase_mode_none, 
   1267     bcm_tdpll_dpll_phase_mode_pbo, 
   1268     bcm_tdpll_dpll_phase_mode_pboslew 
   1269 } bcm_tdpll_dpll_phase_mode_t;
   1270 
   1271 typedef struct bcm_tdpll_dpll_phase_control_s {
   1272     bcm_tdpll_dpll_phase_mode_t mode; 
   1273     int offset_ns; 
   1274 } bcm_tdpll_dpll_phase_control_t;
   1275 
   1276 typedef struct bcm_tdpll_dpll_properties_s {
   1277     bcm_tdpll_dpll_bandwidth_t bandwidth; 
   1278     bcm_tdpll_dpll_phase_control_t phase_control; 
   1279 } bcm_tdpll_dpll_properties_t;
   1280 
   1281 typedef struct bcm_tdpll_dpll_bindings_s {
   1282     SHR_BITDCL input_clocks[_SHR_BITDCLSIZE(BCM_TDPLL_INPUT_CLOCK_NUM_MAX)]; 
   1283     SHR_BITDCL output_clocks[_SHR_BITDCLSIZE(BCM_TDPLL_OUTPUT_CLOCK_NUM_MAX)]; 
   1284 } bcm_tdpll_dpll_bindings_t;
   1285 
   1286 typedef struct bcm_tdpll_dpll_instance_s {
   1287     int index; 
   1288     bcm_tdpll_dpll_bindings_t bindings; 
   1289     bcm_tdpll_dpll_properties_t properties; 
   1290     int reference; 
   1291 } bcm_tdpll_dpll_instance_t;
   1292 
   1293 typedef struct bcm_tdpll_input_clock_l1mux_s {
   1294     int index; 
   1295     int port; 
   1296 } bcm_tdpll_input_clock_l1mux_t;
   1297 
   1298 typedef struct bcm_tdpll_input_clock_frequency_s {
   1299     uint32 clock; 
   1300     uint32 tsevent; 
   1301     int tsevent_quotient; 
   1302 } bcm_tdpll_input_clock_frequency_t;
   1303 
   1304 typedef enum bcm_tdpll_input_clock_monitor_type_e {
   1305     bcm_tdpll_input_clock_monitor_type_soft_warn, 
   1306     bcm_tdpll_input_clock_monitor_type_hard_accept, 
   1307     bcm_tdpll_input_clock_monitor_type_hard_reject 
   1308 } bcm_tdpll_input_clock_monitor_type_t;
   1309 
   1310 typedef enum bcm_tdpll_notification_type_e {
   1311     bcmTdpllNotificationTypeRefchange 
   1312 } bcm_tdpll_notification_type_t;
   1313 
   1314 typedef enum bcm_tdpll_callback_type_e {
   1315     bcmTdpllCallbackTypeMonitor, 
   1316     bcmTdpllCallbackTypeSelector, 
   1317     bcmTdpllCallbackTypeNotification 
   1318 } bcm_tdpll_callback_type_t;
   1319 
   1320 typedef struct bcm_tdpll_input_clock_monitor_s {
   1321     uint64 tsevent_dt; 
   1322     uint64 tsevent_time; 
   1323     uint64 tsevent_num; 
   1324     uint64 dt_ns; 
   1325     uint64 dtref_ns; 
   1326     uint64 dt_sum_ns; 
   1327     uint64 dtref_sum_ns; 
   1328     uint64 prior_evnum; 
   1329     uint32 numev_sum; 
   1330     int freq_error_ppb; 
   1331     int over_soft_warn_threshold; 
   1332     int under_hard_accept_threshold; 
   1333     int over_hard_reject_threshold; 
   1334     uint32 num_missing_tsevent; 
   1335 } bcm_tdpll_input_clock_monitor_t;
   1336 
   1337 typedef struct bcm_tdpll_input_clock_select_s {
   1338     bcm_esmc_quality_level_t ql; 
   1339     int priority; 
   1340     int lockout; 
   1341 } bcm_tdpll_input_clock_select_t;
   1342 
   1343 typedef struct bcm_tdpll_input_clock_s {
   1344     int index; 
   1345     bcm_tdpll_input_clock_l1mux_t l1mux; 
   1346     bcm_mac_t mac; 
   1347     uint32 state; 
   1348     bcm_tdpll_input_clock_frequency_t frequency; 
   1349     bcm_tdpll_input_clock_monitor_t monitor; 
   1350     bcm_tdpll_input_clock_select_t select; 
   1351     int dpll_use[BCM_TDPLL_DPLL_INSTANCE_NUM_MAX]; 
   1352 } bcm_tdpll_input_clock_t;
   1353 
   1354 typedef struct bcm_tdpll_input_clock_monitor_cb_data_s {
   1355     int index; 
   1356     bcm_tdpll_input_clock_monitor_type_t monitor_type; 
   1357     int monitor_value; 
   1358 } bcm_tdpll_input_clock_monitor_cb_data_t;
   1359 
   1360 typedef int (*bcm_tdpll_input_clock_monitor_cb)(
   1361     int unit, 
   1362     int stack_id, 
   1363     bcm_tdpll_input_clock_monitor_cb_data_t *cb_data);
   1364 
   1365 typedef struct bcm_tdpll_input_clock_selector_cb_data_s {
   1366     int dpll_index; 
   1367     int prior_selected_clock; 
   1368     int selected_clock; 
   1369 } bcm_tdpll_input_clock_selector_cb_data_t;
   1370 
   1371 typedef int (*bcm_tdpll_input_clock_selector_cb)(
   1372     int unit, 
   1373     int stack_id, 
   1374     bcm_tdpll_input_clock_selector_cb_data_t *cb_data);
   1375 
   1376 typedef struct bcm_tdpll_input_clock_ref_change_cb_data_s {
   1377     bcm_tdpll_notification_type_t noti_type; 
   1378     int dpll_index; 
   1379     int prior_selected_clock; 
   1380     int selected_clock; 
   1381 } bcm_tdpll_input_clock_ref_change_cb_data_t;
   1382 
   1383 typedef struct bcm_tdpll_input_clock_cb_data_s {
   1384     bcm_tdpll_callback_type_t callback_type; 
   1385     void *cb_info; 
   1386 } bcm_tdpll_input_clock_cb_data_t;
   1387 
   1388 typedef int (*bcm_tdpll_input_clock_cb)(
   1389     int unit, 
   1390     int stack_id, 
   1391     bcm_tdpll_input_clock_cb_data_t *cb_data);
   1392 
   1393 typedef struct bcm_tdpll_output_clock_frequency_s {
   1394     uint32 synth; 
   1395     uint32 tsevent; 
   1396     int tsevent_quotient; 
   1397     uint32 deriv; 
   1398     int deriv_quotient; 
   1399 } bcm_tdpll_output_clock_frequency_t;
   1400 
   1401 typedef struct bcm_tdpll_output_clock_s {
   1402     int index; 
   1403     uint32 state; 
   1404     bcm_tdpll_output_clock_frequency_t frequency; 
   1405 } bcm_tdpll_output_clock_t;
   1406 
   1407 typedef enum bcm_tdpll_holdover_mode_e {
   1408     bcm_tdpll_holdover_mode_instantaneous, 
   1409     bcm_tdpll_holdover_mode_avg1s, 
   1410     bcm_tdpll_holdover_mode_manual, 
   1411     bcm_tdpll_holdover_mode_fast_average, 
   1412     bcm_tdpll_holdover_mode_slow_average 
   1413 } bcm_tdpll_holdover_mode_t;
   1414 
   1415 /* Frequency correction */
   1416 typedef int32 bcm_tdpll_frequency_correction_t;
   1417 
   1418 typedef struct bcm_tdpll_holdover_data_s {
   1419     bcm_tdpll_frequency_correction_t freq_instantaneous; 
   1420     bcm_tdpll_frequency_correction_t freq_avg1s; 
   1421     bcm_tdpll_frequency_correction_t freq_manual; 
   1422     bcm_tdpll_frequency_correction_t freq_fast_average; 
   1423     bcm_tdpll_frequency_correction_t freq_slow_average; 
   1424     int freq_fast_average_valid; 
   1425     int freq_slow_average_valid; 
   1426     bcm_tdpll_holdover_mode_t mode; 
   1427 } bcm_tdpll_holdover_data_t;
   1428 
   1429 typedef struct bcm_ptp_servo_threshold_s {
   1430     int32 bcmPtpServoThresholdFreqLock; 
   1431     int32 bcmPtpServoThresholdFreqUnlock; 
   1432     int32 bcmPtpServoThresholdPhaseLock; 
   1433     int32 bcmPtpServoThresholdPhaseUnlock; 
   1434 } bcm_ptp_servo_threshold_t;
   1435 
   1436 /* Clock Port Drop Packet count statistics. */
   1437 typedef struct bcm_ptp_clock_port_packet_drop_counters_s {
   1438     uint32 domain_mismatch;             /* default DS domain number mismatch. */
   1439     uint32 memory_alloc_failure;        /* memory allocation failed. */
   1440     uint32 pkt_len_too_short;           /* Invalid packet length. */
   1441     uint32 pkt_rcvd_on_bad_port_state;  /* PTP packet received on bad port state */
   1442     uint32 ptp_profile_mismatch;        /* PTP profile does not match. */
   1443     uint32 clock_port_mismatch;         /* No match to clock port */
   1444     uint32 ptp_packet_parsing_failure;  /* Assigned to clock port, but failed
   1445                                            PTP parsing. */
   1446     uint32 unicast_delreq_from_unknown_slave; /* Unicast Delay Request from unknown
   1447                                            slave. */
   1448     uint32 announce_rcvd_on_master_only_port; /* Announce message received on master
   1449                                            only port. */
   1450     uint32 announce_rcvd_with_invalid_steps_removed_field; /* Announce message with invalid steps
   1451                                            removed field. */
   1452     uint32 announce_from_unknown_unicast_master; /* Announce message received from a
   1453                                            master not present in unicast master
   1454                                            table. */
   1455     uint32 announce_rcvd_on_gps_timesource_ptp_port; /* Announce message received on a ptp
   1456                                            port having timesource as GPS. */
   1457     uint32 sync_rcvd_invalid;           /* Invalid sync packet (e.g duplicate
   1458                                            sync packet). */
   1459     uint32 sync_rcvd_on_ptp_port_without_master; /* sync packet received on port on which
   1460                                            master is not present. */
   1461 } bcm_ptp_clock_port_packet_drop_counters_t;
   1462 
   1463 #define BCM_PTP_TELECOM_G8265_MAP_QUALITY_LEVEL_CLOCK_CLASS(ql, clock_class)  \
   1464     do {                                                                         \
   1465         switch (ql) {                                                            \
   1466         case bcm_ptp_telecom_g8265_ql_II_prs:                                    \
   1467             clock_class = 80;                                                    \
   1468             break;                                                               \
   1469         case bcm_ptp_telecom_g8265_ql_II_stu:                                    \
   1470             /* Fall through. */                                                  \
   1471         case bcm_ptp_telecom_g8265_ql_III_unk:                                   \
   1472             clock_class = 82;                                                    \
   1473             break;                                                               \
   1474         case bcm_ptp_telecom_g8265_ql_I_prc:                                     \
   1475             clock_class = 84;                                                    \
   1476             break;                                                               \
   1477         case bcm_ptp_telecom_g8265_ql_II_st2:                                    \
   1478             clock_class = 86;                                                    \
   1479             break;                                                               \
   1480         case bcm_ptp_telecom_g8265_ql_I_ssua:                                    \
   1481             /* Fall through. */                                                  \
   1482         case bcm_ptp_telecom_g8265_ql_II_tnc:                                    \
   1483             clock_class = 90;                                                    \
   1484             break;                                                               \
   1485         case bcm_ptp_telecom_g8265_ql_I_ssub:                                    \
   1486             clock_class = 96;                                                    \
   1487             break;                                                               \
   1488         case bcm_ptp_telecom_g8265_ql_II_st3e:                                   \
   1489             clock_class = 100;                                                   \
   1490             break;                                                               \
   1491         case bcm_ptp_telecom_g8265_ql_II_st3:                                    \
   1492             clock_class = 102;                                                   \
   1493             break;                                                               \
   1494         case bcm_ptp_telecom_g8265_ql_I_sec:                                     \
   1495             /* Fall through. */                                                  \
   1496         case bcm_ptp_telecom_g8265_ql_III_sec:                                   \
   1497             clock_class = 104;                                                   \
   1498             break;                                                               \
   1499         case bcm_ptp_telecom_g8265_ql_II_smc:                                    \
   1500             clock_class = 106;                                                   \
   1501             break;                                                               \
   1502         case bcm_ptp_telecom_g8265_ql_II_prov:                                   \
   1503             clock_class = 108;                                                   \
   1504             break;                                                               \
   1505         case bcm_ptp_telecom_g8265_ql_I_dnu:                                     \
   1506             /* Fall through. */                                                  \
   1507         case bcm_ptp_telecom_g8265_ql_II_dus:                                    \
   1508             clock_class = 110;                                                   \
   1509             break;                                                               \
   1510         case bcm_ptp_telecom_g8265_ql_na_slv:                                    \
   1511             /* Not applicable (packet slave). */                                 \
   1512             clock_class = 255;                                                   \
   1513             break;                                                               \
   1514         default:                                                                 \
   1515             /*                                                                   \
   1516              * Mapping unsuccessful.                                             \
   1517              * Maximum alternate PTP profile clockClass value                    \
   1518              * in the range [68,122] used by telecom profile.                    \
   1519              * Ref. IEEE Std. 1588-2008, Clause 7.6.2.4.                         \
   1520              */                                                                  \
   1521             clock_class = 122;                                                   \
   1522         }                                                                        \
   1523     } while (0)                                                                          
   1524 
   1525 #ifndef BCM_HIDE_DISPATCHABLE
   1526 
   1527 /* Initializes the PTP subsystem */
   1528 extern int bcm_ptp_init(
   1529     int unit);
   1530 
   1531 /* Shut down the PTP subsystem */
   1532 extern int bcm_ptp_detach(
   1533     int unit);
   1534 
   1535 /* Create a PTP stack instance */
   1536 extern int bcm_ptp_stack_create(
   1537     int unit, 
   1538     bcm_ptp_stack_info_t *ptp_info);
   1539 
   1540 /* Destroys a PTP stack instance */
   1541 extern int bcm_ptp_stack_destroy(
   1542     int unit, 
   1543     bcm_ptp_stack_id_t ptp_id);
   1544 
   1545 /* Gets information associated with a PTP stack instance */
   1546 extern int bcm_ptp_stack_get(
   1547     int unit, 
   1548     bcm_ptp_stack_id_t ptp_id, 
   1549     bcm_ptp_stack_info_t *ptp_info);
   1550 
   1551 /* 
   1552  * Gets information associated with all PTP stack instances, and their
   1553  * number
   1554  */
   1555 extern int bcm_ptp_stack_get_all(
   1556     int unit, 
   1557     int max_size, 
   1558     bcm_ptp_stack_info_t *ptp_info, 
   1559     int *no_of_stacks);
   1560 
   1561 /* Set Time Of Day format for PTP stack instance. */
   1562 extern int bcm_ptp_time_format_set(
   1563     int unit, 
   1564     bcm_ptp_stack_id_t ptp_id, 
   1565     bcm_ptp_time_type_t type);
   1566 
   1567 #endif /* BCM_HIDE_DISPATCHABLE */
   1568 
   1569 /* Callback function type for PTP */
   1570 typedef int (*bcm_ptp_cb)(
   1571     int unit, 
   1572     bcm_ptp_stack_id_t ptp_id, 
   1573     int clock_num, 
   1574     uint32 clock_port, 
   1575     bcm_ptp_cb_type_t type, 
   1576     bcm_ptp_cb_msg_t *msg, 
   1577     void *user_data);
   1578 
   1579 #ifndef BCM_HIDE_DISPATCHABLE
   1580 
   1581 /* Register a callback for handling PTP events and messages */
   1582 extern int bcm_ptp_cb_register(
   1583     int unit, 
   1584     bcm_ptp_cb_types_t cb_types, 
   1585     bcm_ptp_cb cb, 
   1586     void *user_data);
   1587 
   1588 /* Unregister a callback */
   1589 extern int bcm_ptp_cb_unregister(
   1590     int unit, 
   1591     bcm_ptp_cb_types_t cb_types, 
   1592     bcm_ptp_cb cb);
   1593 
   1594 /* Register an arbiter for handling PTP signaling logic */
   1595 extern int bcm_ptp_signaling_arbiter_register(
   1596     int unit, 
   1597     bcm_ptp_stack_id_t ptp_id, 
   1598     int clock_num, 
   1599     bcm_ptp_signaling_arbiter_t arb, 
   1600     void *user_data);
   1601 
   1602 /* Unregister an arbiter for handling PTP signaling logic */
   1603 extern int bcm_ptp_signaling_arbiter_unregister(
   1604     int unit, 
   1605     bcm_ptp_stack_id_t ptp_id, 
   1606     int clock_num);
   1607 
   1608 /* Create PTP Clock instance. */
   1609 extern int bcm_ptp_clock_create(
   1610     int unit, 
   1611     bcm_ptp_stack_id_t ptp_id, 
   1612     bcm_ptp_clock_info_t *clock_info);
   1613 
   1614 /* Get PTP Clock instance information. */
   1615 extern int bcm_ptp_clock_get(
   1616     int unit, 
   1617     bcm_ptp_stack_id_t ptp_id, 
   1618     int clock_num, 
   1619     bcm_ptp_clock_info_t *clock_info);
   1620 
   1621 /* Set PTP Clock instance user description. */
   1622 extern int bcm_ptp_clock_user_description_set(
   1623     int unit, 
   1624     bcm_ptp_stack_id_t ptp_id, 
   1625     int clock_num, 
   1626     uint8 *desc);
   1627 
   1628 /* Get PTP Clock instance default dataset. */
   1629 extern int bcm_ptp_clock_default_dataset_get(
   1630     int unit, 
   1631     bcm_ptp_stack_id_t ptp_id, 
   1632     int clock_num, 
   1633     bcm_ptp_default_dataset_t *dataset);
   1634 
   1635 /* Get PTP Clock instance current dataset. */
   1636 extern int bcm_ptp_clock_current_dataset_get(
   1637     int unit, 
   1638     bcm_ptp_stack_id_t ptp_id, 
   1639     int clock_num, 
   1640     bcm_ptp_current_dataset_t *dataset);
   1641 
   1642 /* Get PTP Clock instance parent dataset. */
   1643 extern int bcm_ptp_clock_parent_dataset_get(
   1644     int unit, 
   1645     bcm_ptp_stack_id_t ptp_id, 
   1646     int clock_num, 
   1647     bcm_ptp_parent_dataset_t *dataset);
   1648 
   1649 /* Get PTP Clock instance time properties. */
   1650 extern int bcm_ptp_clock_time_properties_get(
   1651     int unit, 
   1652     bcm_ptp_stack_id_t ptp_id, 
   1653     int clock_num, 
   1654     bcm_ptp_time_properties_t *data);
   1655 
   1656 /* Get foreign master dataset. */
   1657 extern int bcm_ptp_foreign_master_dataset_get(
   1658     int unit, 
   1659     bcm_ptp_stack_id_t ptp_id, 
   1660     int clock_num, 
   1661     int port_num, 
   1662     bcm_ptp_foreign_master_dataset_t *data_set);
   1663 
   1664 /* Get PTP Clock priority 1. */
   1665 extern int bcm_ptp_clock_priority1_get(
   1666     int unit, 
   1667     bcm_ptp_stack_id_t ptp_id, 
   1668     int clock_num, 
   1669     uint32 *priority1);
   1670 
   1671 /* Set PTP Clock priority 1. */
   1672 extern int bcm_ptp_clock_priority1_set(
   1673     int unit, 
   1674     bcm_ptp_stack_id_t ptp_id, 
   1675     int clock_num, 
   1676     uint32 priority1);
   1677 
   1678 /* Get PTP Clock priority 2. */
   1679 extern int bcm_ptp_clock_priority2_get(
   1680     int unit, 
   1681     bcm_ptp_stack_id_t ptp_id, 
   1682     int clock_num, 
   1683     uint32 *priority2);
   1684 
   1685 /* Set PTP Clock priority 2. */
   1686 extern int bcm_ptp_clock_priority2_set(
   1687     int unit, 
   1688     bcm_ptp_stack_id_t ptp_id, 
   1689     int clock_num, 
   1690     uint32 priority2);
   1691 
   1692 /* Get PTP Clock local priority . */
   1693 extern int bcm_ptp_clock_local_priority_get(
   1694     int unit, 
   1695     bcm_ptp_stack_id_t ptp_id, 
   1696     int clock_num, 
   1697     uint8 *local_priority);
   1698 
   1699 /* Set PTP Clock local priority . */
   1700 extern int bcm_ptp_clock_local_priority_set(
   1701     int unit, 
   1702     bcm_ptp_stack_id_t ptp_id, 
   1703     int clock_num, 
   1704     uint8 local_priority);
   1705 
   1706 /* Get PTP Clock's maxStepsRemoved. */
   1707 extern int bcm_ptp_clock_max_steps_removed_get(
   1708     int unit, 
   1709     bcm_ptp_stack_id_t ptp_id, 
   1710     int clock_num, 
   1711     uint8 *max_steps_removed);
   1712 
   1713 /* Set PTP Clock's maxStepsRemoved. */
   1714 extern int bcm_ptp_clock_max_steps_removed_set(
   1715     int unit, 
   1716     bcm_ptp_stack_id_t ptp_id, 
   1717     int clock_num, 
   1718     uint8 max_steps_removed);
   1719 
   1720 /* Get PTP Clock domain. */
   1721 extern int bcm_ptp_clock_domain_get(
   1722     int unit, 
   1723     bcm_ptp_stack_id_t ptp_id, 
   1724     int clock_num, 
   1725     uint32 *domain);
   1726 
   1727 /* Set PTP Clock domain. */
   1728 extern int bcm_ptp_clock_domain_set(
   1729     int unit, 
   1730     bcm_ptp_stack_id_t ptp_id, 
   1731     int clock_num, 
   1732     uint32 domain);
   1733 
   1734 /* Get PTP Clock slave_only. */
   1735 extern int bcm_ptp_clock_slaveonly_get(
   1736     int unit, 
   1737     bcm_ptp_stack_id_t ptp_id, 
   1738     int clock_num, 
   1739     uint32 *slaveonly);
   1740 
   1741 /* Set PTP Clock slave_only. */
   1742 extern int bcm_ptp_clock_slaveonly_set(
   1743     int unit, 
   1744     bcm_ptp_stack_id_t ptp_id, 
   1745     int clock_num, 
   1746     uint32 slaveonly);
   1747 
   1748 /* Get PTP Clock Accuracy info. */
   1749 extern int bcm_ptp_clock_accuracy_get(
   1750     int unit, 
   1751     bcm_ptp_stack_id_t ptp_id, 
   1752     int clock_num, 
   1753     bcm_ptp_clock_accuracy_t *accuracy);
   1754 
   1755 /* Set PTP Clock Accuracy info. */
   1756 extern int bcm_ptp_clock_accuracy_set(
   1757     int unit, 
   1758     bcm_ptp_stack_id_t ptp_id, 
   1759     int clock_num, 
   1760     bcm_ptp_clock_accuracy_t *accuracy);
   1761 
   1762 /* Get PTP Clock quality info. */
   1763 extern int bcm_ptp_clock_quality_get(
   1764     int unit, 
   1765     bcm_ptp_stack_id_t ptp_id, 
   1766     int clock_num, 
   1767     bcm_ptp_clock_quality_t *clock_quality, 
   1768     uint32 flags);
   1769 
   1770 /* Set PTP Clock Quality info. */
   1771 extern int bcm_ptp_clock_quality_set(
   1772     int unit, 
   1773     bcm_ptp_stack_id_t ptp_id, 
   1774     int clock_num, 
   1775     bcm_ptp_clock_quality_t clock_quality, 
   1776     uint32 flags);
   1777 
   1778 /* 
   1779  * Gets applicable clock class value for given clock traceability
   1780  * information.
   1781  */
   1782 extern int bcm_ptp_g8275p1_traceability_info_clock_class_map(
   1783     int unit, 
   1784     bcm_ptp_stack_id_t ptp_id, 
   1785     int clock_num, 
   1786     bcm_ptp_g8275p1_clock_traceability_info_t traceability_info, 
   1787     uint8 *clock_class);
   1788 
   1789 /* Get PTP Clock Time. */
   1790 extern int bcm_ptp_clock_time_get(
   1791     int unit, 
   1792     bcm_ptp_stack_id_t ptp_id, 
   1793     int clock_num, 
   1794     bcm_ptp_timestamp_t *time);
   1795 
   1796 /* Set PTP Clock Time. */
   1797 extern int bcm_ptp_clock_time_set(
   1798     int unit, 
   1799     bcm_ptp_stack_id_t ptp_id, 
   1800     int clock_num, 
   1801     bcm_ptp_timestamp_t *time);
   1802 
   1803 /* Get PTP Clock Timescale info. */
   1804 extern int bcm_ptp_clock_timescale_get(
   1805     int unit, 
   1806     bcm_ptp_stack_id_t ptp_id, 
   1807     int clock_num, 
   1808     bcm_ptp_timescale_t *timescale);
   1809 
   1810 /* Set PTP Clock Timescale info. */
   1811 extern int bcm_ptp_clock_timescale_set(
   1812     int unit, 
   1813     bcm_ptp_stack_id_t ptp_id, 
   1814     int clock_num, 
   1815     bcm_ptp_timescale_t *timescale);
   1816 
   1817 /* Get PTP Clock Traceability info. */
   1818 extern int bcm_ptp_clock_traceability_get(
   1819     int unit, 
   1820     bcm_ptp_stack_id_t ptp_id, 
   1821     int clock_num, 
   1822     bcm_ptp_trace_t *trace);
   1823 
   1824 /* Set PTP Clock Traceability info. */
   1825 extern int bcm_ptp_clock_traceability_set(
   1826     int unit, 
   1827     bcm_ptp_stack_id_t ptp_id, 
   1828     int clock_num, 
   1829     bcm_ptp_trace_t *trace);
   1830 
   1831 /* Get PTP Clock UTC info. */
   1832 extern int bcm_ptp_clock_utc_get(
   1833     int unit, 
   1834     bcm_ptp_stack_id_t ptp_id, 
   1835     int clock_num, 
   1836     bcm_ptp_utc_t *utc);
   1837 
   1838 /* Set PTP Clock UTC info. */
   1839 extern int bcm_ptp_clock_utc_set(
   1840     int unit, 
   1841     bcm_ptp_stack_id_t ptp_id, 
   1842     int clock_num, 
   1843     bcm_ptp_utc_t *utc);
   1844 
   1845 /* Configure PTP Clock Port information. */
   1846 extern int bcm_ptp_clock_port_configure(
   1847     int unit, 
   1848     bcm_ptp_stack_id_t ptp_id, 
   1849     int clock_num, 
   1850     uint32 clock_port, 
   1851     bcm_ptp_clock_port_info_t *info);
   1852 
   1853 /* Get PTP Clock Port Identity. */
   1854 extern int bcm_ptp_clock_port_identity_get(
   1855     int unit, 
   1856     bcm_ptp_stack_id_t ptp_id, 
   1857     int clock_num, 
   1858     uint32 clock_port, 
   1859     bcm_ptp_port_identity_t *identity);
   1860 
   1861 /* Get PTP Clock Port Type. */
   1862 extern int bcm_ptp_clock_port_type_get(
   1863     int unit, 
   1864     bcm_ptp_stack_id_t ptp_id, 
   1865     int clock_num, 
   1866     uint32 clock_port, 
   1867     bcm_ptp_port_type_t *type);
   1868 
   1869 /* Get PTP Clock Port Protocol. */
   1870 extern int bcm_ptp_clock_port_protocol_get(
   1871     int unit, 
   1872     bcm_ptp_stack_id_t ptp_id, 
   1873     int clock_num, 
   1874     uint32 clock_port, 
   1875     bcm_ptp_protocol_t *protocol);
   1876 
   1877 /* Get PTP Clock Port MAC Address. */
   1878 extern int bcm_ptp_clock_port_mac_get(
   1879     int unit, 
   1880     bcm_ptp_stack_id_t ptp_id, 
   1881     int clock_num, 
   1882     uint32 clock_port, 
   1883     bcm_mac_t *mac);
   1884 
   1885 /* Get PTP Clock Port Information. */
   1886 extern int bcm_ptp_clock_port_info_get(
   1887     int unit, 
   1888     bcm_ptp_stack_id_t ptp_id, 
   1889     int clock_num, 
   1890     uint32 clock_port, 
   1891     bcm_ptp_clock_port_info_t *info);
   1892 
   1893 /* Get PTP Clock Port Dataset Information. */
   1894 extern int bcm_ptp_clock_port_dataset_get(
   1895     int unit, 
   1896     bcm_ptp_stack_id_t ptp_id, 
   1897     int clock_num, 
   1898     uint32 clock_port, 
   1899     bcm_ptp_port_dataset_t *dataset);
   1900 
   1901 /* Get PTP Clock Port Delay Mechanism. */
   1902 extern int bcm_ptp_clock_port_delay_mechanism_get(
   1903     int unit, 
   1904     bcm_ptp_stack_id_t ptp_id, 
   1905     int clock_num, 
   1906     uint32 clock_port, 
   1907     uint32 *delay_mechanism);
   1908 
   1909 /* Set PTP Clock Port Delay Mechanism. */
   1910 extern int bcm_ptp_clock_port_delay_mechanism_set(
   1911     int unit, 
   1912     bcm_ptp_stack_id_t ptp_id, 
   1913     int clock_num, 
   1914     uint32 clock_port, 
   1915     uint32 delay_mechanism);
   1916 
   1917 /* Set PTP Clock Port Latency. */
   1918 extern int bcm_ptp_clock_port_latency_set(
   1919     int unit, 
   1920     bcm_ptp_stack_id_t ptp_id, 
   1921     int clock_num, 
   1922     uint32 clock_port, 
   1923     uint32 latency_in, 
   1924     uint32 latency_out);
   1925 
   1926 /* Set PTP Clock Port Log Announce Interval. */
   1927 extern int bcm_ptp_clock_port_log_announce_interval_set(
   1928     int unit, 
   1929     bcm_ptp_stack_id_t ptp_id, 
   1930     int clock_num, 
   1931     uint32 clock_port, 
   1932     int interval);
   1933 
   1934 /* Get PTP Clock Port Log Announce interval. */
   1935 extern int bcm_ptp_clock_port_log_announce_interval_get(
   1936     int unit, 
   1937     bcm_ptp_stack_id_t ptp_id, 
   1938     int clock_num, 
   1939     uint32 clock_port, 
   1940     int *interval);
   1941 
   1942 /* Get PTP Clock Port Announce Receipt Timeout. */
   1943 extern int bcm_ptp_clock_port_announce_receipt_timeout_get(
   1944     int unit, 
   1945     bcm_ptp_stack_id_t ptp_id, 
   1946     int clock_num, 
   1947     uint32 clock_port, 
   1948     uint32 *timeout);
   1949 
   1950 /* Set PTP Clock Port Announce Receipt Timeout. */
   1951 extern int bcm_ptp_clock_port_announce_receipt_timeout_set(
   1952     int unit, 
   1953     bcm_ptp_stack_id_t ptp_id, 
   1954     int clock_num, 
   1955     uint32 clock_port, 
   1956     uint32 timeout);
   1957 
   1958 /* Get PTP Clock Port Log Sync Interval. */
   1959 extern int bcm_ptp_clock_port_log_sync_interval_get(
   1960     int unit, 
   1961     bcm_ptp_stack_id_t ptp_id, 
   1962     int clock_num, 
   1963     uint32 clock_port, 
   1964     int *interval);
   1965 
   1966 /* Set PTP Clock Port Log Sync Interval. */
   1967 extern int bcm_ptp_clock_port_log_sync_interval_set(
   1968     int unit, 
   1969     bcm_ptp_stack_id_t ptp_id, 
   1970     int clock_num, 
   1971     uint32 clock_port, 
   1972     int interval);
   1973 
   1974 /* Get PTP Clock Port Version Number. */
   1975 extern int bcm_ptp_clock_port_version_number_get(
   1976     int unit, 
   1977     bcm_ptp_stack_id_t ptp_id, 
   1978     int clock_num, 
   1979     uint32 clock_port, 
   1980     uint32 *version);
   1981 
   1982 /* Get PTP Clock Port Log Min PDelay Request Interval. */
   1983 extern int bcm_ptp_clock_port_log_min_pdelay_req_interval_get(
   1984     int unit, 
   1985     bcm_ptp_stack_id_t ptp_id, 
   1986     int clock_num, 
   1987     uint32 clock_port, 
   1988     int *interval);
   1989 
   1990 /* Set PTP Clock Port Log Min Peer Delay Request Interval. */
   1991 extern int bcm_ptp_clock_port_log_min_pdelay_req_interval_set(
   1992     int unit, 
   1993     bcm_ptp_stack_id_t ptp_id, 
   1994     int clock_num, 
   1995     uint32 clock_port, 
   1996     int interval);
   1997 
   1998 /* Get PTP Clock Port Log Min Delay Request Interval. */
   1999 extern int bcm_ptp_clock_port_log_min_delay_req_interval_get(
   2000     int unit, 
   2001     bcm_ptp_stack_id_t ptp_id, 
   2002     int clock_num, 
   2003     uint32 clock_port, 
   2004     int *interval);
   2005 
   2006 /* Set PTP Clock Port Log Min Delay Request Interval. */
   2007 extern int bcm_ptp_clock_port_log_min_delay_req_interval_set(
   2008     int unit, 
   2009     bcm_ptp_stack_id_t ptp_id, 
   2010     int clock_num, 
   2011     uint32 clock_port, 
   2012     int interval);
   2013 
   2014 /* Enable PTP Clock Port. */
   2015 extern int bcm_ptp_clock_port_enable(
   2016     int unit, 
   2017     bcm_ptp_stack_id_t ptp_id, 
   2018     int clock_num, 
   2019     uint32 clock_port);
   2020 
   2021 /* Disable PTP Clock Port. */
   2022 extern int bcm_ptp_clock_port_disable(
   2023     int unit, 
   2024     bcm_ptp_stack_id_t ptp_id, 
   2025     int clock_num, 
   2026     uint32 clock_port);
   2027 
   2028 /* Add PTP Clock Static Unicast Slave */
   2029 extern int bcm_ptp_static_unicast_slave_add(
   2030     int unit, 
   2031     bcm_ptp_stack_id_t ptp_id, 
   2032     int clock_num, 
   2033     int port_num, 
   2034     bcm_ptp_clock_peer_t *slave_info);
   2035 
   2036 /* List PTP Clock Static Unicast Slaves */
   2037 extern int bcm_ptp_static_unicast_slave_list(
   2038     int unit, 
   2039     bcm_ptp_stack_id_t ptp_id, 
   2040     int clock_num, 
   2041     int port_num, 
   2042     int max_num_slaves, 
   2043     int *num_slaves, 
   2044     bcm_ptp_clock_peer_t *slave_info);
   2045 
   2046 /* Remove PTP Clock Static Unicast Slave */
   2047 extern int bcm_ptp_static_unicast_slave_remove(
   2048     int unit, 
   2049     bcm_ptp_stack_id_t ptp_id, 
   2050     int clock_num, 
   2051     int port_num, 
   2052     bcm_ptp_clock_peer_t *slave_info);
   2053 
   2054 /* Clear All PTP Clock Static Unicast Slaves */
   2055 extern int bcm_ptp_static_unicast_slave_table_clear(
   2056     int unit, 
   2057     bcm_ptp_stack_id_t ptp_id, 
   2058     int clock_num, 
   2059     int port_num);
   2060 
   2061 /* Get PTP Clock Static Unicast Master Table Size */
   2062 extern int bcm_ptp_static_unicast_master_table_size_get(
   2063     int unit, 
   2064     bcm_ptp_stack_id_t ptp_id, 
   2065     int clock_num, 
   2066     int port_num, 
   2067     int *max_table_entries);
   2068 
   2069 /* Add PTP Clock Static Unicast Master Table Entry */
   2070 extern int bcm_ptp_static_unicast_master_add(
   2071     int unit, 
   2072     bcm_ptp_stack_id_t ptp_id, 
   2073     int clock_num, 
   2074     int port_num, 
   2075     bcm_ptp_clock_unicast_master_t *master_info);
   2076 
   2077 /* List PTP Static Unicast Master Table */
   2078 extern int bcm_ptp_static_unicast_master_list(
   2079     int unit, 
   2080     bcm_ptp_stack_id_t ptp_id, 
   2081     int clock_num, 
   2082     int port_num, 
   2083     int max_num_masters, 
   2084     int *num_masters, 
   2085     bcm_ptp_clock_peer_address_t *master_addr);
   2086 
   2087 /* Remove PTP Clock Static Unicast Master Entry */
   2088 extern int bcm_ptp_static_unicast_master_remove(
   2089     int unit, 
   2090     bcm_ptp_stack_id_t ptp_id, 
   2091     int clock_num, 
   2092     int port_num, 
   2093     bcm_ptp_clock_peer_address_t *master_info);
   2094 
   2095 /* Clear PTP Clock Static Unicast Master Table */
   2096 extern int bcm_ptp_static_unicast_master_table_clear(
   2097     int unit, 
   2098     bcm_ptp_stack_id_t ptp_id, 
   2099     int clock_num, 
   2100     int port_num);
   2101 
   2102 /* Add PTP Clock Signaled Unicast Master Entry */
   2103 extern int bcm_ptp_signaled_unicast_master_add(
   2104     int unit, 
   2105     bcm_ptp_stack_id_t ptp_id, 
   2106     int clock_num, 
   2107     int port_num, 
   2108     bcm_ptp_clock_unicast_master_t *master_info, 
   2109     uint32 mask);
   2110 
   2111 /* Remove PTP Clock Signaled Unicast Master Entry */
   2112 extern int bcm_ptp_signaled_unicast_master_remove(
   2113     int unit, 
   2114     bcm_ptp_stack_id_t ptp_id, 
   2115     int clock_num, 
   2116     int port_num, 
   2117     bcm_ptp_clock_peer_address_t *master_info);
   2118 
   2119 /* Clear All PTP Clock Static Unicast Slaves */
   2120 extern int bcm_ptp_signaled_unicast_slave_table_clear(
   2121     int unit, 
   2122     bcm_ptp_stack_id_t ptp_id, 
   2123     int clock_num, 
   2124     int port_num, 
   2125     int callstack);
   2126 
   2127 /* List PTP Clock Signaled Unicast Slaves */
   2128 extern int bcm_ptp_signaled_unicast_slave_list(
   2129     int unit, 
   2130     bcm_ptp_stack_id_t ptp_id, 
   2131     int clock_num, 
   2132     int port_num, 
   2133     int max_num_slaves, 
   2134     int *num_slaves, 
   2135     bcm_ptp_clock_peer_t *slave_info);
   2136 
   2137 /* Set PTP Default Default Unicast Request Duration */
   2138 extern int bcm_ptp_unicast_request_duration_set(
   2139     int unit, 
   2140     bcm_ptp_stack_id_t ptp_id, 
   2141     int clock_num, 
   2142     int port_num, 
   2143     uint32 duration);
   2144 
   2145 /* Get PTP Default Unicast Request Duration */
   2146 extern int bcm_ptp_unicast_request_duration_get(
   2147     int unit, 
   2148     bcm_ptp_stack_id_t ptp_id, 
   2149     int clock_num, 
   2150     int port_num, 
   2151     uint32 *duration);
   2152 
   2153 /* Set PTP Master's Minimum Allowed Unicast Request Duration */
   2154 extern int bcm_ptp_unicast_request_duration_min_set(
   2155     int unit, 
   2156     bcm_ptp_stack_id_t ptp_id, 
   2157     int clock_num, 
   2158     int port_num, 
   2159     uint32 duration_min);
   2160 
   2161 /* Get PTP Master's Minimum Allowed Unicast Request Duration */
   2162 extern int bcm_ptp_unicast_request_duration_min_get(
   2163     int unit, 
   2164     bcm_ptp_stack_id_t ptp_id, 
   2165     int clock_num, 
   2166     int port_num, 
   2167     uint32 *duration_min);
   2168 
   2169 /* Set PTP Master's Maximum Allowed Unicast Request Duration */
   2170 extern int bcm_ptp_unicast_request_duration_max_set(
   2171     int unit, 
   2172     bcm_ptp_stack_id_t ptp_id, 
   2173     int clock_num, 
   2174     int port_num, 
   2175     uint32 duration_max);
   2176 
   2177 /* Get PTP Master's Maximum Allowed Unicast Request Duration */
   2178 extern int bcm_ptp_unicast_request_duration_max_get(
   2179     int unit, 
   2180     bcm_ptp_stack_id_t ptp_id, 
   2181     int clock_num, 
   2182     int port_num, 
   2183     uint32 *duration_max);
   2184 
   2185 /* Get PTP Clock Acceptable Master Table Size */
   2186 extern int bcm_ptp_acceptable_master_table_size_get(
   2187     int unit, 
   2188     bcm_ptp_stack_id_t ptp_id, 
   2189     int clock_num, 
   2190     int port_num, 
   2191     int *max_table_entries);
   2192 
   2193 /* Add PTP Clock Acceptable Master Table Entry */
   2194 extern int bcm_ptp_acceptable_master_add(
   2195     int unit, 
   2196     bcm_ptp_stack_id_t ptp_id, 
   2197     int clock_num, 
   2198     int port_num, 
   2199     int priority1_alt_value, 
   2200     bcm_ptp_clock_peer_address_t *master_info);
   2201 
   2202 /* List PTP Acceptable Master Table */
   2203 extern int bcm_ptp_acceptable_master_list(
   2204     int unit, 
   2205     bcm_ptp_stack_id_t ptp_id, 
   2206     int clock_num, 
   2207     int port_num, 
   2208     int max_num_masters, 
   2209     int *num_masters, 
   2210     bcm_ptp_clock_peer_address_t *master_addr);
   2211 
   2212 /* Remove PTP Clock Acceptable Master Entry */
   2213 extern int bcm_ptp_acceptable_master_remove(
   2214     int unit, 
   2215     bcm_ptp_stack_id_t ptp_id, 
   2216     int clock_num, 
   2217     int port_num, 
   2218     bcm_ptp_clock_peer_address_t *master_info);
   2219 
   2220 /* Clear PTP Clock Acceptable Master Table */
   2221 extern int bcm_ptp_acceptable_master_table_clear(
   2222     int unit, 
   2223     bcm_ptp_stack_id_t ptp_id, 
   2224     int clock_num, 
   2225     int port_num);
   2226 
   2227 /* Get PTP Clock Acceptable Master Table Enabled State */
   2228 extern int bcm_ptp_acceptable_master_enabled_get(
   2229     int unit, 
   2230     bcm_ptp_stack_id_t ptp_id, 
   2231     int clock_num, 
   2232     int port_num, 
   2233     uint8 *enabled);
   2234 
   2235 /* Set PTP Clock Acceptable Master Enabled state */
   2236 extern int bcm_ptp_acceptable_master_enabled_set(
   2237     int unit, 
   2238     bcm_ptp_stack_id_t ptp_id, 
   2239     int clock_num, 
   2240     int port_num, 
   2241     uint8 enabled);
   2242 
   2243 /* Get PTP Clock Primary Domain */
   2244 extern int bcm_ptp_primary_domain_get(
   2245     int unit, 
   2246     bcm_ptp_stack_id_t ptp_id, 
   2247     int clock_num, 
   2248     int *primary_domain);
   2249 
   2250 /* Set PTP Clock Primary Domain */
   2251 extern int bcm_ptp_primary_domain_set(
   2252     int unit, 
   2253     bcm_ptp_stack_id_t ptp_id, 
   2254     int clock_num, 
   2255     int primary_domain);
   2256 
   2257 /* Get PTP Transparent Clock Default Dataset */
   2258 extern int bcm_ptp_transparent_clock_default_dataset_get(
   2259     int unit, 
   2260     bcm_ptp_stack_id_t ptp_id, 
   2261     int clock_num, 
   2262     bcm_ptp_transparent_clock_default_dataset_t *data_set);
   2263 
   2264 /* Get PTP Transparent Clock Port Dataset */
   2265 extern int bcm_ptp_transparent_clock_port_dataset_get(
   2266     int unit, 
   2267     bcm_ptp_stack_id_t ptp_id, 
   2268     int clock_num, 
   2269     uint16 clock_port, 
   2270     bcm_ptp_transparent_clock_port_dataset_t *data_set);
   2271 
   2272 /* Set PTP TOD Input Sources */
   2273 extern int bcm_ptp_tod_input_sources_set(
   2274     int unit, 
   2275     bcm_ptp_stack_id_t ptp_id, 
   2276     int clock_num, 
   2277     int num_tod_sources, 
   2278     bcm_ptp_tod_input_t *tod_sources);
   2279 
   2280 /* Get PTP Input Timesource Status */
   2281 extern int bcm_ptp_timesource_input_status_get(
   2282     int unit, 
   2283     bcm_ptp_stack_id_t ptp_id, 
   2284     int clock_num, 
   2285     bcm_ptp_timesource_status_t *status);
   2286 
   2287 /* Get PTP TOD Input Sources */
   2288 extern int bcm_ptp_tod_input_sources_get(
   2289     int unit, 
   2290     bcm_ptp_stack_id_t ptp_id, 
   2291     int clock_num, 
   2292     int *num_tod_sources, 
   2293     bcm_ptp_tod_input_t *tod_sources);
   2294 
   2295 /* Get PTP input channels. */
   2296 extern int bcm_ptp_input_channels_get(
   2297     int unit, 
   2298     bcm_ptp_stack_id_t ptp_id, 
   2299     int clock_num, 
   2300     int *num_channels, 
   2301     bcm_ptp_channel_t *channels);
   2302 
   2303 /* Set PTP Input Channels */
   2304 extern int bcm_ptp_input_channels_set(
   2305     int unit, 
   2306     bcm_ptp_stack_id_t ptp_id, 
   2307     int clock_num, 
   2308     int num_channels, 
   2309     bcm_ptp_channel_t *channels);
   2310 
   2311 /* Set PTP Input Channels Precedence Mode */
   2312 extern int bcm_ptp_input_channel_precedence_mode_set(
   2313     int unit, 
   2314     bcm_ptp_stack_id_t ptp_id, 
   2315     int clock_num, 
   2316     int channel_select_mode);
   2317 
   2318 /* Set PTP Input Channels Switching Mode */
   2319 extern int bcm_ptp_input_channel_switching_mode_set(
   2320     int unit, 
   2321     bcm_ptp_stack_id_t ptp_id, 
   2322     int clock_num, 
   2323     int channel_switching_mode);
   2324 
   2325 /* Set PTP TOD Output */
   2326 extern int bcm_ptp_tod_output_set(
   2327     int unit, 
   2328     bcm_ptp_stack_id_t ptp_id, 
   2329     int clock_num, 
   2330     int *tod_output_id, 
   2331     bcm_ptp_tod_output_t *output_info);
   2332 
   2333 /* Get PTP TOD Output */
   2334 extern int bcm_ptp_tod_output_get(
   2335     int unit, 
   2336     bcm_ptp_stack_id_t ptp_id, 
   2337     int clock_num, 
   2338     int *tod_output_count, 
   2339     bcm_ptp_tod_output_t *tod_output);
   2340 
   2341 /* Remove PTP TOD Output */
   2342 extern int bcm_ptp_tod_output_remove(
   2343     int unit, 
   2344     bcm_ptp_stack_id_t ptp_id, 
   2345     int clock_num, 
   2346     int tod_output_id);
   2347 
   2348 /* Set PTP Signal Output */
   2349 extern int bcm_ptp_signal_output_set(
   2350     int unit, 
   2351     bcm_ptp_stack_id_t ptp_id, 
   2352     int clock_num, 
   2353     int *signal_output_id, 
   2354     bcm_ptp_signal_output_t *output_info);
   2355 
   2356 /* Get PTP Signal Output */
   2357 extern int bcm_ptp_signal_output_get(
   2358     int unit, 
   2359     bcm_ptp_stack_id_t ptp_id, 
   2360     int clock_num, 
   2361     int *signal_output_count, 
   2362     bcm_ptp_signal_output_t *signal_output_id);
   2363 
   2364 /* Remove PTP Signal Output */
   2365 extern int bcm_ptp_signal_output_remove(
   2366     int unit, 
   2367     bcm_ptp_stack_id_t ptp_id, 
   2368     int clock_num, 
   2369     int signal_output_id);
   2370 
   2371 /* Synchronize PHY clock to the TOP clock */
   2372 extern int bcm_ptp_sync_phy(
   2373     int unit, 
   2374     bcm_ptp_stack_id_t ptp_id, 
   2375     int clock_num, 
   2376     bcm_ptp_sync_phy_input_t sync_input);
   2377 
   2378 /* Query the BSHB timestamp for PHY DPLL config to sync with TOP clock */
   2379 extern int bcm_ptp_bs_time_info_get(
   2380     int unit, 
   2381     bcm_ptp_stack_id_t ptp_id, 
   2382     int clock_num, 
   2383     bcm_ptp_bs_time_info_t *time);
   2384 
   2385 /* Get PTP servo configuration properties */
   2386 extern int bcm_ptp_servo_configuration_get(
   2387     int unit, 
   2388     bcm_ptp_stack_id_t ptp_id, 
   2389     int clock_num, 
   2390     bcm_ptp_servo_config_t *config);
   2391 
   2392 /* Set PTP servo configuration properties */
   2393 extern int bcm_ptp_servo_configuration_set(
   2394     int unit, 
   2395     bcm_ptp_stack_id_t ptp_id, 
   2396     int clock_num, 
   2397     bcm_ptp_servo_config_t *config);
   2398 
   2399 /* Get PTP servo status. */
   2400 extern int bcm_ptp_servo_status_get(
   2401     int unit, 
   2402     bcm_ptp_stack_id_t ptp_id, 
   2403     int clock_num, 
   2404     bcm_ptp_servo_status_t *status);
   2405 
   2406 /* Set servo thresholds. */
   2407 extern int bcm_ptp_servo_threshold_set(
   2408     int unit, 
   2409     bcm_ptp_stack_id_t ptp_id, 
   2410     int clock_num, 
   2411     bcm_ptp_servo_threshold_t *threshold);
   2412 
   2413 /* Get servo thresholds. */
   2414 extern int bcm_ptp_servo_threshold_get(
   2415     int unit, 
   2416     bcm_ptp_stack_id_t ptp_id, 
   2417     int clock_num, 
   2418     bcm_ptp_servo_threshold_t *threshold);
   2419 
   2420 /* Get peer dataset. */
   2421 extern int bcm_ptp_peer_dataset_get(
   2422     int unit, 
   2423     bcm_ptp_stack_id_t ptp_id, 
   2424     int clock_num, 
   2425     int port_num, 
   2426     int max_num_peers, 
   2427     bcm_ptp_peer_entry_t *peers, 
   2428     int *num_peers);
   2429 
   2430 /* Get PTP Clock slave peer aging time for cleanup */
   2431 extern int bcm_ptp_clock_peer_age_timer_get(
   2432     int unit, 
   2433     bcm_ptp_stack_id_t ptp_id, 
   2434     int clock_num, 
   2435     uint8 *aging_time);
   2436 
   2437 /* Set PTP Clock slave Peer Aging time for cleanup */
   2438 extern int bcm_ptp_clock_peer_age_timer_set(
   2439     int unit, 
   2440     bcm_ptp_stack_id_t ptp_id, 
   2441     int clock_num, 
   2442     uint8 aging_time);
   2443 
   2444 /* Get PTP Clock flag field override mask/value get */
   2445 extern int bcm_ptp_pkt_flags_override_get(
   2446     int unit, 
   2447     bcm_ptp_stack_id_t ptp_id, 
   2448     int clock_num, 
   2449     uint32 *override_flag, 
   2450     uint32 *override_value);
   2451 
   2452 /* Set PTP Clock flag field override mask/value set */
   2453 extern int bcm_ptp_pkt_flags_override_set(
   2454     int unit, 
   2455     bcm_ptp_stack_id_t ptp_id, 
   2456     int clock_num, 
   2457     uint32 override_flag, 
   2458     uint32 override_value);
   2459 
   2460 /* Get packet counts/statistics. */
   2461 extern int bcm_ptp_packet_counters_get(
   2462     int unit, 
   2463     bcm_ptp_stack_id_t ptp_id, 
   2464     int clock_num, 
   2465     bcm_ptp_packet_counters_t *counters);
   2466 
   2467 #endif /* BCM_HIDE_DISPATCHABLE */
   2468 
   2469 /* 
   2470  *  Bits#13:0 of "counter_bitmap" indicates a PTP packet counter. When
   2471  * set to 1, will clear the corresponding packet counter. Bits#31:14 are
   2472  * ignored.
   2473  */
   2474 #define BCM_PTP_PKT_COUNTER_TX              (1 << 0)   
   2475 #define BCM_PTP_PKT_COUNTER_RX              (1 << 1)   
   2476 #define BCM_PTP_PKT_COUNTER_DISCARD         (1 << 2)   
   2477 #define BCM_PTP_PKT_COUNTER_RCPU_ENCAP_RX   (1 << 3)   
   2478 #define BCM_PTP_PKT_COUNTER_IPV4_RX         (1 << 4)   
   2479 #define BCM_PTP_PKT_COUNTER_IPV6_RX         (1 << 5)   
   2480 #define BCM_PTP_PKT_COUNTER_L2_RX           (1 << 6)   
   2481 #define BCM_PTP_PKT_COUNTER_UDP_RX          (1 << 7)   
   2482 #define BCM_PTP_PKT_COUNTER_ENDUROSYNC_TX   (1 << 8)   
   2483 #define BCM_PTP_PKT_COUNTER_ENDUROSYNC_RX   (1 << 9)   
   2484 #define BCM_PTP_PKT_COUNTER_RXQUEUE_OVERFLOWS (1 << 10)  
   2485 #define BCM_PTP_PKT_COUNTER_PORT_TX         (1 << 11)  
   2486 #define BCM_PTP_PKT_COUNTER_PORT_RX         (1 << 12)  
   2487 #define BCM_PTP_PKT_COUNTER_PORT_DISCARD    (1 << 13)  
   2488 #define BCM_PTP_PKT_COUNTER_ALL             (0x3FFF)   /* clear all packet
   2489                                                           counters ( both common
   2490                                                           and port-specific). */
   2491 #define BCM_PTP_PKT_COUNTER_COMMON          (0x07FF)   /* clear all common
   2492                                                           packet counters */
   2493 #define BCM_PTP_PKT_COUNTER_PORT_SPECIFIC   (0x3800)   /* clear all
   2494                                                           port-specific packet
   2495                                                           counters */
   2496 
   2497 #ifndef BCM_HIDE_DISPATCHABLE
   2498 
   2499 /* Reset/Clear packet counts/statistics. */
   2500 extern int bcm_ptp_packet_counters_clear(
   2501     int unit, 
   2502     bcm_ptp_stack_id_t ptp_id, 
   2503     int clock_num, 
   2504     int port_num, 
   2505     uint32 counter_bitmap);
   2506 
   2507 /* Set phase offsets for path asymmetry compensation */
   2508 extern int bcm_ptp_phase_offset_set(
   2509     int unit, 
   2510     bcm_ptp_stack_id_t ptp_id, 
   2511     int clock_num, 
   2512     const bcm_ptp_phase_offset_t *offset);
   2513 
   2514 /* Get phase offsets for path asymmetry compensation */
   2515 extern int bcm_ptp_phase_offset_get(
   2516     int unit, 
   2517     bcm_ptp_stack_id_t ptp_id, 
   2518     int clock_num, 
   2519     bcm_ptp_phase_offset_t *offset);
   2520 
   2521 /* ESMC PDU transmit (Tx). */
   2522 extern int bcm_esmc_tx(
   2523     int unit, 
   2524     int stack_id, 
   2525     bcm_pbmp_t pbmp, 
   2526     bcm_esmc_pdu_data_t *esmc_pdu_data);
   2527 
   2528 /* Register ESMC PDU Rx callback. */
   2529 extern int bcm_esmc_rx_callback_register(
   2530     int unit, 
   2531     int stack_id, 
   2532     bcm_esmc_rx_cb rx_cb);
   2533 
   2534 /* Unregister ESMC PDU Rx callback. */
   2535 extern int bcm_esmc_rx_callback_unregister(
   2536     int unit, 
   2537     int stack_id);
   2538 
   2539 /* Get ESMC PDU tunneling-enabled Boolean. */
   2540 extern int bcm_esmc_tunnel_get(
   2541     int unit, 
   2542     int stack_id, 
   2543     int *enable);
   2544 
   2545 /* Set ESMC PDU tunneling-enabled Boolean. */
   2546 extern int bcm_esmc_tunnel_set(
   2547     int unit, 
   2548     int stack_id, 
   2549     int enable);
   2550 
   2551 /* Get ITU-T G.781 networking option for SyncE. */
   2552 extern int bcm_esmc_g781_option_get(
   2553     int unit, 
   2554     int stack_id, 
   2555     bcm_esmc_network_option_t *g781_option);
   2556 
   2557 /* Set ITU-T G.781 networking option for SyncE. */
   2558 extern int bcm_esmc_g781_option_set(
   2559     int unit, 
   2560     int stack_id, 
   2561     bcm_esmc_network_option_t g781_option);
   2562 
   2563 /* 
   2564  * Get synchronization status message (SSM) code corresponding to ITU-T
   2565  * G.781 quality level (QL).
   2566  */
   2567 extern int bcm_esmc_QL_SSM_map(
   2568     int unit, 
   2569     bcm_esmc_network_option_t opt, 
   2570     bcm_esmc_quality_level_t ql, 
   2571     uint8 *ssm_code);
   2572 
   2573 /* 
   2574  * Get ITU-T G.781 quality level (QL) corresponding to synchronization
   2575  * status message (SSM) code.
   2576  */
   2577 extern int bcm_esmc_SSM_QL_map(
   2578     int unit, 
   2579     bcm_esmc_network_option_t opt, 
   2580     uint8 ssm_code, 
   2581     bcm_esmc_quality_level_t *ql);
   2582 
   2583 /* Register input clock esmc quality change callback. */
   2584 extern int bcm_tdpll_input_clock_ql_change_callback_register(
   2585     int unit, 
   2586     int stack_id, 
   2587     bcm_tdpll_input_clock_ql_change_cb ql_change_cb);
   2588 
   2589 /* Unregister input clock esmc quality change callback. */
   2590 extern int bcm_tdpll_input_clock_ql_change_callback_unregister(
   2591     int unit, 
   2592     int stack_id);
   2593 
   2594 /* Get logical DPLL instance input/output bindings. */
   2595 extern int bcm_tdpll_dpll_bindings_get(
   2596     int unit, 
   2597     int stack_id, 
   2598     int dpll_index, 
   2599     bcm_tdpll_dpll_bindings_t *bindings);
   2600 
   2601 /* Set logical DPLL instance input/output bindings. */
   2602 extern int bcm_tdpll_dpll_bindings_set(
   2603     int unit, 
   2604     int stack_id, 
   2605     int dpll_index, 
   2606     bcm_tdpll_dpll_bindings_t *bindings);
   2607 
   2608 /* Get reference clocks for DPLL instances. */
   2609 extern int bcm_tdpll_dpll_reference_get(
   2610     int unit, 
   2611     int stack_id, 
   2612     int max_num_dpll, 
   2613     int *dpll_ref, 
   2614     int *num_dpll);
   2615 
   2616 /* Get DPLL bandwidth. */
   2617 extern int bcm_tdpll_dpll_bandwidth_get(
   2618     int unit, 
   2619     int stack_id, 
   2620     int dpll_index, 
   2621     bcm_tdpll_dpll_bandwidth_t *bandwidth);
   2622 
   2623 /* Set DPLL bandwidth. */
   2624 extern int bcm_tdpll_dpll_bandwidth_set(
   2625     int unit, 
   2626     int stack_id, 
   2627     int dpll_index, 
   2628     bcm_tdpll_dpll_bandwidth_t *bandwidth);
   2629 
   2630 /* Get DPLL instance's phase control configuration. */
   2631 extern int bcm_tdpll_dpll_phase_control_get(
   2632     int unit, 
   2633     int stack_id, 
   2634     int dpll_index, 
   2635     bcm_tdpll_dpll_phase_control_t *phase_control);
   2636 
   2637 /* Set DPLL instance's phase control configuration. */
   2638 extern int bcm_tdpll_dpll_phase_control_set(
   2639     int unit, 
   2640     int stack_id, 
   2641     int dpll_index, 
   2642     bcm_tdpll_dpll_phase_control_t *phase_control);
   2643 
   2644 /* 
   2645  * Start/stop T-DPLL input clock monitoring, reference selection, and
   2646  * switching state machine
   2647  */
   2648 extern int bcm_tdpll_input_clock_control(
   2649     int unit, 
   2650     int stack_id, 
   2651     int enable);
   2652 
   2653 /* Get MAC address of input clock. */
   2654 extern int bcm_tdpll_input_clock_mac_get(
   2655     int unit, 
   2656     int stack_id, 
   2657     int clock_index, 
   2658     bcm_mac_t *mac);
   2659 
   2660 /* Set MAC address of input clock. */
   2661 extern int bcm_tdpll_input_clock_mac_set(
   2662     int unit, 
   2663     int stack_id, 
   2664     int clock_index, 
   2665     bcm_mac_t *mac);
   2666 
   2667 /* 
   2668  * Get fractional frequency error of an input clock from input-clock
   2669  * monitoring process.
   2670  */
   2671 extern int bcm_tdpll_input_clock_frequency_error_get(
   2672     int unit, 
   2673     int stack_id, 
   2674     int clock_index, 
   2675     int *freq_error_ppb);
   2676 
   2677 /* 
   2678  * Get monitor threshold state of an input clock from input-clock
   2679  * monitoring process.
   2680  */
   2681 extern int bcm_tdpll_input_clock_threshold_state_get(
   2682     int unit, 
   2683     int stack_id, 
   2684     int clock_index, 
   2685     bcm_tdpll_input_clock_monitor_type_t threshold_type, 
   2686     int *threshold_state);
   2687 
   2688 /* Get input clock enable Boolean. */
   2689 extern int bcm_tdpll_input_clock_enable_get(
   2690     int unit, 
   2691     int stack_id, 
   2692     int clock_index, 
   2693     int *enable);
   2694 
   2695 /* Set input-clock enable Boolean. */
   2696 extern int bcm_tdpll_input_clock_enable_set(
   2697     int unit, 
   2698     int stack_id, 
   2699     int clock_index, 
   2700     int enable);
   2701 
   2702 /* Get L1 mux mapping (mux index and port number) of input clock. */
   2703 extern int bcm_tdpll_input_clock_l1mux_get(
   2704     int unit, 
   2705     int stack_id, 
   2706     int clock_index, 
   2707     bcm_tdpll_input_clock_l1mux_t *l1mux);
   2708 
   2709 /* Set L1 mux mapping (mux index and port number) of input clock. */
   2710 extern int bcm_tdpll_input_clock_l1mux_set(
   2711     int unit, 
   2712     int stack_id, 
   2713     int clock_index, 
   2714     bcm_tdpll_input_clock_l1mux_t *l1mux);
   2715 
   2716 /* 
   2717  * Get valid Boolean of an input clock from input-clock monitoring
   2718  * process.
   2719  */
   2720 extern int bcm_tdpll_input_clock_valid_get(
   2721     int unit, 
   2722     int stack_id, 
   2723     int clock_index, 
   2724     int *valid);
   2725 
   2726 /* Set input-clock valid Boolean from monitoring process. */
   2727 extern int bcm_tdpll_input_clock_valid_set(
   2728     int unit, 
   2729     int stack_id, 
   2730     int clock_index, 
   2731     int valid);
   2732 
   2733 /* Get input clock frequency. */
   2734 extern int bcm_tdpll_input_clock_frequency_get(
   2735     int unit, 
   2736     int stack_id, 
   2737     int clock_index, 
   2738     uint32 *clock_frequency, 
   2739     uint32 *tsevent_frequency);
   2740 
   2741 /* Set input clock frequency. */
   2742 extern int bcm_tdpll_input_clock_frequency_set(
   2743     int unit, 
   2744     int stack_id, 
   2745     int clock_index, 
   2746     uint32 clock_frequency, 
   2747     uint32 tsevent_frequency);
   2748 
   2749 /* Get input clock quality level (QL). */
   2750 extern int bcm_tdpll_input_clock_ql_get(
   2751     int unit, 
   2752     int stack_id, 
   2753     int clock_index, 
   2754     bcm_esmc_quality_level_t *ql);
   2755 
   2756 /* Set input clock quality level (QL). */
   2757 extern int bcm_tdpll_input_clock_ql_set(
   2758     int unit, 
   2759     int stack_id, 
   2760     int clock_index, 
   2761     bcm_esmc_quality_level_t ql);
   2762 
   2763 /* Get input clock priority for reference selection. */
   2764 extern int bcm_tdpll_input_clock_priority_get(
   2765     int unit, 
   2766     int stack_id, 
   2767     int clock_index, 
   2768     int *priority);
   2769 
   2770 /* Set input clock priority for reference selection. */
   2771 extern int bcm_tdpll_input_clock_priority_set(
   2772     int unit, 
   2773     int stack_id, 
   2774     int clock_index, 
   2775     int priority);
   2776 
   2777 /* Get input clock lockout Boolean for reference selection. */
   2778 extern int bcm_tdpll_input_clock_lockout_get(
   2779     int unit, 
   2780     int stack_id, 
   2781     int clock_index, 
   2782     int *lockout);
   2783 
   2784 /* Set input clock lockout Boolean for reference selection. */
   2785 extern int bcm_tdpll_input_clock_lockout_set(
   2786     int unit, 
   2787     int stack_id, 
   2788     int clock_index, 
   2789     int lockout);
   2790 
   2791 /* Get input clock monitoring interval. */
   2792 extern int bcm_tdpll_input_clock_monitor_interval_get(
   2793     int unit, 
   2794     int stack_id, 
   2795     uint32 *monitor_interval);
   2796 
   2797 /* Set input clock monitoring interval. */
   2798 extern int bcm_tdpll_input_clock_monitor_interval_set(
   2799     int unit, 
   2800     int stack_id, 
   2801     uint32 monitor_interval);
   2802 
   2803 /* 
   2804  * Get monitor threshold for input-clock valid classification required in
   2805  * reference selection.
   2806  */
   2807 extern int bcm_tdpll_input_clock_monitor_threshold_get(
   2808     int unit, 
   2809     int stack_id, 
   2810     bcm_tdpll_input_clock_monitor_type_t threshold_type, 
   2811     uint32 *threshold);
   2812 
   2813 /* 
   2814  * Set monitor threshold for input-clock valid classification required in
   2815  * reference selection.
   2816  */
   2817 extern int bcm_tdpll_input_clock_monitor_threshold_set(
   2818     int unit, 
   2819     int stack_id, 
   2820     bcm_tdpll_input_clock_monitor_type_t threshold_type, 
   2821     uint32 threshold);
   2822 
   2823 /* Get QL-enabled Boolean for reference selection. */
   2824 extern int bcm_tdpll_input_clock_ql_enabled_get(
   2825     int unit, 
   2826     int stack_id, 
   2827     int dpll_index, 
   2828     int *ql_enabled);
   2829 
   2830 /* Set QL-enabled Boolean for reference selection. */
   2831 extern int bcm_tdpll_input_clock_ql_enabled_set(
   2832     int unit, 
   2833     int stack_id, 
   2834     int dpll_index, 
   2835     int ql_enabled);
   2836 
   2837 /* Get revertive mode Boolean for reference selection and switching. */
   2838 extern int bcm_tdpll_input_clock_revertive_get(
   2839     int unit, 
   2840     int stack_id, 
   2841     int dpll_index, 
   2842     int *revertive);
   2843 
   2844 /* Set revertive mode Boolean for reference selection and switching. */
   2845 extern int bcm_tdpll_input_clock_revertive_set(
   2846     int unit, 
   2847     int stack_id, 
   2848     int dpll_index, 
   2849     int revertive);
   2850 
   2851 /* Get best (i.e. selected) reference for a DPLL instance. */
   2852 extern int bcm_tdpll_input_clock_best_get(
   2853     int unit, 
   2854     int stack_id, 
   2855     int dpll_index, 
   2856     int *best_clock);
   2857 
   2858 /* Register input clock monitoring callback. */
   2859 extern int bcm_tdpll_input_clock_monitor_callback_register(
   2860     int unit, 
   2861     int stack_id, 
   2862     bcm_tdpll_input_clock_monitor_cb monitor_cb);
   2863 
   2864 /* Unregister input clock monitoring callback. */
   2865 extern int bcm_tdpll_input_clock_monitor_callback_unregister(
   2866     int unit, 
   2867     int stack_id);
   2868 
   2869 /* Register input clock reference selection callback. */
   2870 extern int bcm_tdpll_input_clock_selector_callback_register(
   2871     int unit, 
   2872     int stack_id, 
   2873     bcm_tdpll_input_clock_selector_cb selector_cb);
   2874 
   2875 /* Unregister input clock reference selection callback. */
   2876 extern int bcm_tdpll_input_clock_selector_callback_unregister(
   2877     int unit, 
   2878     int stack_id);
   2879 
   2880 /* Register callback for different tdpll callback types. */
   2881 extern int bcm_tdpll_input_clock_callback_register(
   2882     int unit, 
   2883     int stack_id, 
   2884     bcm_tdpll_callback_type_t type, 
   2885     bcm_tdpll_input_clock_cb callback);
   2886 
   2887 /* Unregister the tdpll callback. */
   2888 extern int bcm_tdpll_input_clock_callback_unregister(
   2889     int unit, 
   2890     int stack_id, 
   2891     bcm_tdpll_callback_type_t type);
   2892 
   2893 /* Get output clock enable Boolean. */
   2894 extern int bcm_tdpll_output_clock_enable_get(
   2895     int unit, 
   2896     int stack_id, 
   2897     int clock_index, 
   2898     int *enable);
   2899 
   2900 /* Create output clock. */
   2901 extern int bcm_tdpll_output_clock_create(
   2902     int unit, 
   2903     int stack_id, 
   2904     int clock_index, 
   2905     bcm_pbmp_t pbmp, 
   2906     bcm_tdpll_dpll_bandwidth_t *bandwidth);
   2907 
   2908 /* Set output clock enable Boolean. */
   2909 extern int bcm_tdpll_output_clock_enable_set(
   2910     int unit, 
   2911     int stack_id, 
   2912     int clock_index, 
   2913     int enable);
   2914 
   2915 /* Get output-clock (synthesizer) frequency. */
   2916 extern int bcm_tdpll_output_clock_synth_frequency_get(
   2917     int unit, 
   2918     int stack_id, 
   2919     int clock_index, 
   2920     uint32 *synth_frequency, 
   2921     uint32 *tsevent_frequency);
   2922 
   2923 /* Set output-clock (synthesizer) frequency. */
   2924 extern int bcm_tdpll_output_clock_synth_frequency_set(
   2925     int unit, 
   2926     int stack_id, 
   2927     int clock_index, 
   2928     uint32 synth_frequency, 
   2929     uint32 tsevent_frequency);
   2930 
   2931 /* Get synthesizer derivative-clock frequency. */
   2932 extern int bcm_tdpll_output_clock_deriv_frequency_get(
   2933     int unit, 
   2934     int stack_id, 
   2935     int clock_index, 
   2936     uint32 *deriv_frequency);
   2937 
   2938 /* Set synthesizer derivative clock frequency. */
   2939 extern int bcm_tdpll_output_clock_deriv_frequency_set(
   2940     int unit, 
   2941     int stack_id, 
   2942     int clock_index, 
   2943     uint32 deriv_frequency);
   2944 
   2945 /* Get holdover configuration data. */
   2946 extern int bcm_tdpll_output_clock_holdover_data_get(
   2947     int unit, 
   2948     int stack_id, 
   2949     int clock_index, 
   2950     bcm_tdpll_holdover_data_t *hdata);
   2951 
   2952 /* Set manual holdover frequency correction. */
   2953 extern int bcm_tdpll_output_clock_holdover_frequency_set(
   2954     int unit, 
   2955     int stack_id, 
   2956     int clock_index, 
   2957     bcm_tdpll_frequency_correction_t hfreq);
   2958 
   2959 /* Get holdover mode. */
   2960 extern int bcm_tdpll_output_clock_holdover_mode_get(
   2961     int unit, 
   2962     int stack_id, 
   2963     int clock_index, 
   2964     bcm_tdpll_holdover_mode_t *hmode);
   2965 
   2966 /* Set holdover mode. */
   2967 extern int bcm_tdpll_output_clock_holdover_mode_set(
   2968     int unit, 
   2969     int stack_id, 
   2970     int clock_index, 
   2971     bcm_tdpll_holdover_mode_t hmode);
   2972 
   2973 /* Reset holdover frequency calculations. */
   2974 extern int bcm_tdpll_output_clock_holdover_reset(
   2975     int unit, 
   2976     int stack_id, 
   2977     int clock_index);
   2978 
   2979 /* Execute state machine for Rx ESMC PDU. */
   2980 extern int bcm_tdpll_esmc_rx_state_machine(
   2981     int unit, 
   2982     int stack_id, 
   2983     int ingress_port, 
   2984     bcm_esmc_pdu_data_t *esmc_pdu_data);
   2985 
   2986 /* Get quality level (QL) for ESMC. */
   2987 extern int bcm_tdpll_esmc_ql_get(
   2988     int unit, 
   2989     int stack_id, 
   2990     int dpll_index, 
   2991     bcm_esmc_quality_level_t *ql);
   2992 
   2993 /* Set quality level (QL) for ESMC. */
   2994 extern int bcm_tdpll_esmc_ql_set(
   2995     int unit, 
   2996     int stack_id, 
   2997     int dpll_index, 
   2998     bcm_esmc_quality_level_t ql);
   2999 
   3000 /* Get quality level (QL) for ESMC during holdover. */
   3001 extern int bcm_tdpll_esmc_holdover_ql_get(
   3002     int unit, 
   3003     int stack_id, 
   3004     int dpll_index, 
   3005     bcm_esmc_quality_level_t *ql);
   3006 
   3007 /* Set quality level (QL) for ESMC during holdover. */
   3008 extern int bcm_tdpll_esmc_holdover_ql_set(
   3009     int unit, 
   3010     int stack_id, 
   3011     int dpll_index, 
   3012     bcm_esmc_quality_level_t ql);
   3013 
   3014 /* Get MAC address for ESMC. */
   3015 extern int bcm_tdpll_esmc_mac_get(
   3016     int unit, 
   3017     int stack_id, 
   3018     int dpll_index, 
   3019     bcm_mac_t *mac);
   3020 
   3021 /* Set MAC address for ESMC. */
   3022 extern int bcm_tdpll_esmc_mac_set(
   3023     int unit, 
   3024     int stack_id, 
   3025     int dpll_index, 
   3026     bcm_mac_t *mac);
   3027 
   3028 /* Get ESMC PDU receive (Rx) enable state. */
   3029 extern int bcm_tdpll_esmc_rx_enable_get(
   3030     int unit, 
   3031     int stack_id, 
   3032     int *enable);
   3033 
   3034 /* Set ESMC PDU receive (Rx) enable state. */
   3035 extern int bcm_tdpll_esmc_rx_enable_set(
   3036     int unit, 
   3037     int stack_id, 
   3038     int enable);
   3039 
   3040 /* Get ESMC PDU transmit (Tx) enable state. */
   3041 extern int bcm_tdpll_esmc_tx_enable_get(
   3042     int unit, 
   3043     int stack_id, 
   3044     int dpll_index, 
   3045     int *enable);
   3046 
   3047 /* Set ESMC PDU transmit (Tx) enable state. */
   3048 extern int bcm_tdpll_esmc_tx_enable_set(
   3049     int unit, 
   3050     int stack_id, 
   3051     int dpll_index, 
   3052     int enable);
   3053 
   3054 /* Get port bitmap for ESMC Rx. */
   3055 extern int bcm_tdpll_esmc_rx_portbitmap_get(
   3056     int unit, 
   3057     int stack_id, 
   3058     int dpll_index, 
   3059     bcm_pbmp_t *pbmp);
   3060 
   3061 /* Set port bitmap for ESMC Rx. */
   3062 extern int bcm_tdpll_esmc_rx_portbitmap_set(
   3063     int unit, 
   3064     int stack_id, 
   3065     int dpll_index, 
   3066     bcm_pbmp_t pbmp);
   3067 
   3068 /* Get port bitmap for ESMC Tx. */
   3069 extern int bcm_tdpll_esmc_tx_portbitmap_get(
   3070     int unit, 
   3071     int stack_id, 
   3072     int dpll_index, 
   3073     bcm_pbmp_t *pbmp);
   3074 
   3075 /* Set port bitmap for ESMC Tx. */
   3076 extern int bcm_tdpll_esmc_tx_portbitmap_set(
   3077     int unit, 
   3078     int stack_id, 
   3079     int dpll_index, 
   3080     bcm_pbmp_t pbmp);
   3081 
   3082 /* Set SyncE clock type as per ITU-T G8264amd2. */
   3083 extern int bcm_tdpll_esmc_essm_code_set(
   3084     int unit, 
   3085     int stack_id, 
   3086     int dpll_index, 
   3087     bcm_esmc_essm_code_t  essm_code);
   3088 
   3089 /* Get SyncE clock type as per ITU-T G8264amd2. */
   3090 extern int bcm_tdpll_esmc_essm_code_get(
   3091     int unit, 
   3092     int stack_id, 
   3093     int dpll_index, 
   3094     bcm_esmc_essm_code_t  *essm_code);
   3095 
   3096 #endif /* BCM_HIDE_DISPATCHABLE */
   3097 
   3098 /* TDPLL event callback type */
   3099 typedef enum bcm_tdpll_event_cb_type_e {
   3100     bcmTdpllEventCbTypeQlChange,    /* QL change in ESMC Rx. */
   3101     bcmTdpllEventCbTypeEsmcTimeout, /* Timeout of ESMC Rx PDUs. */
   3102     bcmTdpllEventCbTypeSynceTsMiss, /* SyncE TS event missed. */
   3103     bcmTdpllEventCbTypeLinkDown,    /* port linkdown notification. */
   3104     bcmTdpllEventCbTypeMax          /* Number of event types supported. */
   3105 } bcm_tdpll_event_cb_type_t;
   3106 
   3107 typedef struct bcm_tdpll_event_cb_data_s {
   3108     bcm_tdpll_event_cb_type_t cb_event_type; /* event type that triggered the
   3109                                            callback . */
   3110     void *cb_data; 
   3111 } bcm_tdpll_event_cb_data_t;
   3112 
   3113 typedef struct bcm_tdpll_ql_change_event_cb_data_s {
   3114     bcm_tdpll_event_cb_type_t event_type; /* event type that triggered the
   3115                                            callback. */
   3116     bcm_port_t port;                    /* Ingress port number for which the QL
   3117                                            change is seen */
   3118     bcm_esmc_quality_level_t ql_old;    /* previous QL. */
   3119     bcm_esmc_quality_level_t ql_new;    /* current QL. */
   3120 } bcm_tdpll_ql_change_event_cb_data_t;
   3121 
   3122 typedef struct bcm_tdpll_esmc_timeout_event_cb_data_s {
   3123     bcm_tdpll_event_cb_type_t event_type; /* Event callback type. */
   3124     bcm_port_t port;                    /* Ingress port number for which the
   3125                                            ESMC timeout is seen */
   3126 } bcm_tdpll_esmc_timeout_event_cb_data_t;
   3127 
   3128 typedef struct bcm_tdpll_synce_ts_miss_event_cb_data_s {
   3129     bcm_tdpll_event_cb_type_t event_type; /* Event callback type. */
   3130     bcm_port_t port;                    /* Ingress port number for which the TS
   3131                                            event loss is detected */
   3132 } bcm_tdpll_synce_ts_miss_event_cb_data_t;
   3133 
   3134 typedef struct bcm_tdpll_port_linkdown_event_cb_data_s {
   3135     bcm_tdpll_event_cb_type_t event_type; /* Event callback type. */
   3136     bcm_port_t port;                    /* Ingress port number for which the
   3137                                            port linkdown is detected */
   3138 } bcm_tdpll_port_linkdown_event_cb_data_t;
   3139 
   3140 /* prototype for callback function to register for events. */
   3141 typedef int (*bcm_tdpll_event_cb_f)(
   3142     int unit, 
   3143     int stack_id, 
   3144     bcm_tdpll_event_cb_data_t *data);
   3145 
   3146 #ifndef BCM_HIDE_DISPATCHABLE
   3147 
   3148 /* Register for notifications related to ESMC support with external DPLL */
   3149 extern int bcm_tdpll_event_callback_register(
   3150     int unit, 
   3151     int stack_id, 
   3152     bcm_tdpll_event_cb_f event_cb);
   3153 
   3154 /* 
   3155  * Unregister for notifications related to ESMC support with external
   3156  * DPLL
   3157  */
   3158 extern int bcm_tdpll_event_callback_unregister(
   3159     int unit, 
   3160     int stack_id);
   3161 
   3162 /* Initialize Telecom G8265 Profile */
   3163 extern int bcm_ptp_telecom_g8265_init(
   3164     int unit, 
   3165     bcm_ptp_stack_id_t ptp_id, 
   3166     int clock_num);
   3167 
   3168 /* Get Telecom G8265 Profile Network Option */
   3169 extern int bcm_ptp_telecom_g8265_network_option_get(
   3170     int unit, 
   3171     bcm_ptp_stack_id_t ptp_id, 
   3172     int clock_num, 
   3173     bcm_ptp_telecom_g8265_network_option_t *network_option);
   3174 
   3175 /* Set Telecom G8265 Profile Network Option */
   3176 extern int bcm_ptp_telecom_g8265_network_option_set(
   3177     int unit, 
   3178     bcm_ptp_stack_id_t ptp_id, 
   3179     int clock_num, 
   3180     bcm_ptp_telecom_g8265_network_option_t network_option);
   3181 
   3182 /* Set Telecom G8265 Quality Level */
   3183 extern int bcm_ptp_telecom_g8265_quality_level_set(
   3184     int unit, 
   3185     bcm_ptp_stack_id_t ptp_id, 
   3186     int clock_num, 
   3187     bcm_ptp_telecom_g8265_quality_level_t ql);
   3188 
   3189 /* Set Telecom G8265 Profile Message Receipt Timeout */
   3190 extern int bcm_ptp_telecom_g8265_receipt_timeout_set(
   3191     int unit, 
   3192     bcm_ptp_stack_id_t ptp_id, 
   3193     int clock_num, 
   3194     bcm_ptp_message_type_t message_type, 
   3195     uint32 receipt_timeout);
   3196 
   3197 /* Get Telecom G8265 Profile Message Receipt Timeout */
   3198 extern int bcm_ptp_telecom_g8265_receipt_timeout_get(
   3199     int unit, 
   3200     bcm_ptp_stack_id_t ptp_id, 
   3201     int clock_num, 
   3202     bcm_ptp_message_type_t message_type, 
   3203     uint32 *receipt_timeout);
   3204 
   3205 /* Set Telecom G8265 Profile Pakcet Stats Thresholds */
   3206 extern int bcm_ptp_telecom_g8265_pktstats_thresholds_set(
   3207     int unit, 
   3208     bcm_ptp_stack_id_t ptp_id, 
   3209     int clock_num, 
   3210     bcm_ptp_telecom_g8265_pktstats_t thresholds);
   3211 
   3212 /* Get Telecom G8265 Profile Pakcet Stats Thresholds */
   3213 extern int bcm_ptp_telecom_g8265_pktstats_thresholds_get(
   3214     int unit, 
   3215     bcm_ptp_stack_id_t ptp_id, 
   3216     int clock_num, 
   3217     bcm_ptp_telecom_g8265_pktstats_t *thresholds);
   3218 
   3219 /* List Telecom G8265 Profile Packet Masters */
   3220 extern int bcm_ptp_telecom_g8265_packet_master_list(
   3221     int unit, 
   3222     bcm_ptp_stack_id_t ptp_id, 
   3223     int clock_num, 
   3224     int max_master_count, 
   3225     int *num_masters, 
   3226     int *best_master, 
   3227     bcm_ptp_telecom_g8265_pktmaster_t *pktmaster);
   3228 
   3229 /* Get Telecom G8265 Profile Best Packet Master */
   3230 extern int bcm_ptp_telecom_g8265_packet_master_best_get(
   3231     int unit, 
   3232     bcm_ptp_stack_id_t ptp_id, 
   3233     int clock_num, 
   3234     bcm_ptp_telecom_g8265_pktmaster_t *pktmaster);
   3235 
   3236 /* Add Telecom G8265 Profile Packet Master */
   3237 extern int bcm_ptp_telecom_g8265_packet_master_add(
   3238     int unit, 
   3239     bcm_ptp_stack_id_t ptp_id, 
   3240     int clock_num, 
   3241     int port_num, 
   3242     bcm_ptp_clock_port_address_t *address);
   3243 
   3244 /* Get Telecom G8265 Profile Packet Master By Address */
   3245 extern int bcm_ptp_telecom_g8265_packet_master_get(
   3246     int unit, 
   3247     bcm_ptp_stack_id_t ptp_id, 
   3248     int clock_num, 
   3249     bcm_ptp_clock_port_address_t *address, 
   3250     bcm_ptp_telecom_g8265_pktmaster_t *pktmaster);
   3251 
   3252 /* Remove Telecom G8265 Profile Packet Master */
   3253 extern int bcm_ptp_telecom_g8265_packet_master_remove(
   3254     int unit, 
   3255     bcm_ptp_stack_id_t ptp_id, 
   3256     int clock_num, 
   3257     int port_num, 
   3258     bcm_ptp_clock_port_address_t *address);
   3259 
   3260 /* Set Telecom G8265 Profile Pakcet Master Lockout */
   3261 extern int bcm_ptp_telecom_g8265_packet_master_lockout_set(
   3262     int unit, 
   3263     bcm_ptp_stack_id_t ptp_id, 
   3264     int clock_num, 
   3265     uint8 lockout, 
   3266     bcm_ptp_clock_port_address_t *address);
   3267 
   3268 /* Set Telecom G8265 Profile Packet Master Non Reversion */
   3269 extern int bcm_ptp_telecom_g8265_packet_master_non_reversion_set(
   3270     int unit, 
   3271     bcm_ptp_stack_id_t ptp_id, 
   3272     int clock_num, 
   3273     uint8 nonres, 
   3274     bcm_ptp_clock_port_address_t *address);
   3275 
   3276 /* Set Telecom G8265 Profile Duration Wait */
   3277 extern int bcm_ptp_telecom_g8265_packet_master_wait_duration_set(
   3278     int unit, 
   3279     bcm_ptp_stack_id_t ptp_id, 
   3280     int clock_num, 
   3281     uint64 wait_sec, 
   3282     bcm_ptp_clock_port_address_t *address);
   3283 
   3284 /* Set Telecom G8265 Profile Packet Master Priority Override */
   3285 extern int bcm_ptp_telecom_g8265_packet_master_priority_override(
   3286     int unit, 
   3287     bcm_ptp_stack_id_t ptp_id, 
   3288     int clock_num, 
   3289     uint8 override, 
   3290     bcm_ptp_clock_port_address_t *address);
   3291 
   3292 /* Set Telecom G8265 Profile Packet Master Priority */
   3293 extern int bcm_ptp_telecom_g8265_packet_master_priority_set(
   3294     int unit, 
   3295     bcm_ptp_stack_id_t ptp_id, 
   3296     int clock_num, 
   3297     uint16 priority, 
   3298     bcm_ptp_clock_port_address_t *address);
   3299 
   3300 /* Shutdown Telecom G8265 Profile */
   3301 extern int bcm_ptp_telecom_g8265_shutdown(
   3302     int unit);
   3303 
   3304 /* Get enable/disable state of modular system functionality. */
   3305 extern int bcm_ptp_modular_enable_get(
   3306     int unit, 
   3307     bcm_ptp_stack_id_t ptp_id, 
   3308     int clock_num, 
   3309     int *enable, 
   3310     uint32 *flags);
   3311 
   3312 /* Set enable/disable state of modular system functionality. */
   3313 extern int bcm_ptp_modular_enable_set(
   3314     int unit, 
   3315     bcm_ptp_stack_id_t ptp_id, 
   3316     int clock_num, 
   3317     int enable, 
   3318     uint32 flags);
   3319 
   3320 /* Get verbose program control option of modular system functionality. */
   3321 extern int bcm_ptp_modular_verbose_get(
   3322     int unit, 
   3323     bcm_ptp_stack_id_t ptp_id, 
   3324     int clock_num, 
   3325     int *verbose);
   3326 
   3327 /* Set verbose program control option of modular system functionality. */
   3328 extern int bcm_ptp_modular_verbose_set(
   3329     int unit, 
   3330     bcm_ptp_stack_id_t ptp_id, 
   3331     int clock_num, 
   3332     int verbose);
   3333 
   3334 /* Get PHY port bitmap. */
   3335 extern int bcm_ptp_modular_portbitmap_get(
   3336     int unit, 
   3337     bcm_ptp_stack_id_t ptp_id, 
   3338     int clock_num, 
   3339     bcm_pbmp_t *pbmp);
   3340 
   3341 /* Set PHY port bitmap. */
   3342 extern int bcm_ptp_modular_portbitmap_set(
   3343     int unit, 
   3344     bcm_ptp_stack_id_t ptp_id, 
   3345     int clock_num, 
   3346     bcm_pbmp_t pbmp);
   3347 
   3348 /* Get PHY timestamping configuration state and data. */
   3349 extern int bcm_ptp_modular_phyts_get(
   3350     int unit, 
   3351     bcm_ptp_stack_id_t ptp_id, 
   3352     int clock_num, 
   3353     int *phyts, 
   3354     int *framesync_pin);
   3355 
   3356 /* Set PHY timestamping configuration state and data. */
   3357 extern int bcm_ptp_modular_phyts_set(
   3358     int unit, 
   3359     bcm_ptp_stack_id_t ptp_id, 
   3360     int clock_num, 
   3361     int phyts, 
   3362     int framesync_pin);
   3363 
   3364 /* Get enable/disable state of C-TDEV processing. */
   3365 extern int bcm_ptp_ctdev_enable_get(
   3366     int unit, 
   3367     bcm_ptp_stack_id_t ptp_id, 
   3368     int clock_num, 
   3369     int *enable, 
   3370     uint32 *flags);
   3371 
   3372 /* Set enable/disable state of C-TDEV processing. */
   3373 extern int bcm_ptp_ctdev_enable_set(
   3374     int unit, 
   3375     bcm_ptp_stack_id_t ptp_id, 
   3376     int clock_num, 
   3377     int enable, 
   3378     uint32 flags);
   3379 
   3380 /* Get verbose program control option of C-TDEV processing. */
   3381 extern int bcm_ptp_ctdev_verbose_get(
   3382     int unit, 
   3383     bcm_ptp_stack_id_t ptp_id, 
   3384     int clock_num, 
   3385     int *verbose);
   3386 
   3387 /* Set verbose program control option of C-TDEV processing. */
   3388 extern int bcm_ptp_ctdev_verbose_set(
   3389     int unit, 
   3390     bcm_ptp_stack_id_t ptp_id, 
   3391     int clock_num, 
   3392     int verbose);
   3393 
   3394 /* Get C-TDEV recursive algorithm forgetting factor (alpha). */
   3395 extern int bcm_ptp_ctdev_alpha_get(
   3396     int unit, 
   3397     bcm_ptp_stack_id_t ptp_id, 
   3398     int clock_num, 
   3399     uint16 *alpha_numerator, 
   3400     uint16 *alpha_denominator);
   3401 
   3402 /* Set C-TDEV recursive algorithm forgetting factor (alpha). */
   3403 extern int bcm_ptp_ctdev_alpha_set(
   3404     int unit, 
   3405     bcm_ptp_stack_id_t ptp_id, 
   3406     int clock_num, 
   3407     uint16 alpha_numerator, 
   3408     uint16 alpha_denominator);
   3409 
   3410 /* Register a C-TDEV alarm callback function. */
   3411 extern int bcm_ptp_ctdev_alarm_callback_register(
   3412     int unit, 
   3413     bcm_ptp_stack_id_t ptp_id, 
   3414     int clock_num, 
   3415     bcm_ptp_ctdev_alarm_cb alarm_cb);
   3416 
   3417 /* Unregister a C-TDEV alarm callback function. */
   3418 extern int bcm_ptp_ctdev_alarm_callback_unregister(
   3419     int unit, 
   3420     bcm_ptp_stack_id_t ptp_id, 
   3421     int clock_num);
   3422 
   3423 /* Set or Clear the drop counters for a clock port. */
   3424 extern int bcm_ptp_clock_port_drop_counters_enable_set(
   3425     int unit, 
   3426     bcm_ptp_stack_id_t ptp_id, 
   3427     int clock_num, 
   3428     uint32 clock_port, 
   3429     int enable);
   3430 
   3431 /* Set or Clear the drop counters for a clock port. */
   3432 extern int bcm_ptp_clock_port_drop_counters_get(
   3433     int unit, 
   3434     bcm_ptp_stack_id_t ptp_id, 
   3435     int clock_num, 
   3436     uint32 clock_port, 
   3437     bcm_ptp_clock_port_packet_drop_counters_t *per_port_packet_drop_counters);
   3438 
   3439 /* Set flags to be used for overriding BMCA. */
   3440 extern int bcm_ptp_clock_bmca_override_set(
   3441     int unit, 
   3442     bcm_ptp_stack_id_t ptp_id, 
   3443     int clock_num, 
   3444     uint32 flags, 
   3445     uint32 enable_mask);
   3446 
   3447 /* Get flags to be used for overriding BMCA. */
   3448 extern int bcm_ptp_clock_bmca_override_get(
   3449     int unit, 
   3450     bcm_ptp_stack_id_t ptp_id, 
   3451     int clock_num, 
   3452     uint32 *flags, 
   3453     uint32 *enable_mask);
   3454 
   3455 #endif /* BCM_HIDE_DISPATCHABLE */
   3456 
   3457 /* Macros required for APTS automatic switching feature. */
   3458 #define BCM_PTP_CLOCK_APTS_MAX_FREQ_SOURCES (3)        /* Max number of
   3459                                                           frequency sources
   3460                                                           supported */
   3461 #define BCM_PTP_CLOCK_APTS_MAX_TIME_SOURCES (2)        /* Max number of time
   3462                                                           sources supported */
   3463 
   3464 /* APTS supported sources. */
   3465 typedef enum bcm_ptp_clock_apts_source_e {
   3466     bcmPtpClockAptsSourceSynceInternalDpll = 0x01, 
   3467     bcmPtpClockAptsSourceSynceExternalDpll = 0x02, 
   3468     bcmPtpClockAptsSourceGps = 0x04, 
   3469     bcmPtpClockAptsSourcePtp = 0x08, 
   3470     bcmPtpClockAptsSourceLast = 0xFFFF 
   3471 } bcm_ptp_clock_apts_source_t;
   3472 
   3473 /* Supported APTS operating modes. */
   3474 typedef enum bcm_ptp_clock_apts_mode_e {
   3475     bcmPtpClockAptsModeSyncEGps,        /* Frequency source: SyncE, Time source:
   3476                                            GPS */
   3477     bcmPtpClockAptsModeSyncEPtp, 
   3478     bcmPtpClockAptsModeGpsGps, 
   3479     bcmPtpClockAptsModePtpPtp, 
   3480     bcmPtpClockAptsModeSyncEHoldover, 
   3481     bcmPtpClockAptsModeHoldoverHoldover, 
   3482     bcmPtpClockAptsModeLast 
   3483 } bcm_ptp_clock_apts_mode_t;
   3484 
   3485 #ifndef BCM_HIDE_DISPATCHABLE
   3486 
   3487 /* Get enable/disable status of the APTS automatic switching feature. */
   3488 extern int bcm_ptp_clock_apts_enable_get(
   3489     int unit, 
   3490     bcm_ptp_stack_id_t ptp_id, 
   3491     int clock_num, 
   3492     int *enable);
   3493 
   3494 /* Set enable/disable status of the APTS automatic switching feature. */
   3495 extern int bcm_ptp_clock_apts_enable_set(
   3496     int unit, 
   3497     bcm_ptp_stack_id_t ptp_id, 
   3498     int clock_num, 
   3499     int enable);
   3500 
   3501 /* Get the configured APTS time and frequency priorities */
   3502 extern int bcm_ptp_clock_apts_source_prio_get(
   3503     int unit, 
   3504     bcm_ptp_stack_id_t ptp_id, 
   3505     int clock_num, 
   3506     int *num_sources, 
   3507     bcm_ptp_clock_apts_source_t *priority_list);
   3508 
   3509 /* Set the APTS time and frequency priorities */
   3510 extern int bcm_ptp_clock_apts_source_prio_set(
   3511     int unit, 
   3512     bcm_ptp_stack_id_t ptp_id, 
   3513     int clock_num, 
   3514     int num_sources, 
   3515     bcm_ptp_clock_apts_source_t *priority_list);
   3516 
   3517 /* Get the current APTS mode of operation */
   3518 extern int bcm_ptp_clock_apts_mode_get(
   3519     int unit, 
   3520     bcm_ptp_stack_id_t ptp_id, 
   3521     int clock_num, 
   3522     bcm_ptp_clock_apts_mode_t *current_mode);
   3523 
   3524 /* Get the APTS source state */
   3525 extern int bcm_ptp_clock_apts_source_enable_get(
   3526     int unit, 
   3527     bcm_ptp_stack_id_t ptp_id, 
   3528     int clock_num, 
   3529     bcm_ptp_clock_apts_source_t source, 
   3530     int *enable);
   3531 
   3532 /* Set the APTS source state */
   3533 extern int bcm_ptp_clock_apts_source_enable_set(
   3534     int unit, 
   3535     bcm_ptp_stack_id_t ptp_id, 
   3536     int clock_num, 
   3537     bcm_ptp_clock_apts_source_t source, 
   3538     int enable);
   3539 
   3540 #endif /* BCM_HIDE_DISPATCHABLE */
   3541 
   3542 /* PTP External PHY sync - Pin to be used for PHY Framesync (SYNC_IN1) */
   3543 typedef enum bcm_ptp_extphy_framesync_pin_e {
   3544     bcm_ptp_extphy_framesync_pin_tsgpio0 = 0, /* TS GPIO0 */
   3545     bcm_ptp_extphy_framesync_pin_tsgpio1 = 1, /* TS GPIO1 */
   3546     bcm_ptp_extphy_framesync_pin_gpio0 = 2, /* GPIO0 */
   3547     bcm_ptp_extphy_framesync_pin_gpio1 = 3, /* GPIO1 */
   3548     bcm_ptp_extphy_framesync_pin_gpio2 = 4, /* GPIO2 */
   3549     bcm_ptp_extphy_framesync_pin_gpio3 = 5 /* GPIO3 */
   3550 } bcm_ptp_extphy_framesync_pin_t;
   3551 
   3552 /* PTP External PHY sync - Pin configured for PHY 4KHz reference */
   3553 typedef enum bcm_ptp_extphy_freq_pin_e {
   3554     bcm_ptp_extphy_freq_pin_bs0_hb = -1, /* BS0 Heartbit */
   3555     bcm_ptp_extphy_freq_pin_bs1_hb = -2 /* BS1 hearbit */
   3556 } bcm_ptp_extphy_freq_pin_t;
   3557 
   3558 /* 
   3559  * PHY sync user function that will be called while running phy sync
   3560  * state machine
   3561  */
   3562 typedef int (*bcm_ptp_external_phy_sync)(
   3563     int unit, 
   3564     int stack_id, 
   3565     int clock_num, 
   3566     bcm_pbmp_t pbm, 
   3567     uint64 ref_phase);
   3568 
   3569 /* PTP external PHY config */
   3570 typedef struct bcm_ptp_external_phy_config_s {
   3571     bcm_ptp_extphy_framesync_pin_t framesync_pin; /* Pin to be used for PHY Framesync
   3572                                            (SYNC_IN1) e.g. GPIO3 */
   3573     bcm_ptp_extphy_freq_pin_t freq_pin; /* Pin configured for PHY 4KHz reference
   3574                                            - BS0 HB or BS1 HB */
   3575     uint64 cpu_latency_nsec;            /* Latency to configure external phy
   3576                                            ports */
   3577     bcm_pbmp_t pbm;                     /* external phy port bitmap e.g ge0-ge3 */
   3578     bcm_ptp_external_phy_sync ext_physync_func; /* PHY sync user function will be called
   3579                                            while running phy sync state machine */
   3580 } bcm_ptp_external_phy_config_t;
   3581 
   3582 #ifndef BCM_HIDE_DISPATCHABLE
   3583 
   3584 /* Run state machine to synchronize CMIC time with external PHY time */
   3585 extern int bcm_ptp_external_phy_synchronize(
   3586     int unit, 
   3587     bcm_ptp_stack_id_t ptp_id, 
   3588     int clock_num, 
   3589     bcm_ptp_external_phy_config_t *extphy_config);
   3590 
   3591 /* Set the GPS offset value */
   3592 extern int bcm_ptp_clock_apts_gps_offset_set(
   3593     int unit, 
   3594     bcm_ptp_stack_id_t ptp_id, 
   3595     int clock_num, 
   3596     int offset_nsec);
   3597 
   3598 /* Get the GPS offset value */
   3599 extern int bcm_ptp_clock_apts_gps_offset_get(
   3600     int unit, 
   3601     bcm_ptp_stack_id_t ptp_id, 
   3602     int clock_num, 
   3603     int *offset_nsec);
   3604 
   3605 #endif /* BCM_HIDE_DISPATCHABLE */
   3606 
   3607 /* PTP tlv_action enumeration. Specify the action for sending TLV */
   3608 typedef enum bcm_ptp_tlv_action_e {
   3609     bcmPtpTlvActionAppendGrantUnicastTransmissionTlv, /* Append TLV to GRANT_UNICAST_TX TLV */
   3610     bcmPtpTlvActionLast                 /* TLV action last */
   3611 } bcm_ptp_tlv_action_t;
   3612 
   3613 #ifndef BCM_HIDE_DISPATCHABLE
   3614 
   3615 /* Add a new TLV config */
   3616 extern int bcm_ptp_clock_port_tlv_config_add(
   3617     int unit, 
   3618     bcm_ptp_stack_id_t ptp_id, 
   3619     int clock_index, 
   3620     uint32 clock_port, 
   3621     bcm_ptp_tlv_type_t tlv_type, 
   3622     uint16 data_len, 
   3623     uint8 *data, 
   3624     bcm_ptp_tlv_action_t action, 
   3625     int config_id);
   3626 
   3627 /* delete existing TLV config */
   3628 extern int bcm_ptp_clock_port_tlv_config_delete(
   3629     int unit, 
   3630     bcm_ptp_stack_id_t ptp_id, 
   3631     int clock_index, 
   3632     uint32 clock_port, 
   3633     int config_id);
   3634 
   3635 /* delete all TLV config */
   3636 extern int bcm_ptp_clock_port_tlv_config_delete_all(
   3637     int unit, 
   3638     bcm_ptp_stack_id_t ptp_id, 
   3639     int clock_index, 
   3640     uint32 clock_port);
   3641 
   3642 /* Enable or disable a config */
   3643 extern int bcm_ptp_clock_tlv_enable_set(
   3644     int unit, 
   3645     bcm_ptp_stack_id_t ptp_id, 
   3646     int clock_index, 
   3647     uint32 clock_port, 
   3648     int config_id, 
   3649     int enable);
   3650 
   3651 /* Get the status of a config */
   3652 extern int bcm_ptp_clock_tlv_enable_get(
   3653     int unit, 
   3654     bcm_ptp_stack_id_t ptp_id, 
   3655     int clock_index, 
   3656     uint32 clock_port, 
   3657     int config_id, 
   3658     int *enable);
   3659 
   3660 #endif /* defined(INCLUDE_PTP) */
   3661 
   3662 #endif /* BCM_HIDE_DISPATCHABLE */
   3663 
   3664 #endif /* __BCM_PTP_H__ */