summaryrefslogtreecommitdiff
path: root/core/cortex-m/task.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-04-06 09:33:41 -0700
committerRandall Spangler <rspangler@chromium.org>2012-04-09 10:33:35 -0700
commite9328ac4f63351b4282916034270aa86b7e74922 (patch)
treed0fde5840594c33709927a5a4d1fabfe0f858c26 /core/cortex-m/task.c
parent1a9a415cf68c6e8e3b31972c072c81ed886290ab (diff)
downloadchrome-ec-e9328ac4f63351b4282916034270aa86b7e74922.tar.gz
Support dynamically changing the system clock
Add nopll command to turn off the PLL, reducing the system clock to 16Mhz. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8798 TEST=manual boot system press power button to boot x86 temps // should print all temperatures timerinfo timerinfo timerinfo // convince yourself this is counting up at about 1MHz nopll // this drops the system clock to 16MHz temps // should still print all temperatures timerinfo timerinfo timerinfo // should still be counting up at about 1MHz Change-Id: Ie29ceb17af348148bffadf63d60c1b731f4c3f6d
Diffstat (limited to 'core/cortex-m/task.c')
-rw-r--r--core/cortex-m/task.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 1f15bf5df6..34c12d674c 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -35,7 +35,7 @@ typedef union {
/* declare task routine prototypes */
#define TASK(n, r, d) int r(void *);
#include TASK_LIST
-void __idle(void);
+static void __idle(void);
CONFIG_TASK_LIST
#undef TASK
@@ -51,6 +51,17 @@ static const char * const task_names[] = {
extern void __switchto(task_ *from, task_ *to);
+/* Idle task. Executed when no tasks are ready to be scheduled. */
+void __idle(void)
+{
+ while (1) {
+ /* Wait for the irq event */
+ asm("wfi");
+ /* TODO: more power management here */
+ }
+}
+
+
static void task_exit_trap(void)
{
int i = task_get_current();