AM273x MCU+ SDK  08.06.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 
170 
174 typedef enum EnetTimeSync_MsgType_e
175 {
178 
181 
184 
187 
190 
193 
196 
199 
202 
205 
209 
213 typedef enum EnetTimeSync_AdjMode_e
214 {
217 
220 
224 
228 typedef enum EnetTimeSync_AdjDir_e
229 {
232 
236 
240 typedef struct EnetTimeSync_setTimestamp_s
241 {
243  uint64_t tsLoadVal;
244 
246  uint8_t clkMode;
247 
249  uint8_t clkSign;
251 
255 typedef struct EnetTimeSync_TimestampAdj_s
256 {
258  int32_t adjValInNsecs;
259 
261  uint32_t intervalInNsecs;
263 
268 typedef struct EnetTimeSync_GetEthTimestampInArgs_s
269 {
272 
274  uint32_t seqId;
275 
277  uint32_t portNum;
278 
280  uint32_t domain;
282 
283 /* ========================================================================== */
284 /* Global Variables Declarations */
285 /* ========================================================================== */
286 
287 /* None */
288 
289 /* ========================================================================== */
290 /* Function Declarations */
291 /* ========================================================================== */
292 
293 /* None */
294 
295 /* ========================================================================== */
296 /* Deprecated Function Declarations */
297 /* ========================================================================== */
298 
299 /* None */
300 
301 /* ========================================================================== */
302 /* Static Function Definitions */
303 /* ========================================================================== */
304 
305 /* None */
306 
307 #ifdef __cplusplus
308 }
309 #endif
310 
311 #endif /* ENET_MOD_TIMESYNC_H_ */
312 
ENET_TIMESYNC_ADJMODE_PPH
@ ENET_TIMESYNC_ADJMODE_PPH
Definition: enet_mod_timesync.h:222
ENET_TIMESYNC_MESSAGE_ANNOUNCE
@ ENET_TIMESYNC_MESSAGE_ANNOUNCE
Definition: enet_mod_timesync.h:198
ENET_TIMESYNC_ADJDIR_DECREASE
@ ENET_TIMESYNC_ADJDIR_DECREASE
Definition: enet_mod_timesync.h:234
ENET_TIMESYNC_MESSAGE_MANAGEMENT
@ ENET_TIMESYNC_MESSAGE_MANAGEMENT
Definition: enet_mod_timesync.h:204
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:271
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
EnetTimeSync_setTimestamp::clkMode
uint8_t clkMode
Definition: enet_mod_timesync.h:246
ENET_TIMESYNC_MESSAGE_FOLLOW_UP
@ ENET_TIMESYNC_MESSAGE_FOLLOW_UP
Definition: enet_mod_timesync.h:189
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_IOCTL_SET_TIMESTAMP_COMPLETE
@ ENET_TIMESYNC_IOCTL_SET_TIMESTAMP_COMPLETE
ICSSG Set timestamp operation completed.
Definition: enet_mod_timesync.h:168
ENET_TIMESYNC_MESSAGE_INVALID
@ ENET_TIMESYNC_MESSAGE_INVALID
Definition: enet_mod_timesync.h:207
EnetTimeSync_setTimestamp::tsLoadVal
uint64_t tsLoadVal
Definition: enet_mod_timesync.h:243
EnetTimeSync_GetEthTimestampInArgs::seqId
uint32_t seqId
Definition: enet_mod_timesync.h:274
EnetTimeSync_TimestampAdj::intervalInNsecs
uint32_t intervalInNsecs
Definition: enet_mod_timesync.h:261
EnetTimeSync_Ioctl
EnetTimeSync_Ioctl
TimeSync module IOCTL commands.
Definition: enet_mod_timesync.h:78
EnetTimeSync_setTimestamp::clkSign
uint8_t clkSign
Definition: enet_mod_timesync.h:249
EnetTimeSync_TimestampAdj
Timestamp adjustment.
Definition: enet_mod_timesync.h:256
ENET_TIMESYNC_MESSAGE_DELAY_REQ
@ ENET_TIMESYNC_MESSAGE_DELAY_REQ
Definition: enet_mod_timesync.h:180
EnetTimeSync_TimestampAdj::adjValInNsecs
int32_t adjValInNsecs
Definition: enet_mod_timesync.h:258
EnetTimeSync_AdjMode
EnetTimeSync_AdjMode
TimeSync adjustment mode.
Definition: enet_mod_timesync.h:214
ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
Definition: enet_mod_timesync.h:195
ENET_TIMESYNC_MESSAGE_SIGNALING
@ ENET_TIMESYNC_MESSAGE_SIGNALING
Definition: enet_mod_timesync.h:201
ENET_TIMESYNC_MESSAGE_PDELAY_RESP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP
Definition: enet_mod_timesync.h:186
ENET_TIMESYNC_ADJDIR_INCREASE
@ ENET_TIMESYNC_ADJDIR_INCREASE
Definition: enet_mod_timesync.h:231
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:269
EnetTimeSync_setTimestamp
Timestamp set.
Definition: enet_mod_timesync.h:241
EnetTimeSync_AdjDir
EnetTimeSync_AdjDir
TimeSync adjustment direction.
Definition: enet_mod_timesync.h:229
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:277
EnetTimeSync_MsgType
EnetTimeSync_MsgType
TimeSync Ethernet message type.
Definition: enet_mod_timesync.h:175
ENET_TIMESYNC_MESSAGE_SYNC
@ ENET_TIMESYNC_MESSAGE_SYNC
Definition: enet_mod_timesync.h:177
EnetTimeSync_GetEthTimestampInArgs::domain
uint32_t domain
Definition: enet_mod_timesync.h:280
ENET_TIMESYNC_ADJMODE_PPM
@ ENET_TIMESYNC_ADJMODE_PPM
Definition: enet_mod_timesync.h:219
ENET_TIMESYNC_ADJMODE_DISABLE
@ ENET_TIMESYNC_ADJMODE_DISABLE
Definition: enet_mod_timesync.h:216
ENET_TIMESYNC_MESSAGE_PDELAY_REQ
@ ENET_TIMESYNC_MESSAGE_PDELAY_REQ
Definition: enet_mod_timesync.h:183
ENET_TIMESYNC_MESSAGE_DELAY_RESP
@ ENET_TIMESYNC_MESSAGE_DELAY_RESP
Definition: enet_mod_timesync.h:192