PDK API Guide for AM65xx
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 
224 
228 typedef enum CpswCpts_RftClkFreq_e
229 {
232 
235 
238 
241 
244 
247 
250 
254 
258 typedef enum CpswCpts_EventType_e
259 {
262 
265 
268 
271 
274 
277 
280 
283 
287 
291 typedef enum CpswCpts_OutputBitSel_e
292 {
295 
298 
301 
304 
307 
310 
313 
316 
319 
322 
325 
328 
331 
334 
337 
341 
345 typedef enum CpswCpts_HwPush_e
346 {
349 
352 
355 
358 
361 
364 
367 
370 
373 
376 
380 
382 #define CPSW_CPTS_HWPUSH_COUNT_MAX ((uint32_t)CPSW_CPTS_HWPUSH_LAST)
383 
385 #define CPSW_CPTS_HWPUSH_NORM(x) ((uint32_t)((x) - CPSW_CPTS_HWPUSH_FIRST))
386 
390 typedef struct CpswCpts_Event_s
391 {
393  uint64_t tsVal;
394 
397 
400 
402  uint32_t seqId;
403 
405  uint32_t portNum;
406 
408  uint32_t domain;
409 
413 
421 typedef void (*CpswCpts_EventNotifyCb)(void *eventNotifyCbArg,
422  CpswCpts_Event *eventInfo);
423 
431 typedef void (*CpswCpts_HwPushNotifyCb)(void *hwPushNotifyCbArg,
432  CpswCpts_HwPush hwPushNum);
433 
439 typedef struct CpswCpts_StackConfig_s
440 {
443 
447 
451 typedef struct CpswCpts_RegisterHwPushCbInArgs_s
452 {
455 
458 
462 
466 typedef struct CpswCpts_SetCompValInArgs_s
467 {
469  uint64_t tsCompVal;
470 
472  uint32_t tsCompLen;
473 
479 
484 typedef struct CpswCpts_SetFxnGenInArgs_s
485 {
487  uint32_t index;
488 
490  uint32_t length;
491 
493  uint64_t compare;
494 
499 
501  uint64_t ppmVal;
502 
505 
511 
516 typedef struct CpswCpts_SetFxnGenNudgeInArgs_s
517 {
519  uint32_t index;
520 
523  int32_t tsNudge;
525 
531 typedef struct CpswCpts_Cfg_s
532 {
536 
541 
544 
551 
554 } CpswCpts_Cfg;
555 
556 /* ========================================================================== */
557 /* Global Variables Declarations */
558 /* ========================================================================== */
559 
560 /* None */
561 
562 /* ========================================================================== */
563 /* Function Declarations */
564 /* ========================================================================== */
565 
571 void CpswCpts_initCfg(CpswCpts_Cfg *cptsCfg);
572 
573 /* ========================================================================== */
574 /* Deprecated Function Declarations */
575 /* ========================================================================== */
576 
577 /* None */
578 
579 /* ========================================================================== */
580 /* Static Function Definitions */
581 /* ========================================================================== */
582 
583 /* None */
584 
585 #ifdef __cplusplus
586 }
587 #endif
588 
589 #endif /* CPSW_CPTS_H_ */
590 
Definition: cpsw_cpts.h:273
Definition: cpsw_cpts.h:285
Definition: cpsw_cpts.h:231
Definition: cpsw_cpts.h:315
void * eventNotifyCbArg
Definition: cpsw_cpts.h:445
CPTS set compare nudge.
Definition: cpsw_cpts.h:168
Definition: cpsw_cpts.h:252
void(* CpswCpts_HwPushNotifyCb)(void *hwPushNotifyCbArg, CpswCpts_HwPush hwPushNum)
CPTS hardware push notify callback/.
Definition: cpsw_cpts.h:431
Definition: cpsw_cpts.h:249
CPTS unregister stack.
Definition: cpsw_cpts.h:120
Definition: cpsw_cpts.h:324
CPTS set timestamp nudge.
Definition: cpsw_cpts.h:150
Definition: cpsw_cpts.h:243
Definition: cpsw_cpts.h:261
uint64_t tsCompVal
Definition: cpsw_cpts.h:469
#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:336
EnetTimeSync_AdjDir ppmDir
Definition: cpsw_cpts.h:504
void * hwPushNotifyCbArg
Definition: cpsw_cpts.h:460
CPTS set compare value.
Definition: cpsw_cpts.h:159
CpswCpts_HwPush hwPushNum
Definition: cpsw_cpts.h:411
CPTS set ESTFn stamp nudge.
Definition: cpsw_cpts.h:204
Definition: cpsw_cpts.h:318
Input args for CPSW_CPTS_IOCTL_SET_COMP command.
Definition: cpsw_cpts.h:466
CpswCpts_EventType
CPTS event type.
Definition: cpsw_cpts.h:258
Input args for CPSW_CPTS_IOCTL_SET_GENF_NUDGE and CPSW_CPTS_IOCTL_SET_ESTF_NUDGE commands.
Definition: cpsw_cpts.h:516
Definition: cpsw_cpts.h:369
Definition: cpsw_cpts.h:282
Definition: cpsw_cpts.h:378
Definition: cpsw_cpts.h:375
uint64_t ppmVal
Definition: cpsw_cpts.h:501
Definition: cpsw_cpts.h:333
EnetTimeSync_AdjMode ppmMode
Definition: cpsw_cpts.h:509
Definition: cpsw_cpts.h:297
CPTS register hardware push event callback.
Definition: cpsw_cpts.h:129
bool tsCompPolarity
Definition: cpsw_cpts.h:540
CpswCpts_EventType eventType
Definition: cpsw_cpts.h:396
uint32_t domain
Definition: cpsw_cpts.h:408
Definition: cpsw_cpts.h:351
CpswCpts_Ioctl
CPSW CPTS IOCTL commands.
Definition: cpsw_cpts.h:102
Input args for CPSW_CPTS_IOCTL_REGISTER_STACK command.
Definition: cpsw_cpts.h:439
Definition: cpsw_cpts.h:321
Definition: cpsw_cpts.h:267
uint32_t portNum
Definition: cpsw_cpts.h:405
Definition: cpsw_cpts.h:348
bool tsRxEventsDis
Definition: cpsw_cpts.h:543
Definition: cpsw_cpts.h:360
Definition: cpsw_cpts.h:354
CPTS set EST function generator.
Definition: cpsw_cpts.h:195
Definition: cpsw_cpts.h:330
bool hostRxTsEn
Definition: cpsw_cpts.h:535
EnetTimeSync_MsgType
TimeSync Ethernet message type.
Definition: enet_mod_timesync.h:165
CpswCpts_EventNotifyCb eventNotifyCb
Definition: cpsw_cpts.h:442
CpswCpts_HwPushNotifyCb hwPushNotifyCb
Definition: cpsw_cpts.h:457
CPTS event.
Definition: cpsw_cpts.h:390
CPTS register stack.
Definition: cpsw_cpts.h:111
CpswCpts_RftClkFreq cptsRftClkFreq
Definition: cpsw_cpts.h:553
CPTS unregister hardware push event callback.
Definition: cpsw_cpts.h:138
uint64_t compare
Definition: cpsw_cpts.h:493
CpswCpts_RftClkFreq
CPTS clock frequency add value.
Definition: cpsw_cpts.h:228
uint32_t tsCompLen
Definition: cpsw_cpts.h:472
void CpswCpts_initCfg(CpswCpts_Cfg *cptsCfg)
Initialize CPSW CPTS configuration parameters.
Definition: cpsw_cpts.h:306
Definition: cpsw_cpts.h:234
CPTS lookup event.
Definition: cpsw_cpts.h:222
Definition: cpsw_cpts.h:279
uint64_t tsVal
Definition: cpsw_cpts.h:393
CPTS TS output bit select.
Definition: cpsw_cpts.h:213
CPTS configuration.
Definition: cpsw_cpts.h:531
Definition: cpsw_cpts.h:294
Definition: cpsw_cpts.h:276
int32_t tsNudge
Definition: cpsw_cpts.h:523
Definition: cpsw_cpts.h:339
bool tsGenfClrEn
Definition: cpsw_cpts.h:550
Definition: cpsw_cpts.h:357
EnetTimeSync_MsgType msgType
Definition: cpsw_cpts.h:399
Definition: cpsw_cpts.h:372
Definition: cpsw_cpts.h:309
bool tsCompToggle
Definition: cpsw_cpts.h:477
bool polarityInv
Definition: cpsw_cpts.h:498
Definition: cpsw_cpts.h:240
CpswCpts_OutputBitSel
CPTS time stamp output bit.
Definition: cpsw_cpts.h:291
uint32_t length
Definition: cpsw_cpts.h:490
Definition: cpsw_cpts.h:270
Definition: cpsw_cpts.h:246
Input args for CPSW_CPTS_IOCTL_REGISTER_HWPUSH_CALLBACK command.
Definition: cpsw_cpts.h:451
uint32_t index
Definition: cpsw_cpts.h:519
Definition: cpsw_cpts.h:363
CPTS set GenFn stamp nudge.
Definition: cpsw_cpts.h:186
Definition: cpsw_cpts.h:312
EnetTimeSync_AdjMode
TimeSync adjustment mode.
Definition: enet_mod_timesync.h:204
CpswCpts_HwPush
CPTS Hardware push instances.
Definition: cpsw_cpts.h:345
Definition: cpsw_cpts.h:327
This file contains the type definitions and helper macros for the Enet Time Synchronization module in...
Definition: cpsw_cpts.h:366
Definition: cpsw_cpts.h:264
void(* CpswCpts_EventNotifyCb)(void *eventNotifyCbArg, CpswCpts_Event *eventInfo)
CPTS event notify callback.
Definition: cpsw_cpts.h:421
uint32_t index
Definition: cpsw_cpts.h:487
Definition: cpsw_cpts.h:300
uint32_t seqId
Definition: cpsw_cpts.h:402
Definition: cpsw_cpts.h:303
Input args for CPSW_CPTS_IOCTL_SET_GENF and CPSW_CPTS_IOCTL_SET_ESTF commands.
Definition: cpsw_cpts.h:484
CpswCpts_HwPush hwPushNum
Definition: cpsw_cpts.h:454
Definition: cpsw_cpts.h:237
CPTS set function generator.
Definition: cpsw_cpts.h:177
EnetTimeSync_AdjDir
TimeSync adjustment direction.
Definition: enet_mod_timesync.h:219