Files
OpenCellular/test/pingpong.c
Randall Spangler a61d8db3d3 Change task messages to events
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7461
TEST=manual

make BOARD={bds,link,daisy}
make tests
flash link system and make sure it boots

Change-Id: I1241a1895c083e387e38ddab01ac346ca4474eb9
2012-04-06 09:06:53 -07:00

43 lines
869 B
C

/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Tasks for scheduling test.
*/
#include "common.h"
#include "uart.h"
#include "task.h"
#include "timer.h"
int TaskAbc(void *data)
{
char letter = (char)(unsigned)data;
char string[2] = {letter, '\0' };
task_id_t next = task_get_current() + 1;
if (next > TASK_ID_TESTC)
next = TASK_ID_TESTA;
uart_printf("\n[starting Task %c]\n", letter);
while (1) {
uart_puts(string);
uart_flush_output();
task_set_event(next, TASK_EVENT_WAKE, 1);
}
return EC_SUCCESS;
}
int TaskTick(void *data)
{
uart_set_console_mode(1);
uart_printf("\n[starting Task T]\n");
/* Print T every tick */
while (1) {
/* Wait for timer interrupt message */
usleep(3000);
uart_puts("T\n");
}
}