From 6f6e1a6401eda000dce198150937c7919b4c9855 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Feb 2011 18:59:39 +0000 Subject: Improved messages subsystem. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2759 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmsg.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'test/testmsg.c') diff --git a/test/testmsg.c b/test/testmsg.c index 881db167f..14b6d8186 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -64,11 +64,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 +76,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 = { -- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmsg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/testmsg.c') diff --git a/test/testmsg.c b/test/testmsg.c index 14b6d8186..0fadc8d98 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. -- cgit v1.2.3 From 506212845dd0644b2755191da1252380aababd24 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Mar 2011 13:12:41 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2839 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/testmsg.c') diff --git a/test/testmsg.c b/test/testmsg.c index 0fadc8d98..54c049d44 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -49,7 +49,7 @@ * @brief Messages header file */ -#if CH_USE_MESSAGES +#if CH_USE_MESSAGES || defined(__DOXYGEN__) /** * @page test_msg_001 Messages Server loop @@ -105,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 -- cgit v1.2.3