summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/systemeventsend.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-10-26 10:05:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-10-30 18:03:02 +0100
commit0edf263139088e8ac0ff1f0d52513f6fc85677d2 (patch)
tree62f376215aa7ae30aa77e9386c2191ae20b70258 /cpukit/rtems/src/systemeventsend.c
parentrtems: Reusable event implementation (diff)
downloadrtems-0edf263139088e8ac0ff1f0d52513f6fc85677d2.tar.bz2
rtems: Add system events
System events are similar to normal events. They offer a second set of events. These events are intended for internal RTEMS use and should not be used by applications (with the exception of the transient system event).
Diffstat (limited to 'cpukit/rtems/src/systemeventsend.c')
-rw-r--r--cpukit/rtems/src/systemeventsend.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/cpukit/rtems/src/systemeventsend.c b/cpukit/rtems/src/systemeventsend.c
new file mode 100644
index 0000000000..13d31ccf85
--- /dev/null
+++ b/cpukit/rtems/src/systemeventsend.c
@@ -0,0 +1,65 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicEventSystem
+ *
+ * @brief rtems_event_system_send() implementation.
+ */
+
+/*
+ * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/tasks.h>
+
+rtems_status_code rtems_event_system_send(
+ rtems_id id,
+ rtems_event_set event_in
+)
+{
+ rtems_status_code sc;
+ Thread_Control *thread;
+ Objects_Locations location;
+ RTEMS_API_Control *api;
+
+ thread = _Thread_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_LOCAL:
+ api = thread->API_Extensions[ THREAD_API_RTEMS ];
+ _Event_Surrender(
+ thread,
+ event_in,
+ &api->System_event,
+ &_System_event_Sync_state,
+ STATES_WAITING_FOR_SYSTEM_EVENT
+ );
+ _Thread_Enable_dispatch();
+ sc = RTEMS_SUCCESSFUL;
+ break;
+#ifdef RTEMS_MULTIPROCESSING
+ case OBJECTS_REMOTE:
+ sc = RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+ break;
+#endif
+ default:
+ sc = RTEMS_INVALID_ID;
+ break;
+ }
+
+ return sc;
+}