VSF Documented
ll.h
Go to the documentation of this file.
1
11#ifndef LL_H_
12#define LL_H_
13
14#include "hal/arch/vsf_arch.h"
15
20#define GLOBAL_INT_START() vsf_enable_interrupt()
21
26#define GLOBAL_INT_STOP() vsf_disable_interrupt()
27
28
35#define GLOBAL_INT_DISABLE() \
36do { \
37 vsf_arch_prio_t __vsf_orig_int_state = vsf_disable_interrupt(); \
38
39
44#define GLOBAL_INT_RESTORE() \
45 vsf_set_interrupt(__vsf_orig_int_state); \
46} while(0)
47
54#define WFI() \
55do { \
56 GLOBAL_INT_DISABLE(); \
57 __WFI(); \
58 GLOBAL_INT_RESTORE(); \
59} while (0)
60
61__STATIC_FORCEINLINE uint32_t global_irq_lock(void)
62{
63 uint32_t pmask = __get_PRIMASK();
64 if ((pmask & 0x1) == 0) {
65 __disable_irq();
66 }
67 return pmask;
68}
69
70__STATIC_FORCEINLINE void global_irq_unlock(uint32_t pmask)
71{
72 if ((pmask & 0x1) == 0) {
73 __enable_irq();
74 }
75}
76
84void critical_section_start(void);
85
92void critical_section_end(void);
93
94
95#endif // LL_H_
__STATIC_FORCEINLINE void global_irq_unlock(uint32_t pmask)
Definition ll.h:70
void critical_section_end(void)
Definition ll.c:26
void critical_section_start(void)
Definition ll.c:18
__STATIC_FORCEINLINE uint32_t global_irq_lock(void)
Definition ll.h:61
unsigned uint32_t
Definition stdint.h:9