summaryrefslogtreecommitdiffstats
path: root/cpukit/itron/src/tsnd_mbf.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-15 17:15:58 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-15 17:15:58 +0000
commit9da09940e4313465c77a2531f4a4f918d7ad99ef (patch)
tree0d580090a6772135d2123745c2a73409e62d933d /cpukit/itron/src/tsnd_mbf.c
parentSplit ITRON semaphore manager into multiple files. (diff)
downloadrtems-9da09940e4313465c77a2531f4a4f918d7ad99ef.tar.bz2
Split ITRON Message Buffer Manager into multiple files.
Diffstat (limited to '')
-rw-r--r--cpukit/itron/src/tsnd_mbf.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/cpukit/itron/src/tsnd_mbf.c b/cpukit/itron/src/tsnd_mbf.c
new file mode 100644
index 0000000000..7649a2005d
--- /dev/null
+++ b/cpukit/itron/src/tsnd_mbf.c
@@ -0,0 +1,82 @@
+/*
+ * ITRON Message Buffer Manager
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <itron.h>
+
+#include <rtems/itron/msgbuffer.h>
+#include <rtems/itron/task.h>
+
+#include <assert.h> /* only for blocking */
+
+/*
+ * tsnd_mbf - Send Message to MessageBuffer with Timeout
+ */
+
+ER tsnd_mbf(
+ ID mbfid,
+ VP msg,
+ INT msgsz,
+ TMO tmout
+)
+{
+ ITRON_Message_buffer_Control *the_message_buffer;
+ Objects_Locations location;
+ Watchdog_Interval interval;
+ boolean wait;
+ CORE_message_queue_Status status;
+
+ if (msgsz <= 0 || !msg)
+ return E_PAR;
+
+ interval = 0;
+ if ( tmout == TMO_POL ) {
+ wait = FALSE;
+ } else {
+ wait = TRUE;
+ if ( tmout != TMO_FEVR )
+ interval = TOD_MILLISECONDS_TO_TICKS(tmout);
+ }
+
+ if ( wait && _ITRON_Is_in_non_task_state() )
+ return E_CTX;
+
+ assert( wait == FALSE );
+
+ the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
+ switch (location) {
+ case OBJECTS_REMOTE:
+ case OBJECTS_ERROR: /* Multiprocessing not supported */
+ return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
+
+ case OBJECTS_LOCAL:
+ /* XXX Submit needs to take into account blocking */
+ status = _CORE_message_queue_Submit(
+ &the_message_buffer->message_queue,
+ msg,
+ msgsz,
+ the_message_buffer->Object.id,
+ NULL,
+ CORE_MESSAGE_QUEUE_SEND_REQUEST
+ );
+ _Thread_Enable_dispatch();
+ return
+ _ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
+ }
+
+ /*
+ * If multiprocessing were supported, this is where we would announce
+ * the existence of the semaphore to the rest of the system.
+ */
+
+#if defined(RTEMS_MULTIPROCESSING)
+#endif
+
+ return E_OK;
+}