[processor-sdk/performance-audio-sr.git] / ipc_3_43_00_00_eng / docs / cdoc / ti / sdo / ipc / nsremote / NameServerRemoteNotify-src.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html><head><title>module ti.sdo.ipc.nsremote.NameServerRemoteNotify</title>
3 <meta name="googlebot" content="noindex,nofollow">
4 <link rel="stylesheet" type="text/css" href="../../../../src.css"/>
5 </head>
6 <body>
7 <pre class=src>
8 1 <span class="comment">/*
9 </span> 2 <span class="comment"> * Copyright (c) 2012-2013, Texas Instruments Incorporated
10 </span> 3 <span class="comment"> * All rights reserved.
11 </span> 4 <span class="comment"> *
12 </span> 5 <span class="comment"> * Redistribution and use in source and binary forms, with or without
13 </span> 6 <span class="comment"> * modification, are permitted provided that the following conditions
14 </span> 7 <span class="comment"> * are met:
15 </span> 8 <span class="comment"> *
16 </span> 9 <span class="comment"> * * Redistributions of source code must retain the above copyright
17 </span> 10 <span class="comment"> * notice, this list of conditions and the following disclaimer.
18 </span> 11 <span class="comment"> *
19 </span> 12 <span class="comment"> * * Redistributions in binary form must reproduce the above copyright
20 </span> 13 <span class="comment"> * notice, this list of conditions and the following disclaimer in the
21 </span> 14 <span class="comment"> * documentation and/or other materials provided with the distribution.
22 </span> 15 <span class="comment"> *
23 </span> 16 <span class="comment"> * * Neither the name of Texas Instruments Incorporated nor the names of
24 </span> 17 <span class="comment"> * its contributors may be used to endorse or promote products derived
25 </span> 18 <span class="comment"> * from this software without specific prior written permission.
26 </span> 19 <span class="comment"> *
27 </span> 20 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 </span> 21 <span class="comment"> * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29 </span> 22 <span class="comment"> * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 </span> 23 <span class="comment"> * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
31 </span> 24 <span class="comment"> * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 </span> 25 <span class="comment"> * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 </span> 26 <span class="comment"> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
34 </span> 27 <span class="comment"> * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35 </span> 28 <span class="comment"> * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
36 </span> 29 <span class="comment"> * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
37 </span> 30 <span class="comment"> * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 </span> 31 <span class="comment"> */</span>
39 32 <span class="comment">/*
40 </span> 33 <span class="comment"> * ======== NameServerRemoteNotify.xdc ========
41 </span> 34 <span class="comment"> */</span>
42 35
43 36 import xdc.runtime.Error;
44 37 import xdc.runtime.Assert;
45 38
46 39 import xdc.rov.ViewInfo;
47 40
48 41 import ti.sysbios.knl.Swi;
49 42 import ti.sysbios.knl.Semaphore;
50 43 import ti.sdo.ipc.GateMP;
51 44 import ti.sdo.utils.INameServerRemote;
52 45
53 46 <span class="xdoc">/*!
54 </span> 47 <span class="xdoc"> * ======== NameServerRemoteNotify ========
55 </span> 48 <span class="xdoc"> * Used by NameServer to communicate to remote processors.
56 </span> 49 <span class="xdoc"> *
57 </span> 50 <span class="xdoc"> * This module is used by {<b>@link</b> #ti.sdo.utils.NameServer} to communicate
58 </span> 51 <span class="xdoc"> * to remote processors using {<b>@link</b> ti.sdo.ipc.Notify} and shared memory.
59 </span> 52 <span class="xdoc"> * There needs to be one instance between each two cores in the system.
60 </span> 53 <span class="xdoc"> * Interrupts must be enabled before using this module. For critical
61 </span> 54 <span class="xdoc"> * memory management, a GateMP {<b>@link</b> #gate} can be specified. Currently
62 </span> 55 <span class="xdoc"> * supports transferring up to 300-bytes between two cores.
63 </span> 56 <span class="xdoc"> */</span>
64 57 @InstanceInitError
65 58 @InstanceFinalize
66 59
67 60 <span class=key>module</span> NameServerRemoteNotify <span class=key>inherits</span> INameServerRemote
68 61 {
69 62 <span class="xdoc">/*! <b>@_nodoc</b> */</span>
70 63 <span class=key>metaonly</span> <span class=key>struct</span> BasicView {
71 64 UInt remoteProcId;
72 65 String remoteProcName;
73 66 String localRequestStatus;
74 67 String localInstanceName;
75 68 String localName;
76 69 String localValue;
77 70 String remoteRequestStatus;
78 71 String remoteInstanceName;
79 72 String remoteName;
80 73 String remoteValue;
81 74 }
82 75
83 76 <span class="xdoc">/*!
84 </span> 77 <span class="xdoc"> * ======== rovViewInfo ========
85 </span> 78 <span class="xdoc"> */</span>
86 79 @Facet
87 80 <span class=key>metaonly</span> <span class=key>config</span> ViewInfo.Instance rovViewInfo =
88 81 ViewInfo.create({
89 82 viewMap: [
90 83 [<span class="string">'Basic'</span>,
91 84 {
92 85 type: ViewInfo.INSTANCE,
93 86 viewInitFxn: <span class="string">'viewInitBasic'</span>,
94 87 structName: <span class="string">'BasicView'</span>
95 88 }
96 89 ],
97 90 ]
98 91 });
99 92
100 93 <span class="comment">/* structure in shared memory for retrieving value */</span>
101 94 <span class=key>struct</span> Message {
102 95 Bits32 requestStatus; <span class="comment">/* if request sucessful set to 1 */</span>
103 96 Bits32 value; <span class="comment">/* holds value if len <= 4 */</span>
104 97 Bits32 valueLen; <span class="comment">/* len of value */</span>
105 98 Bits32 instanceName[8]; <span class="comment">/* name of NameServer instance */</span>
106 99 Bits32 name[8]; <span class="comment">/* name of NameServer entry */</span>
107 100 Bits32 valueBuf[77]; <span class="comment">/* padded to fill 128-B cache line */</span>
108 101 };
109 102
110 103 <span class="xdoc">/*!
111 </span> 104 <span class="xdoc"> * Assert raised when length of value larger then 300 bytes.
112 </span> 105 <span class="xdoc"> */</span>
113 106 <span class=key>config</span> xdc.runtime.Assert.Id A_invalidValueLen =
114 107 {msg: <span class="string">"A_invalidValueLen: Invalid valueLen (too large)"</span>};
115 108
116 109 <span class="xdoc">/*!
117 </span> 110 <span class="xdoc"> * Message structure size is not aligned on cache line size.
118 </span> 111 <span class="xdoc"> *
119 </span> 112 <span class="xdoc"> * The message structure size must be an exact multiple of the
120 </span> 113 <span class="xdoc"> * cache line size.
121 </span> 114 <span class="xdoc"> */</span>
122 115 <span class=key>config</span> xdc.runtime.Assert.Id A_messageSize =
123 116 {msg: <span class="string">"A_messageSize: message size not aligned with cache line size."</span>};
124 117
125 118 <span class="xdoc">/*!
126 </span> 119 <span class="xdoc"> * ======== notifyEventId ========
127 </span> 120 <span class="xdoc"> * The Notify event ID.
128 </span> 121 <span class="xdoc"> */</span>
129 122 <span class=key>config</span> UInt notifyEventId = 4;
130 123
131 124 <span class="xdoc">/*!
132 </span> 125 <span class="xdoc"> * ======== timeoutInMicroSecs ========
133 </span> 126 <span class="xdoc"> * The timeout value in terms of microseconds
134 </span> 127 <span class="xdoc"> *
135 </span> 128 <span class="xdoc"> * A NameServer request will return after this amout of time
136 </span> 129 <span class="xdoc"> * without a response. The default timeout value is to wait forever.
137 </span> 130 <span class="xdoc"> * To not wait, use the value of '0'.
138 </span> 131 <span class="xdoc"> */</span>
139 132 <span class=key>config</span> UInt timeoutInMicroSecs = ~(0);
140 133
141 134 <span class=key>instance</span>:
142 135
143 136 <span class="xdoc">/*!
144 </span> 137 <span class="xdoc"> * ======== sharedAddr ========
145 </span> 138 <span class="xdoc"> * Physical address of the shared memory
146 </span> 139 <span class="xdoc"> *
147 </span> 140 <span class="xdoc"> * The shared memory that will be used for maintaining shared state
148 </span> 141 <span class="xdoc"> * information. This value must be the same for both processors when
149 </span> 142 <span class="xdoc"> * creating the instance between a pair of processors.
150 </span> 143 <span class="xdoc"> */</span>
151 144 <span class=key>config</span> Ptr sharedAddr = <span class=key>null</span>;
152 145
153 146 <span class="xdoc">/*!
154 </span> 147 <span class="xdoc"> * ======== gate ========
155 </span> 148 <span class="xdoc"> * GateMP used for critical region management of the shared memory
156 </span> 149 <span class="xdoc"> *
157 </span> 150 <span class="xdoc"> * Using the default value of NULL will result in the default GateMP
158 </span> 151 <span class="xdoc"> * being used for context protection.
159 </span> 152 <span class="xdoc"> */</span>
160 153 <span class=key>config</span> GateMP.Handle gate = <span class=key>null</span>;
161 154
162 155 <span class=key>internal</span>:
163 156
164 157 <span class="comment">/*
165 </span> 158 <span class="comment"> * ======== timeout ========
166 </span> 159 <span class="comment"> * The timeout value to pass into Semaphore_pend
167 </span> 160 <span class="comment"> *
168 </span> 161 <span class="comment"> * This value is calculated based on timeoutInMicroSecs and the
169 </span> 162 <span class="comment"> * SYSBIOS clock.tickPeriod.
170 </span> 163 <span class="comment"> */</span>
171 164 <span class=key>config</span> UInt timeout;
172 165
173 166 <span class="xdoc">/*!
174 </span> 167 <span class="xdoc"> * ======== cbFxn ========
175 </span> 168 <span class="xdoc"> * The call back function registered with Notify.
176 </span> 169 <span class="xdoc"> *
177 </span> 170 <span class="xdoc"> * This function is registered with Notify as a call back function
178 </span> 171 <span class="xdoc"> * when the specified event is triggered. This function simply posts
179 </span> 172 <span class="xdoc"> * a Swi which will process the event.
180 </span> 173 <span class="xdoc"> *
181 </span> 174 <span class="xdoc"> * <b>@param(procId)</b> Source proc id
182 </span> 175 <span class="xdoc"> * <b>@param(lineId)</b> Interrupt line id
183 </span> 176 <span class="xdoc"> * <b>@param(eventId)</b> the Notify event id.
184 </span> 177 <span class="xdoc"> * <b>@param(arg)</b> the argument for the function.
185 </span> 178 <span class="xdoc"> * <b>@param(payload)</b> a 32-bit payload value.
186 </span> 179 <span class="xdoc"> */</span>
187 180 Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
188 181 UInt32 payload);
189 182
190 183 <span class="xdoc">/*!
191 </span> 184 <span class="xdoc"> * ======== swiFxnRequest ========
192 </span> 185 <span class="xdoc"> * The swi function which handles a request message
193 </span> 186 <span class="xdoc"> *
194 </span> 187 <span class="xdoc"> * <b>@param(arg)</b> pointer to the instance object
195 </span> 188 <span class="xdoc"> */</span>
196 189 Void swiFxnRequest(UArg arg);
197 190
198 191 <span class="xdoc">/*!
199 </span> 192 <span class="xdoc"> * ======== swiFxnResponse ========
200 </span> 193 <span class="xdoc"> * The swi function that which handles a response message
201 </span> 194 <span class="xdoc"> *
202 </span> 195 <span class="xdoc"> * <b>@param(arg)</b> pointer to the instance object
203 </span> 196 <span class="xdoc"> */</span>
204 197 Void swiFxnResponse(UArg arg);
205 198
206 199 <span class="xdoc">/*! no pending messages */</span>
207 200 <span class=key>const</span> UInt8 IDLE = 0;
208 201
209 202 <span class="xdoc">/*! sending a request message to another processor */</span>
210 203 <span class=key>const</span> UInt8 SEND_REQUEST = 1;
211 204
212 205 <span class="xdoc">/*! receiving a response message (in reply to a sent request) */</span>
213 206 <span class=key>const</span> UInt8 RECEIVE_RESPONSE = 2;
214 207
215 208 <span class="xdoc">/*! receiving a request from a remote processor (unsolicited message) */</span>
216 209 <span class=key>const</span> UInt8 RECEIVE_REQUEST = 1;
217 210
218 211 <span class="xdoc">/*! sending a response message (in reply to a received request) */</span>
219 212 <span class=key>const</span> UInt8 SEND_RESPONSE = 2;
220 213
221 214 <span class="comment">/* instance state */</span>
222 215 <span class=key>struct</span> Instance_State {
223 216 Message *msg[2]; <span class="comment">/* Ptrs to messages in shared mem */</span>
224 217 UInt16 regionId; <span class="comment">/* SharedRegion ID */</span>
225 218 UInt8 localState; <span class="comment">/* state of local message */</span>
226 219 UInt8 remoteState; <span class="comment">/* state of remote message */</span>
227 220 GateMP.Handle gate; <span class="comment">/* remote and local gate protect */</span>
228 221 UInt16 remoteProcId; <span class="comment">/* remote MultiProc id */</span>
229 222 Bool cacheEnable; <span class="comment">/* cacheability */</span>
230 223 Semaphore.Object semRemoteWait; <span class="comment">/* sem to wait on remote proc */</span>
231 224 Semaphore.Object semMultiBlock; <span class="comment">/* sem to block multiple threads */</span>
232 225 Swi.Object swiRequest; <span class="comment">/* handle a request message */</span>
233 226 Swi.Object swiResponse; <span class="comment">/* handle a response message */</span>
234 227 };
235 228 }
236 </pre>
237 </body></html>