PDK API Guide for AM65xx
cpsw_cpts_priv.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 
40 #ifndef CPSW_CPTS_PRIV_H_
41 #define CPSW_CPTS_PRIV_H_
42 
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
46 
47 #include <ti/drv/enet/enet_cfg.h>
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /* ========================================================================== */
56 /* Macros */
57 /* ========================================================================== */
58 
60 #define CPSW_CPTS_PRIVATE_IOCTL(x) (ENET_IOCTL_TYPE_PRIVATE | \
61  ENET_IOCTL_TIMESYNC_BASE | \
62  ENET_IOCTL_PER_CPSW | \
63  ENET_IOCTL_MIN(x))
64 
66 #define CPSW_CPTS_ERRATA_GENFN_RECONFIG (ENET_BIT(0U))
67 
68 /* ========================================================================== */
69 /* Structures and Enums */
70 /* ========================================================================== */
71 
75 typedef enum CpswCpts_PrivIoctls_e
76 {
85 
94 
104 
108 typedef struct CpswCpts_EventMemObj_s
109 {
112 
114  uint32_t index;
116 
120 typedef struct CpswCpts_EventStats_s
121 {
124 
127 
129  uint64_t cmpEventCnt;
130 
132  uint64_t ethRxEventCnt;
133 
135  uint64_t ethTxEventCnt;
136 
139 
142 
145 
148 
151 
154 
157 
160 
163 
166 
170 
174 typedef struct CpswCpts_Obj_s
175 {
178 
180  volatile bool tsPushInFifo;
181 
183  uint64_t tsVal;
184 
187 
190 
192  uint32_t hwPushCnt;
193 
196 
198  void *hwPushNotifyCbArg[CPSW_CPTS_HWPUSH_COUNT_MAX];
199 
202 
205 
208 
211 
214 
217 } CpswCpts_Obj;
218 
223 
224 /* ========================================================================== */
225 /* Global Variables Declarations */
226 /* ========================================================================== */
227 
228 /* None */
229 
230 /* ========================================================================== */
231 /* Function Declarations */
232 /* ========================================================================== */
233 
245 int32_t CpswCpts_open(EnetMod_Handle hMod,
246  Enet_Type enetType,
247  uint32_t instId,
248  const void *cfg,
249  uint32_t cfgSize);
250 
260 int32_t CpswCpts_rejoin(EnetMod_Handle hMod,
261  Enet_Type enetType,
262  uint32_t instId);
263 
273 int32_t CpswCpts_ioctl(EnetMod_Handle hMod,
274  uint32_t cmd,
275  Enet_IoctlPrms *prms);
276 
282 void CpswCpts_close(EnetMod_Handle hMod);
283 
284 /* ========================================================================== */
285 /* Deprecated Function Declarations */
286 /* ========================================================================== */
287 
288 /* None */
289 
290 /* ========================================================================== */
291 /* Static Function Definitions */
292 /* ========================================================================== */
293 
294 /* None */
295 
296 #ifdef __cplusplus
297 }
298 #endif
299 
300 #endif /* CPSW_CPTS_PRIV_H_ */
uint64_t ethHostTxEventLookupCnt
Definition: cpsw_cpts_priv.h:153
CpswCpts_EventMemObj ethTxEventPool
Definition: cpsw_cpts_priv.h:201
#define ENET_CFG_CPSW_CPTS_EVENTS_POOL_SIZE
Maximum size of CPTS event pool.
Definition: enet_cfg.h:127
uint64_t cmpEventDiscardCnt
Definition: cpsw_cpts_priv.h:159
Disable CPTS interrupt.
Definition: cpsw_cpts_priv.h:102
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
CpswCpts_EventNotifyCb eventNotifyCb
Definition: cpsw_cpts_priv.h:186
Handle the interrupt and notify the event's registered callback.
Definition: cpsw_cpts_priv.h:84
void CpswCpts_close(EnetMod_Handle hMod)
Close CPSW CPTS.
Enable CPTS interrupt.
Definition: cpsw_cpts_priv.h:93
CPTS event memory object.
Definition: cpsw_cpts_priv.h:108
void(* CpswCpts_HwPushNotifyCb)(void *hwPushNotifyCbArg, CpswCpts_HwPush hwPushNum)
CPTS hardware push notify callback/.
Definition: cpsw_cpts.h:431
uint64_t ethHostTxEventDiscardCnt
Definition: cpsw_cpts_priv.h:168
CPSW CPTS object.
Definition: cpsw_cpts_priv.h:174
uint64_t hwTsPushLookupCnt
Definition: cpsw_cpts_priv.h:141
uint64_t ethTxEventCnt
Definition: cpsw_cpts_priv.h:135
CpswCpts_EventStats eventStats
Definition: cpsw_cpts_priv.h:216
uint64_t tsVal
Definition: cpsw_cpts_priv.h:183
uint64_t ethHostTxEventCnt
Definition: cpsw_cpts_priv.h:138
Ethernet Module object.
Definition: enet_mod.h:136
uint32_t index
Definition: cpsw_cpts_priv.h:114
CPTS event.
Definition: cpsw_cpts.h:390
CpswCpts_Obj * CpswCpts_Handle
CPSW CPTS module handle.
Definition: cpsw_cpts_priv.h:222
uint64_t swTsPushEventCnt
Definition: cpsw_cpts_priv.h:123
CpswCpts_EventMemObj hwPushEventPool
Definition: cpsw_cpts_priv.h:207
uint64_t cmpEventCnt
Definition: cpsw_cpts_priv.h:129
#define CPSW_CPTS_PRIVATE_IOCTL(x)
Helper macro to create private IOCTL commands for CPSW CPTS module.
Definition: cpsw_cpts_priv.h:60
uint64_t ethRxEventCnt
Definition: cpsw_cpts_priv.h:132
CPTS event statistics.
Definition: cpsw_cpts_priv.h:120
uint64_t ethTxEventLookupCnt
Definition: cpsw_cpts_priv.h:150
EnetMod_Obj enetMod
Definition: cpsw_cpts_priv.h:177
#define CPSW_CPTS_HWPUSH_COUNT_MAX
Max number of hardware push instances.
Definition: cpsw_cpts.h:382
Enet IOCTL param.
Definition: enet_ioctl.h:229
CpswCpts_EventMemObj ethRxEventPool
Definition: cpsw_cpts_priv.h:204
uint64_t ethRxEventLookupCnt
Definition: cpsw_cpts_priv.h:147
This file contains the type definitions and helper macros for the Enet Time Synchronization module in...
int32_t CpswCpts_ioctl(EnetMod_Handle hMod, uint32_t cmd, Enet_IoctlPrms *prms)
Run an IOCTL operation on CPSW CPTS.
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
int32_t CpswCpts_rejoin(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId)
Rejoin a running CPSW CPTS module.
uint64_t hwTsPushEventCnt
Definition: cpsw_cpts_priv.h:126
void(* CpswCpts_EventNotifyCb)(void *eventNotifyCbArg, CpswCpts_Event *eventInfo)
CPTS event notify callback.
Definition: cpsw_cpts.h:421
void * eventNotifyCbArg
Definition: cpsw_cpts_priv.h:189
uint64_t ethRxEventDiscardCnt
Definition: cpsw_cpts_priv.h:162
CpswCpts_PrivIoctls
CPTS private IOCTL commands.
Definition: cpsw_cpts_priv.h:75
CpswCpts_EventMemObj cmpEventPool
Definition: cpsw_cpts_priv.h:210
This file contains private type definitions and helper macros for the CPSW CPTS module.
volatile bool tsPushInFifo
Definition: cpsw_cpts_priv.h:180
uint64_t ethTxEventDiscardCnt
Definition: cpsw_cpts_priv.h:165
uint64_t cmpEventLookupCnt
Definition: cpsw_cpts_priv.h:144
CpswCpts_EventMemObj hostTxEventPool
Definition: cpsw_cpts_priv.h:213
int32_t CpswCpts_open(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize CPSW CPTS.
This file contains the Enet configuration parameters.
uint32_t hwPushCnt
Definition: cpsw_cpts_priv.h:192
uint64_t hwTsPushDiscardCnt
Definition: cpsw_cpts_priv.h:156