AM64x MCU+ SDK  09.02.01
cb_lld_thread.h File Reference

Introduction

bindings to TI ENET LLD specific thread, mutex and semaphore functions

Go to the source code of this file.

Macros

#define TILLD_SUCCESS   (0)
 
#define TILLD_FAILURE   (-1)
 
#define TILLD_TIMEDOUT   (-2)
 
#define CB_THREAD_T   cb_lld_task_t*
 
#define CB_THREAD_CREATE   cb_lld_task_create
 
#define CB_THREAD_JOIN   cb_lld_task_join
 
#define CB_THREAD_EXIT   cb_lld_task_exit
 
#define CB_THREAD_MUTEX_T   cb_lld_mutex_t
 
#define CB_THREAD_MUTEX_LOCK   cb_lld_mutex_lock
 
#define CB_THREAD_MUTEX_TRYLOCK   cb_lld_mutex_trylock
 
#define CB_THREAD_MUTEX_TIMEDLOCK   cb_lld_mutex_timedlock
 
#define CB_THREAD_MUTEX_UNLOCK   cb_lld_mutex_unlock
 
#define CB_THREAD_MUTEX_INIT   cb_lld_mutex_init
 
#define CB_THREAD_MUTEX_DESTROY   cb_lld_mutex_destroy
 
#define CB_THREAD_IS_MUTEX_INITIALIZED(x)   ((x).lldmutex!=NULL)
 
#define CB_STATIC_MUTEX_INITIALIZER(x)   x=TILLD_MUTEX_INITIALIZER
 
#define CB_STATIC_MUTEX_CONSTRUCTOR(x)    UB_PROTECTED_FUNC_VOID(cb_lld_mutex_init_protect,&(x))
 
#define CB_STATIC_MUTEX_DESTRUCTOR(x)    UB_PROTECTED_FUNC_VOID(cb_lld_mutex_destroy_protect, &(x))
 
#define CB_THREAD_MUTEXATTR_T   void*
 
#define CB_THREAD_MUTEXATTR_INIT(a)
 
#define CB_THREAD_MUTEXATTR_SETPSHARED(a, b)
 
#define CB_THREAD_PROCESS_SHARED   0
 
#define CB_SEM_T   cb_lld_sem_t*
 
#define CB_SEM_INIT   cb_lld_sem_init
 
#define CB_SEM_GETVALUE   cb_lld_sem_getvalue
 
#define CB_SEM_WAIT   cb_lld_sem_wait
 
#define CB_SEM_TRYWAIT   cb_lld_sem_trywait
 
#define CB_SEM_TIMEDWAIT   cb_lld_sem_timedwait
 
#define CB_SEM_POST   cb_lld_sem_post
 
#define CB_SEM_DESTROY   cb_lld_sem_destroy
 
#define CB_THREAD_COND_T   void*
 
#define CB_THREAD_COND_INIT(a, b)
 
#define CB_THREAD_COND_DESTROY(a)
 
#define CB_THREAD_COND_WAIT(a, b)
 
#define CB_THREAD_COND_SIGNAL(a)
 
#define CB_THREAD_COND_BROADCAST(a)
 

Typedefs

typedef struct cb_lld_sem cb_lld_sem_t
 
typedef struct cb_lld_task cb_lld_task_t
 

Functions

int cb_lld_sem_init (CB_SEM_T *sem, int pshared, unsigned int value)
 Initializes a semaphore. More...
 
int cb_lld_sem_wait (CB_SEM_T *sem)
 Waits on a semaphore until it becomes available. More...
 
int cb_lld_sem_trywait (CB_SEM_T *sem)
 Attempts to wait on a semaphore without blocking. To know if the semaphore was acquired, get the return value from the cb_lld_sem_wait_status(). If the return value is 1, then the semaphore was acquired. Otherwise, the semaphore was not acquired. More...
 
int cb_lld_sem_timedwait (CB_SEM_T *sem, struct timespec *abstime)
 Waits on a semaphore until it becomes available or until a timeout occurs. To know if the semaphore was acquired, refer to the cb_lld_sem_wait_status(). More...
 
int cb_lld_sem_post (CB_SEM_T *sem)
 Posts (signals) a semaphore, releasing a waiting thread. More...
 
int cb_lld_sem_getvalue (CB_SEM_T *sem, int *sval)
 return the count of a semaphore More...
 
int cb_lld_sem_destroy (CB_SEM_T *sem)
 Destroys a semaphore. More...
 
int cb_lld_sem_wait_status (CB_SEM_T *sem)
 Get the semaphore wait status. The return value of this function determines the wait status of cb_lld_sem_wait(), cb_lld_sem_trywait() and cb_lld_sem_timedwait() More...
 
int cb_lld_mutex_init (CB_THREAD_MUTEX_T *mutex, CB_THREAD_MUTEXATTR_T attr)
 Initializes a mutex. More...
 
static int cb_lld_mutex_init_protect (void *mutex)
 Initializes a mutex that will be protected by the UB_PROTECTED_FUNC_VOID(). More...
 
int cb_lld_mutex_destroy (CB_THREAD_MUTEX_T *mutex)
 Destroys a mutex. More...
 
static void cb_lld_mutex_destroy_protect (void *mutex)
 Destroy a mutex that will be protected by the UB_PROTECTED_FUNC_VOID(). More...
 
int cb_lld_mutex_lock (CB_THREAD_MUTEX_T *mutex)
 Locks a mutex. More...
 
int cb_lld_mutex_unlock (CB_THREAD_MUTEX_T *mutex)
 Unlocks a mutex. More...
 
int cb_lld_mutex_trylock (CB_THREAD_MUTEX_T *mutex)
 Attempts to lock a mutex without blocking. More...
 
int cb_lld_mutex_timedlock (CB_THREAD_MUTEX_T *mutex, struct timespec *abstime)
 Locks a mutex and waits until a timeout occurs. More...
 
int cb_lld_task_create (CB_THREAD_T *th, void *attr, void *(*func)(void *), void *arg)
 Creates a new thread. This function creates a new thread with the specified attributes and starts executing the specified function with the provided argument. More...
 
int cb_lld_task_join (CB_THREAD_T th, void **retval)
 Waits for a thread to terminate. This function waits for the specified thread to terminate. More...
 
void cb_lld_task_exit (void *retval)
 Terminates the calling thread. More...