summaryrefslogtreecommitdiff
path: root/cros_ec/test/ec_os_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'cros_ec/test/ec_os_test.c')
-rw-r--r--cros_ec/test/ec_os_test.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/cros_ec/test/ec_os_test.c b/cros_ec/test/ec_os_test.c
index f34ccec4d3..6eda412b04 100644
--- a/cros_ec/test/ec_os_test.c
+++ b/cros_ec/test/ec_os_test.c
@@ -5,10 +5,8 @@
/* Basic test for EcOs objects */
-#include <stdio.h>
-#include <stdint.h>
-
#include "ec_os.h"
+#include "ec_uart.h"
EcTask t1, t2, t3, t4;
EcSemaphore sem;
@@ -24,7 +22,7 @@ void Thread1(void* arg) {
EcSemaphoreWait(&sem, EC_OS_FOREVER);
/* Do some work */
EcTaskSleep(5000);
- fprintf(stderr, "Hello from thread1: %s\n", (char*)arg);
+ EcUartPrintf("Hello from thread1: %s\n", (char*)arg);
EcSemaphorePost(&sem);
/* Two rapid posts to SWI, to see that they merge */
@@ -35,7 +33,7 @@ void Thread1(void* arg) {
}
EcTaskSleep(500000);
- fprintf(stderr, "Goodbye from thread1\n");
+ EcUartPrintf("Goodbye from thread1\n");
}
@@ -46,7 +44,7 @@ void Thread2(void* arg) {
EcSemaphoreWait(&sem, EC_OS_FOREVER);
/* Do some work */
EcTaskSleep(5000);
- fprintf(stderr, "Hello from thread2: %s\n", (char*)arg);
+ EcUartPrintf("Hello from thread2: %s\n", (char*)arg);
EcSemaphorePost(&sem);
/* Post events */
@@ -57,7 +55,7 @@ void Thread2(void* arg) {
}
EcTaskSleep(50000);
- fprintf(stderr, "Goodbye from thread2\n");
+ EcUartPrintf("Goodbye from thread2\n");
}
@@ -68,43 +66,44 @@ void Thread3(void* arg) {
/* Wait for any of the bits to be set */
EcEventWaitAny(&ev1, 0x1c, &got_bits, EC_OS_FOREVER);
- fprintf(stderr, "Event thread 3 got bits: 0x%x\n", got_bits);
+ EcUartPrintf("Event thread 3 got bits: 0x%x\n", got_bits);
}
- fprintf(stderr, "Goodbye from event thread 3\n");
+ EcUartPrintf("Goodbye from event thread 3\n");
}
void Thread4(void* arg) {
/* Wait on event bit from creation and a few posted bits. */
EcEventWaitAll(&ev2, 0x10e, EC_OS_FOREVER);
- fprintf(stderr, "Event thread 4 got all bits\n");
- fprintf(stderr, "Goodbye from event thread 4\n");
+ EcUartPrintf("Event thread 4 got all bits\n");
+ EcUartPrintf("Goodbye from event thread 4\n");
}
void SwiFunc(void* arg, uint32_t bits) {
- fprintf(stderr, "Hello from SWI with bits=0x%x\n", bits);
+ EcUartPrintf("Hello from SWI with bits=0x%x\n", bits);
}
void TimerFunc(void* arg) {
- fprintf(stderr, "Hello from timer: %s\n", (char*)arg);
+ EcUartPrintf("Hello from timer: %s\n", (char*)arg);
/* Start the one-shot timer. */
EcTimerStart(&timer2);
}
void OneTimerFunc(void* arg) {
- fprintf(stderr, "Hello from one-shot timer: %s\n", (char*)arg);
+ EcUartPrintf("Hello from one-shot timer: %s\n", (char*)arg);
/* Stop the periodic timer */
EcTimerStop(&timer1);
}
int main(void) {
- fprintf(stderr, "Hello, world.\n");
-
EcOsInit();
+ EcUartInit();
+
+ EcUartPrintf("Hello, world.\n");
EcTaskCreate(&t1, EC_TASK_PRIORITY_DEFAULT, 0, Thread1, "Foo1");
EcTaskCreate(&t2, EC_TASK_PRIORITY_DEFAULT, 0, Thread2, "Foo2");
@@ -121,7 +120,7 @@ int main(void) {
EcEventCreate(&ev1, 0);
EcEventCreate(&ev2, 0x100);
- fprintf(stderr, "EcOs objects created.\n");
+ EcUartPrintf("EcOs objects created.\n");
EcOsStart();