time.h (13575B)
1 /* 2 * DO NOT EDIT THIS FILE! 3 * This file is auto-generated. 4 * Edits to this file will be lost when it is regenerated. 5 * 6 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 7 * 8 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 9 */ 10 11 #ifndef BCMINT_LTSW_MBCM_TIME_H 12 #define BCMINT_LTSW_MBCM_TIME_H 13 14 #include <bcm/time.h> 15 #include <bcm/types.h> 16 #include <bcm/switch.h> 17 18 /*! 19 * \brief Initialize time module. 20 * 21 * \param [in] unit Unit Number. 22 * 23 * \retval SHR_E_NONE No errors. 24 * \retval !SHR_E_NONE Failure. 25 */ 26 typedef int (*time_init_f)(int unit); 27 28 /*! 29 * \brief De-initializes time module. 30 * 31 * \param [in] unit Unit Number. 32 * 33 * \retval SHR_E_NONE No errors. 34 * \retval !SHR_E_NONE Failure. 35 */ 36 typedef int (*time_deinit_f)(int unit); 37 38 /*! 39 * \brief Set syncE clock output frequency beased on the input divisor settings. 40 * 41 * \param [in] unit Unit Number. 42 * \param [in] clk_src SyncE clock source type. 43 * \param [in] divisor SyncE divisor setting. 44 * 45 * \retval SHR_E_NONE No errors. 46 * \retval !SHR_E_NONE Failure. 47 */ 48 typedef int (*time_synce_clock_set_f)( 49 int unit, 50 bcm_time_synce_clock_src_type_t clk_src, 51 bcm_time_synce_divisor_setting_t *divisor); 52 53 /*! 54 * \brief Get current syncE input divisor settings. 55 * 56 * \param [in] unit Unit Number. 57 * \param [in] clk_src SyncE clock source type. 58 * \param [out] divisor SyncE divisor setting. 59 * 60 * \retval SHR_E_NONE No errors. 61 * \retval !SHR_E_NONE Failure. 62 */ 63 typedef int (*time_synce_clock_get_f)( 64 int unit, 65 bcm_time_synce_clock_src_type_t clk_src, 66 bcm_time_synce_divisor_setting_t *divisor); 67 68 /*! 69 * \brief Set Primary or Secondary SyncE Recovered clock. 70 * 71 * \param [in] unit Unit Number. 72 * \param [in] clk_src_config SyncE clock source type. 73 * \param [in] control SyncE divisor setting. 74 * \param [in] value Value to set. 75 * 76 * \retval SHR_E_NONE No errors. 77 * \retval !SHR_E_NONE Failure. 78 */ 79 typedef int (*time_synce_clock_source_control_set_f)( 80 int unit, 81 bcm_time_synce_clock_source_config_t *clk_src_config, 82 bcm_time_synce_clock_source_control_t control, 83 int value); 84 85 /*! 86 * \brief Get Primary or Secondary SyncE Recovered clock. 87 * 88 * \param [in] unit Unit Number. 89 * \param [in] clk_src_config SyncE clock source type. 90 * \param [in] control SyncE divisor setting. 91 * \param [out] value Value to set. 92 * 93 * \retval SHR_E_NONE No errors. 94 * \retval !SHR_E_NONE Failure. 95 */ 96 typedef int (*time_synce_clock_source_control_get_f)( 97 int unit, 98 bcm_time_synce_clock_source_config_t *clk_src_config, 99 bcm_time_synce_clock_source_control_t control, 100 int *value); 101 102 /*! 103 * \brief Set time of the day values at various stages in ASIC. 104 * 105 * \param [in] unit Unit Number. 106 * \param [in] stages Time stamping stages. 107 * \param [in] tod Structure for Time of the day values. 108 * 109 * \retval SHR_E_NONE No errors. 110 * \retval !SHR_E_NONE Failure. 111 */ 112 typedef int (*time_tod_set_f)( 113 int unit, 114 uint32 stages, 115 bcm_time_tod_t *tod); 116 117 /*! 118 * \brief Get time of the day values at various stages in ASIC. 119 * 120 * \param [in] unit Unit Number. 121 * \param [in] stages Time stamping stages. 122 * \param [out] tod Structure for Time of the day values. 123 * 124 * \retval SHR_E_NONE No errors. 125 * \retval !SHR_E_NONE Failure. 126 */ 127 typedef int (*time_tod_get_f)( 128 int unit, 129 uint32 stages, 130 bcm_time_tod_t *tod); 131 132 /*! 133 * \brief Set timesync configurations for the port. 134 * 135 * \param [in] unit Unit Number. 136 * \param [in] port Port Number. 137 * \param [in] config_count Input configuration size. 138 * \param [in] config_array Timesync configuration array. 139 * 140 * \retval SHR_E_NONE No errors. 141 * \retval !SHR_E_NONE Failure. 142 */ 143 typedef int (*time_port_timesync_config_set_f)( 144 int unit, 145 bcm_port_t port, 146 int config_count, 147 bcm_port_timesync_config_t *config_array); 148 149 /*! 150 * \brief Get timesync configurations for the port. 151 * 152 * \param [in] unit Unit Number. 153 * \param [in] port Port Number. 154 * \param [in] config_count Input array size. 155 * \param [out] config_array Timesync configuration array. 156 * \param [out] array_count Fetched array size. 157 * 158 * \retval SHR_E_NONE No errors. 159 * \retval !SHR_E_NONE Failure. 160 */ 161 typedef int (*time_port_timesync_config_get_f)( 162 int unit, 163 bcm_port_t port, 164 int config_count, 165 bcm_port_timesync_config_t *config_array, 166 int *array_count); 167 168 /*! 169 * \brief Specify general time switch behaviors. 170 * 171 * \param [in] unit Unit Number. 172 * \param [in] type The desired configuration parameter to modify. 173 * \param [in] arg Value to set. 174 * 175 * \retval SHR_E_NONE No errors. 176 * \retval !SHR_E_NONE Failure. 177 */ 178 typedef int (*time_switch_control_set_f)( 179 int unit, 180 bcm_switch_control_t type, 181 int arg); 182 183 /*! 184 * \brief Retrieve general time switch behaviors. 185 * 186 * \param [in] unit Unit Number. 187 * \param [in] type The desired configuration parameter to modify. 188 * \param [out] arg Value to get. 189 * 190 * \retval SHR_E_NONE No errors. 191 * \retval !SHR_E_NONE Failure. 192 */ 193 typedef int (*time_switch_control_get_f)( 194 int unit, 195 bcm_switch_control_t type, 196 int *arg); 197 198 /*! 199 * \brief Specify time port-specific and device-wide operating configuration. 200 * 201 * \param [in] unit Unit Number. 202 * \param [in] port Port Number. 203 * \param [in] type Switch control type. 204 * \param [in] arg Value to set. 205 * 206 * \retval SHR_E_NONE No errors. 207 * \retval !SHR_E_NONE Failure. 208 */ 209 typedef int (*time_switch_control_port_set_f)( 210 int unit, 211 bcm_port_t port, 212 bcm_switch_control_t type, 213 int arg); 214 215 /*! 216 * \brief Retrieve time port-specific and device-wide operating configuration. 217 * 218 * \param [in] unit Unit Number. 219 * \param [in] port Port Number. 220 * \param [in] type Switch control type. 221 * \param [out] arg Value to get. 222 * 223 * \retval SHR_E_NONE No errors. 224 * \retval !SHR_E_NONE Failure. 225 */ 226 typedef int (*time_switch_control_port_get_f)( 227 int unit, 228 bcm_port_t port, 229 bcm_switch_control_t type, 230 int *arg); 231 232 /*! 233 * \brief Time driver structure. 234 */ 235 typedef struct mbcm_ltsw_time_drv_s { 236 237 /*! Initialize time module. */ 238 time_init_f time_init; 239 240 /*! De-initializes time module. */ 241 time_deinit_f time_deinit; 242 243 /*! Set syncE clock output frequency beased on the input divisor settings. */ 244 time_synce_clock_set_f time_synce_clock_set; 245 246 /*! Get current syncE input divisor settings. */ 247 time_synce_clock_get_f time_synce_clock_get; 248 249 /*! Set Primary or Secondary SyncE Recovered clock. */ 250 time_synce_clock_source_control_set_f time_synce_clock_source_control_set; 251 252 /*! Get Primary or Secondary SyncE Recovered clock. */ 253 time_synce_clock_source_control_get_f time_synce_clock_source_control_get; 254 255 /*! Set time of the day values at various stages in ASIC. */ 256 time_tod_set_f time_tod_set; 257 258 /*! Get time of the day values at various stages in ASIC. */ 259 time_tod_get_f time_tod_get; 260 261 /*! Set timesync configurations for the port. */ 262 time_port_timesync_config_set_f time_port_timesync_config_set; 263 264 /*! Get timesync configurations for the port. */ 265 time_port_timesync_config_get_f time_port_timesync_config_get; 266 267 /*! Specify general time switch behaviors. */ 268 time_switch_control_set_f time_switch_control_set; 269 270 /*! Retrieve general time switch behaviors. */ 271 time_switch_control_get_f time_switch_control_get; 272 273 /*! Specify time port-specific and device-wide operating configuration. */ 274 time_switch_control_port_set_f time_switch_control_port_set; 275 276 /*! Retrieve time port-specific and device-wide operating configuration. */ 277 time_switch_control_port_get_f time_switch_control_port_get; 278 279 } mbcm_ltsw_time_drv_t; 280 281 /*! 282 * \brief Set the TIME driver of the device. 283 * 284 * \param [in] unit Unit Number. 285 * \param [in] drv Time driver to set. 286 * 287 * \retval SHR_E_NONE No errors. 288 * \retval !SHR_E_NONE Failure. 289 */ 290 extern int 291 mbcm_ltsw_time_drv_set( 292 int unit, 293 mbcm_ltsw_time_drv_t *drv); 294 295 /*! 296 * \brief Initialize time module. 297 * 298 * \param [in] unit Unit Number. 299 * 300 * \retval SHR_E_NONE No errors. 301 * \retval !SHR_E_NONE Failure. 302 */ 303 extern int 304 mbcm_ltsw_time_init(int unit); 305 306 /*! 307 * \brief De-initializes time module. 308 * 309 * \param [in] unit Unit Number. 310 * 311 * \retval SHR_E_NONE No errors. 312 * \retval !SHR_E_NONE Failure. 313 */ 314 extern int 315 mbcm_ltsw_time_deinit(int unit); 316 317 /*! 318 * \brief Set syncE clock output frequency beased on the input divisor settings. 319 * 320 * \param [in] unit Unit Number. 321 * \param [in] clk_src SyncE clock source type. 322 * \param [in] divisor SyncE divisor setting. 323 * 324 * \retval SHR_E_NONE No errors. 325 * \retval !SHR_E_NONE Failure. 326 */ 327 extern int 328 mbcm_ltsw_time_synce_clock_set( 329 int unit, 330 bcm_time_synce_clock_src_type_t clk_src, 331 bcm_time_synce_divisor_setting_t *divisor); 332 333 /*! 334 * \brief Get current syncE input divisor settings. 335 * 336 * \param [in] unit Unit Number. 337 * \param [in] clk_src SyncE clock source type. 338 * \param [out] divisor SyncE divisor setting. 339 * 340 * \retval SHR_E_NONE No errors. 341 * \retval !SHR_E_NONE Failure. 342 */ 343 extern int 344 mbcm_ltsw_time_synce_clock_get( 345 int unit, 346 bcm_time_synce_clock_src_type_t clk_src, 347 bcm_time_synce_divisor_setting_t *divisor); 348 349 /*! 350 * \brief Set Primary or Secondary SyncE Recovered clock. 351 * 352 * \param [in] unit Unit Number. 353 * \param [in] clk_src_config SyncE clock source type. 354 * \param [in] control SyncE divisor setting. 355 * \param [in] value Value to set. 356 * 357 * \retval SHR_E_NONE No errors. 358 * \retval !SHR_E_NONE Failure. 359 */ 360 extern int 361 mbcm_ltsw_time_synce_clock_source_control_set( 362 int unit, 363 bcm_time_synce_clock_source_config_t *clk_src_config, 364 bcm_time_synce_clock_source_control_t control, 365 int value); 366 367 /*! 368 * \brief Get Primary or Secondary SyncE Recovered clock. 369 * 370 * \param [in] unit Unit Number. 371 * \param [in] clk_src_config SyncE clock source type. 372 * \param [in] control SyncE divisor setting. 373 * \param [out] value Value to set. 374 * 375 * \retval SHR_E_NONE No errors. 376 * \retval !SHR_E_NONE Failure. 377 */ 378 extern int 379 mbcm_ltsw_time_synce_clock_source_control_get( 380 int unit, 381 bcm_time_synce_clock_source_config_t *clk_src_config, 382 bcm_time_synce_clock_source_control_t control, 383 int *value); 384 385 /*! 386 * \brief Set time of the day values at various stages in ASIC. 387 * 388 * \param [in] unit Unit Number. 389 * \param [in] stages Time stamping stages. 390 * \param [in] tod Structure for Time of the day values. 391 * 392 * \retval SHR_E_NONE No errors. 393 * \retval !SHR_E_NONE Failure. 394 */ 395 extern int 396 mbcm_ltsw_time_tod_set( 397 int unit, 398 uint32 stages, 399 bcm_time_tod_t *tod); 400 401 /*! 402 * \brief Get time of the day values at various stages in ASIC. 403 * 404 * \param [in] unit Unit Number. 405 * \param [in] stages Time stamping stages. 406 * \param [out] tod Structure for Time of the day values. 407 * 408 * \retval SHR_E_NONE No errors. 409 * \retval !SHR_E_NONE Failure. 410 */ 411 extern int 412 mbcm_ltsw_time_tod_get( 413 int unit, 414 uint32 stages, 415 bcm_time_tod_t *tod); 416 417 /*! 418 * \brief Set timesync configurations for the port. 419 * 420 * \param [in] unit Unit Number. 421 * \param [in] port Port Number. 422 * \param [in] config_count Input configuration size. 423 * \param [in] config_array Timesync configuration array. 424 * 425 * \retval SHR_E_NONE No errors. 426 * \retval !SHR_E_NONE Failure. 427 */ 428 extern int 429 mbcm_ltsw_time_port_timesync_config_set( 430 int unit, 431 bcm_port_t port, 432 int config_count, 433 bcm_port_timesync_config_t *config_array); 434 435 /*! 436 * \brief Get timesync configurations for the port. 437 * 438 * \param [in] unit Unit Number. 439 * \param [in] port Port Number. 440 * \param [in] config_count Input array size. 441 * \param [out] config_array Timesync configuration array. 442 * \param [out] array_count Fetched array size. 443 * 444 * \retval SHR_E_NONE No errors. 445 * \retval !SHR_E_NONE Failure. 446 */ 447 extern int 448 mbcm_ltsw_time_port_timesync_config_get( 449 int unit, 450 bcm_port_t port, 451 int config_count, 452 bcm_port_timesync_config_t *config_array, 453 int *array_count); 454 455 /*! 456 * \brief Specify general time switch behaviors. 457 * 458 * \param [in] unit Unit Number. 459 * \param [in] type The desired configuration parameter to modify. 460 * \param [in] arg Value to set. 461 * 462 * \retval SHR_E_NONE No errors. 463 * \retval !SHR_E_NONE Failure. 464 */ 465 extern int 466 mbcm_ltsw_time_switch_control_set( 467 int unit, 468 bcm_switch_control_t type, 469 int arg); 470 471 /*! 472 * \brief Retrieve general time switch behaviors. 473 * 474 * \param [in] unit Unit Number. 475 * \param [in] type The desired configuration parameter to modify. 476 * \param [out] arg Value to get. 477 * 478 * \retval SHR_E_NONE No errors. 479 * \retval !SHR_E_NONE Failure. 480 */ 481 extern int 482 mbcm_ltsw_time_switch_control_get( 483 int unit, 484 bcm_switch_control_t type, 485 int *arg); 486 487 /*! 488 * \brief Specify time port-specific and device-wide operating configuration. 489 * 490 * \param [in] unit Unit Number. 491 * \param [in] port Port Number. 492 * \param [in] type Switch control type. 493 * \param [in] arg Value to set. 494 * 495 * \retval SHR_E_NONE No errors. 496 * \retval !SHR_E_NONE Failure. 497 */ 498 extern int 499 mbcm_ltsw_time_switch_control_port_set( 500 int unit, 501 bcm_port_t port, 502 bcm_switch_control_t type, 503 int arg); 504 505 /*! 506 * \brief Retrieve time port-specific and device-wide operating configuration. 507 * 508 * \param [in] unit Unit Number. 509 * \param [in] port Port Number. 510 * \param [in] type Switch control type. 511 * \param [out] arg Value to get. 512 * 513 * \retval SHR_E_NONE No errors. 514 * \retval !SHR_E_NONE Failure. 515 */ 516 extern int 517 mbcm_ltsw_time_switch_control_port_get( 518 int unit, 519 bcm_port_t port, 520 bcm_switch_control_t type, 521 int *arg); 522 523 #endif /* BCMINT_LTSW_MBCM_TIME_H */