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