PDK API Guide for AM65xx
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>
53 #include <ti/drv/enet/enet.h>
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* ========================================================================== */
66 /* Macros */
67 /* ========================================================================== */
68 
70 #define ICSSG_PRUSS_ID_0 (0U)
71 
73 #define ICSSG_PRUSS_ID_1 (1U)
74 
76 #define ICSSG_PRUSS_ID_2 (2U)
77 
79 #define ICSSG_CACHELINE_ALIGNMENT (64U)
80 
81 /* ========================================================================== */
82 /* Structures and Enums */
83 /* ========================================================================== */
87 typedef struct Icssg_evtCbInfo_s
88 {
91 
93  void *evtCbArgs;
95 
112 typedef struct Icssg_Pruss_s
113 {
115  PRUICSS_Handle hPruss;
116 
118  uint32_t instance;
119 
122 
124  bool iep0InUse;
125 
129  void *lock;
130 } Icssg_Pruss;
131 
137 typedef struct Icssg_Fw_s
138 {
140  const uint32_t *pru;
141 
143  uint32_t pruSize;
144 
146  const uint32_t *rtu;
147 
149  uint32_t rtuSize;
150 
152  const uint32_t *txpru;
153 
155  uint32_t txpruSize;
156 } Icssg_Fw;
157 
164 typedef struct Icssg_FwPoolMem_s
165 {
169 
172 
175 
179 
182 
185 
189 
193 
196 
199 
203 
207 typedef struct Icssg_IoctlCmd_s
208 {
210  uint8_t param;
211 
213  uint8_t seqNum;
214 
216  uint8_t type;
217 
219  uint8_t header;
220 
222  uint32_t spare[3];
223 } __attribute__((packed)) Icssg_IoctlCmd;
224 
228 typedef struct Icssg_IoctlCmdResp_s
229 {
231  uint8_t status;
232 
234  uint8_t seqNum;
235 
237  uint32_t paramsLen;
238 
240  uint32_t params[3U];
242 
246 typedef struct Icssg_Obj_s
247 {
250 
253 
260 
268 
271 
273  uint32_t asyncIoctlType;
274 
277 
280 
283 
286 
288  uint32_t selfCoreId;
289 
292 
294  uint32_t numRxCh;
295 
298 
301 
303  uint32_t rsvdFlowId[ICSSG_MAC_PORT_MAX];
304 
307 
310 
313 
316 
319 
322 
325 
327  Icssg_IoctlCmd cmd __attribute__ ((aligned(ICSSG_CACHELINE_ALIGNMENT)));
328 } Icssg_Obj;
329 
334 
335 /* ========================================================================== */
336 /* Global Variables Declarations */
337 /* ========================================================================== */
338 
339 /* None */
340 
341 /* ========================================================================== */
342 /* Function Declarations */
343 /* ========================================================================== */
344 
357 void Icssg_initCfg(EnetPer_Handle hPer,
358  Enet_Type enetType,
359  void *cfg,
360  uint32_t cfgSize);
361 
378 int32_t Icssg_open(EnetPer_Handle hPer,
379  Enet_Type enetType,
380  uint32_t instId,
381  const void *cfg,
382  uint32_t cfgSize);
383 
396 int32_t Icssg_rejoin(EnetPer_Handle hPer,
397  Enet_Type enetType,
398  uint32_t instId);
399 
411 int32_t Icssg_ioctl(EnetPer_Handle hPer,
412  uint32_t cmd,
413  Enet_IoctlPrms *prms);
414 
427 void Icssg_poll(EnetPer_Handle hPer,
428  Enet_Event evt,
429  const void *arg,
430  uint32_t argSize);
431 
444 uint64_t Icssg_convertTs(EnetPer_Handle hPer,
445  uint64_t ts);
446 
456 
458  Enet_Event evt,
459  uint32_t evtNum,
460  Enet_EventCallback evtCb,
461  void *evtCbArgs);
462 
464  Enet_Event evt,
465  uint32_t evtNum);
466 
474 void Icssg_close(EnetPer_Handle hPer);
475 
476 /* ========================================================================== */
477 /* Deprecated Function Declarations */
478 /* ========================================================================== */
479 
480 /* None */
481 
482 /* ========================================================================== */
483 /* Static Function Definitions */
484 /* ========================================================================== */
485 
486 /* None */
487 
488 #ifdef __cplusplus
489 }
490 #endif
491 
492 #endif /* ICSSG_PRIV_H_ */
EnetPer_Obj enetPer
Definition: icssg_priv.h:249
const uint32_t * pru
Definition: icssg_priv.h:140
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:294
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:222
uint32_t hostBufferPoolNum
Definition: icssg_priv.h:184
EnetMod_Handle hRm
Definition: icssg_priv.h:285
uint32_t hostBufferPoolSize
Definition: icssg_priv.h:181
void Icssg_close(EnetPer_Handle hPer)
Close the ICSSG peripheral.
uint8_t type
Definition: icssg_priv.h:216
This file contains the basic types using across the Enet driver.
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:288
uint8_t * hostBufferPoolMem
Definition: icssg_priv.h:178
uint32_t txpruSize
Definition: icssg_priv.h:155
const uint32_t * rtu
Definition: icssg_priv.h:146
This file contains the type definitions and helper macros for the Ethernet PHY interface.
uint32_t scratchBufferSize
Definition: icssg_priv.h:201
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:231
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:273
uint32_t paramsLen
Definition: icssg_priv.h:237
Icssg event callback info structure.
Definition: icssg_priv.h:87
bool initialized
Definition: icssg_priv.h:121
uint8_t asyncIoctlSeqNum
Definition: icssg_priv.h:270
uint64_t Icssg_convertTs(EnetPer_Handle hPer, uint64_t ts)
Converts ICSSG timestamp to nanoseconds.
uint32_t pruSize
Definition: icssg_priv.h:143
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:333
ICSSG firmware.
Definition: icssg_priv.h:137
const uint32_t * txpru
Definition: icssg_priv.h:152
uint8_t * hostEgressQueueMem
Definition: icssg_priv.h:188
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:93
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:279
uint8_t seqNum
Definition: icssg_priv.h:234
IcssgStats_Obj statsObj
Definition: icssg_priv.h:321
This file contains the private type definitions and helper macros for Enet Resource Manager.
uint32_t portBufferPoolNum
Definition: icssg_priv.h:174
Enet_EventCallback evtCb
Definition: icssg_priv.h:90
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:79
IcssgTimeSync_Obj timeSyncObj
Definition: icssg_priv.h:315
EnetMod_Handle hMdio
Definition: icssg_priv.h:309
EnetMod_Handle hStats
Definition: icssg_priv.h:324
Ethernet Peripheral object.
Definition: enet_per.h:461
Enet IOCTL param.
Definition: enet_ioctl.h:229
Mdio_Obj mdioObj
Definition: icssg_priv.h:306
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:252
uint8_t param
Definition: icssg_priv.h:210
uint32_t hostEgressQueueNum
Definition: icssg_priv.h:195
Icssg per object.
Definition: icssg_priv.h:246
ICSSG buffer pool memories.
Definition: icssg_priv.h:164
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:228
EnetRm_Obj rmObj
Definition: icssg_priv.h:282
uint8_t seqNum
Definition: icssg_priv.h:213
Enet_Event
Ethernet events.
Definition: enet_types.h:258
Icssg_evtCbInfo asyncCmdRespCbEvtInfo
Definition: icssg_priv.h:276
ICSSG Statistics object.
Definition: icssg_stats_priv.h:67
EnetDma_Handle hDma
Definition: icssg_priv.h:291
bool iep0InUse
Definition: icssg_priv.h:124
uint32_t hostEgressQueueSize
Definition: icssg_priv.h:192
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
uint32_t portBufferPoolSize
Definition: icssg_priv.h:171
EnetMod_Handle hTimeSync
Definition: icssg_priv.h:318
uint8_t * scratchBufferMem
Definition: icssg_priv.h:198
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.
#define ICSSG_MAC_PORT_MAX
Maximum number of MAC ports per ICSSG instance.
Definition: icssg.h:82
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
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:219
This file contains the type definitions and helper macros for the MDIO module interface.
uint32_t rtuSize
Definition: icssg_priv.h:149
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:207
void * lock
Definition: icssg_priv.h:129
This file contains the private type definitions and helper macros for the ICSSG TimeSync driver.
ICSS_PRU object.
Definition: icssg_priv.h:112
uint8_t * portBufferPoolMem
Definition: icssg_priv.h:168