![]() |
![]() |
CPSW utility API to make TR, get TR descriptor memory requirement. More...
#include <stdarg.h>
#include <ti/drv/cpsw/include/cpsw_cfg.h>
#include <ti/drv/cpsw/include/cpsw_dma_pktutils.h>
#include <ti/drv/cpsw/soc/cpsw_soc.h>
Data Structures | |
struct | CpswUtils_Prms |
CPSW utils parameters. More... | |
Macros | |
#define | container_of(ptr, type, member) |
Macro to get container structure from one of its members' addresses. More... | |
#define | CPSW_UTILS_ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) |
Macro to get the size of an array. | |
#define | CPSW_UTILS_GETARRAYINDEX(member, array) (member - &array[0]) |
Get the index of the given element within an array. | |
#define | CPSW_UTILS_ARRAYISMEMBER(member, array) |
Macro to determine if a member is part of an array. More... | |
#define | CPSW_UTILS_COMPILETIME_ASSERT(condition) |
Compile-time assertion. More... | |
#define | CPSW_UTILS_DIV_ROUNDUP(val, div) (((val) + (div) - 1) / (div)) |
Macro to perform round-up division. | |
#define | CPSW_UTILS_ROUNDUP(val, div) (CPSW_UTILS_DIV_ROUNDUP((val), (div)) * (div)) |
Macro to round up a value. | |
#define | CPSW_UTILS_ROUNDDOWN(val, div) (((val) / (div)) * (div)) |
Macro round down a value. | |
#define | CPSW_UTILS_MK_ONES(c_ebit, c_sbit) (((1U << (((c_ebit) - (c_sbit)) + 1U)) - 1U) << (c_sbit)) |
Generates a pattern of ones between end bit and start bit M_ONES(7,4) will give 0x000000F0. | |
#define | CPSW_UTILS_MK_MASK(c_ebit, c_sbit) (~(CPSW_UTILS_MK_ONES((c_ebit), (c_sbit)))) |
Generates a pattern of zeros between end bit and start bit M_MASK(7,4) will give 0xFFFFFF0F. | |
#define | CPSW_UTILS_VAL_BOUND(val, c_ebit, c_sbit) ((CPSW_UTILS_MK_ONES((c_ebit), (c_sbit)) >> (c_sbit)) & (val)) |
Bounds the value before writing to register M_VAL_BOUND(0x1F, 7, 4) will remove the extra bit resulting in 0xF. | |
#define | CPSW_UTILS_CACHELINE_SIZE (UDMA_CACHELINE_ALIGNMENT) |
CPSW Ring Acc memory alignment. | |
#define | CPSW_UTILS_ALIGN(x, y) (((x + (y - 1)) / y) * y) |
Align a value by performing a round-up operation. | |
#define | CPSW_UTILS_IS_ALIGNED(addr, alignSize) (((uintptr_t)addr & (alignSize - 1U)) == 0U) |
Macro to determine if an address is aligned to a given size. | |
#define | CPSW_UTILS_ARRAY_COPY(dst, src) |
Macro to copy arrays. They must be of the same size. More... | |
Functions | |
void | CpswUtils_printf (const char *format,...) |
Prints to shared memory and CCS console. More... | |
void | CpswUtils_trace (const char *format, va_list vaArgPtr) |
Logs trace info. More... | |
void | CpswUtils_init (CpswUtils_Prms *pUtilsPrms) |
Initialize utils module. More... | |
void | CpswUtils_deInit (void) |
De-initialize utils module. | |
uint32_t | CpswUtils_min (uint32_t num1, uint32_t num2) |
Returns minimum of two numbers. More... | |
uint32_t | CpswUtils_max (uint32_t num1, uint32_t num2) |
Returns minimum of two numbers. More... | |
void | CpswUtils_delay (uint32_t delayVal) |
Busy loop for a given amount of time. More... | |
void * | CpswUtils_registerIntr (CpswOsal_IsrFxn isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, void *arg) |
Register an ISR for an interrupt. More... | |
void | CpswUtils_unRegisterIntr (void *hwiHandle) |
Unregister an interrupt. More... | |
void | CpswUtils_enableIntr (uint32_t coreIntrNum) |
Enable interrupt. More... | |
void | CpswUtils_disableIntr (uint32_t coreIntrNum) |
Disable interrupt. More... | |
void * | CpswUtils_mutexCreate (void) |
Create a mutex. More... | |
void | CpswUtils_mutexDelete (void *mutexHandle) |
Delete a mutex. More... | |
void | CpswUtils_mutexLock (void *mutexHandle) |
Lock a mutex. More... | |
void | CpswUtils_mutexUnlock (void *mutexHandle) |
Unlock a mutex. More... | |
uint64_t | CpswUtils_virtToPhyFxn (const void *virtAddr, void *appData) |
Convert a virtual address to physical address. More... | |
void * | CpswUtils_phyToVirtFxn (uint64_t phyAddr, void *appData) |
Convert a physical address to virtual address. More... | |
int32_t | CpswUtils_timerInit (void) |
Initialize a timer. More... | |
int32_t | CpswUtils_timerDeInit (void) |
De-initialize a timer. More... | |
uint32_t | CpswUtils_timerRead (void) |
Read timer value. More... | |
uint32_t | CpswOsal_timerGetDiff (uint32_t startTime) |
Get time different between a starting and current time. More... | |
uint32_t | CpswUtils_getIpFeatureBitMap (Cpsw_Type cpswType) |
Returns CPSW IP featureBitmap. More... | |
const CpswSoc_CpswIpInfo * | CpswUtils_getIpInfo (Cpsw_Type cpswType) |
Get CPSW IP information. More... | |
uint32_t | CpswUtils_getIpErrataBitMap (Cpsw_Type cpswType) |
Returns CPSW IP errataBitmap. More... | |
CPSW utility API to make TR, get TR descriptor memory requirement.
#define container_of | ( | ptr, | |
type, | |||
member | |||
) |
Macro to get container structure from one of its members' addresses.
#define CPSW_UTILS_ARRAY_COPY | ( | dst, | |
src | |||
) |
Macro to copy arrays. They must be of the same size.
#define CPSW_UTILS_ARRAYISMEMBER | ( | member, | |
array | |||
) |
Macro to determine if a member is part of an array.
#define CPSW_UTILS_COMPILETIME_ASSERT | ( | condition | ) |
Compile-time assertion.
uint32_t CpswOsal_timerGetDiff | ( | uint32_t | startTime | ) |
Get time different between a starting and current time.
void CpswUtils_delay | ( | uint32_t | delayVal | ) |
Busy loop for a given amount of time.
delayVal | [IN] Delay time |
void CpswUtils_disableIntr | ( | uint32_t | coreIntrNum | ) |
Disable interrupt.
coreIntrNum | [IN] Interrupt number |
void CpswUtils_enableIntr | ( | uint32_t | coreIntrNum | ) |
Enable interrupt.
coreIntrNum | [IN] Interrupt number |
uint32_t CpswUtils_getIpErrataBitMap | ( | Cpsw_Type | cpswType | ) |
Returns CPSW IP errataBitmap.
Returns CPSW IP errataBitmap info from SOC for the given CPSW type
cpswType | [IN] CPSW instance type. Refer to Cpsw_Type |
uint32_t CpswUtils_getIpFeatureBitMap | ( | Cpsw_Type | cpswType | ) |
Returns CPSW IP featureBitmap.
Returns CPSW IP featureBitmap info from SOC for the given CPSW type
cpswType | [IN] CPSW instance type. Refer to Cpsw_Type |
const CpswSoc_CpswIpInfo* CpswUtils_getIpInfo | ( | Cpsw_Type | cpswType | ) |
Get CPSW IP information.
Returns CPSW IP information structure for the given CPSW type in the SoC.
cpswType | [IN] CPSW instance type. Refer to Cpsw_Type |
void CpswUtils_init | ( | CpswUtils_Prms * | pUtilsPrms | ) |
Initialize utils module.
Utils module initialization function. Should be only called from the CPSW top level module.
pUtilsPrms | [IN] Pointer to the initialization parameters |
uint32_t CpswUtils_max | ( | uint32_t | num1, |
uint32_t | num2 | ||
) |
Returns minimum of two numbers.
num1 | [IN] First number |
num2 | [IN] Second number |
uint32_t CpswUtils_min | ( | uint32_t | num1, |
uint32_t | num2 | ||
) |
Returns minimum of two numbers.
num1 | [IN] First number |
num2 | [IN] Second number |
void* CpswUtils_mutexCreate | ( | void | ) |
Create a mutex.
void CpswUtils_mutexDelete | ( | void * | mutexHandle | ) |
Delete a mutex.
mutexHandle | [IN] Mutex handle pointer |
void CpswUtils_mutexLock | ( | void * | mutexHandle | ) |
Lock a mutex.
mutexHandle | [IN] Mutex handle pointer |
void CpswUtils_mutexUnlock | ( | void * | mutexHandle | ) |
Unlock a mutex.
mutexHandle | [IN] Mutex handle pointer |
void* CpswUtils_phyToVirtFxn | ( | uint64_t | phyAddr, |
void * | appData | ||
) |
Convert a physical address to virtual address.
phyAddr | [IN] Physical address |
appData | [IN] Auxiliary data |
void CpswUtils_printf | ( | const char * | format, |
... | |||
) |
Prints to shared memory and CCS console.
This function prints the provided formatted string to shared memory and CCS console.
format | [IN] Formatted string followed by variable arguments |
void* CpswUtils_registerIntr | ( | CpswOsal_IsrFxn | isrFxn, |
uint32_t | coreIntrNum, | ||
uint32_t | intrPriority, | ||
void * | arg | ||
) |
Register an ISR for an interrupt.
isrFxn | [IN] Interrupt service routine |
coreIntrNum | [IN] Interrupt number |
intrPriority | [IN] Interrupt priority |
arg | [IN] Argument to ISR function |
int32_t CpswUtils_timerDeInit | ( | void | ) |
De-initialize a timer.
int32_t CpswUtils_timerInit | ( | void | ) |
Initialize a timer.
uint32_t CpswUtils_timerRead | ( | void | ) |
Read timer value.
void CpswUtils_trace | ( | const char * | format, |
va_list | vaArgPtr | ||
) |
Logs trace info.
This function logs the provided formatted string to the provided trace callback function.
format | [IN] Formatted string |
vaArgPtr | [IN] Variadic argument list |
void CpswUtils_unRegisterIntr | ( | void * | hwiHandle | ) |
Unregister an interrupt.
hwiHandle | [IN] Interrupt handle pointer |
uint64_t CpswUtils_virtToPhyFxn | ( | const void * | virtAddr, |
void * | appData | ||
) |
Convert a virtual address to physical address.
virtAddr | [IN] Virtual address |
appData | [IN] Auxiliary data |