SysLink API Reference  2.21.03.11
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Typedefs | Enumerations | Functions
OsalSemaphore.h File Reference

Detailed Description

Kernel utils Semaphore interface definitions.

This abstracts the Semaphore interface in Kernel code and is implemented using the wait queues. It has interfaces for creating, destroying, waiting and triggering the Semaphores.

Go to the source code of this file.

Macros

#define OSALSEMAPHORE_MODULEID   (UInt16) 0xF6D6
 Module ID for OsalSemaphore OSAL module.
#define OSALSEMAPHORE_STATUSCODEBASE   (OSALSEMAPHORE_MODULEID << 12u)
 Stauts code base for MEMORY module.
#define OSALSEMAPHORE_MAKE_FAILURE(x)
 Convert to failure code.
#define OSALSEMAPHORE_MAKE_SUCCESS(x)   (OSALSEMAPHORE_STATUSCODEBASE + (x))
 Convert to success code.
#define OSALSEMAPHORE_E_MEMORY   OSALSEMAPHORE_MAKE_FAILURE(1)
 Indicates OsalSemaphore alloc/free failure.
#define OSALSEMAPHORE_E_INVALIDARG   OSALSEMAPHORE_MAKE_FAILURE(2)
 Invalid argument provided.
#define OSALSEMAPHORE_E_FAIL   OSALSEMAPHORE_MAKE_FAILURE(3)
 Generic failure.
#define OSALSEMAPHORE_E_TIMEOUT   OSALSEMAPHORE_MAKE_FAILURE(4)
 A timeout occurred.
#define OSALSEMAPHORE_E_HANDLE   OSALSEMAPHORE_MAKE_FAILURE(5)
 Invalid handle provided.
#define OSALSEMAPHORE_E_WAITNONE   OSALSEMAPHORE_MAKE_FAILURE(6)
 WAIT_NONE timeout value was provided, but semaphore was not available.
#define OSALSEMAPHORE_E_RESOURCE   OSALSEMAPHORE_MAKE_FAILURE(7)
 Resource error.
#define OSALSEMAPHORE_SUCCESS   OSALSEMAPHORE_MAKE_SUCCESS(0)
 Operation successfully completed.
#define OSALSEMAPHORE_WAIT_FOREVER   (~((UInt32) 0u))
 Indicates forever wait for APIs that can wait.
#define OSALSEMAPHORE_WAIT_NONE   ((UInt32) 0u)
 Indicates zero wait for APIs that can wait.
#define OSALSEMAPHORE_TYPE_VALUE(type)   (type & 0x0000FFFF)
 Returns the value of semaphore type (binary/counting)
#define OSALSEMAPHORE_INTTYPE_VALUE(type)   (type & 0xFFFF0000)
 Returns the value of semaphore interruptability type.

Typedefs

typedef struct
OsalSemaphore_Object * 
OsalSemaphore_Handle
 Declaration for the OsalSemaphore object handle. Definition of OsalSemaphore_Object is not exposed.

Enumerations

enum  OsalSemaphore_Type {
  OsalSemaphore_Type_Binary = 0x00000000,
  OsalSemaphore_Type_Counting = 0x00000001,
  OsalSemaphore_Type_EndValue = 0x00000002
}
 Enumerates the types of semaphores. More...
enum  OsalSemaphore_IntType {
  OsalSemaphore_IntType_Interruptible = 0x00000000,
  OsalSemaphore_IntType_Noninterruptible = 0x00010000,
  OsalSemaphore_IntType_EndValue = 0x00020000
}
 Enumerates the interruptible/non-interruptible types. More...

Functions

OsalSemaphore_Handle OsalSemaphore_create (UInt32 semType)
Int OsalSemaphore_delete (OsalSemaphore_Handle *semHandle)
Int OsalSemaphore_pend (OsalSemaphore_Handle semHandle, UInt32 timeout)
Int OsalSemaphore_post (OsalSemaphore_Handle semHandle)

Macro Definition Documentation

#define OSALSEMAPHORE_MODULEID   (UInt16) 0xF6D6

Module ID for OsalSemaphore OSAL module.

#define OSALSEMAPHORE_STATUSCODEBASE   (OSALSEMAPHORE_MODULEID << 12u)

Stauts code base for MEMORY module.

#define OSALSEMAPHORE_MAKE_FAILURE (   x)
Value:
((Int) (0x80000000 \

Convert to failure code.

#define OSALSEMAPHORE_MAKE_SUCCESS (   x)    (OSALSEMAPHORE_STATUSCODEBASE + (x))

Convert to success code.

#define OSALSEMAPHORE_E_MEMORY   OSALSEMAPHORE_MAKE_FAILURE(1)

Indicates OsalSemaphore alloc/free failure.

#define OSALSEMAPHORE_E_INVALIDARG   OSALSEMAPHORE_MAKE_FAILURE(2)

Invalid argument provided.

#define OSALSEMAPHORE_E_FAIL   OSALSEMAPHORE_MAKE_FAILURE(3)

Generic failure.

#define OSALSEMAPHORE_E_TIMEOUT   OSALSEMAPHORE_MAKE_FAILURE(4)

A timeout occurred.

#define OSALSEMAPHORE_E_HANDLE   OSALSEMAPHORE_MAKE_FAILURE(5)

Invalid handle provided.

#define OSALSEMAPHORE_E_WAITNONE   OSALSEMAPHORE_MAKE_FAILURE(6)

WAIT_NONE timeout value was provided, but semaphore was not available.

#define OSALSEMAPHORE_E_RESOURCE   OSALSEMAPHORE_MAKE_FAILURE(7)

Resource error.

#define OSALSEMAPHORE_SUCCESS   OSALSEMAPHORE_MAKE_SUCCESS(0)

Operation successfully completed.

#define OSALSEMAPHORE_WAIT_FOREVER   (~((UInt32) 0u))

Indicates forever wait for APIs that can wait.

#define OSALSEMAPHORE_WAIT_NONE   ((UInt32) 0u)

Indicates zero wait for APIs that can wait.

#define OSALSEMAPHORE_TYPE_VALUE (   type)    (type & 0x0000FFFF)

Returns the value of semaphore type (binary/counting)

#define OSALSEMAPHORE_INTTYPE_VALUE (   type)    (type & 0xFFFF0000)

Returns the value of semaphore interruptability type.


Typedef Documentation

typedef struct OsalSemaphore_Object* OsalSemaphore_Handle

Declaration for the OsalSemaphore object handle. Definition of OsalSemaphore_Object is not exposed.


Enumeration Type Documentation

Enumerates the types of semaphores.

Enumerator:
OsalSemaphore_Type_Binary 

Binary semaphore

OsalSemaphore_Type_Counting 

Counting semaphore

OsalSemaphore_Type_EndValue 

End delimiter indicating start of invalid values for this enum

Enumerates the interruptible/non-interruptible types.

Enumerator:
OsalSemaphore_IntType_Interruptible 

Waits on this mutex are interruptible

OsalSemaphore_IntType_Noninterruptible 

Waits on this mutex are non-interruptible

OsalSemaphore_IntType_EndValue 

End delimiter indicating start of invalid values for this enum


Function Documentation

OsalSemaphore_Handle OsalSemaphore_create ( UInt32  semType)
Int OsalSemaphore_delete ( OsalSemaphore_Handle semHandle)
Int OsalSemaphore_pend ( OsalSemaphore_Handle  semHandle,
UInt32  timeout 
)
Int OsalSemaphore_post ( OsalSemaphore_Handle  semHandle)
Copyright 2014, Texas Instruments Incorporated