gparmer / cFE2cos

0 stars 1 forks source link

Implement Semaphore and Mutex API Functions #14

Open base0x10 opened 8 years ago

base0x10 commented 8 years ago

This is going to be a lot of work. There are 22 Functions to implement and it may be difficult to integrate with the COS resource tables (or I could be misunderstanding how that will work).

int32 OS_BinSemCreate(uint32 *sem_id, const char *sem_name, uint32 sem_initial_value, uint32 options) This function creates a binary semaphore. Semaphore names must be unique; if the name already exists this function fails. Names cannot be NULL.

int32 OS_BinSemDelete ( uint32 sem_id ) This is the function used to delete a binary semaphore in the operating system. This also frees the respective sem_id to be used again when another semaphore is created.

int32 OS_BinSemFlush(uint32 sem_id) This function releases all the tasks waiting on the given semaphore

int32 OS_BinSemGive(uint32 sem_id) This function gives back a binary semaphore

int32 OS_BinSemTake(uint32 sem_id) This function reserves a binary semaphore

int32 OS_BinSemTimeWait(uint32 sem_id , uint32 msecs) This function reserves a binary semaphore with a timeout.

int32 OS_BinSemGetIdByName (uint32 *sem_id, const char *sem_name) This function takes a binary semaphore name and looks for a valid binary semaphore with this name and returns the id of that semaphore.

int32 OS_BinSemGetInfo (uint32 sem_id, OS_mut_sem_prop_t *sem_prop) This function takes sem_id, and looks it up in the OS table. It puts all of the information known about that semaphore into a structure pointer to by sem_prop

int32 OS_CountSemCreate(uint32 *sem_id, const char *sem_name, uint32 sem_initial_value, uint32 options) This function creates a counting semaphore. Semaphore names must be unique; if the name already exists this function fails. Names cannot be NULL.

int32 OS_CountSemDelete ( uint32 sem_id ) This is the function used to delete a counting semaphore in the operating system. This also frees the respective sem_id to be used again when another semaphore is created.

int32 OS_CountSemGive(uint32 sem_id) This function gives back a counting semaphore

int32 OS_CountSemTake(uint32 sem_id) This function reserves a counting semaphore

int32 OS_CountSemTimeWait(uint32 sem_id , uint32 msecs) This function reserves a counting semaphore with a timeout.

int32 OS_CountSemGetIdByName (uint32 *sem_id, const char *sem_name) This function takes a counting semaphore name and looks for a valid counting semaphore with this name and returns the id of that semaphore.

int32 OS_CountSemGetInfo (uint32 sem_id, OS_mut_sem_prop_t *sem_prop) This function takes sem_id, and looks it up in the OS table. It puts all of the information known about that semaphore into a structure pointer to by sem_prop

int32 OS_MutSemCreate(uint32 *sem_id, const char *sem_name, uint32 options) This function creates a mutex semaphore. Semaphore names must be unique; if the name already exists this function fails. Names cannot be NULL.

int32 OS_MutSemDelete ( uint32 sem_id ) This is the function used to delete a binary semaphore in the operating system. This also frees the respective sem_id to be used again when another mutex is created.

int32 OS_MutSemGive (uint32 sem_id ) This function releases a mutex semaphore

int32 OS_MutSemTake (uint32 sem_id ) This function allocates a mutex semaphore

int32 OS_MutSemGetIdByName (uint32 *sem_id, const char *sem_name) This function takes a mutex name and looks for a valid mutex semaphore with this name and returns the id of that semaphore.

int32 OS_MutSemGetInfo (uint32 sem_id, OS_mut_sem_prop_t *sem_prop) This function takes sem_id, and looks it up in the OS table. It puts all of the information known about that mutex into a structure pointer to by sem_prop