ETHFW API Guide
Ethernet Firmware OSAL Abstraction APIs

Introduction

This section contains Ethernet Firmware OSAL APIs. This is a common header file for both Jacinto and Sitara which holds macros and declarations for OSAL related APIs.

Data Structures

struct  EthFwOsal_TaskParams
 Task configuration params. More...
 
struct  EthFwOsal_ClockParams
 Clock configuration params. More...
 
struct  EthFwOsal_EventParams
 Event configuration params. More...
 

Functions

void EthFwOsal_init (void)
 ETHFW OSAL init. More...
 
void EthFwOsal_initTaskParams (EthFwOsal_TaskParams *params)
 ETHFW OSAL Task init configuration parameters. More...
 
EthFwOsal_TaskHandle EthFwOsal_createTask (void(*func)(void *), EthFwOsal_TaskParams *params)
 ETHFW OSAL function to create a task. More...
 
int32_t EthFwOsal_deleteTask (EthFwOsal_TaskHandle *taskHandle)
 ETHFW OSAL function to delete a task. More...
 
void EthFwOsal_exitTask (void)
 ETHFW OSAL function to exit from a task. More...
 
uint32_t EthFwOsal_isTaskTerminated (EthFwOsal_TaskHandle taskHandle)
 ETHFW OSAL function to check if a given task is terminated. More...
 
EthFwOsal_TaskHandle EthFwOsal_getTaskSelf (void)
 ETHFW OSAL function returns the Task handle of current task. More...
 
void EthFwOsal_setTaskPrio (EthFwOsal_TaskHandle taskHandle, uint32_t priority)
 ETHFW OSAL function to update Task priority. More...
 
void EthFwOsal_sleepTaskinMsecs (uint32_t timeoutInMsecs)
 ETHFW OSAL function Task sleep in units of msecs. More...
 
uint64_t EthFwOsal_getTimeInUsecs (void)
 ETHFW OSAL function to get time in micro seconds. More...
 
void EthFwOsal_sleepTask (uint32_t timeout)
 ETHFW OSAL function Task sleep in units of OS tick. More...
 
void EthFwOsal_yieldTask (void)
 ETHFW OSAL function to Yield processor to equal priority task. More...
 
void EthFwOsal_wbCache (const void *addr, uint32_t size)
 ETHFW OSAL function to write back cache lines. More...
 
void EthFwOsal_invCache (const void *addr, uint32_t size)
 ETHFW OSAL function to invalidate cache lines. More...
 
void EthFwOsal_wbInvCache (const void *addr, uint32_t size)
 ETHFW OSAL function to write back and invalidate cache lines. More...
 
EthFwOsal_SemHandle EthFwOsal_createSemaphore (uint32_t count)
 ETHFW OSAL function to create a semaphore. More...
 
int32_t EthFwOsal_deleteSemaphore (EthFwOsal_SemHandle handle)
 ETHFW OSAL function to delete a semaphore. More...
 
int32_t EthFwOsal_pendSemaphore (EthFwOsal_SemHandle handle, uint32_t timeout)
 ETHFW OSAL function to pend a semaphore. More...
 
int32_t EthFwOsal_postSemaphore (EthFwOsal_SemHandle handle)
 ETHFW OSAL function to post a semaphore. More...
 
EthFwOsal_MutexHandle EthFwOsal_createMutex (void)
 ETHFW OSAL function to create a mutex. More...
 
void EthFwOsal_deleteMutex (void *EthFwOsal_MutexHandle)
 ETHFW OSAL function to post a mutex. More...
 
void EthFwOsal_lockMutex (void *EthFwOsal_MutexHandle)
 ETHFW OSAL function to lock a muex. More...
 
void EthFwOsal_unlockMutex (void *EthFwOsal_MutexHandle)
 ETHFW OSAL function to unlock a mutex. More...
 
void EthFwOsal_initClockParams (EthFwOsal_ClockParams *params)
 ETHFW OSAL Clock init configuration parameters. More...
 
EthFwOsal_ClockHandle EthFwOsal_createClock (void(*func)(void *), EthFwOsal_ClockParams *params)
 ETHFW OSAL function to create a clock. More...
 
int32_t EthFwOsal_startClock (EthFwOsal_ClockHandle handle)
 ETHFW OSAL function to stack a clock. More...
 
