Skip to content

Commit 239d20a

Browse files
bjarki-andreasenfabiobaltieri
authored andcommitted
arch: arm: implement arch_zli_lock and arch_zli_unlock
Implement arch_zli_lock and arch_zli_unlock for the currently only supported target cortex-M. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 1bbbedc commit 239d20a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

include/zephyr/arch/arm/asm_inline_gcc.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,31 @@ static ALWAYS_INLINE bool arch_irq_unlocked(unsigned int key)
105105
return key == 0U;
106106
}
107107

108+
#ifdef CONFIG_ZERO_LATENCY_IRQS
109+
110+
static ALWAYS_INLINE unsigned int arch_zli_lock(void)
111+
{
112+
unsigned int key;
113+
114+
key = __get_PRIMASK();
115+
116+
/*
117+
* The cpsid instruction is self synchronizing within the instruction stream, no need for
118+
* an explicit __ISB().
119+
*/
120+
__disable_irq();
121+
122+
return key;
123+
}
124+
125+
static ALWAYS_INLINE void arch_zli_unlock(unsigned int key)
126+
{
127+
__set_PRIMASK(key);
128+
__ISB();
129+
}
130+
131+
#endif /* CONFIG_ZERO_LATENCY_IRQS */
132+
108133
#ifdef __cplusplus
109134
}
110135
#endif

0 commit comments

Comments
 (0)