1 | /** |
---|
2 | * @file rtems/rtems/asr.inl |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * This include file contains the implemenation of all routines |
---|
7 | * associated with the asynchronous signal handler which are inlined. |
---|
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 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef __INLINE_ASR_inl |
---|
20 | #define __INLINE_ASR_inl |
---|
21 | |
---|
22 | #include <rtems/score/isr.h> |
---|
23 | |
---|
24 | /*PAGE |
---|
25 | * |
---|
26 | * _ASR_Initialize |
---|
27 | * |
---|
28 | * DESCRIPTION: |
---|
29 | * |
---|
30 | * This routine initializes the given RTEMS_ASR information record. |
---|
31 | */ |
---|
32 | |
---|
33 | RTEMS_INLINE_ROUTINE void _ASR_Initialize ( |
---|
34 | ASR_Information *information |
---|
35 | ) |
---|
36 | { |
---|
37 | information->is_enabled = TRUE; |
---|
38 | information->handler = NULL; |
---|
39 | information->mode_set = RTEMS_DEFAULT_MODES; |
---|
40 | information->signals_posted = 0; |
---|
41 | information->signals_pending = 0; |
---|
42 | information->nest_level = 0; |
---|
43 | } |
---|
44 | |
---|
45 | /*PAGE |
---|
46 | * |
---|
47 | * _ASR_Swap_signals |
---|
48 | * |
---|
49 | * DESCRIPTION: |
---|
50 | * |
---|
51 | * This routine atomically swaps the pending and posted signal |
---|
52 | * sets. This is done when the thread alters its mode in such a |
---|
53 | * way that the RTEMS_ASR disable/enable flag changes. |
---|
54 | */ |
---|
55 | |
---|
56 | RTEMS_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 | /*PAGE |
---|
71 | * |
---|
72 | * _ASR_Is_null_handler |
---|
73 | * |
---|
74 | * DESCRIPTION: |
---|
75 | * |
---|
76 | * This function returns TRUE if the given asr_handler is NULL and |
---|
77 | * FALSE otherwise. |
---|
78 | */ |
---|
79 | |
---|
80 | RTEMS_INLINE_ROUTINE boolean _ASR_Is_null_handler ( |
---|
81 | rtems_asr_entry asr_handler |
---|
82 | ) |
---|
83 | { |
---|
84 | return asr_handler == NULL; |
---|
85 | } |
---|
86 | |
---|
87 | /*PAGE |
---|
88 | * |
---|
89 | * _ASR_Are_signals_pending |
---|
90 | * |
---|
91 | * DESCRIPTION: |
---|
92 | * |
---|
93 | * This function returns TRUE if there are signals pending in the |
---|
94 | * given RTEMS_ASR information record and FALSE otherwise. |
---|
95 | */ |
---|
96 | |
---|
97 | RTEMS_INLINE_ROUTINE boolean _ASR_Are_signals_pending ( |
---|
98 | ASR_Information *information |
---|
99 | ) |
---|
100 | { |
---|
101 | return information->signals_posted != 0; |
---|
102 | } |
---|
103 | |
---|
104 | /*PAGE |
---|
105 | * |
---|
106 | * _ASR_Post_signals |
---|
107 | * |
---|
108 | * DESCRIPTION: |
---|
109 | * |
---|
110 | * This routine posts the given signals into the signal_set |
---|
111 | * passed in. The result is returned to the user in signal_set. |
---|
112 | * |
---|
113 | * NOTE: This must be implemented as a macro. |
---|
114 | */ |
---|
115 | |
---|
116 | RTEMS_INLINE_ROUTINE void _ASR_Post_signals( |
---|
117 | rtems_signal_set signals, |
---|
118 | rtems_signal_set *signal_set |
---|
119 | ) |
---|
120 | { |
---|
121 | ISR_Level _level; |
---|
122 | |
---|
123 | _ISR_Disable( _level ); |
---|
124 | *signal_set |= signals; |
---|
125 | _ISR_Enable( _level ); |
---|
126 | } |
---|
127 | |
---|
128 | |
---|
129 | #endif |
---|
130 | /* end of include file */ |
---|