Go to the source code of this file.
Classes | |
| struct | sw_mutex_t |
| struct | sw_sem_t |
| struct | spinlock |
Macros | |
| #define | OTZ_LOCKED 1 |
| #define | OTZ_FREE 0 |
| #define | TRUE 1 |
| #define | FALSE 0 |
| #define | OTZ_OK 0 |
| #define | OTZ_INVALID 1 |
| #define | OTZ_BUSY 2 |
| #define | OTZ_AGAIN 3 |
| #define | INIT_SPIN_LOCK(s) ((s)->lock = 0) |
| #define | OTZ_MUTEX_INIT {TRUE, OTZ_FREE} |
| #define | sw_mutexattr_t void |
Functions | |
| void | sw_spinlock_s (void *data) |
| void | sw_spinunlock_s (void *data) |
| void | sw_sem_post_s (volatile s32int *data) |
| void | sw_sem_wait_s (volatile s32int *data) |
| u32 | sw_trylock_s (void *data) |
| s32int | sw_mutex_init (sw_mutex_t *mutex, const sw_mutexattr_t *attribute) |
| dymanic initialization of the mutex. The attribute parameter is kept for consistency and is not used. Attempting to re-initialize a mutex will reset it. More... | |
| s32int | sw_mutex_destroy (sw_mutex_t *mutex) |
| this function destroys the mutex object. Attempting to destroy a mutex that has already been destroyed has no effect. Attempting to destroy a locked mutex fails. More... | |
| s32int | sw_mutex_lock (sw_mutex_t *mutex) |
| this function locks the mutex object referenced. If the mutex is already locked, it blocks till it becomes available. Once it is available, it is locked. No deadlock detection is provided. More... | |
| s32int | sw_mutex_unlock (sw_mutex_t *mutex) |
| this function unlocks the mutex object referenced. Attempts to unlock a mutex that is already locked has no effect. More... | |
| s32int | sw_mutex_trylock (sw_mutex_t *mutex) |
| Try to lock the mutex. This function is same as the lock function, except that it returns if the mutex cannot be locked. More... | |
| s32int | sw_sem_init (sw_sem_t *sem, s32int shared, u32 value) |
| This function initializes the semaphore, and sets is counters to the value passed to it. More... | |
| s32int | sw_sem_wait (sw_sem_t *sem) |
| This function locks the semaphore referenced by the sem value. An atomic decrement is performed. If the counters become negative, sem_init is blocked, till another thread invokes sw_sem_post. More... | |
| s32int | sw_sem_post (sw_sem_t *sem) |
| This function unlocks the semaphore referenced by sem. The value is incremented atomically. If there are any threads waiting on this semaphore, only one of them would be released from sem_wait. More... | |
| s32int | sw_sem_destroy (sw_sem_t *sem) |
| Delete the semaphore pointed to by sem variable The semaphore cannot be used after deletion. More... | |
| s32int | sw_sem_getvalue (sw_sem_t *sem, s32int *value) |
| Get the current value of the semaphore. It is copied into the argument supplied by the caller. More... | |
| #define FALSE 0 |
| #define INIT_SPIN_LOCK | ( | s | ) | ((s)->lock = 0) |
| #define OTZ_AGAIN 3 |
| #define OTZ_BUSY 2 |
| #define OTZ_FREE 0 |
| #define OTZ_INVALID 1 |
| #define OTZ_LOCKED 1 |
| #define OTZ_OK 0 |
| #define sw_mutexattr_t void |
| #define TRUE 1 |
| s32int sw_mutex_destroy | ( | sw_mutex_t * | mutex | ) |
this function destroys the mutex object. Attempting to destroy a mutex that has already been destroyed has no effect. Attempting to destroy a locked mutex fails.
| mutex | - A pointer to the mutex that needs to be destroyed. |
this function destroys the mutex object. Attempting to destroy a mutex that has already been destroyed has no effect. Attempting to destroy a locked mutex fails.
| mutex |
| s32int sw_mutex_init | ( | sw_mutex_t * | mutex, |
| const sw_mutexattr_t * | attribute | ||
| ) |
dymanic initialization of the mutex. The attribute parameter is kept for consistency and is not used. Attempting to re-initialize a mutex will reset it.
This function must be invoked before a mutex can be used.
| mutex | - A pointer to the mutex that needs to be initialized |
| attribute | - A pointer to the attributes of the mutex |
dymanic initialization of the mutex. The attribute parameter is kept for consistency and is not used. Attempting to re-initialize a mutex will reset it.
| mutex | |
| attribute |
| s32int sw_mutex_lock | ( | sw_mutex_t * | mutex | ) |
this function locks the mutex object referenced. If the mutex is already locked, it blocks till it becomes available. Once it is available, it is locked. No deadlock detection is provided.
| mutex | - A pointer to the mutex that has to be locked. |
this function locks the mutex object referenced. If the mutex is already locked, it blocks till it becomes available. Once it is available, it is locked. No deadlock detection is provided.
| mutex |
| s32int sw_mutex_trylock | ( | sw_mutex_t * | mutex | ) |
Try to lock the mutex. This function is same as the lock function, except that it returns if the mutex cannot be locked.
| mutex | - A pointer to the mutex that needs to be locked. |
Try to lock the mutex. This function is same as the lock function, except that it returns if the mutex cannot be locked.
| mutex |
| s32int sw_mutex_unlock | ( | sw_mutex_t * | mutex | ) |
this function unlocks the mutex object referenced. Attempts to unlock a mutex that is already locked has no effect.
| mutex | - A pointer to the mutex that has to be unlocked. |
this function unlocks the mutex object referenced. Attempts to unlock a mutex that is already locked has no effect.
| mutex |
| s32int sw_sem_destroy | ( | sw_sem_t * | sem | ) |
Delete the semaphore pointed to by sem variable The semaphore cannot be used after deletion.
| sem | - The semaphore to be destroyed. |
| OTZ_OK | If the semaphore has been deleted successfully. |
| OTZ_INVALID | If the semaphore parameter is invalid. |
| OTZ_BUSY | If the semaphore is currently busy and hence cannot be destroyed. |
Delete the semaphore pointed to by sem variable The semaphore cannot be used after deletion.
| sem |
| s32int sw_sem_getvalue | ( | sw_sem_t * | sem, |
| s32int * | value | ||
| ) |
Get the current value of the semaphore. It is copied into the argument supplied by the caller.
| sem | - The semaphore whose value has to be obtained. |
| value | - The location where the value of the semaphore needs to be copied. |
Get the current value of the semaphore. It is copied into the argument supplied by the caller.
| sem | |
| value |
| s32int sw_sem_init | ( | sw_sem_t * | sem, |
| s32int | shared, | ||
| u32 | value | ||
| ) |
This function initializes the semaphore, and sets is counters to the value passed to it.
| sem | - A pointer to the semaphore that needs to be initialized |
| shared | - Not supported and any value that is passed is ignored. |
| value | - The value that needs to be assigned to the semaphore. |
This function initializes the semaphore, and sets is counters to the value passed to it.
| sem | |
| shared | |
| value |
| s32int sw_sem_post | ( | sw_sem_t * | sem | ) |
This function unlocks the semaphore referenced by sem. The value is incremented atomically. If there are any threads waiting on this semaphore, only one of them would be released from sem_wait.
| sem | - A pointer to the semaphore that needs to be incremented. |
This function unlocks the semaphore referenced by sem. The value is incremented atomically. If there are any threads waiting on this semaphore, only one of them would be released from sem_wait.
| sem |
| void sw_sem_post_s | ( | volatile s32int * | data | ) |
| data |
| s32int sw_sem_wait | ( | sw_sem_t * | sem | ) |
This function locks the semaphore referenced by the sem value. An atomic decrement is performed. If the counters become negative, sem_init is blocked, till another thread invokes sw_sem_post.
| sem | - A pointer to the semaphore to be waited upon on. |
This function locks the semaphore referenced by the sem value. An atomic decrement is performed. If the counters become negative, sem_init is blocked, till another thread invokes sw_sem_post.
| sem |
| void sw_sem_wait_s | ( | volatile s32int * | data | ) |
| data |
| void sw_spinlock_s | ( | void * | data | ) |
| data |
| void sw_spinunlock_s | ( | void * | data | ) |
| data |
| u32 sw_trylock_s | ( | void * | data | ) |
| data |
1.8.6