123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #ifndef __GSL_SEMA_H__
- #define __GSL_SEMA_H__
- #include "gl_types.h"
- /******************************************************************************/
- /**
- * @brief Used to create a binary or counting semaphore.
- *
- * @param szName String identifier for the semaphore. Limit to 16 characters. Used wherever supported.
- * @param dMaxCount Maximum semaphore count. Value of 1 means binary semaphore.
- * @param dInitialValue Initial count of semaphore. Zero means semaphore is unavailable.
- * @param pSemId Semaphore object identifier returned by the API (on success)
- *
- * @return @a GL_SUCCESS on success
- * @return @a GL_FAILURE on failure
- *
- * @note Cannot be used from ISR/DSR.
- *******************************************************************************/
- GL_Status_t GL_SemaphoreCreate(GL_INT8 *szName, GL_UINT32 dMaxCount, GL_UINT32 dInitialValue, GL_Semaphore_t *pSemId);
- /******************************************************************************/
- /**
- * @brief Used to delete a semaphore. Regarding tasks waiting on a deleted semaphore, the behavior depends on the underlying OS; the GSL does not guarantee a default behavior (hence, applications should avoid this scenario). Typically, an error is returned to the waiting tasks.
- *
- * @param semId Semaphore object identifier
- *
- * @return @a GL_SUCCESS on success
- * @return @a GL_FAILURE on failure
- *
- * @note Cannot be used from ISR/DSR.
- *******************************************************************************/
- GL_Status_t GL_SemaphoreDelete(GL_Semaphore_t semId);
- /******************************************************************************/
- /**
- * @brief Used to release a semaphore.
- *
- * @param semId Semaphore object identifier
- *
- * @return @a GL_SUCCESS on success
- * @return @a GL_FAILURE on failure
- *******************************************************************************/
- GL_Status_t GL_SemaphoreGive(GL_Semaphore_t semId);
- /******************************************************************************/
- /**
- * @brief Used to take a semaphore with/without timeout.
- *
- * @param semId Semaphore object identifier
- * @param sdTimeout timeout period to receive message. Measured in milliseconds. Set to:
- * @li @a GL_INFINITE_WAIT
- * @li @a GL_NO_WAIT
- * @li Any value between 1-2147483647 for finite wait)
- *
- * @return @a GL_SUCCESS on success
- * @return @a GL_FAILURE on failure
- * @return @a GL_TIMEOUT on timeout
- *
- * @note Cannot be used from ISR/DSR.
- *******************************************************************************/
- GL_Status_t GL_SemaphoreTake(GL_Semaphore_t semId, GL_INT32 sdTimeout);
- #endif // __GL_SEMA_H__
|