AM64x MCU+ SDK  08.02.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 
161 
165 typedef enum EnetTimeSync_MsgType_e
166 {
169 
172 
175 
178 
181 
184 
187 
190 
193 
196 
200 
204 typedef enum EnetTimeSync_AdjMode_e
205 {
208 
211 
215 
219 typedef enum EnetTimeSync_AdjDir_e
220 {
223 
227 
231 typedef struct EnetTimeSync_TimestampAdj_s
232 {
234  int32_t adjValInNsecs;
235 
237  uint32_t intervalInNsecs;
239 
244 typedef struct EnetTimeSync_GetEthTimestampInArgs_s
245 {
248 
250  uint32_t seqId;
251 
253  uint32_t portNum;
254 
256  uint32_t domain;
258 
259 /* ========================================================================== */
260 /* Global Variables Declarations */
261 /* ========================================================================== */
262 
263 /* None */
264 
265 /* ========================================================================== */
266 /* Function Declarations */
267 /* ========================================================================== */
268 
269 /* None */
270 
271 /* ========================================================================== */
272 /* Deprecated Function Declarations */
273 /* ========================================================================== */
274 
275 /* None */
276 
277 /* ========================================================================== */
278 /* Static Function Definitions */
279 /* ========================================================================== */
280 
281 /* None */
282 
283 #ifdef __cplusplus
284 }
285 #endif
286 
287 #endif /* ENET_MOD_TIMESYNC_H_ */
288 
ENET_TIMESYNC_ADJMODE_PPH
@ ENET_TIMESYNC_ADJMODE_PPH
Definition: enet_mod_timesync.h:213
ENET_TIMESYNC_MESSAGE_ANNOUNCE
@ ENET_TIMESYNC_MESSAGE_ANNOUNCE
Definition: enet_mod_timesync.h:189
ENET_TIMESYNC_ADJDIR_DECREASE
@ ENET_TIMESYNC_ADJDIR_DECREASE
Definition: enet_mod_timesync.h:225
ENET_TIMESYNC_MESSAGE_MANAGEMENT
@ ENET_TIMESYNC_MESSAGE_MANAGEMENT
Definition: enet_mod_timesync.h:195
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:247
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:180
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:198
EnetTimeSync_GetEthTimestampInArgs::seqId
uint32_t seqId
Definition: enet_mod_timesync.h:250
EnetTimeSync_TimestampAdj::intervalInNsecs
uint32_t intervalInNsecs
Definition: enet_mod_timesync.h:237
EnetTimeSync_Ioctl
EnetTimeSync_Ioctl
TimeSync module IOCTL commands.
Definition: enet_mod_timesync.h:78
EnetTimeSync_TimestampAdj
Timestamp adjustment.
Definition: enet_mod_timesync.h:232
ENET_TIMESYNC_MESSAGE_DELAY_REQ
@ ENET_TIMESYNC_MESSAGE_DELAY_REQ
Definition: enet_mod_timesync.h:171
EnetTimeSync_TimestampAdj::adjValInNsecs
int32_t adjValInNsecs
Definition: enet_mod_timesync.h:234
EnetTimeSync_AdjMode
EnetTimeSync_AdjMode
TimeSync adjustment mode.
Definition: enet_mod_timesync.h:205
ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
Definition: enet_mod_timesync.h:186
ENET_TIMESYNC_MESSAGE_SIGNALING
@ ENET_TIMESYNC_MESSAGE_SIGNALING
Definition: enet_mod_timesync.h:192
ENET_TIMESYNC_MESSAGE_PDELAY_RESP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP
Definition: enet_mod_timesync.h:177
ENET_TIMESYNC_ADJDIR_INCREASE
@ ENET_TIMESYNC_ADJDIR_INCREASE
Definition: enet_mod_timesync.h:222
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:245
EnetTimeSync_AdjDir
EnetTimeSync_AdjDir
TimeSync adjustment direction.
Definition: enet_mod_timesync.h:220
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:253
EnetTimeSync_MsgType
EnetTimeSync_MsgType
TimeSync Ethernet message type.
Definition: enet_mod_timesync.h:166
ENET_TIMESYNC_MESSAGE_SYNC
@ ENET_TIMESYNC_MESSAGE_SYNC
Definition: enet_mod_timesync.h:168
EnetTimeSync_GetEthTimestampInArgs::domain
uint32_t domain
Definition: enet_mod_timesync.h:256
ENET_TIMESYNC_ADJMODE_PPM
@ ENET_TIMESYNC_ADJMODE_PPM
Definition: enet_mod_timesync.h:210
ENET_TIMESYNC_ADJMODE_DISABLE
@ ENET_TIMESYNC_ADJMODE_DISABLE
Definition: enet_mod_timesync.h:207
ENET_TIMESYNC_MESSAGE_PDELAY_REQ
@ ENET_TIMESYNC_MESSAGE_PDELAY_REQ
Definition: enet_mod_timesync.h:174
ENET_TIMESYNC_MESSAGE_DELAY_RESP
@ ENET_TIMESYNC_MESSAGE_DELAY_RESP
Definition: enet_mod_timesync.h:183