source: rtems/cpukit/rtems/src/eventsend.c @ 990575c

4.115
Last change on this file since 990575c was 990575c, checked in by Sebastian Huber <sebastian.huber@…>, on 10/30/12 at 15:18:36

rtems: Reusable event implementation

Change event implementation to enable reuse for system events.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Event Manager
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13  #include "config.h"
14#endif
15
16#include <rtems/rtems/event.h>
17#include <rtems/rtems/tasks.h>
18
19rtems_status_code rtems_event_send(
20  rtems_id        id,
21  rtems_event_set event_in
22)
23{
24  rtems_status_code  sc;
25  Thread_Control    *thread;
26  Objects_Locations  location;
27  RTEMS_API_Control *api;
28
29  thread = _Thread_Get( id, &location );
30  switch ( location ) {
31    case OBJECTS_LOCAL:
32      api = thread->API_Extensions[ THREAD_API_RTEMS ];
33      _Event_Surrender(
34        thread,
35        event_in,
36        &api->Event,
37        &_Event_Sync_state,
38        STATES_WAITING_FOR_EVENT
39      );
40      _Thread_Enable_dispatch();
41      sc = RTEMS_SUCCESSFUL;
42      break;
43#ifdef RTEMS_MULTIPROCESSING
44    case OBJECTS_REMOTE:
45      sc = _Event_MP_Send_request_packet(
46        EVENT_MP_SEND_REQUEST,
47        id,
48        event_in
49      );
50      break;
51#endif
52    default:
53      sc = RTEMS_INVALID_ID;
54      break;
55  }
56
57  return sc;
58}
Note: See TracBrowser for help on using the repository browser.