source: rtems/cpukit/score/include/rtems/score/smplock.h @ a1f9934a

4.115
Last change on this file since a1f9934a was a1f9934a, checked in by Mathew Kallada <matkallada@…>, on 01/04/13 at 15:01:21

score: Doxygen Clean Up Task #3

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/**
2 *  @file  rtems/score/smplock.h
3 *
4 *  @brief Interface for Atomic Locks
5 *
6 *  This include file defines the interface for atomic locks
7 *  which can be used in multiprocessor configurations.
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_LOCK_H
20#define _RTEMS_LOCK_H
21
22#include <rtems/score/isr.h>
23
24/**
25 *  @defgroup RTEMS Lock Interface
26 *
27 *  @ingroup Score
28 *
29 */
30
31/**@{*/
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/**
38 *  This type is used to lock elements for atomic access.
39 *  This spinlock is a simple non-nesting spinlock, and
40 *  may be used for short non-nesting accesses.
41 */
42typedef uint32_t SMP_lock_spinlock_simple_Control;
43
44/**
45 *  This type is used to lock elements for atomic access.
46 *  This spinlock supports nesting, but is slightly more
47 *  complicated to use.  Please see the descriptions of
48 *  obtain and release prior to using in order to understand
49 *  the callers responsibilty of managing short interupt disable
50 *  times.
51 */
52typedef struct {
53  SMP_lock_spinlock_simple_Control lock;
54  uint32_t  count;
55  int       cpu_id;
56} SMP_lock_spinlock_nested_Control;
57
58/**
59 *  @brief Initialize a lock.
60 *
61 *  This method is used to initialize the lock at @a lock.
62 *
63 *  @param [in] lock is the address of the lock to obtain.
64 */
65void _SMP_lock_spinlock_simple_Initialize(
66  SMP_lock_spinlock_simple_Control *lock
67);
68
69/**
70 *  @brief Obtain a lock.
71 *
72 *  This method is used to obtain the lock at @a lock.
73 *
74 *  @param [in] lock is the address of the lock to obtain.
75 *
76 *  @retval This method returns with processor interrupts disabled.
77 *          The previous level is returned.
78 */
79ISR_Level _SMP_lock_spinlock_simple_Obtain(
80  SMP_lock_spinlock_simple_Control *lock
81);
82
83/**
84 *  @brief Release a lock.
85 *
86 *  This method is used to release the lock at @a lock.
87 *
88 *  @param [in] lock is the address of the lock to obtain.
89 */
90void _SMP_lock_spinlock_simple_Release(
91  SMP_lock_spinlock_simple_Control  *lock,
92  ISR_Level                         level
93);
94
95/**
96 *  @brief Initialize a lock.
97 *
98 *  This method is used to initialize the lock at @a lock.
99 *
100 *  @param [in] lock is the address of the lock to obtain.
101 */
102void _SMP_lock_spinlock_nested_Initialize(
103  SMP_lock_spinlock_nested_Control *lock
104);
105
106/**
107 *  @brief Obtain a lock.
108 *
109 *  This method is used to obtain the lock at @a lock.  ISR's are
110 *  disabled when this routine returns and it is the callers responsibility
111 *  to either:
112 *
113 *   # Do something very short and then call
114 *      _SMP_lock_spinlock_nested_Release  or
115 *   # Do something very sort, call isr enable, then when ready
116 *      call isr_disable and _SMP_lock_spinlock_nested_Release
117 *
118 *  @param [in] lock is the address of the lock to obtain.
119 *
120 *  @retval This method returns with processor interrupts disabled.
121 *          The previous level is returned.
122 */
123ISR_Level _SMP_lock_spinlock_nested_Obtain(
124  SMP_lock_spinlock_nested_Control *lock
125);
126
127/**
128 *  @brief Release a lock.
129 *
130 *  This method is used to release the lock at @a lock.
131 *
132 *  @note ISR's are reenabled by this method and are expected to be
133 *  disabled upon entry to the method.
134 *
135 *  @param [in] lock is the address of the lock to obtain.
136 */
137void _SMP_lock_spinlock_nested_Release(
138  SMP_lock_spinlock_nested_Control  *lock,
139  ISR_Level                         level
140);
141
142#ifdef __cplusplus
143}
144#endif
145
146/**@}*/
147
148#endif
149/* end of include file */
Note: See TracBrowser for help on using the repository browser.