source: rtems/cpukit/rtems/inline/rtems/rtems/asr.inl @ 4d24fccb

4.104.114.95
Last change on this file since 4d24fccb was 4d24fccb, checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/19/08 at 12:09:40

Add header guard to force indirect inclusion.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/**
2 * @file rtems/rtems/asr.inl
3 *
4 *  This include file contains the implemenation of all routines
5 *  associated with the asynchronous signal handler which are inlined.
6 */
7
8/*  COPYRIGHT (c) 1989-2008.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16 */
17
18#ifndef _RTEMS_RTEMS_ASR_H
19# error "Never use <rtems/rtems/asr.inl> directly; include <rtems/rtems/asr.h> instead."
20#endif
21
22#ifndef _RTEMS_RTEMS_ASR_INL
23#define _RTEMS_RTEMS_ASR_INL
24
25#include <rtems/score/isr.h>
26
27/**
28 *  @addtogroup ClassicASR
29 *  @{
30 */
31
32/**
33 *  @brief ASR_Initialize
34 *
35 *  This routine initializes the given RTEMS_ASR information record.
36 */
37RTEMS_INLINE_ROUTINE void _ASR_Initialize (
38  ASR_Information *information
39)
40{
41  information->is_enabled      = TRUE;
42  information->handler         = NULL;
43  information->mode_set        = RTEMS_DEFAULT_MODES;
44  information->signals_posted  = 0;
45  information->signals_pending = 0;
46  information->nest_level      = 0;
47}
48
49/**
50 *  @brief ASR_Swap_signals
51 *
52 *  This routine atomically swaps the pending and posted signal
53 *  sets.  This is done when the thread alters its mode in such a
54 *  way that the RTEMS_ASR disable/enable flag changes.
55 */
56RTEMS_INLINE_ROUTINE void _ASR_Swap_signals (
57  ASR_Information *information
58)
59{
60  rtems_signal_set _signals;
61  ISR_Level        _level;
62
63  _ISR_Disable( _level );
64    _signals                     = information->signals_pending;
65    information->signals_pending = information->signals_posted;
66    information->signals_posted  = _signals;
67  _ISR_Enable( _level );
68}
69
70/**
71 *  @brief ASR_Is_null_handler
72 *
73 *  This function returns TRUE if the given asr_handler is NULL and
74 *  FALSE otherwise.
75 */
76RTEMS_INLINE_ROUTINE boolean _ASR_Is_null_handler (
77  rtems_asr_entry asr_handler
78)
79{
80  return asr_handler == NULL;
81}
82
83/**
84 *  @brief ASR_Are_signals_pending
85 *
86 *  This function returns TRUE if there are signals pending in the
87 *  given RTEMS_ASR information record and FALSE otherwise.
88 */
89RTEMS_INLINE_ROUTINE boolean _ASR_Are_signals_pending (
90  ASR_Information *information
91)
92{
93  return information->signals_posted != 0;
94}
95
96/**
97 *  @brief ASR_Post_signals
98 *
99 *  This routine posts the given signals into the signal_set
100 *  passed in.  The result is returned to the user in signal_set.
101 *
102 *  NOTE:  This must be implemented as a macro.
103 */
104RTEMS_INLINE_ROUTINE void _ASR_Post_signals(
105  rtems_signal_set  signals,
106  rtems_signal_set *signal_set
107)
108{
109  ISR_Level              _level;
110
111  _ISR_Disable( _level );
112    *signal_set |= signals;
113  _ISR_Enable( _level );
114}
115
116/**@}*/
117
118#endif
119/* end of include file */
Note: See TracBrowser for help on using the repository browser.