[processor-sdk/performance-audio-sr.git] / psdk_cust / ipc_3_43_00_00_eng / docs / cdoc / ti / sdo / utils / NameServer-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.utils.NameServer</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-2015 Texas Instruments Incorporated - http://www.ti.com
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"> * ======== NameServer.xdc ========
41 </span> 34 <span class="comment"> *
42 </span> 35 <span class="comment"> */</span>
43 36
44 37 import xdc.runtime.Error;
45 38 import xdc.runtime.Assert;
46 39 import xdc.runtime.IHeap;
47 40 import ti.sysbios.gates.GateSwi;
48 41 import xdc.rov.ViewInfo;
49 42
50 43 <span class="xdoc">/*!
51 </span> 44 <span class="xdoc"> * ======== NameServer ========
52 </span> 45 <span class="xdoc"> * Manages and serves names to remote/local processor
53 </span> 46 <span class="xdoc"> *
54 </span> 47 <span class="xdoc"> * <b>@p(html)</b>
55 </span> 48 <span class="xdoc"> * This module has a common header that can be found in the {<b>@link</b> ti.ipc}
56 </span> 49 <span class="xdoc"> * package. Application code should include the common header file (not the
57 </span> 50 <span class="xdoc"> * RTSC-generated one):
58 </span> 51 <span class="xdoc"> *
59 </span> 52 <span class="xdoc"> * <PRE>#include &lt;ti/ipc/NameServer.h&gt;</PRE>
60 </span> 53 <span class="xdoc"> *
61 </span> 54 <span class="xdoc"> * The RTSC module must be used in the application's RTSC configuration file
62 </span> 55 <span class="xdoc"> * (.cfg) if runtime APIs will be used in the application:
63 </span> 56 <span class="xdoc"> *
64 </span> 57 <span class="xdoc"> * <PRE>NameServer = xdc.useModule('ti.sdo.ipc.NameServer');</PRE>
65 </span> 58 <span class="xdoc"> *
66 </span> 59 <span class="xdoc"> * Documentation for all runtime APIs, instance configuration parameters,
67 </span> 60 <span class="xdoc"> * error codes macros and type definitions available to the application
68 </span> 61 <span class="xdoc"> * integrator can be found in the
69 </span> 62 <span class="xdoc"> * <A HREF="../../../../doxygen/html/files.html">Doxygen documenation</A>
70 </span> 63 <span class="xdoc"> * for the IPC product. However, the documentation presented on this page
71 </span> 64 <span class="xdoc"> * should be referred to for information specific to the RTSC module, such as
72 </span> 65 <span class="xdoc"> * module configuration, Errors, and Asserts.
73 </span> 66 <span class="xdoc"> * <b>@p</b>
74 </span> 67 <span class="xdoc"> *
75 </span> 68 <span class="xdoc"> * <b>@a(Note)</b>
76 </span> 69 <span class="xdoc"> * This modules reflects upon the {<b>@link</b> ti.sdo.utils.MultiProc#procAddrMode}
77 </span> 70 <span class="xdoc"> * configuration parameter. Some internal data structure allocations are
78 </span> 71 <span class="xdoc"> * optimized for the given processor address mode. For example, when using
79 </span> 72 <span class="xdoc"> * MultiProc.ProcAddrMode_Global, resource is allocated for every processor
80 </span> 73 <span class="xdoc"> * in the system. When using MultiProc.ProcAddrMode_Cluster, resources are
81 </span> 74 <span class="xdoc"> * only allocated for processors in the cluster. A side-effect is that when
82 </span> 75 <span class="xdoc"> * using Cluster mode, name queries cannot be addressed to processors
83 </span> 76 <span class="xdoc"> * outside of the cluster.
84 </span> 77 <span class="xdoc"> */</span>
85 78
86 79 @ModuleStartup
87 80 @InstanceInitError <span class="comment">/* Initialization may throw errors */</span>
88 81 @InstanceFinalize
89 82
90 83 <span class=key>module</span> NameServer
91 84 {
92 85 <span class="xdoc">/*!
93 </span> 86 <span class="xdoc"> * ======== BasicView ========
94 </span> 87 <span class="xdoc"> * <b>@_nodoc</b>
95 </span> 88 <span class="xdoc"> */</span>
96 89 <span class=key>metaonly</span> <span class=key>struct</span> BasicView {
97 90 String name;
98 91 Bool checkExisting;
99 92 UInt maxNameLen;
100 93 UInt maxValueLen;
101 94 UInt numStatic;
102 95 String numDynamic;
103 96 }
104 97
105 98 <span class="xdoc">/*!
106 </span> 99 <span class="xdoc"> * ======== NamesListView ========
107 </span> 100 <span class="xdoc"> * <b>@_nodoc</b>
108 </span> 101 <span class="xdoc"> */</span>
109 102 <span class=key>metaonly</span> <span class=key>struct</span> NamesListView {
110 103 String name;
111 104 String value;
112 105 UInt len;
113 106 Ptr nsKey;
114 107 }
115 108
116 109 <span class="xdoc">/*!
117 </span> 110 <span class="xdoc"> * ======== rovViewInfo ========
118 </span> 111 <span class="xdoc"> * <b>@_nodoc</b>
119 </span> 112 <span class="xdoc"> */</span>
120 113 @Facet
121 114 <span class=key>metaonly</span> <span class=key>config</span> xdc.rov.ViewInfo.Instance rovViewInfo =
122 115 xdc.rov.ViewInfo.create({
123 116 viewMap: [
124 117 [<span class="string">'Basic'</span>,
125 118 {
126 119 type: xdc.rov.ViewInfo.INSTANCE,
127 120 viewInitFxn: <span class="string">'viewInitBasic'</span>,
128 121 structName: <span class="string">'BasicView'</span>
129 122 }
130 123 ],
131 124 [<span class="string">'NamesValues'</span>,
132 125 {
133 126 type: xdc.rov.ViewInfo.INSTANCE_DATA,
134 127 viewInitFxn: <span class="string">'viewInitData'</span>,
135 128 structName: <span class="string">'NamesListView'</span>
136 129 }
137 130 ]
138 131 ]
139 132 });
140 133
141 134 <span class="xdoc">/*!
142 </span> 135 <span class="xdoc"> * Assert raised when the name or value is too long
143 </span> 136 <span class="xdoc"> */</span>
144 137 <span class=key>config</span> Assert.Id A_invalidLen = {
145 138 msg: <span class="string">"A_invalidLen: Invalid length"</span>
146 139 };
147 140
148 141 <span class="xdoc">/*!
149 </span> 142 <span class="xdoc"> * ======== A_invArgument ========
150 </span> 143 <span class="xdoc"> * Assert raised when an argument is invalid
151 </span> 144 <span class="xdoc"> */</span>
152 145 <span class=key>config</span> Assert.Id A_invArgument = {
153 146 msg: <span class="string">"A_invArgument: Invalid argument supplied"</span>
154 147 };
155 148
156 149 <span class="xdoc">/*!
157 </span> 150 <span class="xdoc"> * Error raised if all the entries in the instance Name/Value table
158 </span> 151 <span class="xdoc"> * are taken
159 </span> 152 <span class="xdoc"> */</span>
160 153 <span class=key>config</span> Error.Id E_maxReached = {
161 154 msg: <span class="string">"E_maxReached: All entries in use. NameServer.maxRuntimeEntries is %d"</span>
162 155 };
163 156
164 157 <span class="xdoc">/*!
165 </span> 158 <span class="xdoc"> * Error raised when the name already exists in the instance
166 </span> 159 <span class="xdoc"> * Name/Value table
167 </span> 160 <span class="xdoc"> */</span>
168 161 <span class=key>config</span> Error.Id E_entryExists = {
169 162 msg: <span class="string">"E_entryExists: %s name already in table "</span>
170 163 };
171 164
172 165 <span class="xdoc">/*!
173 </span> 166 <span class="xdoc"> * Error raised when creation parameters do not match those of an
174 </span> 167 <span class="xdoc"> * existing NameServer
175 </span> 168 <span class="xdoc"> */</span>
176 169 <span class=key>config</span> Error.Id E_paramMismatch = {
177 170 msg: <span class="string">"E_paramMismatch: parameters do not match existing NameServer %s "</span>
178 171 };
179 172
180 173 <span class="xdoc">/*!
181 </span> 174 <span class="xdoc"> * Allow dynamic growth of the NameServer instance table
182 </span> 175 <span class="xdoc"> *
183 </span> 176 <span class="xdoc"> * This value can be used to set the {<b>@link</b> #maxRuntimeEntries}.
184 </span> 177 <span class="xdoc"> * This flag tells NameServer to allow dynamic growth
185 </span> 178 <span class="xdoc"> * of the table.
186 </span> 179 <span class="xdoc"> */</span>
187 180 <span class=key>const</span> UInt ALLOWGROWTH = (~0);
188 181
189 182 <span class="xdoc">/*!
190 </span> 183 <span class="xdoc"> * Structure of entry in Name/Value table
191 </span> 184 <span class="xdoc"> *
192 </span> 185 <span class="xdoc"> * This structure is returned from the {<b>@link</b> #getMeta}
193 </span> 186 <span class="xdoc"> * API.
194 </span> 187 <span class="xdoc"> *
195 </span> 188 <span class="xdoc"> * <b>@field(name)</b> Name portion of the name/value pair.
196 </span> 189 <span class="xdoc"> * <b>@field(len)</b> Length of the value field.
197 </span> 190 <span class="xdoc"> * <b>@field(value)</b> Value portion of the name/value entry.
198 </span> 191 <span class="xdoc"> */</span>
199 192 <span class=key>metaonly</span> <span class=key>struct</span> Entry {
200 193 String name;
201 194 UInt len;
202 195 UArg value;
203 196 };
204 197
205 198 <span class="xdoc">/*!
206 </span> 199 <span class="xdoc"> * ======== SetupProxy ========
207 </span> 200 <span class="xdoc"> * NameServer setup proxy
208 </span> 201 <span class="xdoc"> */</span>
209 202 <span class=key>proxy</span> SetupProxy <span class=key>inherits</span> INameServerRemote;
210 203
211 204 <span class="xdoc">/*!
212 </span> 205 <span class="xdoc"> * ======== isRegistered ========
213 </span> 206 <span class="xdoc"> * Determines if a remote driver is registered for the specified id.
214 </span> 207 <span class="xdoc"> *
215 </span> 208 <span class="xdoc"> * <b>@param(procId)</b> The remote processor id.
216 </span> 209 <span class="xdoc"> */</span>
217 210 @DirectCall
218 211 Bool isRegistered(UInt16 procId);
219 212
220 213 <span class="xdoc">/*!
221 </span> 214 <span class="xdoc"> * ======== registerRemoteDriver ========
222 </span> 215 <span class="xdoc"> * Register the NameServer remote handle for the specified processor id.
223 </span> 216 <span class="xdoc"> *
224 </span> 217 <span class="xdoc"> * This function is used by NameServer remote driver to register
225 </span> 218 <span class="xdoc"> * themselves with NameServer. Only one remote driver can be registered
226 </span> 219 <span class="xdoc"> * with a remote processor. The API returns {<b>@link</b> #Status_FAIL} if there
227 </span> 220 <span class="xdoc"> * is already a registered remote driver for the processor id.
228 </span> 221 <span class="xdoc"> *
229 </span> 222 <span class="xdoc"> * <b>@param(handle)</b> The handle for a NameServer remote driver instance.
230 </span> 223 <span class="xdoc"> * <b>@param(procId)</b> The remote processor id.
231 </span> 224 <span class="xdoc"> *
232 </span> 225 <span class="xdoc"> * <b>@b(returns)</b> Returns {<b>@link</b> #Status_SUCCESS} if successful or
233 </span> 226 <span class="xdoc"> * {<b>@link</b> #Status_FAIL} if the processor id has already
234 </span> 227 <span class="xdoc"> * been set.
235 </span> 228 <span class="xdoc"> */</span>
236 229 @DirectCall
237 230 Int registerRemoteDriver(INameServerRemote.Handle handle, UInt16 procId);
238 231
239 232 <span class="xdoc">/*!
240 </span> 233 <span class="xdoc"> * ======== unregisterRemoteDriver ========
241 </span> 234 <span class="xdoc"> * Unregister the NameServer remote handle for the specified processor id.
242 </span> 235 <span class="xdoc"> *
243 </span> 236 <span class="xdoc"> * This function is used by NameServer Remote implementations to unregister
244 </span> 237 <span class="xdoc"> * themselves with NameServer.
245 </span> 238 <span class="xdoc"> *
246 </span> 239 <span class="xdoc"> * <b>@param(procId)</b> The remote processor id to unregister.
247 </span> 240 <span class="xdoc"> */</span>
248 241 @DirectCall
249 242 Void unregisterRemoteDriver(UInt16 procId);
250 243
251 244 <span class="xdoc">/*!
252 </span> 245 <span class="xdoc"> * ======== modAddMeta ========
253 </span> 246 <span class="xdoc"> * Add a name/value pair into the specified instance's table during
254 </span> 247 <span class="xdoc"> * configuration
255 </span> 248 <span class="xdoc"> *
256 </span> 249 <span class="xdoc"> * This function adds any length value into the local table. The function
257 </span> 250 <span class="xdoc"> * makes sure the name does not already exist in the local table.
258 </span> 251 <span class="xdoc"> *
259 </span> 252 <span class="xdoc"> * This function should be used by modules when adding into a NameServer
260 </span> 253 <span class="xdoc"> * instance. The application configuration file, should
261 </span> 254 <span class="xdoc"> * use {<b>@link</b> #addMeta}.
262 </span> 255 <span class="xdoc"> *
263 </span> 256 <span class="xdoc"> * The function does not query remote processors to make sure the
264 </span> 257 <span class="xdoc"> * name is unique.
265 </span> 258 <span class="xdoc"> *
266 </span> 259 <span class="xdoc"> * <b>@param(instName)</b> NameServer instance name
267 </span> 260 <span class="xdoc"> * <b>@param(name)</b> Name portion of the name/value pair
268 </span> 261 <span class="xdoc"> * <b>@param(value)</b> Value portion of the name/value pair
269 </span> 262 <span class="xdoc"> * <b>@param(len)</b> Length of the value buffer
270 </span> 263 <span class="xdoc"> */</span>
271 264 <span class=key>metaonly</span> Void modAddMeta(String instName, String name, Any value, UInt len);
272 265
273 266 <span class="xdoc">/*!
274 </span> 267 <span class="xdoc"> * ======== getName$view ========
275 </span> 268 <span class="xdoc"> * <b>@_nodoc</b>
276 </span> 269 <span class="xdoc"> * Used at ROV time to display reverse-lookup name from 32-bit value and
277 </span> 270 <span class="xdoc"> * tableName
278 </span> 271 <span class="xdoc"> */</span>
279 272 <span class=key>metaonly</span> String getName$view(String tableName, UInt32 value);
280 273
281 274 <span class="xdoc">/*!
282 </span> 275 <span class="xdoc"> * ======== getNameByKey$view ========
283 </span> 276 <span class="xdoc"> * <b>@_nodoc</b>
284 </span> 277 <span class="xdoc"> * ROV function for retrieving an entry by its address. Throws an exception
285 </span> 278 <span class="xdoc"> * if the name was not found
286 </span> 279 <span class="xdoc"> */</span>
287 280 <span class=key>metaonly</span> String getNameByKey$view(Ptr addr);
288 281
289 282
290 283 <span class=key>instance</span>:
291 284
292 285 <span class="xdoc">/*!
293 </span> 286 <span class="xdoc"> * Maximum number of name/value pairs that can be dynamically created.
294 </span> 287 <span class="xdoc"> *
295 </span> 288 <span class="xdoc"> * This parameter allows NameServer to pre-allocate memory.
296 </span> 289 <span class="xdoc"> * When NameServer_add or NameServer_addUInt32 is called, no memory
297 </span> 290 <span class="xdoc"> * allocation occurs.
298 </span> 291 <span class="xdoc"> *
299 </span> 292 <span class="xdoc"> * If the number of pairs is not known at configuration time, set this
300 </span> 293 <span class="xdoc"> * value to {<b>@link</b> #ALLOWGROWTH}. This instructs NameServer to grow the
301 </span> 294 <span class="xdoc"> * table as needed. NameServer will allocate memory from the
302 </span> 295 <span class="xdoc"> * {<b>@link</b> #tableHeap} when a name/value pair is added.
303 </span> 296 <span class="xdoc"> *
304 </span> 297 <span class="xdoc"> * The default is {<b>@link</b> #ALLOWGROWTH}.
305 </span> 298 <span class="xdoc"> */</span>
306 299 <span class=key>config</span> UInt maxRuntimeEntries = ALLOWGROWTH;
307 300
308 301 <span class="xdoc">/*!
309 </span> 302 <span class="xdoc"> * Name/value table is allocated from this heap.
310 </span> 303 <span class="xdoc"> *
311 </span> 304 <span class="xdoc"> * The instance table and related buffers are allocated out of this heap
312 </span> 305 <span class="xdoc"> * during the dynamic create. This heap is also used to allocate new
313 </span> 306 <span class="xdoc"> * name/value pairs when {<b>@link</b> #ALLOWGROWTH} for
314 </span> 307 <span class="xdoc"> * {<b>@link</b> #maxRuntimeEntries}
315 </span> 308 <span class="xdoc"> *
316 </span> 309 <span class="xdoc"> * The default is to use the same heap that instances are allocated
317 </span> 310 <span class="xdoc"> * from which can be configured via the
318 </span> 311 <span class="xdoc"> * NameServer.common$.instanceHeap configuration parameter.
319 </span> 312 <span class="xdoc"> */</span>
320 313 <span class=key>config</span> IHeap.Handle tableHeap = <span class=key>null</span>;
321 314
322 315 <span class="xdoc">/*!
323 </span> 316 <span class="xdoc"> * Name/value table is placed into this section on static creates.
324 </span> 317 <span class="xdoc"> *
325 </span> 318 <span class="xdoc"> * The instance table and related buffers are placed into this section
326 </span> 319 <span class="xdoc"> * during the static create.
327 </span> 320 <span class="xdoc"> *
328 </span> 321 <span class="xdoc"> * The default is no explicit section placement.
329 </span> 322 <span class="xdoc"> */</span>
330 323 <span class=key>metaonly</span> <span class=key>config</span> String tableSection = <span class=key>null</span>;
331 324
332 325 <span class="xdoc">/*!
333 </span> 326 <span class="xdoc"> * Check if a name already exists in the name/value table.
334 </span> 327 <span class="xdoc"> *
335 </span> 328 <span class="xdoc"> * When a name/value pair is added during runtime, if this boolean is true,
336 </span> 329 <span class="xdoc"> * the table is searched to see if the name already exists. If it does,
337 </span> 330 <span class="xdoc"> * the name is not added and the {<b>@link</b> #E_entryExists} error is raised.
338 </span> 331 <span class="xdoc"> *
339 </span> 332 <span class="xdoc"> * If this flag is false, the table will not be checked to see if the name
340 </span> 333 <span class="xdoc"> * already exists. It will simply be added. This mode has better
341 </span> 334 <span class="xdoc"> * performance at the expense of potentially having non-unique names in the
342 </span> 335 <span class="xdoc"> * table.
343 </span> 336 <span class="xdoc"> *
344 </span> 337 <span class="xdoc"> * This flag is used for runtime adds only. Adding non-unique names during
345 </span> 338 <span class="xdoc"> * configuration results in a build error.
346 </span> 339 <span class="xdoc"> */</span>
347 340 <span class=key>config</span> Bool checkExisting = <span class=key>true</span>;
348 341
349 342 <span class="xdoc">/*!
350 </span> 343 <span class="xdoc"> * Length, in MAUs, of the value field in the table.
351 </span> 344 <span class="xdoc"> *
352 </span> 345 <span class="xdoc"> * Any value less than sizeof(UInt32) will be rounded up to sizeof(UInt32).
353 </span> 346 <span class="xdoc"> */</span>
354 347 <span class=key>config</span> UInt maxValueLen = 0;
355 348
356 349 <span class="xdoc">/*!
357 </span> 350 <span class="xdoc"> * Length, in MAUs, of the name field in the table.
358 </span> 351 <span class="xdoc"> *
359 </span> 352 <span class="xdoc"> * The maximum length of the name portion of the name/value
360 </span> 353 <span class="xdoc"> * pair. The length includes the null terminator ('\0').
361 </span> 354 <span class="xdoc"> */</span>
362 355 <span class=key>config</span> UInt maxNameLen = 16;
363 356
364 357 <span class="xdoc">/*!
365 </span> 358 <span class="xdoc"> * ======== metaTable ========
366 </span> 359 <span class="xdoc"> * <b>@_nodoc</b>
367 </span> 360 <span class="xdoc"> * Table to hold the statically added name/value pairs until
368 </span> 361 <span class="xdoc"> * they ready to be added to the object.
369 </span> 362 <span class="xdoc"> */</span>
370 363 <span class=key>metaonly</span> <span class=key>config</span> Entry metaTable[];
371 364
372 365 <span class="xdoc">/*!
373 </span> 366 <span class="xdoc"> * ======== create ========
374 </span> 367 <span class="xdoc"> * <b>@_nodoc</b> (Refer to doxygen for ti/ipc/NameServer.h)
375 </span> 368 <span class="xdoc"> * Create a NameServer instance
376 </span> 369 <span class="xdoc"> *
377 </span> 370 <span class="xdoc"> * This function creates a NameServer instance. The name is
378 </span> 371 <span class="xdoc"> * used for remote processor queries and diagnostic tools. For
379 </span> 372 <span class="xdoc"> * single processor system (e.g. no remote queries), the name
380 </span> 373 <span class="xdoc"> * can be NULL.
381 </span> 374 <span class="xdoc"> *
382 </span> 375 <span class="xdoc"> * <b>@param(name)</b> Name of the instance
383 </span> 376 <span class="xdoc"> */</span>
384 377 create(String name);
385 378
386 379 <span class="xdoc">/*!
387 </span> 380 <span class="xdoc"> * ======== addUInt32Meta ========
388 </span> 381 <span class="xdoc"> * Add a name/value pair into the instance's table during configuration
389 </span> 382 <span class="xdoc"> *
390 </span> 383 <span class="xdoc"> * This function adds a UInt32 value into the local table. The function
391 </span> 384 <span class="xdoc"> * makes sure the name does not already exist in the local table.
392 </span> 385 <span class="xdoc"> *
393 </span> 386 <span class="xdoc"> * The function does not query remote processors to make sure the
394 </span> 387 <span class="xdoc"> * name is unique.
395 </span> 388 <span class="xdoc"> *
396 </span> 389 <span class="xdoc"> * <b>@param(name)</b> Name portion of the name/value pair
397 </span> 390 <span class="xdoc"> * <b>@param(value)</b> Value portion of the name/value pair
398 </span> 391 <span class="xdoc"> */</span>
399 392 <span class=key>metaonly</span> Void addUInt32Meta(String name, any value);
400 393
401 394 <span class="xdoc">/*!
402 </span> 395 <span class="xdoc"> * ======== addMeta ========
403 </span> 396 <span class="xdoc"> * Add a name/value pair into the instance's table during configuration
404 </span> 397 <span class="xdoc"> *
405 </span> 398 <span class="xdoc"> * This function adds any length value into the local table. The function
406 </span> 399 <span class="xdoc"> * makes sure the name does not already exist in the local table.
407 </span> 400 <span class="xdoc"> *
408 </span> 401 <span class="xdoc"> * This function should be used by within the application configuration
409 </span> 402 <span class="xdoc"> * file. XDC modules should use {<b>@link</b> #modAddMeta}.
410 </span> 403 <span class="xdoc"> *
411 </span> 404 <span class="xdoc"> * The function does not query remote processors to make sure the
412 </span> 405 <span class="xdoc"> * name is unique.
413 </span> 406 <span class="xdoc"> *
414 </span> 407 <span class="xdoc"> * <b>@param(name)</b> Name portion of the name/value pair
415 </span> 408 <span class="xdoc"> * <b>@param(value)</b> Value portion of the name/value pair
416 </span> 409 <span class="xdoc"> * <b>@param(len)</b> Length of the value buffer
417 </span> 410 <span class="xdoc"> */</span>
418 411 <span class=key>metaonly</span> Void addMeta(String name, Any value, UInt len);
419 412
420 413 <span class="xdoc">/*!
421 </span> 414 <span class="xdoc"> * ======== getMeta ========
422 </span> 415 <span class="xdoc"> * Retrieves the name/value entry
423 </span> 416 <span class="xdoc"> *
424 </span> 417 <span class="xdoc"> * If the name is found, the entry is returned. The caller can parse the
425 </span> 418 <span class="xdoc"> * entry as needed. If the name is not found, null is returned.
426 </span> 419 <span class="xdoc"> *
427 </span> 420 <span class="xdoc"> * The search only occurs on the local table.
428 </span> 421 <span class="xdoc"> *
429 </span> 422 <span class="xdoc"> * <b>@param(name)</b> Name in question
430 </span> 423 <span class="xdoc"> *
431 </span> 424 <span class="xdoc"> * <b>@b(returns)</b> Name/value entry
432 </span> 425 <span class="xdoc"> */</span>
433 426 <span class=key>metaonly</span> Entry getMeta(String name);
434 427
435 428 <span class="xdoc">/*!
436 </span> 429 <span class="xdoc"> * ======== getKey ========
437 </span> 430 <span class="xdoc"> * <b>@_nodoc</b>
438 </span> 431 <span class="xdoc"> * Returns a pointer to the TableEntry containing the argument 'val'.
439 </span> 432 <span class="xdoc"> * This should only be used internally by Ipc modules during their
440 </span> 433 <span class="xdoc"> * initialization process.
441 </span> 434 <span class="xdoc"> *
442 </span> 435 <span class="xdoc"> * This function can only be used when maxValueLen = sizeof(UInt32)
443 </span> 436 <span class="xdoc"> */</span>
444 437 @DirectCall
445 438 Ptr getKey(UInt32 val);
446 439
447 440 <span class=key>internal</span>:
448 441
449 442 <span class="comment">/* Used to eliminate code when doing whole-program */</span>
450 443 <span class=key>config</span> Bool singleProcessor = <span class=key>true</span>;
451 444
452 445 <span class=key>metaonly</span> <span class=key>typedef</span> Entry EntryMap[];
453 446
454 447 <span class="xdoc">/*! Structure of entry in Name/Value table */</span>
455 448 <span class=key>struct</span> TableEntry {
456 449 List.Elem elem;
457 450 String name;
458 451 UInt len;
459 452 UArg value;
460 453 };
461 454
462 455 <span class="xdoc">/*!
463 </span> 456 <span class="xdoc"> * ======== metaModTable ========
464 </span> 457 <span class="xdoc"> * Table to hold the static added name/value pairs until
465 </span> 458 <span class="xdoc"> * they ready to be added to the object.
466 </span> 459 <span class="xdoc"> */</span>
467 460 <span class=key>metaonly</span> <span class=key>config</span> EntryMap metaModTable[string];
468 461
469 462 <span class="comment">/*
470 </span> 463 <span class="comment"> * ======== postInit ========
471 </span> 464 <span class="comment"> * Finish initializing static and dynamic NameServer instances
472 </span> 465 <span class="comment"> */</span>
473 466 Int postInit(Object *obj);
474 467
475 468 <span class="comment">/*
476 </span> 469 <span class="comment"> * ======== findLocal ========
477 </span> 470 <span class="comment"> * Searches to the local instance table.
478 </span> 471 <span class="comment"> *
479 </span> 472 <span class="comment"> * This is an internal function because it returns an internal structure.
480 </span> 473 <span class="comment"> */</span>
481 474 TableEntry *findLocal(Object *obj, String name);
482 475
483 476 <span class="comment">/*
484 </span> 477 <span class="comment"> * ======== removeLocal ========
485 </span> 478 <span class="comment"> * removes an entry from the local instance table.
486 </span> 479 <span class="comment"> */</span>
487 480 Void removeLocal(Object *obj, TableEntry *entry);
488 481
489 482 <span class="comment">/*
490 </span> 483 <span class="comment"> * ======== editLocal ========
491 </span> 484 <span class="comment"> * replaces the value of an entry from the local instance table.
492 </span> 485 <span class="comment"> */</span>
493 486 Void editLocal(Object *obj, TableEntry *entry, Ptr newValue);
494 487
495 488 <span class="comment">/* instance object */</span>
496 489 <span class=key>struct</span> Instance_State {
497 490 String name; <span class="comment">/* Name of the instance */</span>
498 491 List.Object freeList; <span class="comment">/* Empty entries list */</span>
499 492 List.Object nameList; <span class="comment">/* Filled entries list */</span>
500 493 UInt maxNameLen; <span class="comment">/* Max name length */</span>
501 494 UInt maxValueLen; <span class="comment">/* Max value length */</span>
502 495 UInt numStatic; <span class="comment">/* Total static entries in table */</span>
503 496 UInt numDynamic; <span class="comment">/* Total dynamic entries in table */</span>
504 497 TableEntry table[]; <span class="comment">/* Table */</span>
505 498 Char names[]; <span class="comment">/* Buffer for names */</span>
506 499 UInt8 values[]; <span class="comment">/* Buffer for values */</span>
507 500 IHeap.Handle tableHeap; <span class="comment">/* Heap used to alloc table */</span>
508 501 Bool checkExisting; <span class="comment">/* check ig name already exists */</span>
509 502 UInt32 refCount; <span class="comment">/* reference count to this instance */</span>
510 503 };
511 504
512 505 <span class=key>struct</span> Module_State {
513 506 INameServerRemote.Handle nsRemoteHandle[<span class=key>length</span>];
514 507 GateSwi.Handle gate;
515 508 };
516 509 }
517 </pre>
518 </body></html>