source: rtems/cpukit/rtems/src/eventreceive.c @ fe6c170c

4.115
Last change on this file since fe6c170c was fe6c170c, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 14:19:52

score: Create states implementation header

Move implementation specific parts of states.h and states.inl into new
header file statesimpl.h. The states.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief  Constant used to receive the set of currently pending events in
5 * @ingroup ClassicEventSet Event Set
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-1999.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18  #include "config.h"
19#endif
20
21#include <rtems/rtems/eventimpl.h>
22#include <rtems/rtems/tasks.h>
23#include <rtems/score/statesimpl.h>
24
25rtems_status_code rtems_event_receive(
26  rtems_event_set  event_in,
27  rtems_option     option_set,
28  rtems_interval   ticks,
29  rtems_event_set *event_out
30)
31{
32  rtems_status_code sc;
33
34  if ( event_out != NULL ) {
35    Thread_Control    *executing = _Thread_Get_executing();
36    RTEMS_API_Control *api = executing->API_Extensions[ THREAD_API_RTEMS ];
37    Event_Control     *event = &api->Event;
38
39    if ( !_Event_sets_Is_empty( event_in ) ) {
40      _Thread_Disable_dispatch();
41      _Event_Seize(
42        event_in,
43        option_set,
44        ticks,
45        event_out,
46        executing,
47        event,
48        &_Event_Sync_state,
49        STATES_WAITING_FOR_EVENT
50      );
51      _Thread_Enable_dispatch();
52
53      sc = executing->Wait.return_code;
54    } else {
55      *event_out = event->pending_events;
56      sc = RTEMS_SUCCESSFUL;
57    }
58  } else {
59    sc = RTEMS_INVALID_ADDRESS;
60  }
61
62  return sc;
63}
Note: See TracBrowser for help on using the repository browser.