int32_t EthFwOsal_stopClock (EthFwOsal_ClockHandle handle)
 ETHFW OSAL function to stop a clock. More...
 
int32_t EthFwOsal_deleteClock (EthFwOsal_ClockHandle handle)
 ETHFW OSAL function to delete a clock. More...
 
void EthFwOsal_initEventParams (EthFwOsal_EventParams *params)
 ETHFW OSAL Event init configuration parameters. More...
 
EthFwOsal_EventHandle EthFwOsal_createEvent (EthFwOsal_EventParams *params)
 ETHFW OSAL function to create a event. More...
 
uint32_t EthFwOsal_waitEvent (EthFwOsal_EventHandle handle, uint32_t eventMask, uint8_t waitMode, uint32_t timeout)
 ETHFW OSAL function to wait for an event. More...
 
int32_t EthFwOsal_postEvent (EthFwOsal_EventHandle handle, uint32_t eventBits)
 ETHFW OSAL function to post an event. More...
 
void EthFwOsal_initMailboxParams (EthFwOsal_MailboxParams *params)
 ETHFW OSAL Mailbox init configuration parameters. More...
 
EthFwOsal_MailboxHandle EthFwOsal_createMailbox (EthFwOsal_MailboxParams *params)
 ETHFW OSAL function to create a Mailbox. More...
 
int32_t EthFwOsal_deleteMailbox (EthFwOsal_MailboxHandle handle)
 ETHFW OSAL function to delete a Mailbox. More...
 
int32_t EthFwOsal_postMailbox (EthFwOsal_MailboxHandle handle, void *msg, uint32_t timeout)
 ETHFW OSAL function to post a Mailbox. More...
 
int32_t EthFwOsal_pendMailbox (EthFwOsal_MailboxHandle handle, void *msg, uint32_t timeout)
 ETHFW OSAL function to pend a Mailbox. More...
 

Typedefs

typedef MailboxP_Params EthFwOsal_MailboxParams
 Mailbox params for Jacinto and Sitara. More...
 
typedef void * EthFwOsal_TaskHandle
 ETHFW OSAL Task Handle. More...
 
typedef void * EthFwOsal_SemHandle
 ETHFW OSAL Semaphore Handle. More...
 
typedef void * EthFwOsal_ClockHandle
 ETHFW OSAL Clock Handle. More...
 
typedef void * EthFwOsal_EventHandle
 ETHFW OSAL Event Handle. More...
 
typedef void * EthFwOsal_MutexHandle
 ETHFW OSAL Mutex Handle. More...
 
typedef void * EthFwOsal_MailboxHandle
 ETHFW OSAL Mailbox Handle. More...
 

Macros

#define ETHFWCLOCK_STARTMODE_USER   ((uint8_t) 0U)
 
#define ETHFWCLOCK_STARTMODE_AUTO   ((uint8_t) 1U)
 
#define ETHFWCLOCK_RUNMODE_ONESHOT   ((uint8_t) 0U)
 
#define ETHFWCLOCK_RUNMODE_CONTINUOUS   ((uint8_t) 1U)
 
#define ETHFWEVENT_WAITMODE_ANY   ((uint8_t) 0U)
 
#define ETHFWEVENT_WAITMODE_ALL   ((uint8_t) 1U)
 

Macro Definition Documentation

◆ ETHFWCLOCK_STARTMODE_USER

#define ETHFWCLOCK_STARTMODE_USER   ((uint8_t) 0U)

Timer will be started by the user

◆ ETHFWCLOCK_STARTMODE_AUTO

#define ETHFWCLOCK_STARTMODE_AUTO   ((uint8_t) 1U)

Timer starts automatically after create or scheduler start

◆ ETHFWCLOCK_RUNMODE_ONESHOT

#define ETHFWCLOCK_RUNMODE_ONESHOT   ((uint8_t) 0U)

Timer runs for a single period values and stops

◆ ETHFWCLOCK_RUNMODE_CONTINUOUS

#define ETHFWCLOCK_RUNMODE_CONTINUOUS   ((uint8_t) 1U)

Timer is periodic and runs continuously

◆ ETHFWEVENT_WAITMODE_ANY

#define ETHFWEVENT_WAITMODE_ANY   ((uint8_t) 0U)

EventP_wait will return when ANY of the bits set in mask are set in the Event bits

◆ ETHFWEVENT_WAITMODE_ALL

