AM263Px MCU+ SDK: enet_soc.h Source File

| AM263Px MCU+ SDK 26.00.00 |

enet_soc.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) Texas Instruments Incorporated 2020-23
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>
48 #include <include/core/enet_types.h>
49 #include <include/core/enet_base.h>
50 #include <kernel/dpl/DebugP.h>
51
52 #if defined(SOC_AM64X) || defined(SOC_AM243X)
53 #include <soc/k3/am64x_am243x/enet_soc.h>
54 #include <soc/k3/k3_soc.h>
55 #include <drivers/udma/soc/am64x_am243x/udma_soc.h>
56 #elif defined(SOC_AM62AX)
57 #include <soc/k3/am62ax/enet_soc.h>
58 #include <soc/k3/k3_soc.h>
59 #include <drivers/udma.h>
60 #elif defined(SOC_AM62PX)
61 #include <soc/k3/am62px/enet_soc.h>
62 #include <soc/k3/k3_soc.h>
63 #include <drivers/udma.h>
64 #elif defined(SOC_AM275X)
65 #include <soc/k3/am275x/enet_soc.h>
66 #include <soc/k3/k3_soc.h>
67 #include <drivers/udma.h>
68 #elif defined(SOC_AM62X)
69 #include <soc/k3/am62x/enet_soc.h>
70 #include <soc/k3/k3_soc.h>
71 #include <drivers/udma.h>
72 #elif defined(SOC_AM62LX)
73 #include <soc/k3/am62lx/enet_soc.h>
74 #include <soc/k3/k3_soc.h>
75 #include <drivers/udma.h>
76 #elif defined(SOC_AM62DX)
77 #include <soc/k3/am62dx/enet_soc.h>
78 #include <soc/k3/k3_soc.h>
79 #include <drivers/udma.h>
80 #elif defined (SOC_AM273X)
81 #include <soc/am273x/enet_soc.h>
82 #elif defined(SOC_AWR294X)
83 #include <soc/awr294x/enet_soc.h>
84 #elif defined(SOC_AM263X)
85 #include <soc/am263x/enet_soc.h>
86 #elif defined(SOC_AM263PX)
87 #include <soc/am263px/enet_soc.h>
88 #elif defined(SOC_AM261X)
89 #include <soc/am261x/enet_soc.h>
90 #elif defined(SOC_AWR2544)
91 #include <soc/awr2544/enet_soc.h>
92 #elif defined (SOC_J722S)
93 #include <soc/k3/j722s/enet_soc.h>
94 #include <soc/k3/k3_soc.h>
95 #include <drivers/udma.h>
96 #endif
97
98 #ifdef __cplusplus
99 extern "C" {
100 #endif
101
102 /* ========================================================================== */
103 /* Macros */
104 /* ========================================================================== */
105
106
112 #if ENET_CFG_IS_ON(ASSERT)
113 #if defined(__KLOCWORK__) || defined(__cplusplus)
114 #define EnetSoc_assert(cond, ...) do { if (!(cond)) abort(); } while (0)
115 #else /* !defined(__KLOCWORK__) && !defined(__cplusplus) */
116 #define EnetSoc_assert(cond, ...) \
117 do { \
118 DebugP_assert((bool)((cond))); \
119 } while (0)
120 #endif /* defined(__KLOCWORK__) || defined(__cplusplus) */
121 #else /* !ENET_CFG_IS_ON(ASSERT) */
122 #define EnetSoc_assert(cond, ...) (void)(cond)
123 #endif /* ENET_CFG_IS_ON(ASSERT) */
124
125
126 /* ========================================================================== */
127 /* Structures and Enums */
128 /* ========================================================================== */
129
130 /* None */
131
132 /* ========================================================================== */
133 /* Global Variables Declarations */
134 /* ========================================================================== */
135
136 /* None */
137
138 /* ========================================================================== */
139 /* Function Declarations */
140 /* ========================================================================== */
141
149 int32_t EnetSoc_init(void);
150
156 void EnetSoc_deinit(void);
157
169 EnetDma_Handle EnetSoc_getDmaHandle(Enet_Type enetType,
170 uint32_t instId);
171
188 Enet_Handle EnetSoc_getEnetHandleByIdx(uint32_t idx);
189
201 Enet_Handle EnetSoc_getEnetHandle(Enet_Type enetType,
202 uint32_t instId);
203
211 uint32_t EnetSoc_getCoreId(void);
212
225 bool EnetSoc_isCoreAllowed(Enet_Type enetType,
226 uint32_t instId,
227 uint32_t coreId);
228
236 uint32_t EnetSoc_getEnetNum(void);
237
249 uint32_t EnetSoc_getMacPortMax(Enet_Type enetType,
250 uint32_t instId);
251
263 uint32_t EnetSoc_getClkFreq(Enet_Type enetType,
264 uint32_t instId,
265 uint32_t clkId);
266
279 int32_t EnetSoc_setupIntrCfg(Enet_Type enetType,
280 uint32_t instId,
281 uint32_t intrId);
282
295 int32_t EnetSoc_releaseIntrCfg(Enet_Type enetType,
296 uint32_t instId,
297 uint32_t intrId);
298
314 uint32_t EnetSoc_getIntrNum(Enet_Type enetType,
315 uint32_t instId,
316 uint32_t intrId);
317
333 uint32_t EnetSoc_getIntrTriggerType(Enet_Type enetType,
334 uint32_t instId,
335 uint32_t intrId);
336
348 int32_t EnetSoc_getEFusedMacAddrs(uint8_t macAddr[][ENET_MAC_ADDR_LEN],
349 uint32_t *num);
350
362 uint32_t EnetSoc_getMacPortCaps(Enet_Type enetType,
363 uint32_t instId,
364 Enet_MacPort macPort);
365
382 int32_t EnetSoc_getMacPortMii(Enet_Type enetType,
383 uint32_t instId,
384 Enet_MacPort macPort,
385 EnetMacPort_Interface *mii);
396 uint32_t EnetSoc_isIpSupported(Enet_Type enetType,
397 uint32_t instId);
398
399 /* ========================================================================== */
400 /* Deprecated Function Declarations */
401 /* ========================================================================== */
402
403 /* None */
404
405 #ifdef __cplusplus
406 }
407 #endif
408
409 #endif /* ENET_SOC_H_ */
EnetSoc_getEnetNum
uint32_t EnetSoc_getEnetNum(void)
Get number of present Ethernet peripherals.
EnetSoc_getClkFreq
uint32_t EnetSoc_getClkFreq(Enet_Type enetType, uint32_t instId, uint32_t clkId)
Get SoC clock frequency.
EnetSoc_getEnetHandleByIdx
Enet_Handle EnetSoc_getEnetHandleByIdx(uint32_t idx)
Get handle of the Enet driver by its index.
EnetSoc_getDmaHandle
EnetDma_Handle EnetSoc_getDmaHandle(Enet_Type enetType, uint32_t instId)
Get handle of the DMA driver for a given Ethernet peripheral.
EnetSoc_getEnetHandle
Enet_Handle EnetSoc_getEnetHandle(Enet_Type enetType, uint32_t instId)
Get handle of the Enet driver for a given Ethernet peripheral.
EnetSoc_init
int32_t EnetSoc_init(void)
Initialize SoC layer.
EnetSoc_isCoreAllowed
bool EnetSoc_isCoreAllowed(Enet_Type enetType, uint32_t instId, uint32_t coreId)
Check if core is enable to use an Ethernet peripheral.
enet_types.h
This file contains the basic types using across the Enet driver.
EnetSoc_setupIntrCfg
int32_t EnetSoc_setupIntrCfg(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Configure SoC connection of an interrupt.
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:412
EnetSoc_getMacPortCaps
uint32_t EnetSoc_getMacPortCaps(Enet_Type enetType, uint32_t instId, Enet_MacPort macPort)
Get MAC port capability mask.
EnetSoc_getMacPortMii
int32_t EnetSoc_getMacPortMii(Enet_Type enetType, uint32_t instId, Enet_MacPort macPort, EnetMacPort_Interface *mii)
Get MAC port MII mode.
EnetSoc_releaseIntrCfg
int32_t EnetSoc_releaseIntrCfg(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Release SoC connection of an interrupt.
EnetMacPort_Interface
MAC port interface.
Definition: enet_mod_macport.h:443
EnetSoc_deinit
void EnetSoc_deinit(void)
Deinitialize SoC layer.
EnetSoc_getIntrTriggerType
uint32_t EnetSoc_getIntrTriggerType(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Get the interrupt trigger type of a peripheral interrupt signal.
EnetSoc_getMacPortMax
uint32_t EnetSoc_getMacPortMax(Enet_Type enetType, uint32_t instId)
Get number of MAC ports in a peripheral.
EnetSoc_getIntrNum
uint32_t EnetSoc_getIntrNum(Enet_Type enetType, uint32_t instId, uint32_t intrId)
Get the interrupt number of a peripheral interrupt signal.
EnetSoc_getCoreId
uint32_t EnetSoc_getCoreId(void)
Get core id of caller.
Enet_Type
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:202
EnetDma_Handle
struct EnetCpdma_DrvObj_s * EnetDma_Handle
Opaque handle for Enet CPDMA driver object.
Definition: enet_cpdma_types.h:86
DebugP.h
EnetSoc_getEFusedMacAddrs
int32_t EnetSoc_getEFusedMacAddrs(uint8_t macAddr[][ENET_MAC_ADDR_LEN], uint32_t *num)
Get EFused MAC addresses.
EnetSoc_isIpSupported
uint32_t EnetSoc_isIpSupported(Enet_Type enetType, uint32_t instId)
Validate IP support in SOC.
enet_base.h
This file contains the type definitions and helper macros for the Enet Peripheral interface.
ENET_MAC_ADDR_LEN
#define ENET_MAC_ADDR_LEN
MAC address length in bytes/octets.
Definition: enet_types.h:153
Enet_Handle
struct Enet_Obj_s * Enet_Handle
Ethernet driver handle.
Definition: enet_base.h:106