summaryrefslogtreecommitdiffstats
path: root/c/src/tests/libtests/rtems++/Task3.cc
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-07-31 22:13:29 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-07-31 22:13:29 +0000
commit0074691a67f857c9b3f880fb581e0af1d5673337 (patch)
treef80fd23129ad62236ee4f64eeaf537f53bbaa0b8 /c/src/tests/libtests/rtems++/Task3.cc
parentMerged very large and much appreciated patch from Chris Johns (diff)
downloadrtems-0074691a67f857c9b3f880fb581e0af1d5673337.tar.bz2
Merged very large and much appreciated patch from Chris Johns
<cjohns@plessey.com.au>. This patch includes the ods68302 bsp, the RTEMS++ class library, and the rtems++ test.
Diffstat (limited to 'c/src/tests/libtests/rtems++/Task3.cc')
-rw-r--r--c/src/tests/libtests/rtems++/Task3.cc81
1 files changed, 81 insertions, 0 deletions
diff --git a/c/src/tests/libtests/rtems++/Task3.cc b/c/src/tests/libtests/rtems++/Task3.cc
new file mode 100644
index 0000000000..3d3060d398
--- /dev/null
+++ b/c/src/tests/libtests/rtems++/Task3.cc
@@ -0,0 +1,81 @@
+/* Task_3
+ *
+ * This routine serves as a test task. Loopback the messages and test
+ * timeouts
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989-1997.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may in
+ * the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include "System.h"
+
+Task3::Task3(const char* name,
+ const rtems_task_priority initial_priority,
+ const rtems_unsigned32 stack_size)
+ : rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
+{
+}
+
+void Task3::body(rtems_task_argument )
+{
+ screen6();
+
+ printf("%s - destory itself\n", name_string());
+ destroy();
+}
+
+void Task3::screen6()
+{
+ rtemsMessageQueue mq_2("MQ2");
+ printf("%s - construction connect mq_2 - %s\n", name_string(), mq_2.last_status_string());
+
+ if (mq_2.successful())
+ {
+ char in[100];
+ char out[100];
+ rtems_unsigned32 size;
+ bool loopback = true;
+
+ while (loopback)
+ {
+ printf("%s - loopback from mq_2 to mq_2 ...\n", name_string()); fflush(stdout);
+
+ mq_2.receive(in, size);
+ printf("%s - mq_2 receive - %s, size=%i, message string size=%i\n",
+ name_string(), mq_2.last_status_string(), size, (int) strlen(in));
+ if (mq_2.successful())
+ {
+ if (size > (100 - 5))
+ printf("%s - size to large\n", name_string());
+ else
+ {
+ strcpy(out, name_string());
+ strcpy(out + 4, in);
+
+ printf("%s - loopback to mq_2 - ", name_string());
+ mq_2.send(out, strlen(out) + 1);
+ printf("%s\n", mq_2.last_status_string());
+ }
+
+ if (strcmp(in, "broadcast message") == 0)
+ loopback = false;
+ else
+ wake_after(1500000);
+ }
+ }
+ }
+}
+
+