ptp.h (9106B)
1 /** \file bcm_int/dnx/ptp/ptp.h 2 * 3 * DNX PTP headers 4 * 5 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 6 * 7 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 8 */ 9 10 #ifndef DNX_PTP_H_INCLUDED 11 /* { */ 12 #define DNX_PTP_H_INCLUDED 13 14 #ifndef BCM_DNX_SUPPORT 15 #error "This file is for use by DNX (JR2) family only!" 16 #endif 17 18 /* 19 * Include files. 20 * { 21 */ 22 #include <bcm/port.h> 23 24 /* 25 * } 26 */ 27 28 /* 29 * DEFINES 30 * { 31 */ 32 33 /* 34 * } 35 */ 36 37 /* 38 * STRUCTURES 39 * { 40 */ 41 /* 42 * } 43 */ 44 45 /** 46 * \brief 47 * Initialize PTP module. 48 * 49 * \param [in] unit - The unit number. 50 * \return 51 * See \ref shr_error_e 52 * \remark 53 * * None 54 * \see 55 * * None 56 */ 57 shr_error_e dnx_ptp_init( 58 int unit); 59 60 /** 61 * \brief - set 1588 protocol configuaion for port 62 * 63 * \param [in] unit - chip unit id 64 * \param [in] port - logical port 65 * \param [in] config_count - (IN) config_array size 66 * \param [in] config_array - (IN) 1588 port configuration 67 * 68 * \return 69 * shr_error_e - see _SHR_E_* 70 * 71 * \remarks 72 * Disable port 1588 configuration - config_count = 0 73 * Enable port 1588 configuration - config_count = 1 74 * config_array->flags = 75 * BCM_PORT_TIMESYNC_DEFAULT mast be on 76 * BCM_PORT_TIMESYNC_ONE_STEP_TIMESTAMP when one step Tranparent clock (TC) is enabled system updates the 77 * correction field in 1588 Event 1588 messages. 78 * BCM_PORT_TIMESYNC_TWO_STEP_TIMESTAMP when step step Tranparent clock (TC) is enabled system records the 79 * 1588 Event 1588 messages TX time. 80 * 1588 event messages: 81 * 1. SYNC 82 * 2. DELAY_REQ 83 * 3. PDELAY_REQ 84 * 4. PDELAY_RESP 85 * config_array->pkt_drop, config_array->pkt_tocpu - bit masks indicating wehter to forward (drop-0,tocpu-0), 86 * drop(drop-1) or trap(tocpu-1) the packet 87 88 * \see 89 * * None 90 */ 91 shr_error_e dnx_ptp_port_timesync_config_set( 92 int unit, 93 bcm_port_t port, 94 int config_count, 95 bcm_port_timesync_config_t * config_array); 96 97 /** 98 * \brief - get 1588 protocol port configuaion 99 * 100 * \param [in] unit - chip unit id 101 * \param [in] port - logical port 102 * \param [in] array_size - config_array size 103 * \param [out] config_array - 1588 port configuration 104 * \param [out] array_count - config_array size 105 * 106 * \return 107 * shr_error_e - see _SHR_E_* 108 * 109 * \remarks 110 * output will be the follwing: 111 * when port 1588 configuration Disabled - *array_count = 0 112 * when port 1588 configuration Enabled - *array_count = 1, config_array is set with the port configuration 113 * \see 114 * * None 115 */ 116 shr_error_e dnx_ptp_port_timesync_config_get( 117 int unit, 118 bcm_port_t port, 119 int array_size, 120 bcm_port_timesync_config_t * config_array, 121 int *array_count); 122 123 /** 124 * \brief - Verify parameters for the following APIs: 125 * bcm_port_timesync_config_set 126 * 127 * \param [in] unit - chip unit id 128 * \param [in] port - logical port 129 * \param [in] config_count - (IN) config_array size 130 * \param [in] config_array - (IN) 1588 port configuration 131 * 132 * \return 133 * shr_error_e - see _SHR_E_* 134 * 135 * \remarks 136 * * None 137 * \see 138 * * None 139 */ 140 shr_error_e dnx_ptp_timesync_config_set_verify( 141 int unit, 142 bcm_port_t port, 143 int config_count, 144 bcm_port_timesync_config_t * config_array); 145 146 /** 147 * \brief - verify API bcm_dnx_port_timesync_config_get 148 * 149 * \param [in] unit - chip unit id 150 * \param [in] port - logical port 151 * \param [in] array_size - config_array size 152 * \param [out] config_array - 1588 port configuration 153 * \param [out] array_count - config_array size 154 * 155 * \return 156 * shr_error_e - see _SHR_E_* 157 * 158 * \remarks 159 * * None 160 * \see 161 * * None 162 */ 163 shr_error_e dnx_ptp_timesync_config_get_verify( 164 int unit, 165 bcm_port_t port, 166 int array_size, 167 bcm_port_timesync_config_t * config_array, 168 int *array_count); 169 170 /** 171 * \brief - set 1588 ptp delay per port 172 * 173 * \param [in] unit - chip unit id 174 * \param [in] port - logical port 175 * \param [in] value - value of the ptp delay (nanoseconds units) 176 * 177 * \return 178 * shr_error_e - see _SHR_E_* 179 * 180 * \remarks 181 * * None 182 * \see 183 * * None 184 */ 185 shr_error_e dnx_ptp_port_delay_set( 186 int unit, 187 bcm_port_t port, 188 int value); 189 190 /** 191 * \brief - get 1588 ptp delay per port 192 * 193 * \param [in] unit - chip unit id 194 * \param [in] port - logical port 195 * \param [out] value - value of the ptp delay (units according to HW units) 196 * 197 * \return 198 * shr_error_e - see _SHR_E_* 199 * 200 * \remarks 201 * * None 202 * \see 203 * * None 204 */ 205 shr_error_e dnx_ptp_port_delay_get( 206 int unit, 207 bcm_port_t port, 208 int *value); 209 210 /** 211 * \brief - Verify function for bcm_dnx_port_control_phy_timesync_set(). 212 * 213 * \param [in] unit - Unit ID 214 * \param [in] port - logical port 215 * \param [in] type - timesync configuration types 216 * \param [in] value - timesync configuration values 217 * 218 * \return 219 * See shr_error_r 220 * \remark 221 * * None 222 * \see 223 * * None 224 */ 225 int dnx_ptp_phy_timesync_set_verify( 226 int unit, 227 bcm_port_t port, 228 bcm_port_control_phy_timesync_t type, 229 uint64 value); 230 231 /** 232 * \brief - Verify function for bcm_dnx_port_control_phy_timesync_get(). 233 * 234 * \param [in] unit - Unit ID 235 * \param [in] port - logical port 236 * \param [in] type - timesync configuration types 237 * \param [out] value - timesync configuration values 238 * 239 * \return 240 * See shr_error_r 241 * \remark 242 * * None 243 * \see 244 * * None 245 */ 246 int dnx_ptp_phy_timesync_get_verify( 247 int unit, 248 bcm_port_t port, 249 bcm_port_control_phy_timesync_t type, 250 uint64 *value); 251 252 /** 253 * \brief - Set various PHY timesync controls for port. 254 * 255 * \param [in] unit - Unit ID 256 * \param [in] port - logical port 257 * \param [in] type - timesync configuration types 258 * \param [in] value - timesync configuration values 259 * 260 * \return 261 * See shr_error_r 262 * \remark 263 * * None 264 * \see 265 * * None 266 */ 267 int dnx_ptp_phy_timesync_set( 268 int unit, 269 bcm_port_t port, 270 bcm_port_control_phy_timesync_t type, 271 uint64 value); 272 273 /** 274 * \brief - Get various PHY timesync controls for port. 275 * 276 * \param [in] unit - Unit ID 277 * \param [in] port - logical port 278 * \param [in] type - timesync configuration types 279 * \param [out] value - timesync configuration values 280 * 281 * \return 282 * See shr_error_r 283 * \remark 284 * * None 285 * \see 286 * * None 287 */ 288 int dnx_ptp_phy_timesync_get( 289 int unit, 290 bcm_port_t port, 291 bcm_port_control_phy_timesync_t type, 292 uint64 *value); 293 294 /** 295 * \brief - Verify function for bcm_dnx_port_phy_timesync_config_set(). 296 * 297 * \param [in] unit - Unit ID 298 * \param [in] port - logical port 299 * \param [in] conf - timesync configuration 300 * 301 * \return 302 * See shr_error_r 303 * \remark 304 * * None 305 * \see 306 * * None 307 */ 308 int dnx_ptp_phy_timesync_config_set_verify( 309 int unit, 310 bcm_port_t port, 311 bcm_port_phy_timesync_config_t * conf); 312 313 /** 314 * \brief - Verify function for bcm_dnx_port_phy_timesync_config_get(). 315 * 316 * \param [in] unit - Unit ID 317 * \param [in] port - logical port 318 * \param [in] conf - timesync configuration 319 * 320 * \return 321 * See shr_error_r 322 * \remark 323 * * None 324 * \see 325 * * None 326 */ 327 int dnx_ptp_phy_timesync_config_get_verify( 328 int unit, 329 bcm_port_t port, 330 bcm_port_phy_timesync_config_t * conf); 331 332 /** 333 * \brief - Set various PHY timesync configuaion for port. 334 * 335 * \param [in] unit - Unit ID 336 * \param [in] port - logical port 337 * \param [in] conf - timesync configuration 338 * 339 * \return 340 * See shr_error_r 341 * \remark 342 * * None 343 * \see 344 * * None 345 */ 346 int dnx_ptp_phy_timesync_config_set( 347 int unit, 348 bcm_port_t port, 349 bcm_port_phy_timesync_config_t * conf); 350 351 /** 352 * \brief - Get various PHY timesync configuration for port. 353 * 354 * \param [in] unit - Unit ID 355 * \param [in] port - logical port 356 * \param [out] conf - timesync configuration 357 * 358 * \return 359 * See shr_error_r 360 * \remark 361 * * None 362 * \see 363 * * None 364 */ 365 int dnx_ptp_phy_timesync_config_get( 366 int unit, 367 bcm_port_t port, 368 bcm_port_phy_timesync_config_t * conf); 369 370 /** 371 * \brief - Verify function for bcm_dnx_port_timesync_tx_info_get(). 372 * 373 * \param [in] unit - Unit ID 374 * \param [in] port - logical port 375 * \param [out] tx_info - timesync tx info 376 * 377 * \return 378 * See shr_error_r 379 * \remark 380 * * None 381 * \see 382 * * None 383 */ 384 int dnx_ptp_timesync_tx_info_get_verify( 385 int unit, 386 bcm_port_t port, 387 bcm_port_timesync_tx_info_t * tx_info); 388 389 /** 390 * \brief - Get two-step PTP PHY timesync tx info for port. 391 * 392 * \param [in] unit - Unit ID 393 * \param [in] port - logical port 394 * \param [out] tx_info - timesync tx info 395 * 396 * \return 397 * See shr_error_r 398 * \remark 399 * * None 400 * \see 401 * * None 402 */ 403 int dnx_ptp_port_timesync_tx_info_set( 404 int unit, 405 bcm_port_t port, 406 bcm_port_timesync_tx_info_t * tx_info); 407 408 /* } */ 409 #endif /* DNX_PTP_H_INCLUDED */