28 lines
486 B
C
28 lines
486 B
C
#include <kernel/compiler.h>
|
|
#include <kernel/machine/hwlock.h>
|
|
|
|
void ml_hwlock_lock(ml_hwlock_t *lck)
|
|
{
|
|
volatile int q = 0;
|
|
while (!__sync_bool_compare_and_swap(lck, 0, 1)) {
|
|
q++;
|
|
}
|
|
}
|
|
|
|
void ml_hwlock_unlock(ml_hwlock_t *lck)
|
|
{
|
|
__sync_lock_release(lck);
|
|
}
|
|
|
|
void ml_hwlock_lock_irqsave(ml_hwlock_t *lck, unsigned long *flags)
|
|
{
|
|
(void)flags;
|
|
ml_hwlock_lock(lck);
|
|
}
|
|
|
|
void ml_hwlock_unlock_irqrestore(ml_hwlock_t *lck, unsigned long flags)
|
|
{
|
|
(void)flags;
|
|
ml_hwlock_unlock(lck);
|
|
}
|