source: rtems/cpukit/score/include/rtems/score/isrlevel.h @ 21ff802

4.115
Last change on this file since 21ff802 was 21ff802, checked in by Sebastian Huber <sebastian.huber@…>, on 07/26/13 at 14:26:07

smp: Delete _ISR_Disable_on_this_core(), etc.

Delete _ISR_Enable_on_this_core(), _ISR_Flash_on_this_core(),
_ISR_SMP_Disable(), _ISR_SMP_Enable(), _ISR_SMP_Flash().

The ISR disable/enable interface has no parameter to pass a specific
object. Thus it is only possible to implement a single global lock
object with this interface. Using the ISR disable/enable as the giant
lock on SMP configurations is not feasible.

Potentially blocking resource obtain sequences protected by the thread
dispatch disable level are subdivided into smaller ISR disabled critical
sections. This works since on single processor configurations there is
only one thread of execution that can block. On SMP this is different
(image a mutex obtained concurrently by different threads on different
processors).

The thread dispatch disable level is currently used as the giant lock.
There is not need to complicate things with this unused interface.

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/**
2 *  @file  rtems/score/isrlevel.h
3 *
4 *  @brief ISR Level Type
5 *
6 *  This include file defines the ISR Level type.  It exists to
7 *  simplify include dependencies.  It is part of the ISR Handler.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_ISR_LEVEL_h
20#define _RTEMS_SCORE_ISR_LEVEL_h
21
22#include <rtems/score/cpu.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 *  @defgroup ScoreISR ISR Handler
30 *
31 *  @ingroup Score
32 *
33 *  @addtogroup ScoreISR ISR Handler
34 */
35/**@{*/
36
37/**
38 *  The following type defines the control block used to manage
39 *  the interrupt level portion of the status register.
40 */
41typedef uint32_t   ISR_Level;
42
43/**
44 *  @brief Disables interrupts on this processor.
45 *
46 *  This macro disables all interrupts on this processor so that a critical
47 *  section of code is protected from concurrent access by interrupts of this
48 *  processor.  Disabling of interrupts disables thread dispatching on the
49 *  processor as well.
50 *
51 *  On SMP configurations other processors can enter such sections if not
52 *  protected by other means.
53 *
54 *  @param[out] _level The argument @a _level will contain the previous
55 *  interrupt mask level.
56 */
57#define _ISR_Disable( _level ) \
58  do { \
59    _CPU_ISR_Disable( _level ); \
60    RTEMS_COMPILER_MEMORY_BARRIER(); \
61  } while (0)
62
63/**
64 *  @brief Enables interrupts on this processor.
65 *
66 *  This macro restores the interrupt status on the processor with the
67 *  interrupt level value obtained by _ISR_Disable().  It is used at the end of
68 *  a critical section of code to enable interrupts so they can be processed
69 *  again.
70 *
71 *  @param[in] _level The interrupt level previously obtained by
72 *  _ISR_Disable().
73 */
74#define _ISR_Enable( _level ) \
75  do { \
76    RTEMS_COMPILER_MEMORY_BARRIER(); \
77    _CPU_ISR_Enable( _level ); \
78  } while (0)
79
80/**
81 *  @brief Temporarily enables interrupts on this processor.
82 *
83 *  This macro temporarily enables interrupts to the previous
84 *  interrupt mask level and then disables all interrupts so that
85 *  the caller can continue into the second part of a critical
86 *  section.
87 *
88 *  This routine is used to temporarily enable interrupts
89 *  during a long critical section.  It is used in long sections of
90 *  critical code when a point is reached at which interrupts can
91 *  be temporarily enabled.  Deciding where to flash interrupts
92 *  in a long critical section is often difficult and the point
93 *  must be selected with care to ensure that the critical section
94 *  properly protects itself.
95 *
96 *  @param[in] _level The interrupt level previously obtained by
97 *  _ISR_Disable().
98 */
99#define _ISR_Flash( _level ) \
100  do { \
101    RTEMS_COMPILER_MEMORY_BARRIER(); \
102    _CPU_ISR_Flash( _level ); \
103    RTEMS_COMPILER_MEMORY_BARRIER(); \
104  } while (0)
105
106/**
107 *  @brief Return current interrupt level.
108 *
109 *  This routine returns the current interrupt level.
110 *
111 *  LM32 Specific Information:
112 *  XXX document implementation including references if appropriate
113 *
114 *  @retval This method returns the current level.
115 */
116#define _ISR_Get_level() \
117        _CPU_ISR_Get_level()
118
119/**
120 *  @brief Set current interrupt level.
121 *
122 *  This routine sets the current interrupt level to that specified
123 *  by @a _new_level.  The new interrupt level is effective when the
124 *  routine exits.
125 *
126 *  @param[in] _new_level contains the desired interrupt level.
127 */
128#define _ISR_Set_level( _new_level ) \
129  do { \
130    RTEMS_COMPILER_MEMORY_BARRIER();  \
131    _CPU_ISR_Set_level( _new_level ); \
132    RTEMS_COMPILER_MEMORY_BARRIER();  \
133  } while (0)
134
135/**@}*/
136
137#ifdef __cplusplus
138}
139#endif
140#endif
Note: See TracBrowser for help on using the repository browser.