|
@ -42,15 +42,29 @@ void spinLockIsrInit (spinlockIsr_t * lock, int flags) |
|
|
|
|
|
|
|
|
void spinLockIsrGive (spinlockIsr_t * lock) |
|
|
void spinLockIsrGive (spinlockIsr_t * lock) |
|
|
{ |
|
|
{ |
|
|
|
|
|
INTREG *key; |
|
|
|
|
|
|
|
|
if (lock) { |
|
|
if (lock) { |
|
|
API_SpinUnlock(&lock->lock); |
|
|
key = (INTREG *)&(lock->lock.SL_pvReserved); |
|
|
|
|
|
#if SPIN_LOCK_USE_QUICK_LOCK > 0 |
|
|
|
|
|
API_SpinUnlockQuick(&lock->lock, *key); |
|
|
|
|
|
#else |
|
|
|
|
|
API_SpinUnlockIrq(&lock->lock, *key); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void spinLockIsrTake (spinlockIsr_t * lock) |
|
|
void spinLockIsrTake (spinlockIsr_t * lock) |
|
|
{ |
|
|
{ |
|
|
|
|
|
INTREG *key; |
|
|
|
|
|
|
|
|
if (lock) { |
|
|
if (lock) { |
|
|
API_SpinLock(&lock->lock); |
|
|
key = (INTREG *)&(lock->lock.SL_pvReserved); |
|
|
|
|
|
#if SPIN_LOCK_USE_QUICK_LOCK > 0 |
|
|
|
|
|
API_SpinLockQuick(&lock->lock, key); |
|
|
|
|
|
#else |
|
|
|
|
|
API_SpinLockIrq(&lock->lock, key); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -94,7 +108,11 @@ INTREG spinLockIsrNdTake (spinlockIsrNd_t * spin) |
|
|
INTREG key = -1; |
|
|
INTREG key = -1; |
|
|
|
|
|
|
|
|
if (spin) { |
|
|
if (spin) { |
|
|
|
|
|
#if SPIN_LOCK_ND_USE_QUICK_LOCK > 0 |
|
|
API_SpinLockQuick(&spin->lock, &key); |
|
|
API_SpinLockQuick(&spin->lock, &key); |
|
|
|
|
|
#else |
|
|
|
|
|
API_SpinLockIrq(&spin->lock, &key); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return (key); |
|
|
return (key); |
|
@ -103,7 +121,11 @@ INTREG spinLockIsrNdTake (spinlockIsrNd_t * spin) |
|
|
void spinLockIsrNdGive (spinlockIsrNd_t * spin, INTREG key) |
|
|
void spinLockIsrNdGive (spinlockIsrNd_t * spin, INTREG key) |
|
|
{ |
|
|
{ |
|
|
if (spin) { |
|
|
if (spin) { |
|
|
|
|
|
#if SPIN_LOCK_ND_USE_QUICK_LOCK > 0 |
|
|
API_SpinUnlockQuick(&spin->lock, key); |
|
|
API_SpinUnlockQuick(&spin->lock, key); |
|
|
|
|
|
#else |
|
|
|
|
|
API_SpinUnlockIrq(&spin->lock, key); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|