PDK API Guide for AM65xx
enet_rm_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 
45 #ifndef ENET_RM_PRIV_H_
46 #define ENET_RM_PRIV_H_
47 
48 /* ========================================================================== */
49 /* Include Files */
50 /* ========================================================================== */
51 
52 #include <ti/drv/enet/enet_cfg.h>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* ========================================================================== */
63 /* Macros */
64 /* ========================================================================== */
65 
67 #define ENET_RM_PRIVATE_IOCTL(x) (ENET_IOCTL_TYPE_PRIVATE | \
68  ENET_IOCTL_RM_BASE | \
69  ENET_IOCTL_PER_GENERIC | \
70  ENET_IOCTL_MIN(x))
71 
72 /* ========================================================================== */
73 /* Structures and Enums */
74 /* ========================================================================== */
75 
79 typedef enum EnetRm_PrivIoctls_e
80 {
89 
98 
107 
116 
125 
135 
139 typedef struct EnetRm_ValidatePermissionInArgs_s
140 {
142  uint32_t cmd;
143 
145  uint32_t coreId;
147 
151 typedef struct EnetRm_AllocInternalRxFlowInArgs_s
152 {
154  uint32_t coreId;
155 
157  uint32_t chIdx;
159 
163 typedef struct EnetRm_FreeInternalRxFlowInArgs_s
164 {
166  uint32_t coreId;
167 
169  uint32_t chIdx;
170 
172  uint32_t flowIdx;
174 
179 
183 typedef struct EnetRm_Cfg_s
184 {
187 
189  uint32_t instId;
190 
195  uint32_t numRxCh;
196 
198  uint32_t rxStartFlowIdx[ENET_RM_NUM_RXCHAN_MAX];
199 
201  uint32_t rxFlowIdxCnt[ENET_RM_NUM_RXCHAN_MAX];
202 
205 
208 
211 } EnetRm_Cfg;
212 
216 typedef struct EnetRm_ResEntry_s
217 {
220 
222  uint32_t ownerCoreId;
223 
225  uint32_t id;
227 
231 typedef struct EnetRm_CoreResInfo_s
232 {
234  uint32_t coreId;
235 
239 
243 typedef struct EnetRm_CoreResTbl_s
244 {
246  uint32_t numCores;
247 
251 
255 typedef struct EnetRm_TxChObj_s
256 {
259 
261  uint32_t resCnt;
262 
265 
269 
273 typedef struct EnetRm_RxFlowIdxObj_s
274 {
277 
280 
282  uint32_t resCnt;
283 
286 
290 
294 typedef struct EnetRm_MacAddressObj_s
295 {
297  uint32_t resCnt;
298 
301 
305 
309 typedef struct EnetRm_CoreAttachInfo_s
310 {
312  uint32_t numCores;
313 
315  uint32_t attachedCores[ENET_CFG_REMOTE_CLIENT_CORES_MAX];
317 
321 typedef struct EnetRm_Obj_s
322 {
325 
328 
331 
334 
336  uint32_t numRxCh;
337 
340 
343 } EnetRm_Obj;
344 
349 
350 /* ========================================================================== */
351 /* Global Variables Declarations */
352 /* ========================================================================== */
353 
354 /* None */
355 
356 /* ========================================================================== */
357 /* Function Declarations */
358 /* ========================================================================== */
359 
371 int32_t EnetRm_open(EnetMod_Handle hMod,
372  Enet_Type enetType,
373  uint32_t instId,
374  const void *cfg,
375  uint32_t cfgSize);
376 
386 int32_t EnetRm_rejoin(EnetMod_Handle hMod,
387  Enet_Type enetType,
388  uint32_t instId);
389 
399 int32_t EnetRm_ioctl(EnetMod_Handle hMod,
400  uint32_t cmd,
401  Enet_IoctlPrms *prms);
402 
408 void EnetRm_close(EnetMod_Handle hMod);
409 
410 /* ========================================================================== */
411 /* Deprecated Function Declarations */
412 /* ========================================================================== */
413 
414 /* None */
415 
416 /* ========================================================================== */
417 /* Static Function Definitions */
418 /* ========================================================================== */
419 
420 /* None */
421 
422 #ifdef __cplusplus
423 }
424 #endif
425 
426 #endif /* ENET_RM_PRIV_H_ */
427 
Input args for ENET_RM_IOCTL_INTERNAL_ALLOC_RX_FLOW command.
Definition: enet_rm_priv.h:151
EnetRm_MacAddressPool macList
Definition: enet_rm_priv.h:210
EnetQ resQ
Definition: enet_rm_priv.h:237
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
Attach core.
Definition: enet_rm_priv.h:97
A generic node structure for a single link list.
Definition: enet_queue.h:73
EnetRm_Obj * EnetRm_Handle
Enet RM module handle.
Definition: enet_rm_priv.h:348
Input args for ENET_RM_IOCTL_VALIDATE_PERMISSION command.
Definition: enet_rm_priv.h:139
#define ENET_CFG_REMOTE_CLIENT_CORES_MAX
Maximum number of client core that the Enet driver can serve.
Definition: enet_cfg.h:142
uint32_t internalAllocCount
Definition: enet_rm_priv.h:279
This file contains the type definitions and helper macros for the Enet software queue.
uint32_t numCores
Definition: enet_rm_priv.h:246
Enet Resource Manager driver object.
Definition: enet_rm_priv.h:321
#define ENET_CFG_RM_RX_CH_MAX
Maximum number of RX channels that Enet RM can manage.
Definition: enet_cfg.h:151
uint32_t numRxCh
Definition: enet_rm_priv.h:195
Enet_Type enetType
Definition: enet_rm_priv.h:186
EnetRm_Cfg cfg
Definition: enet_rm_priv.h:327
Detach core.
Definition: enet_rm_priv.h:106
Internal RX flow allocation.
Definition: enet_rm_priv.h:115
Generic queue.
Definition: enet_queue.h:82
EnetQ_Node node
Definition: enet_rm_priv.h:219
Internal RX flow free.
Definition: enet_rm_priv.h:124
uint32_t internalAllocCoreId
Definition: enet_rm_priv.h:276
EnetRm_TxChObj txObj
Definition: enet_rm_priv.h:330
Ethernet Module object.
Definition: enet_mod.h:136
#define ENET_CFG_RM_TX_CH_MAX
Maximum number of TX channels that Enet RM can manage.
Definition: enet_cfg.h:148
Resource table of all cores.
Definition: enet_rm_priv.h:243
MAC address resources.
Definition: enet_rm_priv.h:294
Resources of a given core.
Definition: enet_rm_priv.h:231
Validate IOCTL permission.
Definition: enet_rm_priv.h:88
uint32_t resCnt
Definition: enet_rm_priv.h:297
EnetRm_MacAddressObj macObj
Definition: enet_rm_priv.h:339
void EnetRm_close(EnetMod_Handle hMod)
Close Enet RM module.
Input args for ENET_RM_IOCTL_FREE_RX_FLOW command.
Definition: enet_rm_priv.h:163
#define ENET_RM_NUM_RXCHAN_MAX
Maximum number of RX channels (i.e. sets of flows).
Definition: enet_rm.h:100
uint32_t txPSILThreadIdOffset
Definition: enet_rm_priv.h:258
This file contains the type definitions and helper macros for the Enet Resource Manager module.
uint32_t cmd
Definition: enet_rm_priv.h:142
EnetRm_CoreResTbl_t macTbl
Definition: enet_rm_priv.h:300
uint32_t id
Definition: enet_rm_priv.h:225
uint32_t flowIdx
Definition: enet_rm_priv.h:172
EnetRm_FreeRxFlowInArgs EnetRm_ValidateRxFlowInArgs
Input args for ENET_RM_IOCTL_VALIDATE_RX_FLOW command.
Definition: enet_rm_priv.h:178
RX resources.
Definition: enet_rm_priv.h:273
EnetRm_PrivIoctls
Enet RM private IOCTL commands.
Definition: enet_rm_priv.h:79
TX resources.
Definition: enet_rm_priv.h:255
int32_t EnetRm_rejoin(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId)
Rejoin Enet RM module for a running peripheral.
This file contains the OSAL API of the Enet driver.
EnetRm_CoreResTbl_t txResTbl
Definition: enet_rm_priv.h:264
EnetRm_ResPrms resPartInfo
Definition: enet_rm_priv.h:204
Enet RM MAC address pool.
Definition: enet_rm.h:250
Enet RM resource parameters.
Definition: enet_rm.h:201
uint32_t resCnt
Definition: enet_rm_priv.h:261
Information about attached cores.
Definition: enet_rm_priv.h:309
Input args for ENET_RM_IOCTL_FREE_RX_FLOW command.
Definition: enet_rm.h:307
uint32_t ownerCoreId
Definition: enet_rm_priv.h:222
Enet IOCTL param.
Definition: enet_ioctl.h:229
uint32_t coreId
Definition: enet_rm_priv.h:145
int32_t EnetRm_ioctl(EnetMod_Handle hMod, uint32_t cmd, Enet_IoctlPrms *prms)
Run an IOCTL operation on Enet RM.
EnetRm_CoreResTbl_t rxResTbl
Definition: enet_rm_priv.h:285
Validate RX flow is allocated resource and is from a attached core.
Definition: enet_rm_priv.h:133
Enet RM configuration parameters.
Definition: enet_rm_priv.h:183
uint32_t instId
Definition: enet_rm_priv.h:189
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
EnetRm_IoctlPermissionTable ioctlPermissionInfo
Definition: enet_rm_priv.h:207
uint32_t numRxCh
Definition: enet_rm_priv.h:336
int32_t EnetRm_open(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize Enet RM module.
uint32_t coreId
Definition: enet_rm_priv.h:154
#define ENET_RM_PRIVATE_IOCTL(x)
Helper macro to create private IOCTL commands for Enet RM module.
Definition: enet_rm_priv.h:67
uint32_t numCores
Definition: enet_rm_priv.h:312
uint32_t resCnt
Definition: enet_rm_priv.h:282
Enet RM IOCTL permission table.
Definition: enet_rm.h:232
uint32_t chIdx
Definition: enet_rm_priv.h:157
EnetRm_CoreAttachInfo coreAttachObj
Definition: enet_rm_priv.h:342
This file contains the type definitions and helper macros for the Enet Module interface.
EnetMod_Obj enetMod
Definition: enet_rm_priv.h:324
uint32_t coreId
Definition: enet_rm_priv.h:234
uint32_t coreId
Definition: enet_rm_priv.h:166
Resource manager entry.
Definition: enet_rm_priv.h:216
#define ENET_CFG_RM_MAC_ADDR_MAX
Maximum number of MAC addresses that Enet RM can manage.
Definition: enet_cfg.h:145
uint32_t chIdx
Definition: enet_rm_priv.h:169
This file contains the Enet configuration parameters.