los_sem.h文件参考

浏览该文件的源代码。


宏定义

#define  LOS_ERRNO_SEM_NO_MEMORY   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x00)
  Semaphore error code: The memory is insufficient.
#define  LOS_ERRNO_SEM_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x01)
  Semaphore error code: Invalid parameter.
#define  LOS_ERRNO_SEM_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x02)
  Semaphore error code: Null pointer.
#define  LOS_ERRNO_SEM_ALL_BUSY   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x03)
  Semaphore error code: No semaphore control structure is available.
#define  LOS_ERRNO_SEM_UNAVAILABLE   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x04)
  Semaphore error code: Invalid parameter that specifies the timeout interval.
#define  LOS_ERRNO_SEM_PEND_INTERR   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x05)
  Semaphore error code: The API is called during an interrupt, which is forbidden.
#define  LOS_ERRNO_SEM_PEND_IN_LOCK   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x06)
  Semaphore error code: The task is unable to request a semaphore because task scheduling is locked.
#define  LOS_ERRNO_SEM_TIMEOUT   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x07)
  Semaphore error code: The request for a semaphore times out.
#define  LOS_ERRNO_SEM_OVERFLOW   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x08)
  Semaphore error code: The times of semaphore release exceed the maximum times permitted.
#define  LOS_ERRNO_SEM_PENDED   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x09)
  Semaphore error code: The queue of the tasks that are waiting on the semaphore control structure is not null.
#define  LOS_ERRNO_SEM_MAXNUM_ZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_SEM, 0x0A)
  Semaphore error code: LOS_ERRNO_SEM_MAXNUM_ZERO is error.

函数

UINT32  LOS_SemCreate (UINT16 usCount, UINT32 *puwSemHandle)
  Create a Counting semaphore.
UINT32  LOS_BinarySemCreate (UINT16 usCount, UINT32 *puwSemHandle)
  Create a binary semaphore.
UINT32  LOS_SemDelete (UINT32 uwSemHandle)
  Delete a semaphore.
UINT32  LOS_SemPend (UINT32 uwSemHandle, UINT32 uwTimeout)
  Request a semaphore.
UINT32  LOS_SemPost (UINT32 uwSemHandle)
  Release a semaphore.