summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r--cpukit/rtems/src/event.c1
-rw-r--r--cpukit/rtems/src/systemeventreceive.c68
-rw-r--r--cpukit/rtems/src/systemeventsend.c65
-rw-r--r--cpukit/rtems/src/tasks.c2
4 files changed, 136 insertions, 0 deletions
diff --git a/cpukit/rtems/src/event.c b/cpukit/rtems/src/event.c
index ed148e8b37..d5c29f6a3e 100644
--- a/cpukit/rtems/src/event.c
+++ b/cpukit/rtems/src/event.c
@@ -34,6 +34,7 @@
void _Event_Manager_initialization( void )
{
_Event_Sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
+ _System_event_Sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
/*
* Register the MP Process Packet routine.
diff --git a/cpukit/rtems/src/systemeventreceive.c b/cpukit/rtems/src/systemeventreceive.c
new file mode 100644
index 0000000000..43f2bec048
--- /dev/null
+++ b/cpukit/rtems/src/systemeventreceive.c
@@ -0,0 +1,68 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicEventSystem
+ *
+ * @brief rtems_event_system_receive() 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_receive(
+ rtems_event_set event_in,
+ rtems_option option_set,
+ rtems_interval ticks,
+ rtems_event_set *event_out
+)
+{
+ rtems_status_code sc;
+
+ if ( event_out != NULL ) {
+ Thread_Control *executing = _Thread_Executing;
+ RTEMS_API_Control *api = executing->API_Extensions[ THREAD_API_RTEMS ];
+ Event_Control *event = &api->System_event;
+
+ if ( !_Event_sets_Is_empty( event_in ) ) {
+ _Thread_Disable_dispatch();
+ _Event_Seize(
+ event_in,
+ option_set,
+ ticks,
+ event_out,
+ executing,
+ event,
+ &_System_event_Sync_state,
+ STATES_WAITING_FOR_SYSTEM_EVENT
+ );
+ _Thread_Enable_dispatch();
+
+ sc = executing->Wait.return_code;
+ } else {
+ *event_out = event->pending_events;
+ sc = RTEMS_SUCCESSFUL;
+ }
+ } else {
+ sc = RTEMS_INVALID_ADDRESS;
+ }
+
+ return sc;
+}
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;
+}
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index 325eba0546..c679f1e6f2 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -65,6 +65,7 @@ static bool _RTEMS_tasks_Create_extension(
created->API_Extensions[ THREAD_API_RTEMS ] = api;
_Event_Initialize( &api->Event );
+ _Event_Initialize( &api->System_event );
_ASR_Initialize( &api->Signal );
created->task_variables = NULL;
@@ -93,6 +94,7 @@ static void _RTEMS_tasks_Start_extension(
api = started->API_Extensions[ THREAD_API_RTEMS ];
_Event_Initialize( &api->Event );
+ _Event_Initialize( &api->System_event );
}
/*