AM261x MCU+ SDK: APIs for Semaphore

| AM261x MCU+ SDK 26.00.00 |

Functions
APIs for Semaphore
APIs for Driver Porting Layer

## Introduction

For more details and example usage, see Semaphore

## Functions
int32_t | SemaphoreP_constructMutex (SemaphoreP_Object *obj)
| Create a mutex semaphore object. More...
int32_t | SemaphoreP_constructBinary (SemaphoreP_Object *obj, uint32_t initValue)
| Create a binary semaphore object. More...
int32_t | SemaphoreP_constructCounting (SemaphoreP_Object *obj, uint32_t initValue, uint32_t maxValue)
| Create a counting semaphore object. More...
void | SemaphoreP_destruct (SemaphoreP_Object *obj)
| Cleanup, delete, destruct a semaphore object. More...
void | SemaphoreP_post (SemaphoreP_Object *obj)
| Post a semaphore object or unlock a mutex. More...
int32_t | SemaphoreP_pend (SemaphoreP_Object *obj, uint32_t timeToWaitInTicks)
| Pend on a semaphore object or lock a mutex. More...
int32_t | SemaphoreP_getCount (SemaphoreP_Object *obj)
| Function to return the count of a semaphore. More...

## Function Documentation

## ◆ SemaphoreP_constructMutex()

int32_t SemaphoreP_constructMutex | ( | SemaphoreP_Object * | obj | ) |

Create a mutex semaphore object.

Parameters

  obj | [out] created object

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE on error

## ◆ SemaphoreP_constructBinary()

int32_t SemaphoreP_constructBinary | ( | SemaphoreP_Object * | obj,
|  | uint32_t | initValue
| ) |  |

Create a binary semaphore object.

Parameters

  obj | [out] created object
  initValue | [in] Initial value of the binary semaphore, MUST be 0 or 1

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE on error

## ◆ SemaphoreP_constructCounting()

int32_t SemaphoreP_constructCounting | ( | SemaphoreP_Object * | obj,
|  | uint32_t | initValue,
|  | uint32_t | maxValue
| ) |  |

Create a counting semaphore object.

Parameters

  obj | [out] created object
  initValue | [in] Initial value of the counting semaphore, MUST be between 0 .. maxValue
  maxValue | [in] Maximum value of counting semaphore

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE on error

## ◆ SemaphoreP_destruct()

void SemaphoreP_destruct | ( | SemaphoreP_Object * | obj | ) |

Cleanup, delete, destruct a semaphore object.

Parameters

  obj | [in] semaphore object

## ◆ SemaphoreP_post()

void SemaphoreP_post | ( | SemaphoreP_Object * | obj | ) |

Post a semaphore object or unlock a mutex.

Parameters

  obj | [in] semaphore object

## ◆ SemaphoreP_pend()

int32_t SemaphoreP_pend | ( | SemaphoreP_Object * | obj,
|  | uint32_t | timeToWaitInTicks
| ) |  |

Pend on a semaphore object or lock a mutex.

Parameters

  obj | [in] semaphore object
  timeToWaitInTicks | [in] amount of time to block waiting for semaphore to be available, in units of system ticks (see Clock)

Returns
  SystemP_SUCCESS on successful acquire of the semaphore
  SystemP_TIMEOUT on failure to acquire the semaphore due to timeout condition
  SystemP_FAILURE on failure to acquire the semaphore due to other conditions

## ◆ SemaphoreP_getCount()

int32_t SemaphoreP_getCount | ( | SemaphoreP_Object * | obj | ) |

Function to return the count of a semaphore.

Parameters

  obj | A SemaphoreP_Handle

Returns
  The count of the semaphore