From 135f14bf498ab19b6e75efc3a0d18ef7c8a8752d Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 24 Apr 2012 16:29:28 -0700 Subject: Refactor async console output This adds a 'ch' command which prints/sets which channels are active This handles all the async output; the remaining debug commands will be refactored to use ccprintf() / ccputs() in a followup CL. Signed-off-by: Randall Spangler BUG=chrome-os-partner:7464 TEST=manual ch --> all channels active ch 0x100 -> just port80 active powerbtn -> system boots; only port 80 codes shown on console Change-Id: I9efc43acec919b62b78c2c82c61946d32380adfe --- core/cortex-m/task.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'core') diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index b22a336dde..5a9f3d7c84 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -12,7 +12,6 @@ #include "link_defs.h" #include "task.h" #include "timer.h" -#include "uart.h" #include "util.h" /** @@ -68,6 +67,11 @@ extern int __task_start(int *need_resched); /* Idle task. Executed when no tasks are ready to be scheduled. */ void __idle(void) { + /* Print when the idle task starts. This is the lowest priority task, + * so this only starts once all other tasks have gotten a chance to do + * their task inits and have gone to sleep. */ + cprintf(CC_TASK, "[%T idle task started]\n"); + while (1) { /* Wait for the irq event */ asm("wfi"); @@ -79,7 +83,7 @@ void __idle(void) static void task_exit_trap(void) { int i = task_get_current(); - uart_printf("[Task %d (%s) exited!]\n", i, task_names[i]); + cprintf(CC_TASK, "[%T Task %d (%s) exited!]\n", i, task_names[i]); /* Exited tasks simply sleep forever */ while (1) task_wait_event(-1); @@ -473,26 +477,26 @@ int command_task_info(int argc, char **argv) int i; #ifdef CONFIG_TASK_PROFILING - uart_printf("Task switching started: %10ld us\n", task_start_time); - uart_printf("Time in tasks: %10ld us\n", + ccprintf("Task switching started: %10ld us\n", task_start_time); + ccprintf("Time in tasks: %10ld us\n", get_time().val - task_start_time); - uart_printf("Time in exceptions: %10ld us\n", exc_total_time); - uart_flush_output(); - uart_printf("Service calls: %10d\n", svc_calls); - uart_puts("IRQ counts by type:\n"); + ccprintf("Time in exceptions: %10ld us\n", exc_total_time); + cflush(); + ccprintf("Service calls: %10d\n", svc_calls); + ccputs("IRQ counts by type:\n"); for (i = 0; i < ARRAY_SIZE(irq_dist); i++) { if (irq_dist[i]) - uart_printf("%4d %8d\n", i, irq_dist[i]); + ccprintf("%4d %8d\n", i, irq_dist[i]); } #endif - uart_puts("Task Ready Name Events Time (us)\n"); + ccputs("Task Ready Name Events Time (us)\n"); for (i = 0; i < TASK_ID_COUNT; i++) { char is_ready = (tasks_ready & (1<