#define ETHFWEVENT_WAITMODE_ALL   ((uint8_t) 1U)

EventP_wait will return when ALL the bits set in mask are set in the Event bits

Typedef Documentation

◆ EthFwOsal_MailboxParams

typedef MailboxP_Params EthFwOsal_MailboxParams

Mailbox params for Jacinto and Sitara.

◆ EthFwOsal_TaskHandle

typedef void* EthFwOsal_TaskHandle

ETHFW OSAL Task Handle.

◆ EthFwOsal_SemHandle

typedef void* EthFwOsal_SemHandle

ETHFW OSAL Semaphore Handle.

◆ EthFwOsal_ClockHandle

typedef void* EthFwOsal_ClockHandle

ETHFW OSAL Clock Handle.

◆ EthFwOsal_EventHandle

typedef void* EthFwOsal_EventHandle

ETHFW OSAL Event Handle.

◆ EthFwOsal_MutexHandle

typedef void* EthFwOsal_MutexHandle

ETHFW OSAL Mutex Handle.

◆ EthFwOsal_MailboxHandle

typedef void* EthFwOsal_MailboxHandle

ETHFW OSAL Mailbox Handle.

Function Documentation

◆ EthFwOsal_init()

void EthFwOsal_init ( void  )

ETHFW OSAL init.

Based on the caller of the function (Jacinto or Sitara), this function initiates the OSAL module in ETHFW. For Jacinto, this is a empty function and does nothing, but for Sitara, this inits and sets the global OSAL pools to zero, which is needed to support static memory allocation of the OS modules.

◆ EthFwOsal_initTaskParams()

void EthFwOsal_initTaskParams ( EthFwOsal_TaskParams params)

ETHFW OSAL Task init configuration parameters.

Sets the Task init configuration parameters. This function sets to default init params for Task init.

Parameters
paramsInit configuration params.

◆ EthFwOsal_createTask()

EthFwOsal_TaskHandle EthFwOsal_createTask ( void(*)(void *)  func,
EthFwOsal_TaskParams params 
)

ETHFW OSAL function to create a task.

Parameters
funcFunction pointer of the task.
paramsPointer to the instance configuration parameters.
Returns
EthFwOsal_TaskHandle on success or a NULL on an error

◆ EthFwOsal_deleteTask()

int32_t EthFwOsal_deleteTask ( EthFwOsal_TaskHandle taskHandle)

ETHFW OSAL function to delete a task.

Parameters
taskHandleEthFwOsal_TaskHandle returned from EthFwOsal_createTask
Returns
Status of the function

◆ EthFwOsal_exitTask()

void EthFwOsal_exitTask ( void  )

ETHFW OSAL function to exit from a task.

This function does nothing when the caller is from Jacinto baseline, but the same exits at the end of the task for Sitara.

◆ EthFwOsal_isTaskTerminated()

uint32_t EthFwOsal_isTaskTerminated ( EthFwOsal_TaskHandle  taskHandle)

ETHFW OSAL function to check if a given task is terminated.

This function is not supported for Sitara baseline. For a Jacinto caller this function returns the current status of a task if terminated.

Parameters
taskHandleEthFwOsal_TaskHandle returned from EthFwOsal_createTask
Returns
0 if task is not terminated 1 if task is terminated

◆ EthFwOsal_getTaskSelf()

EthFwOsal_TaskHandle EthFwOsal_getTaskSelf ( void  )

ETHFW OSAL function returns the Task handle of current task.

This function is not supported for Sitara baseline. For a Jacinto caller this function returns the Task handle of current task.

Returns
EthFwOsal_TaskHandle of current task

◆ EthFwOsal_setTaskPrio()

void EthFwOsal_setTaskPrio ( EthFwOsal_TaskHandle  taskHandle,
uint32_t  priority 
)

ETHFW OSAL function to update Task priority.

This function is not supported for Sitara baseline. For a Jacinto caller this function to update Task priority.

Parameters
taskHandleEthFwOsal_TaskHandle of task
priorityNew priority to be set

◆ EthFwOsal_sleepTaskinMsecs()

void EthFwOsal_sleepTaskinMsecs ( uint32_t  timeoutInMsecs)

ETHFW OSAL function Task sleep in units of msecs.

◆ EthFwOsal_getTimeInUsecs()

uint64_t EthFwOsal_getTimeInUsecs ( void  )

