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.sysbios;
38
39 import xdc.rov.ViewInfo;
40
41 import xdc.runtime.Error;
42 import xdc.runtime.Types;
43
44 /*! ======== BIOS ========
45 * SYS/BIOS Top-Level Manager
46 *
47 * This module is responsible for setting up global parameters
48 * pertaining to SYS/BIOS and for performing the SYS/BIOS startup
49 * sequence.
50 *
51 * SYS/BIOS configures the
52 * {@link xdc.runtime.Memory#defaultHeapInstance Memory.defaultHeapInstance}
53 * using a {@link ti.sysbios.heaps.HeapMem HeapMem} instance of size
54 * {@link #heapSize}.
55 *
56 * The SYS/BIOS startup sequence is logically divided into two phases: those
57 * operations that occur prior to the application's "main()" function being
58 * called, and those operations that are performed after the application's
59 * "main()" function is invoked.
60 *
61 * The "before main()" startup sequence is governed completely by the RTSC
62 * runtime package's {@link xdc.runtime.Startup Startup} module.
63 *
64 * The "after main()" startup sequence is governed by SYS/BIOS and is
65 * initiated by an explicit call to the {@link #start BIOS_start()} function
66 * at the end of the application's main() function.
67 *
68 * Control points are provided at various places in each of the two startup
69 * sequences for user startup operations to be inserted.
70 *
71 * The RTSC runtime startup sequence is as follows:
72 *
73 * @p(nlist)
74 * - Immediately after CPU reset, perform target-specific CPU
75 * initialization (beginning at c_int00).
76 * - Prior to cinit(), run the single user-supplied "reset function"
77 * (see {@link xdc.runtime.Startup#resetFxn Startup.resetFxn}).
78 * - Run cinit() to initialize C runtime environment.
79 * - Run the user-supplied "first functions"
80 * (see {@link xdc.runtime.Startup#firstFxns Startup.firstFxns}).
81 * - Run all the module initialization functions.
82 * - Run pinit().
83 * - Run the user-supplied "last functions"
84 * (see {@link xdc.runtime.Startup#lastFxns Startup.lastFxns}).
85 * - Run main().
86 * @p
87 *
88 * The SYS/BIOS startup sequence begins at the end of main() when
89 * BIOS_start() is called:
90 *
91 * @p(nlist)
92 * - Run the user-supplied "startup functions"
93 * (see {@link #startupFxns BIOS.startupFxns}).
94 * - Enable Hardware Interrupts.
95 * - Enable Software Interrupts. If the system supports Software Interrupts
96 * (Swis) (see {@link #swiEnabled BIOS.swiEnabled}), then the SYS/BIOS
97 * startup sequence enables Swis at this point.
98 * - Timer Startup. If the system supports Timers, then at this point all
99 * statically configured timers are initialized per their
100 * user-configuration.
101 * If a timer was configured to start "automatically", it is started here.
102 * - Task Startup. If the system supports Tasks
103 * (see {@link #taskEnabled BIOS.taskEnabled}),
104 * then task scheduling begins here. If there are no statically or
105 * dynamically created Tasks in the system, then execution proceeds
106 * directly to the Idle loop.
107 * @p
108 *
109 * Below is a configuration script excerpt that installs a user-supplied
110 * startup function at every possible control point in the RTSC and
111 * SYS/BIOS startup
112 * sequence:
113 *
114 * @p(code)
115 * // get handle to xdc Startup module
116 * var Startup = xdc.useModule('xdc.runtime.Startup');
117 *
118 * // install "reset function"
119 * Startup.resetFxn = '&myReset';
120 *
121 * // install a "first function"
122 * var len = Startup.firstFxns.length
123 * Startup.firstFxns.length++;
124 * Startup.firstFxns[len] = '&myFirst';
125 *
126 * // install a "last function"
127 * var len = Startup.lastFxns.length
128 * Startup.lastFxns.length++;
129 * Startup.lastFxns[len] = '&myLast';
130 *
131 * // get handle to SYS/BIOS module
132 * var BIOS = xdc.useModule('ti.sysbios.BIOS');
133 *
134 * // install a SYS/BIOS startup function
135 * BIOS.addUserStartupFunction('&myBiosStartup');
136 * @p
137 *
138 * @p(html)
139 * <h3> Calling Context </h3>
140 * <table border="1" cellpadding="3">
141 * <colgroup span="1"></colgroup> <colgroup span="5" align="center">
142 * </colgroup>
143 *
144 * <tr><th> Function </th><th> Hwi </th><th> Swi </th>
145 * <th> Task </th><th> Main </th><th> Startup </th></tr>
146 * <!-- -->
147 * <tr><td> {@link #getCpuFreq} </td><td> Y </td><td> Y </td>
148 * <td> Y </td><td> Y </td><td> Y </td></tr>
149 * <tr><td> {@link #getThreadType} </td><td> Y </td><td> Y </td>
150 * <td> Y </td><td> Y </td><td> N </td></tr>
151 * <tr><td> {@link #setCpuFreq} </td><td> Y </td><td> Y </td>
152 * <td> Y </td><td> Y </td><td> Y </td></tr>
153 * <tr><td> {@link #start} </td><td> N </td><td> N </td>
154 * <td> N </td><td> Y </td><td> N </td></tr>
155 * <tr><td colspan="6"> Definitions: <br />
156 * <ul>
157 * <li> <b>Hwi</b>: API is callable from a Hwi thread. </li>
158 * <li> <b>Swi</b>: API is callable from a Swi thread. </li>
159 * <li> <b>Task</b>: API is callable from a Task thread. </li>
160 * <li> <b>Main</b>: API is callable during any of these phases: </li>
161 * <ul>
162 * <li> In your module startup after this module is started
163 * (e.g. BIOS_Module_startupDone() returns TRUE). </li>
164 * <li> During xdc.runtime.Startup.lastFxns. </li>
165 * <li> During main().</li>
166 * <li> During BIOS.startupFxns.</li>
167 * </ul>
168 * <li> <b>Startup</b>: API is callable during any of these phases:</li>
169 * <ul>
170 * <li> During xdc.runtime.Startup.firstFxns.</li>
171 * <li> In your module startup before this module is started
172 * (e.g. BIOS_Module_startupDone() returns FALSE).</li>
173 * </ul>
174 * </ul>
175 * </td></tr>
176 *
177 * </table>
178 * @p
179 */
180
181 @CustomHeader
182 @Template("./BIOS.xdt")
183
184 module BIOS
185 {
186 /*!
187 * ======== ThreadType ========
188 * Current thread type definitions
189 *
190 * These values are returned by {@link #getThreadType BIOS_getThreadType}.
191 *
192 * @see #getThreadType
193 */
194 enum ThreadType {
195 ThreadType_Hwi, /*! Current thread is a Hwi */
196 ThreadType_Swi, /*! Current thread is a Swi */
197 ThreadType_Task, /*! Current thread is a Task */
198 ThreadType_Main /*! Current thread is Boot/Main */
199 };
200
201 /*!
202 * ======== RtsLockType ========
203 * Type of Gate to use in the TI RTS library
204 *
205 * @field(NoLocking) no gate is added to the RTS library. In this case,
206 * the application needs to be careful to always serialize access to the
207 * inherently non-reentrant ANSI C functions (such as `malloc()`,
208 * `printf()`, etc.).
209 *
210 * @field(GateHwi) Interrupts are disabled and restored to maintain
211 * re-entrancy. This is a very efficient lock but will also result in
212 * unbounded interrupt latency times. If real-time responce to interrupts
213 * is important, you should not use this gate to lock the RTS library.
214 *
215 * @field(GateSwi) Swis are disabled and restored to maintain
216 * re-entrancy.
217 *
218 * @field(GateMutex) A single mutex is used to maintain re-entrancy.
219 *
220 * @field(GateMutexPri) A single priority inheriting mutex is used to
221 * maintain re-entrancy.
222 *
223 * @see #rtsGateType
224 */
225 enum RtsLockType {
226 NoLocking,
227 GateHwi,
228 GateSwi,
229 GateMutex,
230 GateMutexPri
231 };
232
233 /*!
234 * ======== LibType ========
235 * SYS/BIOS library selection options
236 *
237 * This enumeration defines all the SYS/BIOS library types
238 * provided by the product. You can select the library type by setting
239 * the {@link #libType BIOS.libType} configuration parameter.
240 *
241 * @field(LibType_Instrumented) The library supplied is prebuilt with
242 * logging and assertions enabled.
243 *
244 * @field(LibType_NonInstrumented) The library supplied is prebuilt
245 * with logging and assertions disabled.
246 *
247 * @field(LibType_Debug) The library supplied is prebuilt with
248 * logging and assertions enabled together with full symbolic debug
249 * enabled. In addition, this library contains embedded information
250 * that enables it to participate in whole program optimization builds.
251 *
252 * @field(LibType_Custom) This option allows you to build the
253 * SYS/BIOS library from sources using the options specified by
254 * {@link #customCCOpts}.
255 *
256 * @see #libType
257 */
258 enum LibType {
259 LibType_Instrumented, /*! Instrumented */
260 LibType_NonInstrumented, /*! Non-instrumented */
261 LibType_Custom, /*! Custom */
262 LibType_Debug /*! Debug */
263 };
264
265 /*! Used in APIs that take a timeout to specify wait forever */
266 const UInt WAIT_FOREVER = ~(0);
267
268 /*! Used in APIs that take a timeout to specify no waiting */
269 const UInt NO_WAIT = 0;
270
271 /*! User startup function type definition. */
272 typedef Void (*StartupFuncPtr)(Void);
273
274 /*!
275 * ======== ModuleView ========
276 * @_nodoc
277 */
278 metaonly struct ModuleView {
279 String currentThreadType;
280 String rtsGateType;
281 Int cpuFreqLow;
282 Int cpuFreqHigh;
283 Bool clockEnabled;
284 Bool swiEnabled;
285 Bool taskEnabled;
286 String startFunc;
287 }
288
289 /*!
290 * ======== ErrorView ========
291 * @_nodoc
292 */
293 metaonly struct ErrorView {
294 String mod;
295 String tab;
296 String inst;
297 String field;
298 String message;
299 }
300
301 /*!
302 * ======== rovViewInfo ========
303 * @_nodoc
304 */
305 @Facet
306 metaonly config ViewInfo.Instance rovViewInfo =
307 ViewInfo.create({
308 viewMap: [
309 [
310 'Module',
311 {
312 type: ViewInfo.MODULE,
313 viewInitFxn: 'viewInitModule',
314 structName: 'ModuleView'
315 }
316 ],
317 [
318 'Scan for errors...',
319 {
320 type: ViewInfo.MODULE_DATA,
321 viewInitFxn: 'viewInitErrorScan',
322 structName: 'ErrorView'
323 }
324 ],
325 ]
326 });
327
328 /*!
329 * ======== libType ========
330 * SYS/BIOS Library type
331 *
332 * The SYS/BIOS runtime is provided in the form of a library that is
333 * linked with your application. Several forms of this library are
334 * provided with the SYS/BIOS product. In addition, there is an
335 * option to build the library from source. This configuration parameter
336 * allows you to select the form of the SYS/BIOS library to use.
337 *
338 * The default value of libType is
339 * {@link #LibType_Instrumented BIOS_LibType_Instrumented}. For a
340 * complete list of options and what they offer see {@link #LibType}.
341 */
342 metaonly config LibType libType = LibType_Instrumented;
343
344 /*!
345 * ======== customCCOpts ========
346 * Compiler options used when building a custom SYS/BIOS library
347 *
348 * When {@link #libType BIOS.libType} is set to
349 * {@link #LibType_Custom BIOS_LibType_Custom},
350 * this string contains the options passed to the compiler during any
351 * re-build of the SYS/BIOS sources.
352 *
353 * In addition to the options
354 * specified by `BIOS.customCCOpts`, several `-D` and `-I` options are also
355 * passed to the compiler. The options specified by `BIOS.customCCOpts` are,
356 * however, the first options passed to the compiler on the command line.
357 *
358 * To view the custom compiler options, add the following line to your
359 * config script:
360 *
361 * @p(code)
362 * print(BIOS.customCCOpts);
363 * @p
364 *
365 * By default, `BIOS.customCCOpts` is initialized to create a highly
366 * optimized SYS/BIOS library. While this is great for runtime performance,
367 * it can can be difficult to interpret when single stepping through the
368 * APIs with the CCS debugger.
369 * An example of how to manipulate the custom library compiler options
370 * to build a more debug friendly version of the custom SYS/BIOS library is
371 * provided in
372 * {@link https://processors.wiki.ti.com/index.php/SYS/BIOS_FAQs#CustomDebugAnchor
373 * SYS/BIOS FAQ #1}.
374 *
375 * @a(Warning)
376 * The default value of `BIOS.customCCOpts`, which is derived from the target
377 * specified by your configuration, includes runtime model options
378 * (such as endianess) that must be the same for all sources built and
379 * linked into your application. You must not change or add any options
380 * that can alter the runtime model specified by the default value of
381 * `BIOS.customCCOpts`.
382 */
383 metaonly config String customCCOpts;
384
385 /*!
386 * @_nodoc
387 * ======== smpEnabled ========
388 * Enables multi core SMP task scheduling
389 *
390 * (Added for compatability with SMP/BIOS
391 */
392 config Bool smpEnabled = false;
393
394 /*!
395 * ======== cpuFreq ========
396 * CPU frequency in Hz
397 *
398 * This configuration parameter allow SYS/BIOS to convert various
399 * periods between timer ticks (or instruction cycles) and real-time
400 * units. For example, timer periods expressed in micro-seconds need
401 * to be converted into timer ticks in order to properly program the
402 * timers.
403 *
404 * The default value of this parameter is obtained from the platform
405 * (the clockRate property of {@link xdc.cfg.Program#cpu Program.cpu})
406 * which is the CPU clock rate when the processor is reset.
407 *
408 * @a(Example)
409 * If CPU frequency is 720MHz, the following configuration script
410 * configures SYS/BIOS with the proper clock frequency:
411 * @p(code)
412 * var BIOS = xdc.useModule('ti.sysbios.BIOS');
413 * BIOS.cpuFreq.hi = 0;
414 * BIOS.cpuFreq.lo = 720000000;
415 * @p
416 */
417 config Types.FreqHz cpuFreq;
418
419 /*!
420 * ======== runtimeCreatesEnabled ========
421 * Runtime instance creation enable flag.
422 *
423 * true = Mod_create() & Mod_delete() callable at runtime
424 * false = Mod_create() & Mod_delete() not callable at runtime
425 */
426 metaonly config Bool runtimeCreatesEnabled = true;
427
428 /*!
429 * ======== taskEnabled ========
430 * SYS/BIOS Task services enable flag
431 *
432 * The following behaviors occur when {@link #taskEnabled} is
433 * set to false:
434 *
435 * @p(blist)
436 * - Static {@link ti.sysbios.knl.Task Task} creation will
437 * result in a fatal build error.
438 * - The Idle task object is not created.
439 * (The Idle functions are invoked within the {@link #start()}
440 * thread.)
441 * - Runtime calls to Task_create will trigger an assertion violation
442 * via {@link xdc.runtime.Assert#isTrue}.
443 * @p
444 */
445 config Bool taskEnabled = true;
446
447 /*!
448 * ======== swiEnabled ========
449 * SYS/BIOS Swi services enable flag
450 *
451 * The following behaviors occur when {@link #swiEnabled} is
452 * set to false:
453 *
454 * @p(blist)
455 * - Static {@link ti.sysbios.knl.Swi Swi} creation will
456 * result in a fatal build error.
457 * - The {@link ti.sysbios.knl.Clock Clock module} is
458 * effectively disabled as it uses a Swi
459 * to process the Clock objects.
460 * - See other effects as noted for {@link #clockEnabled} = false;
461 * - Runtime calls to Swi_create will trigger an assertion violation
462 * via {@link xdc.runtime.Assert#isTrue}.
463 * @p
464 */
465 config Bool swiEnabled = true;
466
467 /*!
468 * ======== clockEnabled ========
469 * SYS/BIOS Clock services enable flag
470 *
471 * The following behaviors occur when {@link #clockEnabled} is
472 * set to false:
473 *
474 * @p(blist)
475 * - Static Clock creation will result in a fatal build error.
476 * - No Clock Swi is created.
477 * - The {@link ti.sysbios.knl.Clock#tickSource Clock_tickSource}
478 * is set to
479 * {@link ti.sysbios.knl.Clock#TickSource_NULL Clock_TickSource_NULL}
480 * to prevent a Timer object from being created.
481 * - For APIs that take a timeout, values other than {@link #NO_WAIT}
482 * will be equivalent to {@link #WAIT_FOREVER}.
483 * @p
484 */
485 config Bool clockEnabled = true;
486
487 /*!
488 * ======== assertsEnabled ========
489 * SYS/BIOS Assert checking in Custom SYS/BIOS library enable flag
490 *
491 * When set to true, Assert checking code is compiled into
492 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
493 *
494 * When set to false, Assert checking code is removed from
495 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
496 * This option can considerably improve runtime performance as well
497 * signficantly reduce the application's code size.
498 *
499 * see {@link #libType BIOS.libType}.
500 */
501 metaonly config Bool assertsEnabled = true;
502
503 /*!
504 * ======== logsEnabled ========
505 * SYS/BIOS Log support in Custom SYS/BIOS library enable flag
506 *
507 * When set to true, SYS/BIOS execution Log code is compiled into
508 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
509 *
510 * When set to false, all Log code is removed from
511 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
512 * This option can considerably improve runtime performance as well
513 * signficantly reduce the application's code size.
514 *
515 * see {@link #libType BIOS.libType}.
516 */
517 metaonly config Bool logsEnabled = true;
518
519 /*!
520 * ======== heapSize ========
521 * Size of system heap
522 *
523 * The system heap is, by default, used to allocate instance object
524 * state structures, such as {@link ti.sysbios.knl.Task Task} objects
525 * and their stacks, {@link ti.sysbios.knl.Semaphore Semaphore} objects,
526 * etc.
527 *
528 * If the application configuration does not set
529 * Memory.defaultHeapInstance, then SYS/BIOS will create a
530 * {@link ti.sysbios.heaps.HeapMem HeapMem} heap of this size. This
531 * heap will be assigned to
532 * {@link xdc.runtime.Memory#defaultHeapInstance Memory.defaultHeapInstance}
533 * and will therefore be used as the default system heap. This heap
534 * will also be used by the SYS/BIOS version of the standard C library
535 * functions malloc(), calloc() and free().
536 */
537 config SizeT heapSize = 0x1000;
538
539 /*!
540 * ======== heapSection ========
541 * Section to place the system heap
542 *
543 * This configuration parameter allows you to specify a named output
544 * section that will contain the SYS/BIOS system heap. The system heap
545 * is, by default, used to allocate {@link ti.sysbios.knl.Task Task}
546 * stacks and instance object state structures. So, giving this section
547 * a name and explicitly placing it via a linker command file can
548 * significantly improve system performance.
549 *
550 * If heapSection is `null` (or `undefined`) the system heap is placed
551 * in the target's default data section.
552 */
553 config String heapSection = null;
554
555 /*!
556 * ======== rtsGateType ========
557 * Gate to make sure TI RTS library APIs are re-entrant
558 *
559 * The application gets to determine the type of gate (lock) that is used
560 * in the TI RTS library. The gate will be used to guarantee re-entrancy
561 * of the RTS APIs.
562 *
563 * The type of gate depends on the type of threads that are going to
564 * be calling into the RTS library. For example, if both Swi and Task
565 * threads are going to be calling the RTS library's printf, GateSwi
566 * should be used. In this case, Hwi threads are not impacted (i.e.
567 * disabled) during the printf calls from the Swi or Task threads.
568 *
569 * If NoLocking is used, the RTS lock is not plugged and re-entrancy for
570 * the TI RTS library calls are not guaranteed. The application can plug
571 * the RTS locks directly if it wants.
572 *
573 * Numerous gate types are provided by SYS/BIOS. Each has its advantages
574 * and disadvantages. The following list summarizes when each type is
575 * appropriate for protecting an underlying non-reentrant RTS library.
576 * @p(dlist)
577 * - {@link #GateHwi}:
578 * Interrupts are disabled and restored to maintain re-entrancy.
579 * Use if only making RTS calls from a Hwi, Swi and/or Task.
580 *
581 * - {@link #GateSwi}:
582 * Swis are disabled and restored to maintain re-entrancy. Use if
583 * only making RTS calls from a Swi and/or Task.
584 *
585 * - {@link #GateMutex}:
586 * A single mutex is used to maintain re-entrancy. Use if only
587 * making RTS calls from a Task. Blocks only Tasks that are
588 * also trying to execute critical regions of RTS library.
589 *
590 * - {@link #GateMutexPri}:
591 * A priority inheriting mutex is used to maintain re-entrancy.
592 * Blocks only Tasks that are also trying to execute critical
593 * regions of RTS library. Raises the priority of the Task that
594 * is executing the critical region in the RTS library to the
595 * level of the highest priority Task that is block by the mutex.
596 * @p
597 *
598 * The default value of rtsGateType depends on the type of threading
599 * model enabled by other configuration parameters.
600 * If {@link #taskEnabled} is true, {@link #GateMutex} is used.
601 * If {@link #swiEnabled} is true and {@link #taskEnabled} is false:
602 * {@link #GateSwi} is used.
603 * If both {@link #swiEnabled} and {@link #taskEnabled} are false:
604 * {@link xdc.runtime#GateNull} is used.
605 *
606 * If {@link #taskEnabled} is false, the user should not select
607 * {@link #GateMutex} (or other Task level gates). Similarly, if
608 * {@link #taskEnabled} and {@link #swiEnabled}are false, the user
609 * should not select {@link #GateSwi} or the Task level gates.
610 */
611 metaonly config RtsLockType rtsGateType;
612
613 /*!
614 * ======== startupFxns ========
615 * Functions to be executed at the beginning of BIOS_start()
616 *
617 * These user (or middleware) functions are executed before Hwis,
618 * Swis, and Tasks are started.
619 */
620 metaonly config StartupFuncPtr startupFxns[] = [];
621
622 /*!
623 * ======== addUserStartupFunction ========
624 * @_nodoc
625 * Statically add a function to the startupFxns table.
626 */
627 metaonly Void addUserStartupFunction(StartupFuncPtr func);
628
629 /*!
630 * ======== start ========
631 * Start SYS/BIOS
632 *
633 * The user's main() function is required to call this function
634 * after all other user initializations have been performed.
635 *
636 * This function does not return.
637 *
638 * This function performs any remaining SYS/BIOS initializations
639 * and then transfers control to the highest priority ready
640 * task if {@link #taskEnabled} is true. If {@link #taskEnabled}
641 * is false, control is transferred directly to the Idle Loop.
642 *
643 * The SYS/BIOS start sequence is as follows:
644 * @p(blist)
645 * - Invoke all the functions in the {@link #startupFxns} array.
646 * - call {@link ti.sysbios.hal.Hwi#enable Hwi_startup()}
647 * to enable interrupts.
648 * - if {@link #swiEnabled} is true, call
649 * {@link ti.sysbios.knl.Swi#enable Swi_startup()} to enable
650 * the Swi scheduler.
651 * - Start any statically created or constructed Timers
652 * in the {@link ti.sysbios.hal.Timer#StartMode Timer_StartMode_AUTO}
653 * mode.
654 * - if {@link #taskEnabled} is true, enable the Task scheduler
655 * and transfer the execution thread to the highest priority
656 * task in the {@link ti.sysbios.knl.Task#Mode Task_Mode_READY}
657 * mode.
658 * - Otherwise, fall directly into the Idle Loop.
659 * @p
660 *
661 */
662 @DirectCall
663 Void start();
664
665 /*!
666 * ======== exit ========
667 * Exit currently running SYS/BIOS executable
668 *
669 * This function is called when a SYS/BIOS executable needs to terminate
670 * normally. This function sets the internal SYS/BIOS threadType to
671 * {@link #ThreadType_Main} and then calls
672 * {@link xdc.runtime.System#exit System_exit}(stat), passing along
673 * the 'stat' argument.
674 *
675 * All functions bound via
676 * `{@link xdc.runtime.System#atexit System_atexit}` or the ANSI C
677 * Standard Library `atexit` function are then executed.
678 *
679 * @param(stat) exit status to return to calling environment.
680 */
681 @DirectCall
682 Void exit(Int stat);
683
684 /*!
685 * ======== getThreadType ========
686 * Get the current thread type
687 *
688 * @b(returns) Current thread type
689 */
690 @DirectCall
691 ThreadType getThreadType();
692
693 /*!
694 * @_nodoc
695 * ======== setThreadType ========
696 * Set the current thread type
697 *
698 * Called by the various threadType owners.
699 *
700 * @param(ttype) New thread type value
701 * @b(returns) Previous thread type
702 */
703 @DirectCall
704 ThreadType setThreadType(ThreadType ttype);
705
706 /*!
707 * ======== setCpuFrequnecy ========
708 * Set CPU Frequency in Hz
709 *
710 * This API is not thread safe. Please use appropriate locks.
711 */
712 @DirectCall
713 Void setCpuFreq(Types.FreqHz *freq);
714
715 /*!
716 * ======== getCpuFrequency ========
717 * Get CPU frequency in Hz
718 *
719 * This API is not thread safe. Please use appropriate locks.
720 */
721 @DirectCall
722 Void getCpuFreq(Types.FreqHz *freq);
723
724 internal:
725
726 727 728 729 730 731 732
733 metaonly config Bool buildingAppLib = true;
734
735 736 737 738
739 metaonly config Bool includeXdcRuntime = false;
740
741 742 743 744
745 metaonly config String libDir = null;
746
747 748 749 750
751 metaonly String getCCOpts(String target);
752
753 754 755 756
757 metaonly String getDefs();
758
759 760 761 762
763 metaonly String getCFiles(String target);
764
765 766 767 768
769 metaonly Any getAsmFiles(String target);
770
771 772 773 774
775 struct intSize {
776 Int intSize;
777 }
778
779 780 781 782 783 784
785 metaonly config Char bitsPerInt;
786
787 788 789 790 791
792 Void errorRaiseHook(Error.Block *eb);
793
794 795 796 797 798 799
800 config Void (*installedErrorHook)(Error.Block *);
801
802 803 804 805
806 Void startFunc();
807
808 809 810 811 812 813
814 Void registerRTSLock();
815
816 817 818 819 820 821
822 Void removeRTSLock();
823
824 825 826
827 function fireFrequencyUpdate(newFreq);
828
829 830 831 832
833 proxy RtsGateProxy inherits xdc.runtime.IGateProvider;
834
835 836 837 838
839 typedef Void (*StartFuncPtr)(void);
840
841 842 843
844 struct Module_State {
845 Types.FreqHz cpuFreq;
846 UInt rtsGateCount;
847 IArg rtsGateKey;
848 RtsGateProxy.Handle rtsGate;
849 ThreadType threadType;
850 StartFuncPtr startFunc;
851 };
852 }
853 854 855 856
857