PDK API Guide for J721E
enet_osal.h File Reference

Introduction

This file contains the OSAL API of the Enet driver.

Go to the source code of this file.

Data Structures

struct  EnetOsal_Cfg
 Enet OSAL configuration paramters. More...
 

Typedefs

typedef uintptr_t(* EnetOsal_DisableAllIntr) (void)
 Enet OSAL intr disable function prototype. More...
 
typedef void(* EnetOsal_RestoreAllIntr) (uintptr_t cookie)
 Enet OSAL intr restore function prototype. More...
 
typedef void(* EnetOsal_RestoreIntr) (uint32_t coreIntrNum)
 Enet OSAL intr restore function prototype. More...
 
typedef void(* EnetOsal_DisableIntr) (uint32_t coreIntrNum)
 Enet OSAL intr disable function prototype. More...
 
typedef void(* EnetOsal_Isr) (uintptr_t arg)
 Enet OSAL ISR callback function prototype. More...
 
typedef void *(* EnetOsal_RegisterIntr) (EnetOsal_Isr isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, uint32_t triggerType, void *arg)
 Enet OSAL ISR register function prototype. More...
 
typedef void(* EnetOsal_UnregisterIntr) (void *hHwi)
 Enet OSAL ISR unregister function prototype. More...
 
typedef void *(* EnetOsal_CreateMutex) (void)
 Enet OSAL mutex create function prototype to protect critical section. More...
 
typedef void(* EnetOsal_DeleteMutex) (void *hMutex)
 Enet OSAL mutex delete function prototype. More...
 
typedef void(* EnetOsal_LockMutex) (void *hMutex)
 Enet OSAL mutex lock function prototype. More...
 
typedef void(* EnetOsal_UnlockMutex) (void *hMutex)
 Enet OSAL mutex lock function prototype. More...
 
typedef bool(* EnetOsal_IsCacheCoherent) (void)
 Enet OSAL cache coherency check function prototype. More...
 
typedef void(* EnetOsal_CacheInv) (const void *addr, int32_t size)
 Enet OSAL cache invalidate function prototype. More...
 
typedef void(* EnetOsal_CacheWb) (const void *addr, int32_t size)
 Enet OSAL cache writeback function prototype. More...
 
typedef void(* EnetOsal_CacheWbInv) (const void *addr, int32_t size)
 Enet OSAL cache writeback invalidate function prototype. More...
 
typedef uint32_t(* EnetOsal_TimerRead) (void)
 Enet OSAL timer read function prototype. More...
 
typedef void(* EnetOsal_Delay) (uint64_t delayInNsecs)
 Enet OSAL delay in nanosecond function prototype. More...
 

Functions

void EnetOsal_init (const EnetOsal_Cfg *cfg)
 Initialize OSAL with provided configuration. More...
 
void EnetOsal_deinit (void)
 Deinitialize OSAL. More...
 
uintptr_t EnetOsal_disableAllIntr (void)
 Enet OSAL intr disable function prototype. More...
 
void EnetOsal_restoreAllIntr (uintptr_t cookie)
 Enet OSAL intr restore function prototype. More...
 
void * EnetOsal_registerIntr (EnetOsal_Isr isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, uint32_t intrTrigType, void *arg)
 Register an ISR for an interrupt. More...
 
void EnetOsal_unregisterIntr (void *hHwi)
 Unregister an interrupt. More...
 
void EnetOsal_enableIntr (uint32_t coreIntrNum)
 Enable interrupt. More...
 
void EnetOsal_disableIntr (uint32_t coreIntrNum)
 Disable interrupt. More...
 
void * EnetOsal_createMutex (void)
 Create a mutex. More...
 
void EnetOsal_deleteMutex (void *hMutex)
 Delete a mutex. More...
 
void EnetOsal_lockMutex (void *hMutex)
 Lock a mutex. More...
 
void EnetOsal_unlockMutex (void *hMutex)
 Unlock a mutex. More...
 
void EnetOsal_cacheInv (const void *addr, int32_t size)
 Invalidate cache. More...
 
void EnetOsal_cacheWb (const void *addr, int32_t size)
 Write-back cache. More...
 
void EnetOsal_cacheWbInv (const void *addr, int32_t size)
 Write-back and invalidate cache. More...
 
