summaryrefslogtreecommitdiff
path: root/test/mutex.c
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/mutex.c
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/mutex.c')
-rw-r--r--test/mutex.c20
1 files changed, 10 insertions, 10 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;
}