PDK API Guide for J721E
cpsw_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_PRIV_H_
41 #define CPSW_PRIV_H_
42 
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
46 
47 #include <stdint.h>
60 #if ENET_CFG_IS_ON(CPSW_EST)
62 #endif
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 /* ========================================================================== */
69 /* Macros */
70 /* ========================================================================== */
71 
73 #define CPSW_FEATURE_INTERVLAN (ENET_BIT(1U))
74 
76 #define CPSW_FEATURE_EST (ENET_BIT(2U))
77 
78 /* ========================================================================== */
79 /* Structures and Enums */
80 /* ========================================================================== */
81 
85 typedef struct Cpsw_MdioLinkIntCtx_s
86 {
88  uint32_t aliveMask;
89 
91  uint32_t linkedMask;
92 
94  uint32_t pollEnableMask;
95 
98 
102 
106 typedef struct Cpsw_PortLinkState_s
107 {
109  uint32_t phyAddr;
110 
112  bool isOpen;
113 
115  bool isLinkUp;
116 
119 
123 
127 typedef struct Cpsw_Obj_s
128 {
131 
134 
137 
139  uint32_t macPortNum;
140 
143 
146 
149 
152 
155 
158 
161 
164 
166  uint32_t rsvdFlowId;
167 
170 
173 
176 
179 
182 
185 
188 
191 
193  uint32_t selfCoreId;
194 
197 
199  void *hStatsIntr;
200 
202  void *hMdioIntr;
203 
205  void *hCptsIntr;
206 
209 
212 
215 
217  uint32_t maxPerPrioMtu;
218 
219 #if ENET_CFG_IS_ON(CPSW_EST)
220 
221  CpswCpts_RftClkFreq cptsRftClkFreq;
222 
225 #endif
226 } Cpsw_Obj;
227 
232 
233 /* ========================================================================== */
234 /* Global Variables Declarations */
235 /* ========================================================================== */
236 
237 /* None */
238 
239 /* ========================================================================== */
240 /* Function Declarations */
241 /* ========================================================================== */
242 
255 void Cpsw_initCfg(EnetPer_Handle hPer,
256  Enet_Type enetType,
257  void *cfg,
258  uint32_t cfgSize);
259 
276 int32_t Cpsw_open(EnetPer_Handle hPer,
277  Enet_Type enetType,
278  uint32_t instId,
279  const void *cfg,
280  uint32_t cfgSize);
281 
297 int32_t Cpsw_rejoin(EnetPer_Handle hPer,
298  Enet_Type enetType,
299  uint32_t instId);
300 
308 void Cpsw_close(EnetPer_Handle hPer);
309 
321 int32_t Cpsw_ioctl(EnetPer_Handle hPer,
322  uint32_t cmd,
323  Enet_IoctlPrms *prms);
324 
336 void Cpsw_poll(EnetPer_Handle hPer,
337  Enet_Event evt,
338  const void *arg,
339  uint32_t argSize);
340 
350 
351 /* ========================================================================== */
352 /* Deprecated Function Declarations */
353 /* ========================================================================== */
354 
355 /* None */
356 
357 /* ========================================================================== */
358 /* Static Function Definitions */
359 /* ========================================================================== */
360 
361 /* None */
362 
363 #ifdef __cplusplus
364 }
365 #endif
366 
367 #endif /* CPSW_PRIV_H_ */
bool isLinkUp
Definition: cpsw_priv.h:115
This file contains the type definitions and helper macros for the CPSW peripheral interface.
Enet DMA resource information.
Definition: enet_base_priv.h:68
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
void * hCptsIntr
Definition: cpsw_priv.h:205
uint32_t macPortNum
Definition: cpsw_priv.h:139
uint32_t pollEnableMask
Definition: cpsw_priv.h:94
CPSW ALE object.
Definition: cpsw_ale_priv.h:87
void(* Cpsw_PortLinkStatusChangeCb)(Enet_MacPort macPort, bool isLinkUp, void *appArg)
CPSW port link status change callback function.
Definition: cpsw.h:504
This file contains the type definitions and helper macros for the CPSW CPTS module.
Cpsw_MdioLinkIntCtx mdioLinkIntCtx
Definition: cpsw_priv.h:208
This file contains the private interface for CPSW peripheral EST feature.
CpswStats_Obj statsObj
Definition: cpsw_priv.h:151
CPSW CPTS object.
Definition: cpsw_cpts_priv.h:174
void Cpsw_close(EnetPer_Handle hPer)
Close the CPSW peripheral.
struct EnetUdma_RxFlowObj_s * EnetDma_RxChHandle
Opaque handle that holds software state for Enet RX DMA flow.
Definition: enet_udma_types.h:95
Enet Resource Manager driver object.
Definition: enet_rm_priv.h:321
void Cpsw_initCfg(EnetPer_Handle hPer, Enet_Type enetType, void *cfg, uint32_t cfgSize)
Initialize CPSW peripheral's configuration parameters.
uint32_t phyAddr
Definition: cpsw_priv.h:109
This file contains private type definitions and helper macros for the CPSW ALE module which are meant...
This file contains the type definitions and helper macros for the Enet Data Path (DMA) interface.
bool isOpen
Definition: cpsw_priv.h:112
EnetMod_Handle hRm
Definition: cpsw_priv.h:190
Cpsw_MdioLinkStateChangeCb linkStateChangeCb
Definition: cpsw_priv.h:97
EnetMod_Handle hHostPort
Definition: cpsw_priv.h:169
This file contains the type definitions and helper macros for the Enet Peripheral interface.
struct EnetUdma_DrvObj_s * EnetDma_Handle
Opaque handle for Enet UDMA driver object.
Definition: enet_udma_types.h:86
CPSW host port object.
Definition: cpsw_hostport_priv.h:88
uint32_t maxPerPrioMtu
Definition: cpsw_priv.h:217
This file contains private type definitions and helper macros for the CPSW statistics module which ar...
EnetDma_RxChHandle hRxRsvdFlow
Definition: cpsw_priv.h:160
uint32_t aliveMask
Definition: cpsw_priv.h:88
#define CPSW_MAC_PORT_NUM
Definition: cpsw.h:95
void * hMdioIntr
Definition: cpsw_priv.h:202
Port link state (link up/down, tick enabled)
Definition: cpsw_priv.h:106
int32_t Cpsw_open(EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize the CPSW Peripheral.
void(* Cpsw_MdioLinkStateChangeCb)(Cpsw_MdioLinkStateChangeInfo *info, void *appArg)
CPSW PHY link state change callback function.
Definition: cpsw.h:494
int32_t Cpsw_ioctl(EnetPer_Handle hPer, uint32_t cmd, Enet_IoctlPrms *prms)
Issue an operation on the CPSW peripheral.
MAC port's EST state (ESTF state, period)
Definition: cpsw_est_priv.h:68
void Cpsw_periodicTick(EnetPer_Handle hPer)
Run periodic tick on the CPSW peripheral.
void * linkStateChangeCbArg
Definition: cpsw_priv.h:100
CpswCpts_RftClkFreq
CPTS clock frequency add value.
Definition: cpsw_cpts.h:237
EnetPer_Obj enetPer
Definition: cpsw_priv.h:130
This file contains the private type definitions and helper macros for Enet Resource Manager.
EnetMod_Handle hAle
Definition: cpsw_priv.h:178
uint32_t linkedMask
Definition: cpsw_priv.h:91
Enet_dmaResInfo dmaResInfo
Definition: cpsw_priv.h:163
EnetMod_Handle hMdio
Definition: cpsw_priv.h:184
Cpsw_PortLinkStatusChangeCb portLinkStatusChangeCb
Definition: cpsw_priv.h:211
CPSW MAC port object.
Definition: cpsw_macport_priv.h:266
EnetRm_Obj rmObj
Definition: cpsw_priv.h:154
Ethernet Peripheral object.
Definition: enet_per.h:462
void Cpsw_poll(EnetPer_Handle hPer, Enet_Event evt, const void *arg, uint32_t argSize)
Poll for Ethernet events.
bool isPollEnabled
Definition: cpsw_priv.h:118
Enet IOCTL param.
Definition: enet_ioctl.h:232
EnetMod_Handle hCpts
Definition: cpsw_priv.h:181
MDIO status change (MDIO_LINKINT) context.
Definition: cpsw_priv.h:85
gptp_ipc_command_t cmd
Definition: gptpipc.h:140
This file contains private type definitions and helper macros for the CPSW MAC port module which are ...
CPSW driver object.
Definition: cpsw_priv.h:127
uint32_t rsvdFlowId
Definition: cpsw_priv.h:166
CpswAle_Obj aleObj
Definition: cpsw_priv.h:142
Cpsw_Obj * Cpsw_Handle
CPSW peripheral handle.
Definition: cpsw_priv.h:231
Enet_Event
Ethernet events.
Definition: enet_types.h:258
uint32_t selfCoreId
Definition: cpsw_priv.h:193
CpswHostPort_Obj hostPortObj
Definition: cpsw_priv.h:133
EnetDma_Handle hDma
Definition: cpsw_priv.h:157
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
int32_t Cpsw_rejoin(EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)
Rejoin a running CPSW peripheral.
struct EnetPhy_Obj_s * EnetPhy_Handle
PHY driver object handle.
Definition: enetphy.h:641
CpswCpts_Obj cptsObj
Definition: cpsw_priv.h:145
Mdio_Obj mdioObj
Definition: cpsw_priv.h:148
CPSW statistics object.
Definition: cpsw_stats_priv.h:90
bool isTickEnabled
Definition: cpsw_priv.h:121
EnetMod_Handle hStats
Definition: cpsw_priv.h:187
void * portLinkStatusChangeCbArg
Definition: cpsw_priv.h:214
This file contains private type definitions and helper macros for the MDIO port module which are mean...
struct EnetPer_Obj_s * EnetPer_Handle
Ethernet Peripheral handle.
Definition: enet_per.h:300
This file contains the private top-level type definitions and helper macros.
void * hStatsIntr
Definition: cpsw_priv.h:199
MDIO port object.
Definition: mdio_priv.h:147
This file contains the type definitions and helper macros for the Ethernet PHY interface.
CpswMacPort_Obj * macPortObj
Definition: cpsw_priv.h:136
This file contains private type definitions and helper macros for the CPSW host port module which are...