File tree Expand file tree Collapse file tree 12 files changed +49
-3
lines changed Expand file tree Collapse file tree 12 files changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -1084,3 +1084,10 @@ config ARCH_CPU_IDLE_CUSTOM
10841084 help
10851085 This options allows applications to override the default arch idle implementation with
10861086 a custom one.
1087+
1088+ config ARCH_CPU_ATOMIC_IDLE_CUSTOM
1089+ bool "Custom arch_cpu_atomic_idle implementation"
1090+ default n
1091+ help
1092+ This options allows applications to override the default arch idle implementation with
1093+ a custom one.
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ SECTION_VAR(BSS, z_arc_cpu_sleep_mode)
2626 .align 4
2727 .word 0
2828
29+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
2930/*
3031 * @brief Put the CPU in low-power mode
3132 *
@@ -48,14 +49,17 @@ SECTION_FUNC(TEXT, arch_cpu_idle)
4849 sleep r1
4950 j_s [blink]
5051 nop
52+ #endif
5153
54+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
5255/*
5356 * @brief Put the CPU in low-power mode, entered with IRQs locked
5457 *
5558 * This function exits with interrupts restored to <key>.
5659 *
5760 * void arch_cpu_atomic_idle(unsigned int key)
5861 */
62+
5963SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
6064
6165#ifdef CONFIG_TRACING
@@ -70,3 +74,4 @@ SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
7074 sleep r1
7175 j_s.d [blink]
7276 seti r0
77+ #endif
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ _skip_\@:
4949#endif /* CONFIG_ARM_ON_ENTER_CPU_IDLE_HOOK */
5050.endm
5151
52+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
5253SECTION_FUNC(TEXT, arch_cpu_idle)
5354#ifdef CONFIG_TRACING
5455 push {r0, lr}
@@ -68,6 +69,9 @@ SECTION_FUNC(TEXT, arch_cpu_idle)
6869
6970 bx lr
7071
72+ #endif
73+
74+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
7175SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
7276#ifdef CONFIG_TRACING
7377 push {r0, lr}
@@ -93,3 +97,4 @@ SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
9397_irq_disabled:
9498
9599 bx lr
100+ #endif
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ void z_arm_cpu_idle_init(void)
5353} while (false)
5454#endif
5555
56+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
5657void arch_cpu_idle (void )
5758{
5859#if defined(CONFIG_TRACING )
@@ -96,7 +97,9 @@ void arch_cpu_idle(void)
9697 __enable_irq ();
9798 __ISB ();
9899}
100+ #endif
99101
102+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
100103void arch_cpu_atomic_idle (unsigned int key )
101104{
102105#if defined(CONFIG_TRACING )
@@ -135,3 +138,4 @@ void arch_cpu_atomic_idle(unsigned int key)
135138 __enable_irq ();
136139#endif
137140}
141+ #endif
Original file line number Diff line number Diff line change 1313#include <zephyr/arch/cpu.h>
1414
1515_ASM_FILE_PROLOGUE
16-
16+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
1717GTEXT(arch_cpu_idle)
1818SECTION_FUNC(TEXT, arch_cpu_idle)
1919#ifdef CONFIG_TRACING
@@ -25,7 +25,9 @@ SECTION_FUNC(TEXT, arch_cpu_idle)
2525 wfi
2626 msr daifclr, #(DAIFCLR_IRQ_BIT)
2727 ret
28+ #endif
2829
30+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
2931GTEXT(arch_cpu_atomic_idle)
3032SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
3133#ifdef CONFIG_TRACING
@@ -41,3 +43,5 @@ SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
4143 msr daifclr, #(DAIFCLR_IRQ_BIT)
4244_irq_disabled:
4345 ret
46+
47+ #endif
Original file line number Diff line number Diff line change @@ -19,12 +19,16 @@ static ALWAYS_INLINE void mips_idle(unsigned int key)
1919 __asm__ volatile ("wait" );
2020}
2121
22+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
2223void arch_cpu_idle (void )
2324{
2425 mips_idle (1 );
2526}
27+ #endif
2628
29+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
2730void arch_cpu_atomic_idle (unsigned int key )
2831{
2932 mips_idle (key );
3033}
34+ #endif
Original file line number Diff line number Diff line change 77#include <zephyr/kernel.h>
88#include <zephyr/kernel_structs.h>
99
10+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
1011void arch_cpu_idle (void )
1112{
1213 /* Do nothing but unconditionally unlock interrupts and return to the
1314 * caller. This CPU does not have any kind of power saving instruction.
1415 */
1516 irq_unlock (NIOS2_STATUS_PIE_MSK );
1617}
18+ #endif
1719
20+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
1821void arch_cpu_atomic_idle (unsigned int key )
1922{
2023 /* Do nothing but restore IRQ state. This CPU does not have any
2124 * kind of power saving instruction.
2225 */
2326 irq_unlock (key );
2427}
28+ #endif
Original file line number Diff line number Diff line change 77#include <zephyr/irq.h>
88#include <zephyr/tracing/tracing.h>
99
10- void __weak arch_cpu_idle (void )
10+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
11+ void arch_cpu_idle (void )
1112{
1213 sys_trace_idle ();
1314 __asm__ volatile ("wfi" );
1415 irq_unlock (MSTATUS_IEN );
1516}
17+ #endif
1618
17- void __weak arch_cpu_atomic_idle (unsigned int key )
19+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
20+ void arch_cpu_atomic_idle (unsigned int key )
1821{
1922 sys_trace_idle ();
2023 __asm__ volatile ("wfi" );
2124 irq_unlock (key );
2225}
26+ #endif
Original file line number Diff line number Diff line change 77#include <zephyr/tracing/tracing.h>
88#include <zephyr/arch/cpu.h>
99
10+ #ifndef CONFIG_ARCH_CPU_IDLE_CUSTOM
1011__pinned_func
1112void arch_cpu_idle (void )
1213{
@@ -15,7 +16,9 @@ void arch_cpu_idle(void)
1516 "sti\n\t"
1617 "hlt\n\t" );
1718}
19+ #endif
1820
21+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
1922__pinned_func
2023void arch_cpu_atomic_idle (unsigned int key )
2124{
@@ -42,3 +45,4 @@ void arch_cpu_atomic_idle(unsigned int key)
4245 __asm__ volatile ("cli" );
4346 }
4447}
48+ #endif
Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ void arch_cpu_idle(void)
1414}
1515#endif
1616
17+ #ifndef CONFIG_ARCH_CPU_ATOMIC_IDLE_CUSTOM
1718void arch_cpu_atomic_idle (unsigned int key )
1819{
1920 sys_trace_idle ();
2021 __asm__ volatile ("waiti 0\n\t"
2122 "wsr.ps %0\n\t"
2223 "rsync" :: "a" (key ));
2324}
25+ #endif
You can’t perform that action at this time.
0 commit comments