blob: a1a08cb6a082af3248d2afd85789ce836dd6eb97 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
brief: |
Disables the maskable interrupts on the current processor.
copyrights:
- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
- Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
definition:
default:
attributes: null
body: ${/score/isr/if/local-disable:/name}( ${.:/params[0]/name} )
params:
- ${level:/name} ${.:/params[0]/name}
return: void
variants: []
description: |
This directive disables all maskable interrupts on the current processor and
returns the previous interrupt level in ${.:/params[0]/name}.
enabled-by:
not: RTEMS_SMP
index-entries:
- disable interrupts
interface-type: macro
links:
- role: interface-placement
uid: header
- role: interface-ingroup
uid: group
- role: constraint
uid: /constraint/directive-not-pre-qualified
- role: constraint
uid: /constraint/directive-ctx-any
- role: constraint
uid: /constraint/directive-no-preempt
- role: constraint
uid: ../constraint/no-smp
name: rtems_interrupt_disable
notes: |
A later invocation of the ${enable:/name} directive should be used to restore
the previous interrupt level.
This directive is implemented as a macro which sets the ${.:/params[0]/name}
parameter.
.. code-block:: c
:linenos:
#include <rtems.h>
void local_critical_section( void )
{
rtems_interrupt_level level;
// Please note that the rtems_interrupt_disable() is a macro. The
// previous interrupt level (before the maskable interrupts are
// disabled) is returned here in the level macro parameter. This
// would be wrong:
//
// rtems_interrupt_disable( &level );
rtems_interrupt_disable( level );
// Here is the critical section: maskable interrupts are disabled
{
rtems_interrupt_level nested_level;
rtems_interrupt_disable( nested_level );
// Here is a nested critical section
rtems_interrupt_enable( nested_level );
}
// Maskable interrupts are still disabled
rtems_interrupt_enable( level );
}
params:
- description: |
is a variable of type ${level:/name} which will be used to save the
previous interrupt level.
dir: out
name: _isr_cookie
return: null
type: interface
|