PDK API Guide for J721E
enet_soc.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 ENET_SOC_H_
41 #define ENET_SOC_H_
42 
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
46 
47 #include <stdint.h>
50 #include <ti/osal/osal.h>
51 
52 #if defined(SOC_AM65XX)
53 #include <ti/drv/enet/soc/j7x/am65xx/enet_soc.h>
54 #include <ti/drv/enet/soc/j7x/j7x_soc.h>
55 #elif defined(SOC_J721E) || defined(SOC_AM77X)
56 #include <ti/drv/enet/soc/j7x/j721e/enet_soc.h>
57 #include <ti/drv/enet/soc/j7x/j7x_soc.h>
58 #elif defined (SOC_J7200)
59 #include <ti/drv/enet/soc/j7x/j7200/enet_soc.h>
60 #include <ti/drv/enet/soc/j7x/j7x_soc.h>
61 #elif defined (SOC_TPR12)
62 #include <ti/drv/enet/soc/tpr12/enet_soc.h>
63 #elif defined(SOC_AWR294X)
64 #include <ti/drv/enet/soc/awr294x/enet_soc.h>
65 #endif
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 /* ========================================================================== */
72 /* Macros */
73 /* ========================================================================== */
74 
75 
81 #if ENET_CFG_IS_ON(ASSERT)
82 #if defined(__KLOCWORK__) || defined(__cplusplus)
83 #define EnetSoc_assert(cond, ...) do { if (!(cond)) abort(); } while (0)
84 #else /* !defined(__KLOCWORK__) && !defined(__cplusplus) */
85 #define EnetSoc_assert(cond, ...) \
86  do { \
87  OSAL_Assert((bool)(!(cond))); \
88  } while (0)
89 #endif /* defined(__KLOCWORK__) || defined(__cplusplus) */
90 #else /* !ENET_CFG_IS_ON(ASSERT) */
91 #define EnetSoc_assert(cond, ...) (void)(cond)
92 #endif /* ENET_CFG_IS_ON(ASSERT) */
93 
94 
95 /* ========================================================================== */
96 /* Structures and Enums */
97 /* ========================================================================== */
98 
99 /* None */
100 
101 /* ========================================================================== */
102 /* Global Variables Declarations */
103 /* ========================================================================== */
104 
105 /* None */
106 
107 /* ========================================================================== */
108 /* Function Declarations */
109 /* ========================================================================== */
110 
118 int32_t EnetSoc_init(void);
119 
125 void EnetSoc_deinit(void);
126 
139  uint32_t instId);
140 
158 
171  uint32_t instId);
172 
180 uint32_t EnetSoc_getCoreId(void);
181 
191 uint32_t EnetSoc_getCoreKey(uint32_t coreId);
192 
205 bool EnetSoc_isCoreAllowed(Enet_Type enetType,
206  uint32_t instId,
207  uint32_t coreId);
208 
216 uint32_t EnetSoc_getEnetNum(void);
217 
229 uint32_t EnetSoc_getMacPortMax(Enet_Type enetType,
230  uint32_t instId);
231 
243 uint32_t EnetSoc_getClkFreq(Enet_Type enetType,
244  uint32_t instId,
245  uint32_t clkId);
246 
259 int32_t EnetSoc_setupIntrCfg(Enet_Type enetType,
260  uint32_t instId,
261  uint32_t intrId);
262 
275 int32_t EnetSoc_releaseIntrCfg(Enet_Type enetType,
276  uint32_t instId,
277  uint32_t intrId);
278 
294 uint32_t EnetSoc_getIntrNum(Enet_Type enetType,
295  uint32_t instId,
296  uint32_t intrId);
297 
313 uint32_t EnetSoc_getIntrTriggerType(Enet_Type enetType,
314  uint32_t instId,
315  uint32_t intrId);
316 
328 int32_t EnetSoc_getEFusedMacAddrs(uint8_t macAddr[][ENET_MAC_ADDR_LEN],
329  uint32_t *num);
330 
342 uint32_t EnetSoc_getMacPortCaps(Enet_Type enetType,
343  uint32_t instId,
344  Enet_MacPort macPort);
345 
362 int32_t EnetSoc_getMacPortMii(Enet_Type enetType,
363  uint32_t instId,
364  Enet_MacPort macPort,
365  EnetMacPort_Interface *mii);
376 uint32_t EnetSoc_isIpSupported(Enet_Type enetType,
377  uint32_t instId);
378 
379 /* ========================================================================== */
380 /* Deprecated Function Declarations */
381 /* ========================================================================== */
382 
383 /* None */
384 
385 #ifdef __cplusplus
386 }
387 #endif
388 
389 #endif /* ENET_SOC_H_ */
OS Abstraction Layer header.
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
struct Enet_Obj_s * Enet_Handle
Ethernet driver handle.
Definition: enet_base.h:105
uint32_t EnetSoc_getCoreKey(uint32_t coreId)
Get core key for the given core id.
uint32_t EnetSoc_getMacPortMax(Enet_Type enetType, uint32_t instId)
Get number of MAC ports in a peripheral.
MAC port interface.
Definition: enet_mod_macport.h:273
uint32_t EnetSoc_getIntrNum(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Get the interrupt number of a peripheral interrupt signal.
This file contains the basic types using across the Enet driver.
Enet_Handle EnetSoc_getEnetHandleByIdx(uint32_t idx)
Get handle of the Enet driver by its index.
uint32_t EnetSoc_getIntrTriggerType(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Get the interrupt trigger type of a peripheral interrupt signal.
#define ENET_MAC_ADDR_LEN
MAC address length in bytes/octets.
Definition: enet_types.h:153
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
uint32_t EnetSoc_getCoreId(void)
Get core id of caller.
int32_t EnetSoc_setupIntrCfg(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Configure SoC connection of an interrupt.
uint32_t EnetSoc_getClkFreq(Enet_Type enetType, uint32_t instId, uint32_t clkId)
Get SoC clock frequency.
uint32_t EnetSoc_getMacPortCaps(Enet_Type enetType, uint32_t instId, Enet_MacPort macPort)
Get MAC port capability mask.
uint32_t EnetSoc_isIpSupported(Enet_Type enetType, uint32_t instId)
Validate IP support in SOC.
int32_t EnetSoc_releaseIntrCfg(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Release SoC connection of an interrupt.
uint32_t EnetSoc_getEnetNum(void)
Get number of present Ethernet peripherals.
int32_t EnetSoc_getMacPortMii(Enet_Type enetType, uint32_t instId, Enet_MacPort macPort, EnetMacPort_Interface *mii)
Get MAC port MII mode.
EnetDma_Handle EnetSoc_getDmaHandle(Enet_Type enetType, uint32_t instId)
Get handle of the DMA driver for a given Ethernet peripheral.
void EnetSoc_deinit(void)
Deinitialize SoC layer.
bool EnetSoc_isCoreAllowed(Enet_Type enetType, uint32_t instId, uint32_t coreId)
Check if core is enable to use an Ethernet peripheral.
Enet_MacPort
MAC port.
Definition: enet_types.h:402
int32_t EnetSoc_getEFusedMacAddrs(uint8_t macAddr[][ENET_MAC_ADDR_LEN], uint32_t *num)
Get EFused MAC addresses.
int32_t EnetSoc_init(void)
Initialize SoC layer.
Enet_Handle EnetSoc_getEnetHandle(Enet_Type enetType, uint32_t instId)
Get handle of the Enet driver for a given Ethernet peripheral.