PDK API Guide for J721E
cpsw_cpts.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2020
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
66 #ifndef CPSW_CPTS_H_
67 #define CPSW_CPTS_H_
68 
69 /* ========================================================================== */
70 /* Include Files */
71 /* ========================================================================== */
72 
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
79 /* ========================================================================== */
80 /* Macros */
81 /* ========================================================================== */
82 
84 #define CPSW_CPTS_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
85  ENET_IOCTL_TIMESYNC_BASE | \
86  ENET_IOCTL_PER_CPSW | \
87  ENET_IOCTL_MIN(x))
88 
90 #define CPSW_CPTS_NUDGE_MIN_VAL (-128)
91 
93 #define CPSW_CPTS_NUDGE_MAX_VAL (127)
94 
95 /* ========================================================================== */
96 /* Structures and Enums */
97 /* ========================================================================== */
98 
102 typedef enum CpswCpts_Ioctl_s
103 {
112 
121 
130 
139 
151 
160 
169 
178 
187 
196 
205 
214 
223 
233 
237 typedef enum CpswCpts_RftClkFreq_e
238 {
241 
244 
247 
250 
253 
256 
259 
263 
267 typedef enum CpswCpts_EventType_e
268 {
271 
274 
277 
280 
283 
286 
289 
292 
296 
300 typedef enum CpswCpts_OutputBitSel_e
301 {
304 
307 
310 
313 
316 
319 
322 
325 
328 
331 
334 
337 
340 
343 
346 
350 
354 typedef enum CpswCpts_HwPush_e
355 {
358 
361 
364 
367 
370 
373 
376 
379 
382 
385 
389 
391 #define CPSW_CPTS_HWPUSH_COUNT_MAX ((uint32_t)CPSW_CPTS_HWPUSH_LAST)
392 
394 #define CPSW_CPTS_HWPUSH_NORM(x) ((uint32_t)((x) - CPSW_CPTS_HWPUSH_FIRST))
395 
399 typedef struct CpswCpts_Event_s
400 {
402  uint64_t tsVal;
403 
406 
409 
411  uint32_t seqId;
412 
414  uint32_t portNum;
415 
417  uint32_t domain;
418 
422 
426 typedef struct CpswCpts_EstEventMatchParams_s
427 {
430 
433  uint32_t domain;
435 
439 typedef struct CpswCpts_EstEvent_s
440 {
442  uint64_t tsVal;
443 
445  uint8_t priority;
446 
448  uint32_t seqNum;
449 
451  uint32_t ingressPort;
452 
454  uint32_t egressPort;
455 
457  uint32_t domain;
459 
467 typedef void (*CpswCpts_EventNotifyCb)(void *eventNotifyCbArg,
468  CpswCpts_Event *eventInfo);
469 
477 typedef void (*CpswCpts_HwPushNotifyCb)(void *hwPushNotifyCbArg,
478  CpswCpts_HwPush hwPushNum);
479 
485 typedef struct CpswCpts_StackConfig_s
486 {
489 
493 
497 typedef struct CpswCpts_RegisterHwPushCbInArgs_s
498 {
501 
504 
508 
512 typedef struct CpswCpts_SetCompValInArgs_s
513 {
515  uint64_t tsCompVal;
516 
518  uint32_t tsCompLen;
519 
525 
530 typedef struct CpswCpts_SetFxnGenInArgs_s
531 {
533  uint32_t index;
534 
536  uint32_t length;
537 
539  uint64_t compare;
540 
545 
547  uint64_t ppmVal;
548 
551 
557 
562 typedef struct CpswCpts_SetFxnGenNudgeInArgs_s
563 {
565  uint32_t index;
566 
569  int32_t tsNudge;
571 
577 typedef struct CpswCpts_Cfg_s
578 {
582 
587 
590 
597 
600 } CpswCpts_Cfg;
601 
602 /* ========================================================================== */
603 /* Global Variables Declarations */
604 /* ========================================================================== */
605 
606 /* None */
607 
608 /* ========================================================================== */
609 /* Function Declarations */
610 /* ========================================================================== */
611 
617 void CpswCpts_initCfg(CpswCpts_Cfg *cptsCfg);
618 
619 /* ========================================================================== */
620 /* Deprecated Function Declarations */
621 /* ========================================================================== */
622 
623 /* None */
624 
625 /* ========================================================================== */
626 /* Static Function Definitions */
627 /* ========================================================================== */
628 
629 /* None */
630 
631 #ifdef __cplusplus
632 }
633 #endif
634 
635 #endif /* CPSW_CPTS_H_ */
636 
Definition: cpsw_cpts.h:282
Definition: cpsw_cpts.h:294
Definition: cpsw_cpts.h:240
Definition: cpsw_cpts.h:324
void * eventNotifyCbArg
Definition: cpsw_cpts.h:491
CPTS set compare nudge.
Definition: cpsw_cpts.h:168
Definition: cpsw_cpts.h:261
void(* CpswCpts_HwPushNotifyCb)(void *hwPushNotifyCbArg, CpswCpts_HwPush hwPushNum)
CPTS hardware push notify callback/.
Definition: cpsw_cpts.h:477
Definition: cpsw_cpts.h:258
CPTS unregister stack.
Definition: cpsw_cpts.h:120
Definition: cpsw_cpts.h:333
CPTS set timestamp nudge.
Definition: cpsw_cpts.h:150
Definition: cpsw_cpts.h:252
Definition: cpsw_cpts.h:270
uint64_t tsCompVal
Definition: cpsw_cpts.h:515
uint32_t domain
Definition: cpsw_cpts.h:457
#define CPSW_CPTS_PUBLIC_IOCTL(x)
Helper macro to create IOCTL commands for CPSW CPTS module.
Definition: cpsw_cpts.h:84
Definition: cpsw_cpts.h:345
EnetTimeSync_AdjDir ppmDir
Definition: cpsw_cpts.h:550
void * hwPushNotifyCbArg
Definition: cpsw_cpts.h:506
uint32_t ingressPort
Definition: cpsw_cpts.h:451
CPTS set compare value.
Definition: cpsw_cpts.h:159
CpswCpts_HwPush hwPushNum
Definition: cpsw_cpts.h:420
CPTS set ESTFn stamp nudge.
Definition: cpsw_cpts.h:204
Definition: cpsw_cpts.h:327
Input args for CPSW_CPTS_IOCTL_SET_COMP command.
Definition: cpsw_cpts.h:512
CpswCpts_EventType
CPTS event type.
Definition: cpsw_cpts.h:267
Input args for CPSW_CPTS_IOCTL_SET_GENF_NUDGE and CPSW_CPTS_IOCTL_SET_ESTF_NUDGE commands.
Definition: cpsw_cpts.h:562
Definition: cpsw_cpts.h:378
Definition: cpsw_cpts.h:291
Definition: cpsw_cpts.h:387
uint8_t priority
Definition: cpsw_cpts.h:445
Definition: cpsw_cpts.h:384
uint64_t ppmVal
Definition: cpsw_cpts.h:547
Definition: cpsw_cpts.h:342
EnetTimeSync_AdjMode ppmMode
Definition: cpsw_cpts.h:555
Definition: cpsw_cpts.h:306
CPTS register hardware push event callback.
Definition: cpsw_cpts.h:129
bool tsCompPolarity
Definition: cpsw_cpts.h:586
CpswCpts_EventType eventType
Definition: cpsw_cpts.h:405
uint32_t domain
Definition: cpsw_cpts.h:417
Definition: cpsw_cpts.h:360
CpswCpts_Ioctl
CPSW CPTS IOCTL commands.
Definition: cpsw_cpts.h:102
Input args for CPSW_CPTS_IOCTL_REGISTER_STACK command.
Definition: cpsw_cpts.h:485
Definition: cpsw_cpts.h:330
Definition: cpsw_cpts.h:276
uint32_t portNum
Definition: cpsw_cpts.h:414
Definition: cpsw_cpts.h:357
bool tsRxEventsDis
Definition: cpsw_cpts.h:589
Definition: cpsw_cpts.h:369
Definition: cpsw_cpts.h:363
CPTS set EST function generator.
Definition: cpsw_cpts.h:195
Definition: cpsw_cpts.h:339
bool hostRxTsEn
Definition: cpsw_cpts.h:581
EnetTimeSync_MsgType
TimeSync Ethernet message type.
Definition: enet_mod_timesync.h:165
CpswCpts_EventNotifyCb eventNotifyCb
Definition: cpsw_cpts.h:488
CpswCpts_HwPushNotifyCb hwPushNotifyCb
Definition: cpsw_cpts.h:503
CPTS event.
Definition: cpsw_cpts.h:399
CPTS register stack.
Definition: cpsw_cpts.h:111
CpswCpts_RftClkFreq cptsRftClkFreq
Definition: cpsw_cpts.h:599
CPTS EST timestamp.
Definition: cpsw_cpts.h:439
CPTS unregister hardware push event callback.
Definition: cpsw_cpts.h:138
uint64_t compare
Definition: cpsw_cpts.h:539
CpswCpts_RftClkFreq
CPTS clock frequency add value.
Definition: cpsw_cpts.h:237
uint32_t tsCompLen
Definition: cpsw_cpts.h:518
void CpswCpts_initCfg(CpswCpts_Cfg *cptsCfg)
Initialize CPSW CPTS configuration parameters.
Definition: cpsw_cpts.h:315
Definition: cpsw_cpts.h:243
CPTS lookup event.
Definition: cpsw_cpts.h:222
Definition: cpsw_cpts.h:288
uint64_t tsVal
Definition: cpsw_cpts.h:402
CPTS TS output bit select.
Definition: cpsw_cpts.h:213
CPTS lookup EST event.
Definition: cpsw_cpts.h:231
CPTS configuration.
Definition: cpsw_cpts.h:577
Definition: cpsw_cpts.h:303
Definition: cpsw_cpts.h:285
int32_t tsNudge
Definition: cpsw_cpts.h:569
Definition: cpsw_cpts.h:348
bool tsGenfClrEn
Definition: cpsw_cpts.h:596
Definition: cpsw_cpts.h:366
EnetTimeSync_MsgType msgType
Definition: cpsw_cpts.h:408
Definition: cpsw_cpts.h:381
Definition: cpsw_cpts.h:318
bool tsCompToggle
Definition: cpsw_cpts.h:523
bool polarityInv
Definition: cpsw_cpts.h:544
Definition: cpsw_cpts.h:249
CpswCpts_OutputBitSel
CPTS time stamp output bit.
Definition: cpsw_cpts.h:300
uint32_t length
Definition: cpsw_cpts.h:536
Definition: cpsw_cpts.h:279
Definition: cpsw_cpts.h:255
Input args for CPSW_CPTS_IOCTL_REGISTER_HWPUSH_CALLBACK command.
Definition: cpsw_cpts.h:497
uint32_t index
Definition: cpsw_cpts.h:565
uint32_t domain
Definition: cpsw_cpts.h:433
Definition: cpsw_cpts.h:372
CPTS EST event match params.
Definition: cpsw_cpts.h:426
uint32_t seqNum
Definition: cpsw_cpts.h:448
CPTS set GenFn stamp nudge.
Definition: cpsw_cpts.h:186
Definition: cpsw_cpts.h:321
Enet_MacPort
MAC port.
Definition: enet_types.h:405
EnetTimeSync_AdjMode
TimeSync adjustment mode.
Definition: enet_mod_timesync.h:204
CpswCpts_HwPush
CPTS Hardware push instances.
Definition: cpsw_cpts.h:354
Definition: cpsw_cpts.h:336
This file contains the type definitions and helper macros for the Enet Time Synchronization module in...
Definition: cpsw_cpts.h:375
uint32_t egressPort
Definition: cpsw_cpts.h:454
uint64_t tsVal
Definition: cpsw_cpts.h:442
Definition: cpsw_cpts.h:273
void(* CpswCpts_EventNotifyCb)(void *eventNotifyCbArg, CpswCpts_Event *eventInfo)
CPTS event notify callback.
Definition: cpsw_cpts.h:467
uint32_t index
Definition: cpsw_cpts.h:533
Definition: cpsw_cpts.h:309
uint32_t seqId
Definition: cpsw_cpts.h:411
Definition: cpsw_cpts.h:312
Input args for CPSW_CPTS_IOCTL_SET_GENF and CPSW_CPTS_IOCTL_SET_ESTF commands.
Definition: cpsw_cpts.h:530
Enet_MacPort macPort
Definition: cpsw_cpts.h:429
CpswCpts_HwPush hwPushNum
Definition: cpsw_cpts.h:500
Definition: cpsw_cpts.h:246
CPTS set function generator.
Definition: cpsw_cpts.h:177
EnetTimeSync_AdjDir
TimeSync adjustment direction.
Definition: enet_mod_timesync.h:219