diff options
author | Vic Yang <victoryang@chromium.org> | 2013-04-14 20:49:30 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-15 20:40:03 -0700 |
commit | 0ffc382af92e400174649451b65e175a455ce6a0 (patch) | |
tree | 2c671a22256f05a631d5e3a2243405a72e88c97f /test | |
parent | 12df5c4923632262573e7cf63d977cf881016206 (diff) | |
download | chrome-ec-0ffc382af92e400174649451b65e175a455ce6a0.tar.gz |
Put timer_dos test behind console commandstabilize-4008.0.B
BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None
Change-Id: I843591089c3d1bc739c452ee654da194355ddb09
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48092
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/timer_dos.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/test/timer_dos.c b/test/timer_dos.c index 63ad7dd657..5ac7cad5df 100644 --- a/test/timer_dos.c +++ b/test/timer_dos.c @@ -6,9 +6,10 @@ */ #include "common.h" -#include "uart.h" +#include "console.h" #include "task.h" #include "timer.h" +#include "util.h" /* Linear congruential pseudo random number generator*/ static uint32_t prng(uint32_t x) @@ -19,20 +20,39 @@ static uint32_t prng(uint32_t x) /* period between 500us and 128ms */ #define PERIOD_US(num) (((num % 256) + 1) * 500) +#define TEST_TIME (3 * SECOND) + int TaskTimer(void *seed) { uint32_t num = (uint32_t)seed; task_id_t id = task_get_current(); - - uart_printf("\n[Timer task %d]\n", id); + timestamp_t start; while (1) { - /* Wait for a "random" period */ - task_wait_event(PERIOD_US(num)); - uart_printf("%01d\n", id); - /* next pseudo random delay */ - num = prng(num); + task_wait_event(-1); + + ccprintf("\n[Timer task %d]\n", id); + start = get_time(); + + while (get_time().val - start.val < TEST_TIME) { + /* Wait for a "random" period */ + task_wait_event(PERIOD_US(num)); + ccprintf("%01d\n", id); + /* next pseudo random delay */ + num = prng(num); + } } return EC_SUCCESS; } + +static int command_run_test(int argc, char **argv) +{ + task_wake(TASK_ID_TMRD); + task_wake(TASK_ID_TMRC); + task_wake(TASK_ID_TMRB); + task_wake(TASK_ID_TMRA); + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(runtest, command_run_test, + NULL, NULL, NULL); |