AM263Px MCU+ SDK  11.00.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>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* ========================================================================== */
63 /* Macros */
64 /* ========================================================================== */
65 
67 #define ENET_TIMESYNC_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
68  ENET_IOCTL_TIMESYNC_BASE | \
69  ENET_IOCTL_MIN(x))
70 
71 /* ========================================================================== */
72 /* Structures and Enums */
73 /* ========================================================================== */
74 
78 typedef enum EnetTimeSync_Ioctl_e
79 {
88 
97 
107 
116 
125 
134 
143 
155 
164 
174 
178 typedef enum EnetTimeSync_MsgType_e
179 {
182 
185 
188 
191 
194 
197 
200 
203 
206 
209 
213 
217 typedef enum EnetTimeSync_AdjMode_e
218 {
221 
224 
228 
232 typedef enum EnetTimeSync_AdjDir_e
233 {
236 
240 
244 typedef struct EnetTimeSync_setTimestamp_s
245 {
247  uint64_t tsLoadVal;
248 
252  uint8_t clkMode;
253 
254  /*Sign of the clock. Applicable only to ICSSG peripheral. */
255  uint8_t clkSign;
257 
261 typedef struct EnetTimeSync_TimestampAdj_s
262 {
264  int32_t adjValInNsecs;
265 
267  uint32_t intervalInNsecs;
269 
274 typedef struct EnetTimeSync_GetEthTimestampInArgs_s
275 {
278 
280  uint32_t seqId;
281 
283  uint32_t portNum;
284 
286  uint32_t domain;
288 
289 /* ========================================================================== */
290 /* Global Variables Declarations */
291 /* ========================================================================== */
292 
293 /* None */
294 
295 /* ========================================================================== */
296 /* Function Declarations */
297 /* ========================================================================== */
298 
299 /* None */
300 
301 /* ========================================================================== */
302 /* Deprecated Function Declarations */
303 /* ========================================================================== */
304 
305 /* None */
306 
307 /* ========================================================================== */
308 /* Static Function Definitions */
309 /* ========================================================================== */
310 
311 /* None */
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 
317 #endif /* ENET_MOD_TIMESYNC_H_ */
318 
ENET_TIMESYNC_ADJMODE_PPH
@ ENET_TIMESYNC_ADJMODE_PPH
Definition: enet_mod_timesync.h:226
ENET_TIMESYNC_MESSAGE_ANNOUNCE
@ ENET_TIMESYNC_MESSAGE_ANNOUNCE
Definition: enet_mod_timesync.h:202
ENET_TIMESYNC_ADJDIR_DECREASE
@ ENET_TIMESYNC_ADJDIR_DECREASE
Definition: enet_mod_timesync.h:238
ENET_TIMESYNC_MESSAGE_MANAGEMENT
@ ENET_TIMESYNC_MESSAGE_MANAGEMENT
Definition: enet_mod_timesync.h:208
ENET_TIMESYNC_IOCTL_ADJUST_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_ADJUST_TIMESTAMP
Adjust the timestamp value.
Definition: enet_mod_timesync.h:133
ENET_TIMESYNC_IOCTL_GET_ETH_TX_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_GET_ETH_TX_TIMESTAMP
Get Ethernet TX timestamp. For CPSW the driver maintains a pool of the timestamps that are captured b...
Definition: enet_mod_timesync.h:154
EnetTimeSync_GetEthTimestampInArgs::msgType
EnetTimeSync_MsgType msgType
Definition: enet_mod_timesync.h:277
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:106
ENET_TIMESYNC_PUBLIC_IOCTL
#define ENET_TIMESYNC_PUBLIC_IOCTL(x)
Helper macro to create IOCTL commands for TIMESYNC module.
Definition: enet_mod_timesync.h:67
enet_types.h
This file contains the basic types using across the Enet driver.
ENET_TIMESYNC_IOCTL_PRINT_REGS
@ ENET_TIMESYNC_IOCTL_PRINT_REGS
Print TimeSync registers.
Definition: enet_mod_timesync.h:96
ENET_TIMESYNC_IOCTL_SET_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_SET_TIMESTAMP
Set timestamp value.
Definition: enet_mod_timesync.h:124
ENET_TIMESYNC_IOCTL_GET_ETH_RX_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_GET_ETH_RX_TIMESTAMP
Get Ethernet RX timestamp.
Definition: enet_mod_timesync.h:142
EnetTimeSync_setTimestamp::clkMode
uint8_t clkMode
Definition: enet_mod_timesync.h:252
ENET_TIMESYNC_MESSAGE_FOLLOW_UP
@ ENET_TIMESYNC_MESSAGE_FOLLOW_UP
Definition: enet_mod_timesync.h:193
enet_ioctl.h
This file contains the type definitions and helper macros for the Enet IOCTL interface.
ENET_TIMESYNC_IOCTL_RESET
@ ENET_TIMESYNC_IOCTL_RESET
Reset TimeSync module.
Definition: enet_mod_timesync.h:163
ENET_TIMESYNC_IOCTL_GET_CURRENT_TIMESTAMP
@ ENET_TIMESYNC_IOCTL_GET_CURRENT_TIMESTAMP
Get current timestamp.
Definition: enet_mod_timesync.h:115
ENET_TIMESYNC_IOCTL_SET_TIMESTAMP_COMPLETE
@ ENET_TIMESYNC_IOCTL_SET_TIMESTAMP_COMPLETE
ICSSG Set timestamp operation completed.
Definition: enet_mod_timesync.h:172
ENET_TIMESYNC_MESSAGE_INVALID
@ ENET_TIMESYNC_MESSAGE_INVALID
Definition: enet_mod_timesync.h:211
EnetTimeSync_setTimestamp::tsLoadVal
uint64_t tsLoadVal
Definition: enet_mod_timesync.h:247
EnetTimeSync_GetEthTimestampInArgs::seqId
uint32_t seqId
Definition: enet_mod_timesync.h:280
EnetTimeSync_TimestampAdj::intervalInNsecs
uint32_t intervalInNsecs
Definition: enet_mod_timesync.h:267
EnetTimeSync_Ioctl
EnetTimeSync_Ioctl
TimeSync module IOCTL commands.
Definition: enet_mod_timesync.h:79
EnetTimeSync_setTimestamp::clkSign
uint8_t clkSign
Definition: enet_mod_timesync.h:255
EnetTimeSync_TimestampAdj
Timestamp adjustment.
Definition: enet_mod_timesync.h:262
ENET_TIMESYNC_MESSAGE_DELAY_REQ
@ ENET_TIMESYNC_MESSAGE_DELAY_REQ
Definition: enet_mod_timesync.h:184
EnetTimeSync_TimestampAdj::adjValInNsecs
int32_t adjValInNsecs
Definition: enet_mod_timesync.h:264
EnetTimeSync_AdjMode
EnetTimeSync_AdjMode
TimeSync adjustment mode.
Definition: enet_mod_timesync.h:218
ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP
Definition: enet_mod_timesync.h:199
ENET_TIMESYNC_MESSAGE_SIGNALING
@ ENET_TIMESYNC_MESSAGE_SIGNALING
Definition: enet_mod_timesync.h:205
ENET_TIMESYNC_MESSAGE_PDELAY_RESP
@ ENET_TIMESYNC_MESSAGE_PDELAY_RESP
Definition: enet_mod_timesync.h:190
ENET_TIMESYNC_ADJDIR_INCREASE
@ ENET_TIMESYNC_ADJDIR_INCREASE
Definition: enet_mod_timesync.h:235
ENET_TIMESYNC_IOCTL_GET_VERSION
@ ENET_TIMESYNC_IOCTL_GET_VERSION
Get the hardware version of the TimeSync module.
Definition: enet_mod_timesync.h:87
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:275
EnetTimeSync_setTimestamp
Timestamp set.
Definition: enet_mod_timesync.h:245
EnetTimeSync_AdjDir
EnetTimeSync_AdjDir
TimeSync adjustment direction.
Definition: enet_mod_timesync.h:233
EnetTimeSync_GetEthTimestampInArgs::portNum
uint32_t portNum
Definition: enet_mod_timesync.h:283
EnetTimeSync_MsgType
EnetTimeSync_MsgType
TimeSync Ethernet message type.
Definition: enet_mod_timesync.h:179
ENET_TIMESYNC_MESSAGE_SYNC
@ ENET_TIMESYNC_MESSAGE_SYNC
Definition: enet_mod_timesync.h:181
EnetTimeSync_GetEthTimestampInArgs::domain
uint32_t domain
Definition: enet_mod_timesync.h:286
ENET_TIMESYNC_ADJMODE_PPM
@ ENET_TIMESYNC_ADJMODE_PPM
Definition: enet_mod_timesync.h:223
ENET_TIMESYNC_ADJMODE_DISABLE
@ ENET_TIMESYNC_ADJMODE_DISABLE
Definition: enet_mod_timesync.h:220
ENET_TIMESYNC_MESSAGE_PDELAY_REQ
@ ENET_TIMESYNC_MESSAGE_PDELAY_REQ
Definition: enet_mod_timesync.h:187
ENET_TIMESYNC_MESSAGE_DELAY_RESP
@ ENET_TIMESYNC_MESSAGE_DELAY_RESP
Definition: enet_mod_timesync.h:196