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 package ti.sdo.ipc.gates;
38
39 import xdc.runtime.Error;
40 import xdc.runtime.Assert;
41 import xdc.runtime.IGateProvider;
42 import xdc.runtime.Diags;
43 import xdc.runtime.Log;
44
45 import ti.sdo.ipc.interfaces.IGateMPSupport;
46
47 /*!
48 * ======== GateHWSpinlock ========
49 * Multiprocessor gate that utilizes a hardware spinlock
50 */
51 @ModuleStartup
52
53 module GateHWSpinlock inherits IGateMPSupport
54 {
55 /*!
56 * ======== BasicView ========
57 * @_nodoc
58 */
59 metaonly struct BasicView {
60 UInt lockNum;
61 UInt nested;
62 }
63
64 /*!
65 * ======== rovViewInfo ========
66 * @_nodoc
67 */
68 @Facet
69 metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
70 xdc.rov.ViewInfo.create({
71 viewMap: [
72 ['Basic',
73 {
74 type: xdc.rov.ViewInfo.INSTANCE,
75 viewInitFxn: 'viewInitBasic',
76 structName: 'BasicView'
77 }
78 ],
79 ]
80 });
81
82 /*!
83 * ======== LM_enter ========
84 * Logged on gate enter
85 */
86 config Log.Event LM_enter = {
87 mask: Diags.USER1,
88 msg: "LM_enter: Gate (lockNum = %d) entered, returning key = %d"
89 };
90
91 /*!
92 * ======== LM_leave ========
93 * Logged on gate leave
94 */
95 config Log.Event LM_leave = {
96 mask: Diags.USER1,
97 msg: "LM_leave: Gate (lockNum = %d) left using key = %d"
98 };
99
100 /*!
101 * ======== LM_create ========
102 * Logged on gate create
103 */
104 config Log.Event LM_create = {
105 mask: Diags.USER1,
106 msg: "LM_create: Gate (lockNum = %d) created"
107 };
108
109 /*!
110 * ======== LM_open ========
111 * Logged on gate open
112 */
113 config Log.Event LM_open = {
114 mask: Diags.USER1,
115 msg: "LM_open: Remote gate (lockNum = %d) opened"
116 };
117
118 /*!
119 * ======== LM_delete ========
120 * Logged on gate deletion
121 */
122 config Log.Event LM_delete = {
123 mask: Diags.USER1,
124 msg: "LM_delete: Gate (lockNum = %d) deleted"
125 };
126
127 /*!
128 * ======== LM_close ========
129 * Logged on gate close
130 */
131 config Log.Event LM_close = {
132 mask: Diags.USER1,
133 msg: "LM_close: Gate (lockNum = %d) closed"
134 };
135
136 /*!
137 * ======== A_invSpinLockNum ========
138 * Assert raised when provided lockNum is invalid for the relevant device
139 */
140 config Assert.Id A_invSpinLockNum = {
141 msg: "A_invSpinLockNum: Invalid hardware spinlock number"
142 };
143
144 /*! Device-specific base address for HW Semaphore subsystem */
145 config Ptr baseAddr = null;
146
147 /*!
148 * ======== setReserved ========
149 * Reserve a HW spinlock for use outside of IPC.
150 *
151 * GateMP will, by default, manage all HW spinlocks on the device unless
152 * this API is used to set aside specific spinlocks for use outside
153 * of IPC.
154 *
155 * @param(lockNum) HW spinlock number to reserve
156 */
157 metaonly Void setReserved(UInt lockNum);
158
159
160
161 instance:
162
163 /*!
164 * @_nodoc
165 * ======== enter ========
166 * Enter this gate
167 */
168 @DirectCall
169 override IArg enter();
170
171 /*!
172 * @_nodoc
173 * ======== leave ========
174 * Leave this gate
175 */
176 @DirectCall
177 override Void leave(IArg key);
178
179 internal:
180
181 /*! Device-specific number of semphores in the HW Semaphore subsystem */
182 config UInt numLocks;
183
184 /*! Mask of reserved HW spinlocks */
185 config Bits32 reservedMaskArr[];
186
187 struct Instance_State {
188 UInt lockNum;
189 UInt nested;
190 IGateProvider.Handle localGate;
191 };
192 }