Skip to content

Commit 1c5a0bf

Browse files
hujun260xiaoxiang781216
authored andcommitted
irq: add [enter|leave]_critical_section_nonirq
Configuring NuttX and compile: $ ./tools/configure.sh -l qemu-armv8a:nsh_smp $ make Running with qemu $ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \ -machine virt,virtualization=on,gic-version=3 \ -net none -chardev stdio,id=con,mux=on -serial chardev:con \ -mon chardev=con,mode=readline -kernel ./nuttx reason: In some non-irq scenarios, we can simplify the implementation of critical sections to improve performance. Signed-off-by: hujun5 <[email protected]>
1 parent 5c90cd2 commit 1c5a0bf

File tree

8 files changed

+209
-152
lines changed

8 files changed

+209
-152
lines changed

include/nuttx/irq.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,10 @@ int irqchain_detach(int irq, xcpt_t isr, FAR void *arg);
258258
****************************************************************************/
259259

260260
#ifdef CONFIG_IRQCOUNT
261+
irqstate_t enter_critical_section_nonirq(void) noinstrument_function;
261262
irqstate_t enter_critical_section(void) noinstrument_function;
262263
#else
264+
# define enter_critical_section_nonirq() up_irq_save()
263265
# define enter_critical_section() up_irq_save()
264266
#endif
265267

@@ -288,8 +290,10 @@ irqstate_t enter_critical_section(void) noinstrument_function;
288290
****************************************************************************/
289291

290292
#ifdef CONFIG_IRQCOUNT
293+
void leave_critical_section_nonirq(irqstate_t flags) noinstrument_function;
291294
void leave_critical_section(irqstate_t flags) noinstrument_function;
292295
#else
296+
# define leave_critical_section_nonirq(f) up_irq_restore(f)
293297
# define leave_critical_section(f) up_irq_restore(f)
294298
#endif
295299

0 commit comments

Comments
 (0)