AM64x MCU+ SDK  08.04.00
enet_mod_timesync.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 
47 #ifndef ENET_MOD_TIMESYNC_H_
48 #define ENET_MOD_TIMESYNC_H_
49 
50 /* ========================================================================== */
51 /* Include Files */
52 /* ========================================================================== */
53 
54 #include <stdint.h>
55 #include <include/core/enet_mod.h>
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /* ========================================================================== */
62 /* Macros */
63 /* ========================================================================== */
64 
66 #define ENET_TIMESYNC_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
67  ENET_IOCTL_TIMESYNC_BASE | \
68  ENET_IOCTL_MIN(x))
69 
70 /* ========================================================================== */
71 /* Structures and Enums */
72 /* ========================================================================== */
73 
77 typedef enum EnetTimeSync_Ioctl_e
78 {
87 
96 
106 
115 
124 
133 
142 
151 
160 
162 
166 typedef enum EnetTimeSync_MsgType_e
167 {
170 
173 
176 
179 
182 
185 
188 
191 
194 
197 
201 
205 typedef enum EnetTimeSync_AdjMode_e
206 {
209 
212 
216 
220 typedef enum EnetTimeSync_AdjDir_e
221 {
224 
228 
232 typedef struct EnetTimeSync_TimestampAdj_s
233 {
235  int32_t adjValInNsecs;
236 
238  uint32_t intervalInNsecs;
240 
245 typedef struct EnetTimeSync_GetEthTimestampInArgs_s
246 {
249 
251  uint32_t seqId;
252 
254  uint32_t portNum;
255 
257  uint32_t domain;
259 
260 /* ========================================================================== */
261 /* Global Variables Declarations */
262 /* ========================================================================== */
263 
264 /* None */
265 
266 /* ========================================================================== */
267 /* Function Declarations */
268 /* ========================================================================== */
269 
270 /* None */
271 
272 /* ========================================================================== */
273 /* Deprecated Function Declarations */
274 /* ========================================================================== */
275 
276 /* None */
277 
278 /* ========================================================================== */
279 /* Static Function Definitions */
280 /* ========================================================================== */
281 
282 /* None */
283 
284 #ifdef __cplusplus
285 }
286 #endif
287 
288 #endif /* ENET_MOD_TIMESYNC_H_ */
289 
ENET_TIMESYNC_ADJMODE_PPH
@ ENET_TIMESYNC_ADJMODE_PPH
Definition: enet_mod_timesync.h:214
ENET_TIMESYNC_MESSAGE_ANNOUNCE
@ ENET_TIMESYNC_MESSAGE_ANNOUNCE
Definition: enet_mod_timesync.h:190
ENET_TIMESYNC_ADJDIR_DECREASE
@ ENET_TIMESYNC_ADJDIR_DECREASE
Definition: enet_mod_timesync.h:226
ENET_TIMESYNC_MESSAGE_MANAGEMENT
@ ENET_TIMESYNC_MESSAGE_MANAGEMENT
Definition: enet_mod_timesync.h:196
ENET_TIMESYNC_IOCTL_ADJUST_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_ADJUST_TIMESTAMP
Adjust the timestamp value.
Definition: enet_mod_timesync.h:132
ENET_TIMESYNC_IOCTL_GET_ETH_TX_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_GET_ETH_TX_TIMESTAMP
Get Ethernet TX timestamp.
Definition: enet_mod_timesync.h:150
EnetTimeSync_GetEthTimestampInArgs::msgType
EnetTimeSync_MsgType msgType
Definition: enet_mod_timesync.h:248
ENET_TIMESYNC_IOCTL_PRINT_STATS
@ ENET_TIMESYNC_IOCTL_PRINT_STATS
Print TimeSync event statistics. They could be either hardware or software based statistics.
Definition: enet_mod_timesync.h:105
ENET_TIMESYNC_PUBLIC_IOCTL
#define ENET_TIMESYNC_PUBLIC_IOCTL(x)
Helper macro to create IOCTL commands for TIMESYNC module.
Definition: enet_mod_timesync.h:66
ENET_TIMESYNC_IOCTL_PRINT_REGS
@ ENET_TIMESYNC_IOCTL_PRINT_REGS
Print TimeSync registers.
Definition: enet_mod_timesync.h:95
ENET_TIMESYNC_IOCTL_SET_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_SET_TIMESTAMP
Set timestamp value.
Definition: enet_mod_timesync.h:123
ENET_TIMESYNC_IOCTL_GET_ETH_RX_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_GET_ETH_RX_TIMESTAMP
Get Ethernet RX timestamp.
Definition: enet_mod_timesync.h:141
ENET_TIMESYNC_MESSAGE_FOLLOW_UP
@ ENET_TIMESYNC_MESSAGE_FOLLOW_UP
Definition: enet_mod_timesync.h:181
ENET_TIMESYNC_IOCTL_RESET
@ ENET_TIMESYNC_IOCTL_RESET
Reset TimeSync module.
Definition: enet_mod_timesync.h:159
ENET_TIMESYNC_IOCTL_GET_CURRENT_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_GET_CURRENT_TIMESTAMP
Get current timestamp.
Definition: enet_mod_timesync.h:114
ENET_TIMESYNC_MESSAGE_INVALID
@ ENET_TIMESYNC_MESSAGE_INVALID
Definition: enet_mod_timesync.h:199
EnetTimeSync_GetEthTimestampInArgs::seqId
uint32_t seqId
Definition: enet_mod_timesync.h:251
EnetTimeSync_TimestampAdj::intervalInNsecs
uint32_t intervalInNsecs
Definition: enet_mod_timesync.h:238
EnetTimeSync_Ioctl
EnetTimeSync_Ioctl
TimeSync module IOCTL commands.
Definition: enet_mod_timesync.h:78
EnetTimeSync_TimestampAdj
Timestamp adjustment.
Definition: enet_mod_timesync.h:233
ENET_TIMESYNC_MESSAGE_DELAY_REQ
@ ENET_TIMESYNC_MESSAGE_DELAY_REQ
Definition: enet_mod_timesync.h:172
EnetTimeSync_TimestampAdj::adjValInNsecs
int32_t adjValInNsecs
Definition: enet_mod_timesync.h:235
EnetTimeSync_AdjMode
EnetTimeSync_AdjMode
TimeSync adjustment mode.
Definition: enet_mod_timesync.h:206
ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
Definition: enet_mod_timesync.h:187
ENET_TIMESYNC_MESSAGE_SIGNALING
@ ENET_TIMESYNC_MESSAGE_SIGNALING
Definition: enet_mod_timesync.h:193
ENET_TIMESYNC_MESSAGE_PDELAY_RESP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP
Definition: enet_mod_timesync.h:178
ENET_TIMESYNC_ADJDIR_INCREASE
@ ENET_TIMESYNC_ADJDIR_INCREASE
Definition: enet_mod_timesync.h:223
ENET_TIMESYNC_IOCTL_GET_VERSION
@ ENET_TIMESYNC_IOCTL_GET_VERSION
Get the hardware version of the TimeSync module.
Definition: enet_mod_timesync.h:86
EnetTimeSync_GetEthTimestampInArgs
Input args for ENET_TIMESYNC_IOCTL_GET_ETH_RX_TIMESTAMP and ENET_TIMESYNC_IOCTL_GET_ETH_TX_TIMESTAMP ...
Definition: enet_mod_timesync.h:246
EnetTimeSync_AdjDir
EnetTimeSync_AdjDir
TimeSync adjustment direction.
Definition: enet_mod_timesync.h:221
enet_mod.h
This file contains the type definitions and helper macros for the Enet Module interface.
EnetTimeSync_GetEthTimestampInArgs::portNum
uint32_t portNum
Definition: enet_mod_timesync.h:254
EnetTimeSync_MsgType
EnetTimeSync_MsgType
TimeSync Ethernet message type.
Definition: enet_mod_timesync.h:167
ENET_TIMESYNC_MESSAGE_SYNC
@ ENET_TIMESYNC_MESSAGE_SYNC
Definition: enet_mod_timesync.h:169
EnetTimeSync_GetEthTimestampInArgs::domain
uint32_t domain
Definition: enet_mod_timesync.h:257
ENET_TIMESYNC_ADJMODE_PPM
@ ENET_TIMESYNC_ADJMODE_PPM
Definition: enet_mod_timesync.h:211
ENET_TIMESYNC_ADJMODE_DISABLE
@ ENET_TIMESYNC_ADJMODE_DISABLE
Definition: enet_mod_timesync.h:208
ENET_TIMESYNC_MESSAGE_PDELAY_REQ
@ ENET_TIMESYNC_MESSAGE_PDELAY_REQ
Definition: enet_mod_timesync.h:175
ENET_TIMESYNC_MESSAGE_DELAY_RESP
@ ENET_TIMESYNC_MESSAGE_DELAY_RESP
Definition: enet_mod_timesync.h:184