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