ETHFW OSAL function to get time in micro seconds.

◆ EthFwOsal_sleepTask()

void EthFwOsal_sleepTask ( uint32_t  timeout)

ETHFW OSAL function Task sleep in units of OS tick.

◆ EthFwOsal_yieldTask()

void EthFwOsal_yieldTask ( void  )

ETHFW OSAL function to Yield processor to equal priority task.

◆ EthFwOsal_wbCache()

void EthFwOsal_wbCache ( const void *  addr,
uint32_t  size 
)

ETHFW OSAL function to write back cache lines.

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

◆ EthFwOsal_invCache()

void EthFwOsal_invCache ( const void *  addr,
uint32_t  size 
)

ETHFW OSAL function to invalidate cache lines.

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

◆ EthFwOsal_wbInvCache()

void EthFwOsal_wbInvCache ( const void *  addr,
uint32_t  size 
)

ETHFW OSAL function to write back and invalidate cache lines.

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

◆ EthFwOsal_createSemaphore()

EthFwOsal_SemHandle EthFwOsal_createSemaphore ( uint32_t  count)

ETHFW OSAL function to create a semaphore.

Parameters
countInitial count of the semaphore. For binary semaphores, only values of 0 or 1 are valid.
Returns
EthFwOsal_SemHandle on success or a NULL on an error

◆ EthFwOsal_deleteSemaphore()

int32_t EthFwOsal_deleteSemaphore ( EthFwOsal_SemHandle  handle)

ETHFW OSAL function to delete a semaphore.

Parameters
handleEthFwOsal_SemHandle returned from EthFwOsal_createSemaphore
Returns
Status of the function

◆ EthFwOsal_pendSemaphore()

int32_t EthFwOsal_pendSemaphore ( EthFwOsal_SemHandle  handle,
uint32_t  timeout 
)

ETHFW OSAL function to pend a semaphore.

Parameters
handleEthFwOsal_SemHandle returned from EthFwOsal_createSemaphore
timeoutTimeout (in ticks) to wait for the semaphore to be signalled (posted)
Returns
Status of the function

◆ EthFwOsal_postSemaphore()

int32_t EthFwOsal_postSemaphore ( EthFwOsal_SemHandle  handle)

ETHFW OSAL function to post a semaphore.

Parameters
handleEthFwOsal_SemHandle returned from EthFwOsal_createSemaphore
Returns
Status of the function

◆ EthFwOsal_createMutex()

EthFwOsal_MutexHandle EthFwOsal_createMutex ( void  )

ETHFW OSAL function to create a mutex.

Returns
EthFwOsal_MutexHandle on success or a NULL on an error

◆ EthFwOsal_deleteMutex()

void EthFwOsal_deleteMutex ( void *  EthFwOsal_MutexHandle)

ETHFW OSAL function to post a mutex.

Parameters
EthFwOsal_MutexHandleEthFwOsal_MutexHandle returned from EthFwOsal_createMutex

◆ EthFwOsal_lockMutex()

void EthFwOsal_lockMutex ( void *  EthFwOsal_MutexHandle)

ETHFW OSAL function to lock a muex.

Parameters
EthFwOsal_MutexHandleEthFwOsal_MutexHandle returned from EthFwOsal_createMutex

◆ EthFwOsal_unlockMutex()

void EthFwOsal_unlockMutex ( void *  EthFwOsal_MutexHandle)

ETHFW OSAL function to unlock a mutex.

Parameters
EthFwOsal_MutexHandleEthFwOsal_MutexHandle returned from EthFwOsal_createMutex

◆ EthFwOsal_initClockParams()

void EthFwOsal_initClockParams ( EthFwOsal_ClockParams params)

ETHFW OSAL Clock init configuration parameters.

Sets the Clock init configuration parameters. This function sets to default init params for Clock init.

Parameters
paramsInit configuration params.

◆ EthFwOsal_createClock()

EthFwOsal_ClockHandle EthFwOsal_createClock ( void(*)(void *)  func,
EthFwOsal_ClockParams params 
)

ETHFW OSAL function to create a clock.

Parameters
funcFunction pointer of the clock function.
paramsPointer to the instance configuration parameters.
Returns
EthFwOsal_ClockHandle on success or a NULL on an error

◆ EthFwOsal_startClock()

