Gates: Create a BIOS-side HwSpinlock module
authorJuan Gutierrez <>
Sat, 23 Jul 2011 23:15:53 +0000 (18:15 -0500)
committerJuan Gutierrez <>
Tue, 20 Sep 2011 22:03:21 +0000 (17:03 -0500)
Gates: Create a BIOS-side HwSpinlock module

The HwSpinlock module provides hardware assistance for
synchronization among multiple processors. This module
provides the following main API:

1. HwSpinlock_Handle HwSpinlock_create(HwSpinlock_Params *params);
     Creates a handle for the HwSpinlock specified in the

2. Int HwSpinlock_delete(HwSpinlock_Handle handle);
     Frees the the HwSpinlock associated with handle.

3. Int HwSpinlock_enter(HwSpinlock_Handle handle,
                        HwSpinlock_PreemptGate pType,
                        UInt timeout, HwSpinlock_Key *key);
     Attempts to lock the HwSpinlock corresponding to the handle
     with a timeout limit specified in ticks (usually 1 ms). If
     the HwSpinlock is already taken, the function will busy loop
     waiting for it to be released, but bails out if the timeout
     elapses. If the HwSpinlock is successfully taken, preemption
     at Task, Hwi or Swi level could be disabled according to
     pType. A key is returned to unlock the HwSpinlock.
     pType could be:
       HwSpinlock_PreemptGate_NONE   = 0,  NO protection
       HwSpinlock_PreemptGate_HWI    = 1,  HWI protection level
       HwSpinlock_PreemptGate_SWI    = 2,  SWI protection level
       HwSpinlock_PreemotGate_TASK   = 3   TASK protection level

4. Void HwSpinlock_leave(HwSpinlock_Handle handle,
                         HwSpinlock_Key *key);
     Unlocks a previously locked HwSpinlock, and restores back the
     previously disabled preemption level. Key must be passed to
     successfully unlock.

5. Int HwSpinlock_getId(HwSpinlock_Handle handle);
     Returns the HwSpinlock Id.

6. HwSpinlock_State HwSpinlock_getState(HwSpinlock_Handle handle);
     Returns TRUE if the HwSpinlock is held by that particular
     handle. FALSE means that the HwSpinlock is FREE or it is
     taken by another processor.

Signed-off-by: Juan Gutierrez <>
Signed-off-by: Suman Anna <>
src/ti/gates/hwspinlock/HwSpinlock.c [new file with mode: 0644]
src/ti/gates/hwspinlock/HwSpinlock.h [new file with mode: 0644]
src/ti/gates/hwspinlock/_HwSpinlock.h [new file with mode: 0644]
src/ti/gates/hwspinlock/package.bld [new file with mode: 0644]
src/ti/gates/hwspinlock/package.xdc [new file with mode: 0644]
src/ti/gates/hwspinlock/package.xs [new file with mode: 0644]