![]()  | 
  
    PDK API Guide for J721E
    
   | 
 
This file contains the type definitions and function prototypes of the Enet Utils functionality.
Go to the source code of this file.
Data Structures | |
| struct | EnetUtils_Cfg | 
| Enet utils parameters.  More... | |
Macros | |
| #define | container_of(ptr, type, member) | 
| Macro to get container structure from one of its members' addresses.  More... | |
| #define | ENET_UNUSED(x) (x = x) | 
| Unused variable.  More... | |
| #define | ENET_MK_ONES(c_ebit, c_sbit) (((1U << (((c_ebit) - (c_sbit)) + 1U)) - 1U) << (c_sbit)) | 
| Macro to create a bit mask.  More... | |
| #define | ENET_UTILS_ALIGN(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 
| Align a value by performing a round-up operation.  More... | |
| #define | ENET_UTILS_IS_ALIGNED(addr, alignSz) (((uintptr_t)addr & ((alignSz) - 1U)) == 0U) | 
| Macro to determine if an address is aligned to a given size.  More... | |
| #define | ENET_UTILS_ARRAY_COPY(dst, src) | 
| Macro to copy arrays. They must be of the same size.  More... | |
| #define | Enet_assert(cond, ...) (void)(cond) | 
| Assertion.  More... | |
| #define | Enet_devAssert(cond, fmt, ...) (void)(cond) | 
| Development-time assertion.  More... | |
| #define | ENET_UTILS_COMPILETIME_ASSERT(cond) | 
| Compile-time assertion.  More... | |
Typedefs | |
| typedef void(* | Enet_Print) (const char *fmt,...) | 
| Info/debug print function prototype.  More... | |
| typedef uint64_t(* | Enet_VirtToPhys) (const void *virtAddr, void *appData) | 
| Virtual-to-physical address translation callback function.  More... | |
| typedef void *(* | Enet_PhysToVirt) (uint64_t phyAddr, void *appData) | 
| Physical-to-virtual address translation callback function.  More... | |
Functions | |
| void | EnetUtils_init (const EnetUtils_Cfg *cfg) | 
| Initialize utils module.  More... | |
| void | EnetUtils_deinit (void) | 
| De-initialize utils module.  More... | |
| void | EnetUtils_printf (const char *fmt,...) | 
| Print function.  More... | |
| void | EnetUtils_vprintf (const char *fmt, va_list args) | 
| Print function for va_list.  More... | |
| uint32_t | EnetUtils_min (uint32_t num1, uint32_t num2) | 
| Returns minimum of two numbers.  More... | |
| uint32_t | EnetUtils_max (uint32_t num1, uint32_t num2) | 
| Returns minimum of two numbers.  More... | |
| void | EnetUtils_delay (uint64_t delayInNsecs) | 
| Busy loop for a given amount of delay in nanoseconds.  More... | |
| uint64_t | EnetUtils_virtToPhys (const void *virtAddr, void *appData) | 
| Convert a virtual address to physical address.  More... | |
| void * | EnetUtils_physToVirt (uint64_t physAddr, void *appData) | 
| Convert a physical address to virtual address.  More... | |
| EnetPhy_Mii | EnetUtils_macToPhyMii (const EnetMacPort_Interface *macMii) | 
| Convert MAC port MII to PHY MII types.  More... | |
| static void | EnetUtils_copyMacAddr (uint8_t *dst, const uint8_t *src) | 
| Copy MAC address.  More... | |
| static bool | EnetUtils_cmpMacAddr (const uint8_t *addr1, const uint8_t *addr2) | 
| Compare two MAC address.  More... | |
| static void | EnetUtils_clearMacAddr (uint8_t *addr) | 
| Clear MAC address.  More... | |
| static bool | EnetUtils_isMcastAddr (const uint8_t *addr) | 
| Check if address is multicast.  More... | |
| #define container_of | ( | ptr, | |
| type, | |||
| member | |||
| ) | 
| #define ENET_UNUSED | ( | x | ) | (x = x) | 
Unused variable.
| #define ENET_MK_ONES | ( | c_ebit, | |
| c_sbit | |||
| ) | (((1U << (((c_ebit) - (c_sbit)) + 1U)) - 1U) << (c_sbit)) | 
Macro to create a bit mask.
| #define ENET_UTILS_ALIGN | ( | x, | |
| y | |||
| ) | ((((x) + ((y) - 1)) / (y)) * (y)) | 
Align a value by performing a round-up operation.
Macro to determine if an address is aligned to a given size.
| #define ENET_UTILS_ARRAY_COPY | ( | dst, | |
| src | |||
| ) | 
Macro to copy arrays. They must be of the same size.
| #define Enet_assert | ( | cond, | |
| ... | |||
| ) | (void)(cond) | 
Assertion.
| #define Enet_devAssert | ( | cond, | |
| fmt, | |||
| ... | |||
| ) | (void)(cond) | 
Development-time assertion.
| #define ENET_UTILS_COMPILETIME_ASSERT | ( | cond | ) | 
Compile-time assertion.
| typedef void(* Enet_Print) (const char *fmt,...) | 
Info/debug print function prototype.
This function is used by the driver to print info/debug messages.
| fmt | Formatted string followed by variable arguments | 
| typedef uint64_t(* Enet_VirtToPhys) (const void *virtAddr, void *appData) | 
Virtual-to-physical address translation callback function.
This function is used by the driver to convert virtual address to physical address.
| virtAddr | Virtual address | 
| appData | Callback pointer passed during translation | 
| typedef void*(* Enet_PhysToVirt) (uint64_t phyAddr, void *appData) | 
Physical-to-virtual address translation callback function.
This function is used by the driver to convert physical address to virtual address.
| phyAddr | Physical address | 
| appData | Callback pointer passed during translation | 
| void EnetUtils_init | ( | const EnetUtils_Cfg * | cfg | ) | 
Initialize utils module.
Utils module initialization function. Should be only called from the Enet top-level module.
| cfg | Pointer to the initialization parameters | 
| void EnetUtils_deinit | ( | void | ) | 
De-initialize utils module.
| void EnetUtils_printf | ( | const char * | fmt, | 
| ... | |||
| ) | 
Print function.
Prints the provided formatted string.
| fmt | Formatted string followed by variable arguments | 
| void EnetUtils_vprintf | ( | const char * | fmt, | 
| va_list | args | ||
| ) | 
Print function for va_list.
Prints the provided formatted string.
| fmt | Formatted string | 
| args | Arg list pointing to the arguments in the format string | 
| uint32_t EnetUtils_min | ( | uint32_t | num1, | 
| uint32_t | num2 | ||
| ) | 
Returns minimum of two numbers.
| num1 | First number | 
| num2 | Second number | 
| uint32_t EnetUtils_max | ( | uint32_t | num1, | 
| uint32_t | num2 | ||
| ) | 
Returns minimum of two numbers.
| num1 | First number | 
| num2 | Second number | 
| void EnetUtils_delay | ( | uint64_t | delayInNsecs | ) | 
Busy loop for a given amount of delay in nanoseconds.
| delayInNsecs | Delay time in nanosecond | 
| uint64_t EnetUtils_virtToPhys | ( | const void * | virtAddr, | 
| void * | appData | ||
| ) | 
Convert a virtual address to physical address.
| virtAddr | Virtual address | 
| appData | Auxiliary data | 
| void* EnetUtils_physToVirt | ( | uint64_t | physAddr, | 
| void * | appData | ||
| ) | 
Convert a physical address to virtual address.
| physAddr | Physical address | 
| appData | Auxiliary data | 
| EnetPhy_Mii EnetUtils_macToPhyMii | ( | const EnetMacPort_Interface * | macMii | ) | 
Convert MAC port MII to PHY MII types.
Converts MII type definition from EnetMacPort_Interface to EnetPhy_Mii.
| macMii | MAC port MII interface type | 
      
  | 
  inlinestatic | 
Copy MAC address.
Copies 6-byte MAC address.
| dst | Pointer to MAC address memory being copied into | 
| src | Pointer to MAC address memory to be copied from | 
      
  | 
  inlinestatic | 
Compare two MAC address.
Compares two MAC address to determine if they are equal.
| addr1 | MAC address being compared | 
| addr2 | MAC address being compared | 
      
  | 
  inlinestatic | 
Clear MAC address.
Clear 6-byte MAC address memory.
| addr | Pointer to MAC address memory to be cleared | 
      
  | 
  inlinestatic | 
Check if address is multicast.
Checks if MAC address is multicast.
| addr | MAC address |