blob: cfca358b455d16a79e96eacde4b5ea5871f07ed4 (
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
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
brief: |
Acquires the ISR lock.
copyrights:
- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
- Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
definition:
default: |
${/score/isr/if/lock-isr-disable-acquire:/name}( ${.:/params[0]/name}, ${.:/params[1]/name} )
variants: []
description: |
This directive acquires the ISR lock specified by ${.:/params[0]/name} using
the lock context provided by ${.:/params[1]/name}. Maskable interrupts will
be disabled on the current processor.
enabled-by: true
index-entries: []
interface-type: macro
links:
- role: interface-placement
uid: header
- role: interface-ingroup
uid: group
- role: constraint
uid: /constraint/directive-ctx-any
- role: constraint
uid: /constraint/directive-no-preempt
name: rtems_interrupt_lock_acquire
notes: |
A caller-specific lock context shall be provided for each acquire/release
pair, for example an automatic variable.
Where the system was built with SMP support enabled, this directive acquires
an SMP lock. An attempt to recursively acquire the lock may result in an
infinite loop with maskable interrupts disabled.
This directive establishes a non-preemptive critical section with system wide
mutual exclusion on the local node in all RTEMS build configurations.
.. code-block:: c
:linenos:
#include <rtems.h>
void critical_section( rtems_interrupt_lock *lock )
{
rtems_interrupt_lock_context lock_context;
rtems_interrupt_lock_acquire( lock, &lock_context );
// Here is the critical section. Maskable interrupts are disabled.
// Where the system was built with SMP support enabled, this section
// is protected by an SMP lock.
rtems_interrupt_lock_release( lock, &lock_context );
}
params:
- description: |
is the ISR lock to acquire.
dir: inout
name: _lock
- description: |
is the ISR lock context. This lock context shall be used to release the
lock by calling ${lock-release:/name}.
dir: out
name: _lock_context
return: null
type: interface
|