RTEMS
smplock.c
1 /*
2  * Copyright (c) 2015, 2016 embedded brains GmbH. All rights reserved.
3  *
4  * embedded brains GmbH
5  * Dornierstr. 4
6  * 82178 Puchheim
7  * Germany
8  * <rtems@embedded-brains.de>
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif
18 
19 #include <rtems/score/smplock.h>
20 
21 #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE)
23  SMP_lock_Control *lock,
24  const char *name
25 )
26 {
27  _SMP_lock_Initialize_inline( lock, name );
28 }
29 
31 {
33 }
34 #endif
35 
37  SMP_lock_Control *lock,
38  SMP_lock_Context *context
39 )
40 {
41  _SMP_lock_Acquire_inline( lock, context );
42 }
43 
44 #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE)
46  SMP_lock_Control *lock,
47  SMP_lock_Context *context
48 )
49 {
50  _SMP_lock_Release_inline( lock, context );
51 }
52 #endif
53 
55  SMP_lock_Control *lock,
56  SMP_lock_Context *context
57 )
58 {
60 }
61 
62 #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE)
64  SMP_lock_Control *lock,
65  SMP_lock_Context *context
66 )
67 {
69 }
70 #endif
71 
72 #if defined(RTEMS_DEBUG)
73 bool _SMP_lock_Is_owner( const SMP_lock_Control *lock )
74 {
75  return lock->owner == _SMP_lock_Who_am_I();
76 }
77 #endif
SMP lock control.
Definition: smplock.h:65
Local SMP lock context for acquire and release pairs.
Definition: smplock.h:90
static void _SMP_lock_Initialize_inline(SMP_lock_Control *lock, const char *name)
Initializes the SMP lock with the given name.
Definition: smplock.h:129
static void _SMP_lock_Release_and_ISR_enable_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Releases the SMP lock and enables interrupts.
Definition: smplock.h:341
static void _SMP_lock_Destroy_inline(SMP_lock_Control *lock)
Destroys the SMP lock.
Definition: smplock.h:169
void _SMP_lock_Acquire(SMP_lock_Control *lock, SMP_lock_Context *context)
Acquires an SMP lock.
Definition: smplock.c:36
#define _SMP_lock_Release_and_ISR_enable(lock, context)
Releases the SMP lock and enables interrupts.
Definition: smplock.h:363
static void _SMP_lock_Release_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Releases an SMP lock.
Definition: smplock.h:272
static void _SMP_lock_ISR_disable_and_acquire_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Disables interrupts and acquires the SMP lock.
Definition: smplock.h:314
void _SMP_lock_ISR_disable_and_acquire(SMP_lock_Control *lock, SMP_lock_Context *context)
Disables interrupts and acquires the SMP lock.
Definition: smplock.c:54
SMP Lock API.
#define _SMP_lock_Release(lock, context)
Releases an SMP lock.
Definition: smplock.h:304
#define _SMP_lock_Destroy(lock)
Destroys an SMP lock.
Definition: smplock.h:185
#define _SMP_lock_Initialize(lock, name)
Initializes an SMP lock.
Definition: smplock.h:160
static void _SMP_lock_Acquire_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Gets my index.
Definition: smplock.h:230