PDK API Guide for J721E
icssg_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 ICSSG_PRIV_H_
41 #define ICSSG_PRIV_H_
42 
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
46 
47 #include <stdint.h>
48 #include <ti/drv/pruss/pruicss.h>
54 #include <ti/drv/enet/enet.h>
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /* ========================================================================== */
67 /* Macros */
68 /* ========================================================================== */
69 
71 #define ICSSG_PRUSS_ID_0 (0U)
72 
74 #define ICSSG_PRUSS_ID_1 (1U)
75 
77 #define ICSSG_PRUSS_ID_2 (2U)
78 
80 #define ICSSG_CACHELINE_ALIGNMENT (64U)
81 
82 /* ========================================================================== */
83 /* Structures and Enums */
84 /* ========================================================================== */
88 typedef struct Icssg_evtCbInfo_s
89 {
92 
94  void *evtCbArgs;
96 
113 typedef struct Icssg_Pruss_s
114 {
116  PRUICSS_Handle hPruss;
117 
119  uint32_t instance;
120 
123 
125  bool iep0InUse;
126 
130  void *lock;
131 } Icssg_Pruss;
132 
138 typedef struct Icssg_Fw_s
139 {
141  const uint32_t *pru;
142 
144  uint32_t pruSize;
145 
147  const uint32_t *rtu;
148 
150  uint32_t rtuSize;
151 
153  const uint32_t *txpru;
154 
156  uint32_t txpruSize;
157 } Icssg_Fw;
158 
165 typedef struct Icssg_FwPoolMem_s
166 {
170 
173 
176 
180 
183 
186 
190 
194 
198 
202 
205 
208 
212 
216 typedef struct Icssg_IoctlCmd_s
217 {
219  uint8_t param;
220 
222  uint8_t seqNum;
223 
225  uint8_t type;
226 
228  uint8_t header;
229 
231  uint32_t spare[3];
232 } __attribute__((packed)) Icssg_IoctlCmd;
233 
237 typedef struct Icssg_IoctlCmdResp_s
238 {
240  uint8_t status;
241 
243  uint8_t seqNum;
244 
246  uint32_t paramsLen;
247 
249  uint32_t params[3U];
251 
255 typedef struct Icssg_Obj_s
256 {
259 
262 
269 
277 
280 
282  uint32_t asyncIoctlType;
283 
286 
289 
292 
295 
297  uint32_t selfCoreId;
298 
301 
303  uint32_t numRxCh;
304 
307 
310 
312  uint32_t rsvdFlowId[ICSSG_MAC_PORT_MAX];
313 
316 
319 
322 
325 
328 
331 
334 
337 
340 
342  Icssg_IoctlCmd cmd __attribute__ ((aligned(ICSSG_CACHELINE_ALIGNMENT)));
343 
345  uint32_t cycleTimeNs;
346 } Icssg_Obj;
347 
352 
353 /* ========================================================================== */
354 /* Global Variables Declarations */
355 /* ========================================================================== */
356 
357 /* None */
358 
359 /* ========================================================================== */
360 /* Function Declarations */
361 /* ========================================================================== */
362 
375 void Icssg_initCfg(EnetPer_Handle hPer,
376  Enet_Type enetType,
377  void *cfg,
378  uint32_t cfgSize);
379 
396 int32_t Icssg_open(EnetPer_Handle hPer,
397  Enet_Type enetType,
398  uint32_t instId,
399  const void *cfg,
400  uint32_t cfgSize);
401 
414 int32_t Icssg_rejoin(EnetPer_Handle hPer,
415  Enet_Type enetType,
416  uint32_t instId);
417 
429 int32_t Icssg_ioctl(EnetPer_Handle hPer,
430  uint32_t cmd,
431  Enet_IoctlPrms *prms);
432 
445 void Icssg_poll(EnetPer_Handle hPer,
446  Enet_Event evt,
447  const void *arg,
448  uint32_t argSize);
449 
462 uint64_t Icssg_convertTs(EnetPer_Handle hPer,
463  uint64_t ts);
464 
474 
476  Enet_Event evt,
477  uint32_t evtNum,
478  Enet_EventCallback evtCb,
479  void *evtCbArgs);
480 
482  Enet_Event evt,
483  uint32_t evtNum);
484 
492 void Icssg_close(EnetPer_Handle hPer);
493 
494 /* ========================================================================== */
495 /* Deprecated Function Declarations */
496 /* ========================================================================== */
497 
498 /* None */
499 
500 /* ========================================================================== */
501 /* Static Function Definitions */
502 /* ========================================================================== */
503 
504 /* None */
505 
506 #ifdef __cplusplus
507 }
508 #endif
509 
510 #endif /* ICSSG_PRIV_H_ */
EnetPer_Obj enetPer
Definition: icssg_priv.h:258
const uint32_t * pru
Definition: icssg_priv.h:141
void Icssg_registerEventCb(EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum, Enet_EventCallback evtCb, void *evtCbArgs)
This file contains internal type definitions and helper macros for the ICSSG Hardware and PA statisti...
Enet DMA resource information.
Definition: enet_base_priv.h:68
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
uint32_t numRxCh
Definition: icssg_priv.h:303
void Icssg_initCfg(EnetPer_Handle hPer, Enet_Type enetType, void *cfg, uint32_t cfgSize)
Initialize ICSSG peripheral's configuration parameters.
uint32_t spare[3]
Definition: icssg_priv.h:231
uint32_t hostBufferPoolNum
Definition: icssg_priv.h:185
This file contains the private type definitions and helper macros for the ICSSG Tas driver.
EnetMod_Handle hRm
Definition: icssg_priv.h:294
uint32_t hostBufferPoolSize
Definition: icssg_priv.h:182
void Icssg_close(EnetPer_Handle hPer)
Close the ICSSG peripheral.
uint8_t type
Definition: icssg_priv.h:225
This file contains the basic types using across the Enet driver.
uint32_t hostEgressPreQueueSize
Definition: icssg_priv.h:201
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
uint32_t selfCoreId
Definition: icssg_priv.h:297
uint8_t * hostBufferPoolMem
Definition: icssg_priv.h:179
PRUICSS_Handle hPruss
Definition: icssg_priv.h:116
uint32_t txpruSize
Definition: icssg_priv.h:156
uint32_t cycleTimeNs
Definition: icssg_priv.h:345
const uint32_t * rtu
Definition: icssg_priv.h:147
This file contains the type definitions and helper macros for the Ethernet PHY interface.
uint32_t scratchBufferSize
Definition: icssg_priv.h:210
void Icssg_periodicTick(EnetPer_Handle hPer)
Run periodic tick on the ICSSG peripheral.
This file contains the type definitions and helper macros for the Enet Peripheral interface.
uint8_t status
Definition: icssg_priv.h:240
struct EnetUdma_DrvObj_s * EnetDma_Handle
Opaque handle for Enet UDMA driver object.
Definition: enet_udma_types.h:86
uint32_t asyncIoctlType
Definition: icssg_priv.h:282
uint32_t paramsLen
Definition: icssg_priv.h:246
Icssg event callback info structure.
Definition: icssg_priv.h:88
bool initialized
Definition: icssg_priv.h:122
uint8_t asyncIoctlSeqNum
Definition: icssg_priv.h:279
uint64_t Icssg_convertTs(EnetPer_Handle hPer, uint64_t ts)
Converts ICSSG timestamp to nanoseconds.
uint32_t pruSize
Definition: icssg_priv.h:144
int32_t Icssg_ioctl(EnetPer_Handle hPer, uint32_t cmd, Enet_IoctlPrms *prms)
Issue an operation on the ICSSG peripheral.
Icssg_Obj * Icssg_Handle
MAC port module handle.
Definition: icssg_priv.h:351
ICSSG firmware.
Definition: icssg_priv.h:138
const uint32_t * txpru
Definition: icssg_priv.h:153
uint8_t * hostEgressQueueMem
Definition: icssg_priv.h:189
void Icssg_poll(EnetPer_Handle hPer, Enet_Event evt, const void *arg, uint32_t argSize)
Poll for Ethernet events.
void * evtCbArgs
Definition: icssg_priv.h:94
int32_t Icssg_rejoin(EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)
Rejoin a running ICSSG peripheral.
Icssg_evtCbInfo txTsCbEvtInfo
Definition: icssg_priv.h:288
uint8_t seqNum
Definition: icssg_priv.h:243
IcssgStats_Obj statsObj
Definition: icssg_priv.h:330
This file contains the private type definitions and helper macros for Enet Resource Manager.
uint32_t portBufferPoolNum
Definition: icssg_priv.h:175
Enet_EventCallback evtCb
Definition: icssg_priv.h:91
void Icssg_unregisterEventCb(EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum)
#define ICSSG_CACHELINE_ALIGNMENT
Cache alignment used for IOCTL command structure.
Definition: icssg_priv.h:80
IcssgTimeSync_Obj timeSyncObj
Definition: icssg_priv.h:324
EnetMod_Handle hMdio
Definition: icssg_priv.h:318
uint8_t * hostEgressPreQueueMem
Definition: icssg_priv.h:193
EnetMod_Handle hStats
Definition: icssg_priv.h:333
Ethernet Peripheral object.
Definition: enet_per.h:462
Enet IOCTL param.
Definition: enet_ioctl.h:232
Mdio_Obj mdioObj
Definition: icssg_priv.h:315
int32_t Icssg_open(EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize the ICSSG Peripheral.
Icssg_Pruss * pruss
Definition: icssg_priv.h:261
uint8_t param
Definition: icssg_priv.h:219
uint32_t hostEgressQueueNum
Definition: icssg_priv.h:204
Icssg per object.
Definition: icssg_priv.h:255
ICSSG buffer pool memories.
Definition: icssg_priv.h:165
This file contains the top-level API of the Enet driver.
ICSSG TimeSync object.
Definition: icssg_timesync_priv.h:69
IOCTL command response structure used to communicate with ICSSG.
Definition: icssg_priv.h:237
EnetRm_Obj rmObj
Definition: icssg_priv.h:291
uint8_t seqNum
Definition: icssg_priv.h:222
Enet_Event
Ethernet events.
Definition: enet_types.h:258
Icssg_evtCbInfo asyncCmdRespCbEvtInfo
Definition: icssg_priv.h:285
ICSSG Statistics object.
Definition: icssg_stats_priv.h:67
EnetDma_Handle hDma
Definition: icssg_priv.h:300
bool iep0InUse
Definition: icssg_priv.h:125
uint32_t hostEgressQueueSize
Definition: icssg_priv.h:197
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
ICSSG Tas object.
Definition: icssg_tas_priv.h:84
uint32_t portBufferPoolSize
Definition: icssg_priv.h:172
EnetMod_Handle hTimeSync
Definition: icssg_priv.h:327
uint8_t * scratchBufferMem
Definition: icssg_priv.h:207
struct EnetPhy_Obj_s * EnetPhy_Handle
PHY driver object handle.
Definition: enetphy.h:641
struct Icssg_IoctlCmd_s __attribute__((packed)) Icssg_IoctlCmd
IOCTL command structure used to communicate with ICSSG.
Definition: csirx_regs.h:40
#define ICSSG_MAC_PORT_MAX
Maximum number of MAC ports per ICSSG instance.
Definition: icssg.h:82
uint32_t instance
Definition: icssg_priv.h:119
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
void(* Enet_EventCallback)(Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2)
Event callback.
Definition: enet_types.h:445
uint8_t header
Definition: icssg_priv.h:228
This file contains the type definitions and helper macros for the MDIO module interface.
uint32_t rtuSize
Definition: icssg_priv.h:150
This file contains the private top-level type definitions and helper macros.
MDIO port object.
Definition: mdio_priv.h:147
This file contains the type definitions and helper macros for the Ethernet PHY interface.
IOCTL command structure used to communicate with ICSSG.
Definition: icssg_priv.h:216
void * lock
Definition: icssg_priv.h:130
This file contains the private type definitions and helper macros for the ICSSG TimeSync driver.
ICSS_PRU object.
Definition: icssg_priv.h:113
uint8_t * portBufferPoolMem
Definition: icssg_priv.h:169