kernel: add k_cpu_idle/k_cpu_atomic_idle()

nano_cpu_idle/nano_cpu_atomic_idle were not ported to the unified
kernel, and only the old APIs were available. There was no real impact
since, in the unified kernel, only the idle thread should really be
doing power management. However, with a single-threaded kernel, these
functions can be useful again.

The kernel internals now make use of these APIs instead of the legacy
ones.

Change-Id: Ie8a6396ba378d3ddda27b8dd32fa4711bf53eb36
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-12-14 13:04:36 -05:00 committed by Benjamin Walsh
commit c3a2bbba16
21 changed files with 247 additions and 48 deletions

View file

@ -37,8 +37,8 @@ GTEXT(_CpuIdleInit)
GTEXT(_NanoIdleValGet)
GTEXT(_NanoIdleValClear)
#endif
GTEXT(nano_cpu_idle)
GTEXT(nano_cpu_atomic_idle)
GTEXT(k_cpu_idle)
GTEXT(k_cpu_atomic_idle)
#define _SCR_INIT_BITS _SCB_SCR_SEVONPEND
@ -116,10 +116,10 @@ SECTION_FUNC(TEXT, _NanoIdleValClear)
*
* C function prototype:
*
* void nano_cpu_idle (void);
* void k_cpu_idle (void);
*/
SECTION_FUNC(TEXT, nano_cpu_idle)
SECTION_FUNC(TEXT, k_cpu_idle)
#ifdef CONFIG_KERNEL_EVENT_LOGGER_SLEEP
push {lr}
bl _sys_k_event_logger_enter_sleep
@ -148,7 +148,7 @@ SECTION_FUNC(TEXT, nano_cpu_idle)
* nano_task_stack_pop(), and nano_task_fifo_get().
*
* INTERNAL
* The requirements for nano_cpu_atomic_idle() are as follows:
* The requirements for k_cpu_atomic_idle() are as follows:
* 1) The enablement of interrupts and entering a low-power mode needs to be
* atomic, i.e. there should be no period of time where interrupts are
* enabled before the processor enters a low-power mode. See the comments
@ -162,10 +162,10 @@ SECTION_FUNC(TEXT, nano_cpu_idle)
*
* C function prototype:
*
* void nano_cpu_atomic_idle (unsigned int imask);
* void k_cpu_atomic_idle (unsigned int imask);
*/
SECTION_FUNC(TEXT, nano_cpu_atomic_idle)
SECTION_FUNC(TEXT, k_cpu_atomic_idle)
#ifdef CONFIG_KERNEL_EVENT_LOGGER_SLEEP
push {lr}
bl _sys_k_event_logger_enter_sleep