Browse Source

Fixed spin lock implement with new SylixOS version.

master
Hanhui 6 years ago
parent
commit
ad7cf8da13
  1. 13
      target/src/spinLockLib.c

13
target/src/spinLockLib.c

@ -11,6 +11,7 @@
*/
#define __SYLIXOS_KERNEL
#include <pthread.h>
#include "spinLockLib.h"
#include "spinlockIsrNdLib.h"
@ -42,16 +43,14 @@ void spinLockIsrInit (spinlockIsr_t * lock, int flags)
void spinLockIsrGive (spinlockIsr_t * lock)
{
if (lock) {
API_SpinUnlockIgnIrq(&lock->lock);
KN_INT_ENABLE_FORCE();
API_SpinUnlock(&lock->lock);
}
}
void spinLockIsrTake (spinlockIsr_t * lock)
{
if (lock) {
KN_INT_DISABLE();
API_SpinLockIgnIrq(&lock->lock);
API_SpinLock(&lock->lock);
}
}
@ -61,7 +60,7 @@ void spinLockIsrTake (spinlockIsr_t * lock)
void spinLockTaskInit (spinlockTask_t * lock, int flags)
{
if (lock) {
API_SpinInit(&lock->lock);
pthread_spin_init(&lock->lock, 1);
lock->flags = flags;
}
}
@ -69,14 +68,14 @@ void spinLockTaskInit (spinlockTask_t * lock, int flags)
void spinLockTaskGive (spinlockTask_t * lock)
{
if (lock) {
API_SpinUnlock(&lock->lock);
pthread_spin_unlock(&lock->lock);
}
}
void spinLockTaskTake (spinlockTask_t * lock)
{
if (lock) {
API_SpinLock(&lock->lock);
pthread_spin_lock(&lock->lock);
}
}

Loading…
Cancel
Save