|
AM64x MCU+ SDK
10.00.00
|
|
Go to the documentation of this file.
55 #include <priv/core/enet_trace_priv.h>
58 #if defined(__KLOCWORK__) || defined(__cplusplus)
73 #define container_of(ptr, type, member) \
75 const typeof(((type *)0)->member) * __mptr = (ptr); \
76 (type *)((char *)__mptr - offsetof(type, member)); \
82 #define ENET_UNUSED(x) (x = x)
87 #define ENET_MK_ONES(c_ebit, c_sbit) (((1U << (((c_ebit) - (c_sbit)) + 1U)) - 1U) << (c_sbit))
90 #define ENET_UTILS_ALIGN(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
93 #define ENET_UTILS_IS_ALIGNED(addr, alignSz) (((uintptr_t)addr & ((alignSz) - 1U)) == 0U)
96 #define ENET_UTILS_ARRAY_COPY(dst, src) \
100 ENET_UTILS_COMPILETIME_ASSERT(sizeof(dst) != sizeof(uintptr_t)); \
101 memcpy(dst, src, (ENET_ARRAYSIZE(dst) * sizeof(dst[0]))); \
107 #if ENET_CFG_IS_ON(ASSERT)
108 #if defined(__KLOCWORK__) || defined(__cplusplus)
109 #define Enet_assert(cond, ...) do { if (!(cond)) abort(); } while (0)
111 #define Enet_assert(cond, ...) \
113 bool assertCond = (bool)(cond); \
114 ENETTRACE_ERR_IF(!assertCond, __VA_ARGS__); \
115 EnetUtils_assertLocal(assertCond, \
116 (const char *)# cond, \
117 (const char *)__FILE__, \
118 (int32_t)__LINE__); \
122 #define Enet_assert(cond, ...) (void)(cond)
128 #if ENET_CFG_IS_ON(ASSERT)
129 #if defined(__KLOCWORK__) || defined(__cplusplus)
130 #define Enet_devAssert(cond, ...) do { if (!(cond)) abort(); } while (0)
132 #define Enet_devAssert(cond, ...) \
134 ENETTRACE_ERR_IF(!(bool)(cond), __VA_ARGS__); \
135 EnetUtils_assertLocal((bool)(cond), \
136 (const char *)# cond, \
137 (const char *)__FILE__, \
138 (int32_t)__LINE__); \
142 #define Enet_devAssert(cond, ...) (void)(cond)
148 #define ENET_UTILS_COMPILETIME_ASSERT(cond) \
150 typedef char ErrorCheck[((cond) == true) ? 1 : -1]; \
151 ErrorCheck a = {0}; \
156 #define ENET_NUM_NANOSECS_PER_SEC (1000000000ULL)
194 typedef void *(*Enet_PhysToVirt)(uint64_t phyAddr,
void *appData);
199 typedef struct EnetUtils_Cfg_s
322 #if ENET_CFG_IS_ON(ASSERT) && !defined(__KLOCWORK__)
331 static inline void EnetUtils_assertLocal(
bool condition,
333 const char *fileName,
371 const uint8_t *addr2);
403 #if ENET_CFG_IS_ON(ASSERT) && !defined(__KLOCWORK__)
404 static inline void EnetUtils_assertLocal(
bool condition,
406 const char *fileName,
409 volatile static bool gEnetAssertWaitInLoop =
true;
414 while (gEnetAssertWaitInLoop)
429 const uint8_t *addr2)
441 return ((
addr[0U] & 1U) == 1U);
void *(* Enet_PhysToVirt)(uint64_t phyAddr, void *appData)
Physical-to-virtual address translation callback function.
Definition: enet_utils.h:194
void EnetUtils_printf(const char *fmt,...)
Print function.
Enet_VirtToPhys virtToPhys
Definition: enet_utils.h:208
This file contains the type definitions and helper macros for the Enet MAC port module interface.
uint32_t EnetUtils_max(uint32_t num1, uint32_t num2)
Returns minimum of two numbers.
This file contains the basic types using across the Enet driver.
void EnetUtils_deinit(void)
De-initialize utils module.
EnetPhy_Mii
MAC Media-Independent Interface (MII).
Definition: enetphy.h:212
void EnetUtils_delayNs(const uint32_t delayNs)
Busy loop for a given amount of delay in nano seconds.
uint64_t addr
Definition: csl_udmap_tr.h:3
void(* Enet_Print)(const char *fmt,...)
Info/debug print function prototype.
Definition: enet_utils.h:168
char str[32]
Definition: tisci_core.h:1
void * EnetUtils_physToVirt(uint64_t physAddr, void *appData)
Convert a physical address to virtual address.
Enet utils parameters.
Definition: enet_utils.h:200
This file contains the type definitions and helper macros for the Ethernet PHY interface.
static bool EnetUtils_isMcastAddr(const uint8_t *addr)
Check if address is multicast.
Definition: enet_utils.h:439
static void EnetUtils_copyMacAddr(uint8_t *dst, const uint8_t *src)
Copy MAC address.
Definition: enet_utils.h:422
MAC port interface.
Definition: enet_mod_macport.h:442
static void EnetUtils_clearMacAddr(uint8_t *addr)
Clear MAC address.
Definition: enet_utils.h:434
EnetPhy_Mii EnetUtils_macToPhyMii(const EnetMacPort_Interface *macMii)
Convert MAC port MII to PHY MII types.
Enet_Print print
Definition: enet_utils.h:203
uint64_t(* Enet_VirtToPhys)(const void *virtAddr, void *appData)
Virtual-to-physical address translation callback function.
Definition: enet_utils.h:181
This file contains the Enet configuration parameters.
uint32_t EnetUtils_min(uint32_t num1, uint32_t num2)
Returns minimum of two numbers.
#define ENET_MAC_ADDR_LEN
MAC address length in bytes/octets.
Definition: enet_types.h:153
void EnetUtils_init(const EnetUtils_Cfg *cfg)
Initialize utils module.
static bool EnetUtils_cmpMacAddr(const uint8_t *addr1, const uint8_t *addr2)
Compare two MAC address.
Definition: enet_utils.h:428
void EnetUtils_delayTicks(const uint32_t delayTicks)
Busy loop for a given amount of delay in CPU clock ticks.
uint64_t EnetUtils_virtToPhys(const void *virtAddr, void *appData)
Convert a virtual address to physical address.
void EnetUtils_vprintf(const char *fmt, va_list args)
Print function for va_list.
Enet_PhysToVirt physToVirt
Definition: enet_utils.h:213