The Spinlock driver provides API to program the Spinlock module to synchronize processes running on multiple processors in the device.
Features Supported
- 256 spinlocks
- Lock and unlock API
SysConfig Features
- Note
- It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
Features NOT Supported
NA
Important Usage Guidelines
- The Spinlock driver doesn't enforce below limitation as defined in device manual. It is the responsibility of the application to take care of below recommendations
- Spinlock is appropriate for mutual exclusion for access to a shared data structure. It should be used only when:
- The time to hold the lock is predictable and small (for example, a maximum hold time of less than 200 CPU cycles may be acceptable).
- The locking task cannot be preempted, suspended, or interrupted while holding the lock (this would make the hold time large and unpredictable).
- The lock is lightly contended, that is the chance of any other process (or processor) trying to acquire the lock while it is held is small.
Example Usage
Include the below file to access the APIs
Lock API
int32_t status;
while(1U)
{
{
break;
}
}
Unlock API
API
APIs for SPINLOCK