PDK API Guide for AM65xx
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 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* ========================================================================== */
66 /* Macros */
67 /* ========================================================================== */
68 
70 #define CPSW_FEATURE_INTERVLAN (ENET_BIT(1U))
71 
72 /* ========================================================================== */
73 /* Structures and Enums */
74 /* ========================================================================== */
75 
79 typedef struct Cpsw_MdioLinkIntCtx_s
80 {
82  uint32_t aliveMask;
83 
85  uint32_t linkedMask;
86 
88  uint32_t pollEnableMask;
89 
92 
96 
100 typedef struct Cpsw_PortLinkState_s
101 {
103  uint32_t phyAddr;
104 
106  bool isOpen;
107 
109  bool isLinkUp;
110 
113 
117 
121 typedef struct Cpsw_Obj_s
122 {
125 
128 
131 
133  uint32_t macPortNum;
134 
137 
140 
143 
146 
149 
152 
155 
158 
160  uint32_t rsvdFlowId;
161 
164 
167 
170 
173 
176 
179 
182 
185 
187  uint32_t selfCoreId;
188 
191 
193  void *hStatsIntr;
194 
196  void *hMdioIntr;
197 
199  void *hCptsIntr;
200 
203 
206 
209 
211  uint32_t maxPerPrioMtu;
212 } Cpsw_Obj;
213 
218 
219 /* ========================================================================== */
220 /* Global Variables Declarations */
221 /* ========================================================================== */
222 
223 /* None */
224 
225 /* ========================================================================== */
226 /* Function Declarations */
227 /* ========================================================================== */
228 
241 void Cpsw_initCfg(EnetPer_Handle hPer,
242  Enet_Type enetType,
243  void *cfg,
244  uint32_t cfgSize);
245 
262 int32_t Cpsw_open(EnetPer_Handle hPer,
263  Enet_Type enetType,
264  uint32_t instId,
265  const void *cfg,
266  uint32_t cfgSize);
267 
283 int32_t Cpsw_rejoin(EnetPer_Handle hPer,
284  Enet_Type enetType,
285  uint32_t instId);
286 
294 void Cpsw_close(EnetPer_Handle hPer);
295 
307 int32_t Cpsw_ioctl(EnetPer_Handle hPer,
308  uint32_t cmd,
309  Enet_IoctlPrms *prms);
310 
322 void Cpsw_poll(EnetPer_Handle hPer,
323  Enet_Event evt,
324  const void *arg,
325  uint32_t argSize);
326 
336 
337 /* ========================================================================== */
338 /* Deprecated Function Declarations */
339 /* ========================================================================== */
340 
341 /* None */
342 
343 /* ========================================================================== */
344 /* Static Function Definitions */
345 /* ========================================================================== */
346 
347 /* None */
348 
349 #ifdef __cplusplus
350 }
351 #endif
352 
353 #endif /* CPSW_PRIV_H_ */
bool isLinkUp
Definition: cpsw_priv.h:109
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:199
uint32_t macPortNum
Definition: cpsw_priv.h:133
uint32_t pollEnableMask
Definition: cpsw_priv.h:88
CPSW ALE object.
Definition: cpsw_ale_priv.h:84
void(* Cpsw_PortLinkStatusChangeCb)(Enet_MacPort macPort, bool isLinkUp, void *appArg)
CPSW port link status change callback function.
Definition: cpsw.h:463
This file contains the type definitions and helper macros for the CPSW CPTS module.
Cpsw_MdioLinkIntCtx mdioLinkIntCtx
Definition: cpsw_priv.h:202
CpswMacPort_Obj * macPortObj
Definition: cpsw_priv.h:130
CpswStats_Obj statsObj
Definition: cpsw_priv.h:145
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:103
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:106
EnetMod_Handle hRm
Definition: cpsw_priv.h:184
Cpsw_MdioLinkStateChangeCb linkStateChangeCb
Definition: cpsw_priv.h:91
EnetMod_Handle hHostPort
Definition: cpsw_priv.h:163
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
void * linkStateChangeCbArg
Definition: cpsw_priv.h:94
CPSW host port object.
Definition: cpsw_hostport_priv.h:88
uint32_t maxPerPrioMtu
Definition: cpsw_priv.h:211
This file contains private type definitions and helper macros for the CPSW statistics module which ar...
EnetDma_RxChHandle hRxRsvdFlow
Definition: cpsw_priv.h:154
uint32_t aliveMask
Definition: cpsw_priv.h:82
#define CPSW_MAC_PORT_NUM
Definition: cpsw.h:97
void * hMdioIntr
Definition: cpsw_priv.h:196
void * portLinkStatusChangeCbArg
Definition: cpsw_priv.h:208
Port link state (link up/down, tick enabled)
Definition: cpsw_priv.h:100
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:453
int32_t Cpsw_ioctl(EnetPer_Handle hPer, uint32_t cmd, Enet_IoctlPrms *prms)
Issue an operation on the CPSW peripheral.
void Cpsw_periodicTick(EnetPer_Handle hPer)
Run periodic tick on the CPSW peripheral.
EnetPer_Obj enetPer
Definition: cpsw_priv.h:124
This file contains the private type definitions and helper macros for Enet Resource Manager.
EnetMod_Handle hAle
Definition: cpsw_priv.h:172
uint32_t linkedMask
Definition: cpsw_priv.h:85
Enet_dmaResInfo dmaResInfo
Definition: cpsw_priv.h:157
EnetMod_Handle hMdio
Definition: cpsw_priv.h:178
Cpsw_PortLinkStatusChangeCb portLinkStatusChangeCb
Definition: cpsw_priv.h:205
CPSW MAC port object.
Definition: cpsw_macport_priv.h:257
EnetRm_Obj rmObj
Definition: cpsw_priv.h:148
Ethernet Peripheral object.
Definition: enet_per.h:461
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:112
Enet IOCTL param.
Definition: enet_ioctl.h:229
EnetMod_Handle hCpts
Definition: cpsw_priv.h:175
MDIO status change (MDIO_LINKINT) context.
Definition: cpsw_priv.h:79
This file contains private type definitions and helper macros for the CPSW MAC port module which are ...
CPSW driver object.
Definition: cpsw_priv.h:121
uint32_t rsvdFlowId
Definition: cpsw_priv.h:160
CpswAle_Obj aleObj
Definition: cpsw_priv.h:136
Cpsw_Obj * Cpsw_Handle
CPSW peripheral handle.
Definition: cpsw_priv.h:217
Enet_Event
Ethernet events.
Definition: enet_types.h:258
uint32_t selfCoreId
Definition: cpsw_priv.h:187
CpswHostPort_Obj hostPortObj
Definition: cpsw_priv.h:127
EnetDma_Handle hDma
Definition: cpsw_priv.h:151
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:139
Mdio_Obj mdioObj
Definition: cpsw_priv.h:142
CPSW statistics object.
Definition: cpsw_stats_priv.h:90
bool isTickEnabled
Definition: cpsw_priv.h:115
EnetMod_Handle hStats
Definition: cpsw_priv.h:181
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:299
This file contains the private top-level type definitions and helper macros.
void * hStatsIntr
Definition: cpsw_priv.h:193
MDIO port object.
Definition: mdio_priv.h:147
This file contains the type definitions and helper macros for the Ethernet PHY interface.
This file contains private type definitions and helper macros for the CPSW host port module which are...