uint32_t EnetOsal_timerGetDiff (uint32_t startTime)
 Get the time difference with respect to timestamp. More...
 
uint32_t EnetOsal_timerRead (void)
 Read current timer value. More...
 
void EnetOsal_delay (uint32_t delayInNsecs)
 Delay function. More...
 

Typedef Documentation

◆ EnetOsal_DisableAllIntr

typedef uintptr_t(* EnetOsal_DisableAllIntr) (void)

Enet OSAL intr disable function prototype.

Returns
Cookie to be passed back to enable interrupt function

◆ EnetOsal_RestoreAllIntr

typedef void(* EnetOsal_RestoreAllIntr) (uintptr_t cookie)

Enet OSAL intr restore function prototype.

Parameters
cookieThis is returned in disable interrupt function

◆ EnetOsal_RestoreIntr

typedef void(* EnetOsal_RestoreIntr) (uint32_t coreIntrNum)

Enet OSAL intr restore function prototype.

Parameters
coreIntrNumInterrupt to restore

◆ EnetOsal_DisableIntr

typedef void(* EnetOsal_DisableIntr) (uint32_t coreIntrNum)

Enet OSAL intr disable function prototype.

Parameters
coreIntrNumInterrupt to disable

◆ EnetOsal_Isr

typedef void(* EnetOsal_Isr) (uintptr_t arg)

Enet OSAL ISR callback function prototype.

Parameters
argApp data

◆ EnetOsal_RegisterIntr

typedef void*(* EnetOsal_RegisterIntr) (EnetOsal_Isr isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, uint32_t triggerType, void *arg)

Enet OSAL ISR register function prototype.

Parameters
isrFxnISR callback fxn pointer
coreIntrNumCore interrupt number to register
intrPriorityPriority
triggerTypeinterrupt trigger type for ARM corepac as OSAL_armGicTrigType_t
argArg that will be passed back in the ISR
Returns
Created Hwi handle

◆ EnetOsal_UnregisterIntr

typedef void(* EnetOsal_UnregisterIntr) (void *hHwi)

Enet OSAL ISR unregister function prototype.

Parameters
hHwiHwi handle

◆ EnetOsal_CreateMutex

typedef void*(* EnetOsal_CreateMutex) (void)

Enet OSAL mutex create function prototype to protect critical section.

Returns
Handle to the created mutex, NULL if creation failed

◆ EnetOsal_DeleteMutex

typedef void(* EnetOsal_DeleteMutex) (void *hMutex)

Enet OSAL mutex delete function prototype.

Parameters
hMutexMutex handle returned during create

◆ EnetOsal_LockMutex

typedef void(* EnetOsal_LockMutex) (void *hMutex)

Enet OSAL mutex lock function prototype.

Parameters
hMutexMutex handle returned during create

◆ EnetOsal_UnlockMutex

typedef void(* EnetOsal_UnlockMutex) (void *hMutex)

Enet OSAL mutex lock function prototype.

Parameters
hMutexMutex handle returned during create

◆ EnetOsal_IsCacheCoherent

typedef bool(* EnetOsal_IsCacheCoherent) (void)

Enet OSAL cache coherency check function prototype.

Returns
Whether cache is coherent or not

◆ EnetOsal_CacheInv

typedef void(* EnetOsal_CacheInv) (const void *addr, int32_t size)

Enet OSAL cache invalidate function prototype.

Parameters
addrStart address of the cache line/s
sizeSize (in bytes) of the memory to invalidate

◆ EnetOsal_CacheWb

typedef void(* EnetOsal_CacheWb) (const void *addr, int32_t size)

Enet OSAL cache writeback function prototype.

Parameters
addrStart address of the cache line/s
sizeSize (in bytes) of the memory to be written back

◆ EnetOsal_CacheWbInv

typedef void(* EnetOsal_CacheWbInv) (const void *addr, int32_t size)

Enet OSAL cache writeback invalidate function prototype.

Parameters
addrStart address of the cache line/s
sizeSize (in bytes) of the memory to be written back

◆ EnetOsal_TimerRead

typedef uint32_t(* EnetOsal_TimerRead) (void)

Enet OSAL timer read function prototype.

Returns
Timer's read value

◆ EnetOsal_Delay

typedef void(* EnetOsal_Delay) (uint64_t delayInNsecs)

