1 | /** |
---|
2 | * @file rtems/score/corespinlock.h |
---|
3 | * |
---|
4 | * @brief Constants and Structures Associated with the Spinlock Handler |
---|
5 | * |
---|
6 | * This include file contains all the constants and structures associated |
---|
7 | * with the Spinlock Handler. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2006. |
---|
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.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_SCORE_CORESPINLOCK_H |
---|
20 | #define _RTEMS_SCORE_CORESPINLOCK_H |
---|
21 | |
---|
22 | #include <rtems/score/object.h> |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | /** |
---|
29 | * @defgroup ScoreSpinlock Spinlock Handler |
---|
30 | * |
---|
31 | * @ingroup Score |
---|
32 | * |
---|
33 | * This handler encapsulates functionality which provides the foundation |
---|
34 | * Spinlock services used in all of the APIs supported by RTEMS. |
---|
35 | */ |
---|
36 | /**@{*/ |
---|
37 | |
---|
38 | /** |
---|
39 | * The following defines the control block used to manage the |
---|
40 | * attributes of each spinlock. |
---|
41 | */ |
---|
42 | typedef struct { |
---|
43 | /** This element indicates XXX |
---|
44 | */ |
---|
45 | uint32_t XXX; |
---|
46 | } CORE_spinlock_Attributes; |
---|
47 | |
---|
48 | /** |
---|
49 | * The following defines the control block used to manage each |
---|
50 | * spinlock. |
---|
51 | */ |
---|
52 | typedef struct { |
---|
53 | /** XXX may not be needed */ |
---|
54 | CORE_spinlock_Attributes Attributes; |
---|
55 | |
---|
56 | /** This field is the lock. |
---|
57 | */ |
---|
58 | volatile uint32_t lock; |
---|
59 | |
---|
60 | /** This field is a count of the current number of threads using |
---|
61 | * this spinlock. It includes the thread holding the lock as well |
---|
62 | * as those waiting. |
---|
63 | */ |
---|
64 | volatile uint32_t users; |
---|
65 | |
---|
66 | /** This field is the Id of the thread holding the lock. It may or may |
---|
67 | * not be the thread which acquired it. |
---|
68 | */ |
---|
69 | volatile Objects_Id holder; |
---|
70 | } CORE_spinlock_Control; |
---|
71 | |
---|
72 | /**@}*/ |
---|
73 | |
---|
74 | #ifdef __cplusplus |
---|
75 | } |
---|
76 | #endif |
---|
77 | |
---|
78 | #endif |
---|
79 | /* end of include file */ |
---|