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 import xdc.runtime.Error;
37 import xdc.runtime.Assert;
38
39 import xdc.rov.ViewInfo;
40
41 import ti.sysbios.knl.Swi;
42 import ti.sysbios.knl.Semaphore;
43 import ti.sdo.ipc.GateMP;
44 import ti.sdo.utils.INameServerRemote;
45
46 /*!
47 * ======== NameServerRemoteNotify ========
48 * Used by NameServer to communicate to remote processors.
49 *
50 * This module is used by {@link #ti.sdo.utils.NameServer} to communicate
51 * to remote processors using {@link ti.sdo.ipc.Notify} and shared memory.
52 * There needs to be one instance between each two cores in the system.
53 * Interrupts must be enabled before using this module. For critical
54 * memory management, a GateMP {@link #gate} can be specified. Currently
55 * supports transferring up to 300-bytes between two cores.
56 */
57 @InstanceInitError
58 @InstanceFinalize
59
60 module NameServerRemoteNotify inherits INameServerRemote
61 {
62 /*! @_nodoc */
63 metaonly struct BasicView {
64 UInt remoteProcId;
65 String remoteProcName;
66 String localRequestStatus;
67 String localInstanceName;
68 String localName;
69 String localValue;
70 String remoteRequestStatus;
71 String remoteInstanceName;
72 String remoteName;
73 String remoteValue;
74 }
75
76 /*!
77 * ======== rovViewInfo ========
78 */
79 @Facet
80 metaonly config ViewInfo.Instance rovViewInfo =
81 ViewInfo.create({
82 viewMap: [
83 ['Basic',
84 {
85 type: ViewInfo.INSTANCE,
86 viewInitFxn: 'viewInitBasic',
87 structName: 'BasicView'
88 }
89 ],
90 ]
91 });
92
93
94 struct Message {
95 Bits32 request;
96 Bits32 response;
97 Bits32 requestStatus;
98 Bits32 value;
99 Bits32 valueLen;
100 Bits32 instanceName[8];
101 Bits32 name[8];
102 Bits32 valueBuf[75];
103 };
104
105 /*!
106 * Assert raised when length of value larger then 300 bytes.
107 */
108 config xdc.runtime.Assert.Id A_invalidValueLen =
109 {msg: "A_invalidValueLen: Invalid valueLen (too large)"};
110
111 /*!
112 * ======== notifyEventId ========
113 * The Notify event ID.
114 */
115 config UInt notifyEventId = 4;
116
117 /*!
118 * ======== timeoutInMicroSecs ========
119 * The timeout value in terms of microseconds
120 *
121 * A NameServer request will return after this amout of time
122 * without a response. The default timeout value is to wait forever.
123 * To not wait, use the value of '0'.
124 */
125 config UInt timeoutInMicroSecs = ~(0);
126
127 instance:
128
129 /*!
130 * ======== sharedAddr ========
131 * Physical address of the shared memory
132 *
133 * The shared memory that will be used for maintaining shared state
134 * information. This value must be the same for both processors when
135 * creating the instance between a pair of processors.
136 */
137 config Ptr sharedAddr = null;
138
139 /*!
140 * ======== gate ========
141 * GateMP used for critical region management of the shared memory
142 *
143 * Using the default value of NULL will result in the default GateMP
144 * being used for context protection.
145 */
146 config GateMP.Handle gate = null;
147
148 internal:
149
150 151 152 153 154 155 156
157 config UInt timeout;
158
159 /*!
160 * ======== cbFxn ========
161 * The call back function registered with Notify.
162 *
163 * This function is registered with Notify as a call back function
164 * when the specified event is triggered. This function simply posts
165 * a Swi which will process the event.
166 *
167 * @param(procId) Source proc id
168 * @param(lineId) Interrupt line id
169 * @param(eventId) the Notify event id.
170 * @param(arg) the argument for the function.
171 * @param(payload) a 32-bit payload value.
172 */
173 Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
174 UInt32 payload);
175
176 /*!
177 * ======== swiFxn ========
178 * The swi function that will be executed during the call back.
179 *
180 * @param(arg) argument to swi function
181 */
182 Void swiFxn(UArg arg);
183
184
185 struct Instance_State {
186 Message *msg[2];
187 UInt16 regionId;
188 GateMP.Handle gate;
189 Semaphore.Object semRemoteWait;
190 Semaphore.Object semMultiBlock;
191 Swi.Object swiObj;
192 UInt16 remoteProcId;
193 Bool cacheEnable;
194 };
195 }