1 /*
2  * Copyright (C) 2015-2021 Alibaba Group Holding Limited
3  */
4 
5 #include <stdio.h>
6 #include <time.h>
7 
8 #include <k_api.h>
9 #include <aos/errno.h>
10 #include <aos/kernel.h>
11 
12 #include "rhino_p.h"
13 
14 #if (RHINO_CONFIG_KOBJ_DYN_ALLOC == 0)
15 #warning "RHINO_CONFIG_KOBJ_DYN_ALLOC is disabled!"
16 #endif
17 
aos_spin_lock_init(aos_spinlock_t * spinlock)18 void aos_spin_lock_init(aos_spinlock_t *spinlock)
19 {
20     krhino_spin_lock_init((kspinlock_t *)spinlock);
21 }
22 
aos_spin_lock(aos_spinlock_t * spinlock)23 void aos_spin_lock(aos_spinlock_t *spinlock)
24 {
25     krhino_spin_lock((kspinlock_t *)spinlock);
26 }
27 
aos_spin_unlock(aos_spinlock_t * spinlock)28 void aos_spin_unlock(aos_spinlock_t *spinlock)
29 {
30     krhino_spin_unlock((kspinlock_t *)spinlock);
31 }
32 
aos_spin_lock_irqsave(aos_spinlock_t * spinlock)33 aos_irqsave_t aos_spin_lock_irqsave(aos_spinlock_t *spinlock)
34 {
35     aos_irqsave_t flag;
36     krhino_spin_lock_irq_save((kspinlock_t *)spinlock, flag);
37     return flag;
38 }
39 
aos_spin_unlock_irqrestore(aos_spinlock_t * spinlock,aos_irqsave_t flag)40 void aos_spin_unlock_irqrestore(aos_spinlock_t *spinlock, aos_irqsave_t flag)
41 {
42     krhino_spin_unlock_irq_restore((kspinlock_t *)spinlock, flag);
43 }
44