int32_t EthFwOsal_startClock ( EthFwOsal_ClockHandle  handle)

ETHFW OSAL function to stack a clock.

Parameters
handleEthFwOsal_ClockHandle returned from EthFwOsal_createClock
Returns
Status of the function

◆ EthFwOsal_stopClock()

int32_t EthFwOsal_stopClock ( EthFwOsal_ClockHandle  handle)

ETHFW OSAL function to stop a clock.

Parameters
handleEthFwOsal_ClockHandle returned from EthFwOsal_createClock
Returns
Status of the function

◆ EthFwOsal_deleteClock()

int32_t EthFwOsal_deleteClock ( EthFwOsal_ClockHandle  handle)

ETHFW OSAL function to delete a clock.

Parameters
handleEthFwOsal_ClockHandle returned from EthFwOsal_createClock
Returns
Status of the function

◆ EthFwOsal_initEventParams()

void EthFwOsal_initEventParams ( EthFwOsal_EventParams params)

ETHFW OSAL Event init configuration parameters.

Sets the Event init configuration parameters. This function sets to default init params for Event init.

Parameters
paramsInit configuration params.

◆ EthFwOsal_createEvent()

EthFwOsal_EventHandle EthFwOsal_createEvent ( EthFwOsal_EventParams params)

ETHFW OSAL function to create a event.

Parameters
paramsPointer to the instance configuration parameters.
Returns
EthFwOsal_EventHandle on success or a NULL on an error

◆ EthFwOsal_waitEvent()

uint32_t EthFwOsal_waitEvent ( EthFwOsal_EventHandle  handle,
uint32_t  eventMask,
uint8_t  waitMode,
uint32_t  timeout 
)

ETHFW OSAL function to wait for an event.

Parameters
handleEthFwOsal_EventHandle returned during EthFwOsal_createEvent
eventMaskmask of eventIds to pend on (must be non-zero) Only supports upto 24 bits.
waitModeEvent wait mode.
timeoutreturn from wait() after this many system time units
Returns
All consumed events or zero if timeout

◆ EthFwOsal_postEvent()

int32_t EthFwOsal_postEvent ( EthFwOsal_EventHandle  handle,
uint32_t  eventBits 
)

ETHFW OSAL function to post an event.

Parameters
handleEthFwOsal_EventHandle returned during EthFwOsal_createEvent
eventBitsmask of eventIds to post (must be non-zero)
Returns
Status of the function

◆ EthFwOsal_initMailboxParams()

void EthFwOsal_initMailboxParams ( EthFwOsal_MailboxParams params)

ETHFW OSAL Mailbox init configuration parameters.

Sets the Mailbox init configuration parameters. This function sets to default init params for Mailbox init.

Parameters
paramsInit configuration params.

◆ EthFwOsal_createMailbox()

EthFwOsal_MailboxHandle EthFwOsal_createMailbox ( EthFwOsal_MailboxParams params)

ETHFW OSAL function to create a Mailbox.

Parameters
paramsPointer to the instance configuration parameters.
Returns
EthFwOsal_MailboxHandle on success or a NULL on an error

◆ EthFwOsal_deleteMailbox()

int32_t EthFwOsal_deleteMailbox ( EthFwOsal_MailboxHandle  handle)

ETHFW OSAL function to delete a Mailbox.

Parameters
handleEthFwOsal_MailboxHandle returned from EthFwOsal_createMailbox
Returns
Status of the function

◆ EthFwOsal_postMailbox()

int32_t EthFwOsal_postMailbox ( EthFwOsal_MailboxHandle  handle,
void *  msg,
uint32_t  timeout 
)

ETHFW OSAL function to post a Mailbox.

Parameters
handleEthFwOsal_MailboxHandle returned from EthFwOsal_createMailbox
msgPointer to the message to post
timeoutTimeout (in milliseconds) to wait for post a message to the mailbox.
Returns
Status of the function

◆ EthFwOsal_pendMailbox()

int32_t EthFwOsal_pendMailbox ( EthFwOsal_MailboxHandle  handle,
void *  msg,
uint32_t  timeout 
)

ETHFW OSAL function to pend a Mailbox.

Parameters
handleEthFwOsal_MailboxHandle returned from EthFwOsal_createMailbox
msgPointer to the message to pend
timeoutTimeout (in milliseconds) to wait for pend a message to the mailbox.
Returns
Status of the function