AM263Px MCU+ SDK: APIs for SPINLOCK

| AM263Px MCU+ SDK 26.00.00 |

Files | Functions | Macros
APIs for SPINLOCK
APIs for SOC Specific Device Drivers

## Introduction

This module contains APIs to program and use the SPINLOCK module.

## Files
file | spinlock/v0/spinlock.h
| SPINLOCK Driver API/interface file.

## Functions
uint32_t | Spinlock_getNumLocks (uint32_t baseAddr)
| This API provides returns the number of locks supported. More...
int32_t | Spinlock_lock (uint32_t baseAddr, uint32_t lockNumber)
| This API performs the Read operation for Lock status of the SPINLOCK_LOCK_REG, in order to acquire a Spinlock. More...
void | Spinlock_unlock (uint32_t baseAddr, uint32_t lockNumber)
| This API performs the write operation for Lock status of the SPINLOCK_LOCK_REG, in order to Free the lock If lockNumber is invalid (out of range), no operation is performed Lock state : Write 0x0: Set the lock to Not Taken(Free) Write 0x1: No update to the lock value. More...

## Macros
#define | SPINLOCK_LOCK_STATUS_FREE (0U)
| Flag to indicate spinlock is free. More...
#define | SPINLOCK_LOCK_STATUS_INUSE (1U)
| Flag to indicate spinlock is in use. More...

## Macro Definition Documentation

## ◆ SPINLOCK_LOCK_STATUS_FREE

#define SPINLOCK_LOCK_STATUS_FREE (0U)

Flag to indicate spinlock is free.

## ◆ SPINLOCK_LOCK_STATUS_INUSE

#define SPINLOCK_LOCK_STATUS_INUSE (1U)

Flag to indicate spinlock is in use.

## Function Documentation

## ◆ Spinlock_getNumLocks()

uint32_t Spinlock_getNumLocks | ( | uint32_t | baseAddr | ) |

This API provides returns the number of locks supported.

Parameters

  baseAddr | Memory address of SPINLOCK module

Returns
  Number of locks in an instance

## ◆ Spinlock_lock()

int32_t Spinlock_lock | ( | uint32_t | baseAddr,
|  | uint32_t | lockNumber
| ) |  |

This API performs the Read operation for Lock status of the SPINLOCK_LOCK_REG, in order to acquire a Spinlock.

Parameters

  baseAddr | Memory address of SPINLOCK module
  lockNumber | Lock number in Spinlock module that should be acquired

Returns
  Status of the Lock Register Lock state : SPINLOCK_LOCK_STATUS_FREE: Lock was previously NOT Taken (Free). The requester is granted the lock SPINLOCK_LOCK_STATUS_INUSE: Lock was previously Taken (Not Free). The requester is not granted the lock and must retry SystemP_FAILURE: lockNumber is invalid (out of range)

## ◆ Spinlock_unlock()

void Spinlock_unlock | ( | uint32_t | baseAddr,
|  | uint32_t | lockNumber
| ) |  |

This API performs the write operation for Lock status of the SPINLOCK_LOCK_REG, in order to Free the lock If lockNumber is invalid (out of range), no operation is performed Lock state : Write 0x0: Set the lock to Not Taken(Free) Write 0x1: No update to the lock value.

Parameters

  baseAddr | Memory address of SPINLOCK module
  lockNumber | Lock number in Spinlock module that should be released