summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-04-05 15:34:01 -0700
committerRandall Spangler <rspangler@chromium.org>2012-04-06 09:06:53 -0700
commita61d8db3d3d7cb145abb3a3580c9a9cfe2d044d7 (patch)
tree6ff786efde031e483645c0900388ca53d51b5255 /test
parent0eb94470511959c09e5cb0f55eda0478dd5c7b04 (diff)
downloadchrome-ec-a61d8db3d3d7cb145abb3a3580c9a9cfe2d044d7.tar.gz
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
Diffstat (limited to 'test')
-rw-r--r--test/mutex.c20
-rw-r--r--test/pingpong.c5
-rw-r--r--test/powerdemo.c4
-rw-r--r--test/timer_calib.c7
-rw-r--r--test/timer_dos.c5
5 files changed, 19 insertions, 22 deletions
diff --git a/test/mutex.c b/test/mutex.c
index a5b7244e36..9fc1cd76b7 100644
--- a/test/mutex.c
+++ b/test/mutex.c
@@ -30,16 +30,16 @@ int mutex_random_task(void *unused)
/* wait to be activated */
while (1) {
- task_wait_msg(0);
+ task_wait_event(0);
uart_printf("%c+\n", letter);
mutex_lock(&mtx);
uart_printf("%c=\n", letter);
- task_wait_msg(0);
+ task_wait_event(0);
uart_printf("%c-\n", letter);
mutex_unlock(&mtx);
}
- task_wait_msg(0);
+ task_wait_event(0);
return EC_SUCCESS;
}
@@ -50,15 +50,15 @@ int mutex_second_task(void *unused)
uart_printf("\n[Mutex second task %d]\n", id);
- task_wait_msg(0);
+ task_wait_event(0);
uart_printf("MTX2: locking...");
mutex_lock(&mtx);
uart_printf("done\n");
- task_send_msg(TASK_ID_MTX1, 1, 0);
+ task_wake(TASK_ID_MTX1);
uart_printf("MTX2: unlocking...\n");
mutex_unlock(&mtx);
- task_wait_msg(0);
+ task_wait_event(0);
return EC_SUCCESS;
}
@@ -85,7 +85,7 @@ int mutex_main_task(void *unused)
/* --- Serialization to test simple contention --- */
uart_printf("Simple contention :\n");
/* lock the mutex from the other task */
- task_send_msg(TASK_ID_MTX2, 1, 1);
+ task_set_event(TASK_ID_MTX2, TASK_EVENT_WAKE, 1);
/* block on the mutex */
uart_printf("MTX1: blocking...\n");
mutex_lock(&mtx);
@@ -96,17 +96,17 @@ int mutex_main_task(void *unused)
uart_printf("Massive locking/unlocking :\n");
for (i = 0; i < 500; i++) {
/* Wake up a random task */
- task_send_msg(RANDOM_TASK(rtask), 1, 0);
+ task_wake(RANDOM_TASK(rtask));
/* next pseudo random delay */
rtask = prng(rtask);
/* Wait for a "random" period */
- task_wait_msg(PERIOD_US(rdelay));
+ task_wait_event(PERIOD_US(rdelay));
/* next pseudo random delay */
rdelay = prng(rdelay);
}
uart_printf("Test done.\n");
- task_wait_msg(0);
+ task_wait_event(0);
return EC_SUCCESS;
}
diff --git a/test/pingpong.c b/test/pingpong.c
index 18115060d3..e6571080c5 100644
--- a/test/pingpong.c
+++ b/test/pingpong.c
@@ -1,7 +1,6 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* 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.
- * Copyright 2011 Google Inc.
*
* Tasks for scheduling test.
*/
@@ -24,7 +23,7 @@ int TaskAbc(void *data)
while (1) {
uart_puts(string);
uart_flush_output();
- task_send_msg(next, TASK_ID_CURRENT, 1);
+ task_set_event(next, TASK_EVENT_WAKE, 1);
}
return EC_SUCCESS;
diff --git a/test/powerdemo.c b/test/powerdemo.c
index c809c1eac5..aabe4c8825 100644
--- a/test/powerdemo.c
+++ b/test/powerdemo.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* 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.
*/
@@ -180,7 +180,7 @@ int power_demo_task(void)
power_demo_init();
/* suspend this task forever */
- task_wait_msg(-1);
+ task_wait_event(-1);
return EC_SUCCESS;
}
diff --git a/test/timer_calib.c b/test/timer_calib.c
index 1169491c86..86da6479ff 100644
--- a/test/timer_calib.c
+++ b/test/timer_calib.c
@@ -1,7 +1,6 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* 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.
- * Copyright 2011 Google Inc.
*
* Tasks for scheduling test.
*/
@@ -35,7 +34,7 @@ int timer_calib_task(void *data)
usleep(1000000);
t1 = get_time();
uart_printf("done. delay = %d us\n", difftime(t0, t1));
-
+
/* try small usleep */
uart_printf("- short sleep :\n");
uart_flush_output();
@@ -49,7 +48,7 @@ int timer_calib_task(void *data)
uart_printf("Done.\n");
/* sleep forever */
- task_wait_msg(-1);
+ task_wait_event(-1);
return EC_SUCCESS;
}
diff --git a/test/timer_dos.c b/test/timer_dos.c
index b0c37a4eaf..63ad7dd657 100644
--- a/test/timer_dos.c
+++ b/test/timer_dos.c
@@ -1,7 +1,6 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* 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.
- * Copyright 2011 Google Inc.
*
* Tasks for timer test.
*/
@@ -29,7 +28,7 @@ int TaskTimer(void *seed)
while (1) {
/* Wait for a "random" period */
- task_wait_msg(PERIOD_US(num));
+ task_wait_event(PERIOD_US(num));
uart_printf("%01d\n", id);
/* next pseudo random delay */
num = prng(num);