Enet OSAL delay in nanosecond function prototype.

Parameters
delayInNsecsdelay value in nanosecond

Function Documentation

◆ EnetOsal_init()

void EnetOsal_init ( const EnetOsal_Cfg *  cfg)

Initialize OSAL with provided configuration.

Initializes the Enet driver OSAL with the provided configuration. It's expected that all function pointers in the configuration are not NULL.

Parameters
cfgConfiguration parameters

◆ EnetOsal_deinit()

void EnetOsal_deinit ( void  )

Deinitialize OSAL.

Deinitializes the Enet driver OSAL by clearing the configuration previously set when calling EnetOsal_init().

◆ EnetOsal_disableAllIntr()

uintptr_t EnetOsal_disableAllIntr ( void  )

Enet OSAL intr disable function prototype.

Returns
Cookie to be passed back to enable interrupt function

◆ EnetOsal_restoreAllIntr()

void EnetOsal_restoreAllIntr ( uintptr_t  cookie)

Enet OSAL intr restore function prototype.

Parameters
cookieThis is returned in disable interrupt function

◆ EnetOsal_registerIntr()

void* EnetOsal_registerIntr ( EnetOsal_Isr  isrFxn,
uint32_t  coreIntrNum,
uint32_t  intrPriority,
uint32_t  intrTrigType,
void *  arg 
)

Register an ISR for an interrupt.

Parameters
isrFxnInterrupt service routine
coreIntrNumInterrupt number
intrPriorityInterrupt priority
intrTrigTypeInterrupt trigger type
argArgument to ISR function
Returns
Interrupt handle pointer

◆ EnetOsal_unregisterIntr()

void EnetOsal_unregisterIntr ( void *  hHwi)

Unregister an interrupt.

Parameters
hHwiInterrupt handle pointer

◆ EnetOsal_enableIntr()

void EnetOsal_enableIntr ( uint32_t  coreIntrNum)

Enable interrupt.

Parameters
coreIntrNumInterrupt number

◆ EnetOsal_disableIntr()

void EnetOsal_disableIntr ( uint32_t  coreIntrNum)

Disable interrupt.

Parameters
coreIntrNumInterrupt number

◆ EnetOsal_createMutex()

void* EnetOsal_createMutex ( void  )

Create a mutex.

Returns
Mutex handle

◆ EnetOsal_deleteMutex()

void EnetOsal_deleteMutex ( void *  hMutex)

Delete a mutex.

Parameters
hMutexMutex handle

◆ EnetOsal_lockMutex()

void EnetOsal_lockMutex ( void *  hMutex)

Lock a mutex.

Parameters
hMutexMutex handle

◆ EnetOsal_unlockMutex()

void EnetOsal_unlockMutex ( void *  hMutex)

Unlock a mutex.

Parameters
hMutexMutex handle

◆ EnetOsal_cacheInv()

void EnetOsal_cacheInv ( const void *  addr,
int32_t  size 
)

Invalidate cache.

Invalidates cache in a range of memory.

Parameters
addrStart address of the cache line(s)
sizeSize (in bytes) of the memory to invalidate

◆ EnetOsal_cacheWb()

void EnetOsal_cacheWb ( const void *  addr,
int32_t  size 
)

Write-back cache.

Writes back cache a range of memory from cache.

Parameters
addrStart address of the cache line(s)
sizeSize (in bytes) of the memory to be written back

◆ EnetOsal_cacheWbInv()

void EnetOsal_cacheWbInv ( const void *  addr,
int32_t  size 
)

Write-back and invalidate cache.

Writes back and invalidates a range of memory.

Parameters
addrStart address of the cache line/s
sizeSize (in bytes) of the memory to be written back

◆ EnetOsal_timerGetDiff()

uint32_t EnetOsal_timerGetDiff ( uint32_t  startTime)

Get the time difference with respect to timestamp.

Gets the difference between time value passed to this function and current time from timer.

Returns
Time difference

◆ EnetOsal_timerRead()

uint32_t EnetOsal_timerRead ( void  )

Read current timer value.

Returns
Timer's read value

◆ EnetOsal_delay()

void EnetOsal_delay ( uint32_t  delayInNsecs)

Delay function.

Parameters
delayInNsecsDelay value in nanosecond