diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-06-07 14:34:59 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-06-07 14:34:59 +0000 |
commit | 5cad241306f64d0a3c0f7829421e4bf8f4b18fbe (patch) | |
tree | ebbcad6d0cdb19fa5ef0bf5f6dc5cf80dfbdc4d1 /test/testmsg.c | |
parent | 152f34a80c6ffe5fd17809732272823091b854e8 (diff) | |
parent | aec912f13f9aa85cd677353fa556f679c3832970 (diff) | |
download | ChibiOS-5cad241306f64d0a3c0f7829421e4bf8f4b18fbe.tar.gz ChibiOS-5cad241306f64d0a3c0f7829421e4bf8f4b18fbe.tar.bz2 ChibiOS-5cad241306f64d0a3c0f7829421e4bf8f4b18fbe.zip |
I2C. Merged code from trunk.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3036 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/testmsg.c')
-rw-r--r-- | test/testmsg.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/test/testmsg.c b/test/testmsg.c index 881db167f..54c049d44 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -1,5 +1,6 @@ /*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -48,7 +49,7 @@ * @brief Messages header file
*/
-#if CH_USE_MESSAGES
+#if CH_USE_MESSAGES || defined(__DOXYGEN__)
/**
* @page test_msg_001 Messages Server loop
@@ -64,11 +65,11 @@ static msg_t thread(void *p) { chMsgSend(p, 'A');
chMsgSend(p, 'B');
chMsgSend(p, 'C');
- chMsgSend(p, 'D');
return 0;
}
static void msg1_execute(void) {
+ Thread *tp;
msg_t msg;
/*
@@ -76,29 +77,19 @@ static void msg1_execute(void) { */
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1,
thread, chThdSelf());
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
test_assert_sequence(1, "ABC");
-
- /*
- * Testing message fetch using chMsgGet().
- * Note, the following is valid because the sender has higher priority than
- * the receiver.
- */
- msg = chMsgGet();
- test_assert(1, msg != 0, "no message");
- chMsgRelease(0);
- test_assert(2, msg == 'D', "wrong message");
-
- /*
- * Must not have pending messages.
- */
- msg = chMsgGet();
- test_assert(3, msg == 0, "unknown message");
}
ROMCONST struct testcase testmsg1 = {
@@ -114,7 +105,7 @@ ROMCONST struct testcase testmsg1 = { * @brief Test sequence for messages.
*/
ROMCONST struct testcase * ROMCONST patternmsg[] = {
-#if CH_USE_MESSAGES
+#if CH_USE_MESSAGES || defined(__DOXYGEN__)
&testmsg1,
#endif
NULL
|