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 * ======== cpuFreq ========
387 * CPU frequency in Hz
388 *
389 * This configuration parameter allow SYS/BIOS to convert various
390 * periods between timer ticks (or instruction cycles) and real-time
391 * units. For example, timer periods expressed in micro-seconds need
392 * to be converted into timer ticks in order to properly program the
393 * timers.
394 *
395 * The default value of this parameter is obtained from the platform
396 * (the clockRate property of {@link xdc.cfg.Program#cpu Program.cpu})
397 * which is the CPU clock rate when the processor is reset.
398 *
399 * @a(Example)
400 * If CPU frequency is 720MHz, the following configuration script
401 * configures SYS/BIOS with the proper clock frequency:
402 * @p(code)
403 * var BIOS = xdc.useModule('ti.sysbios.BIOS');
404 * BIOS.cpuFreq.hi = 0;
405 * BIOS.cpuFreq.lo = 720000000;
406 * @p
407 */
408 config Types.FreqHz cpuFreq;
409
410 /*!
411 * ======== runtimeCreatesEnabled ========
412 * Runtime instance creation enable flag.
413 *
414 * true = Mod_create() & Mod_delete() callable at runtime
415 * false = Mod_create() & Mod_delete() not callable at runtime
416 */
417 metaonly config Bool runtimeCreatesEnabled = true;
418
419 /*!
420 * ======== taskEnabled ========
421 * SYS/BIOS Task services enable flag
422 *
423 * The following behaviors occur when {@link #taskEnabled} is
424 * set to false:
425 *
426 * @p(blist)
427 * - Static {@link ti.sysbios.knl.Task Task} creation will
428 * result in a fatal build error.
429 * - The Idle task object is not created.
430 * (The Idle functions are invoked within the {@link #start()}
431 * thread.)
432 * - Runtime calls to Task_create will trigger an assertion violation
433 * via {@link xdc.runtime.Assert#isTrue}.
434 * @p
435 */
436 config Bool taskEnabled = true;
437
438 /*!
439 * ======== swiEnabled ========
440 * SYS/BIOS Swi services enable flag
441 *
442 * The following behaviors occur when {@link #swiEnabled} is
443 * set to false:
444 *
445 * @p(blist)
446 * - Static {@link ti.sysbios.knl.Swi Swi} creation will
447 * result in a fatal build error.
448 * - The {@link ti.sysbios.knl.Clock Clock module} is
449 * effectively disabled as it uses a Swi
450 * to process the Clock objects.
451 * - See other effects as noted for {@link #clockEnabled} = false;
452 * - Runtime calls to Swi_create will trigger an assertion violation
453 * via {@link xdc.runtime.Assert#isTrue}.
454 * @p
455 */
456 config Bool swiEnabled = true;
457
458 /*!
459 * ======== clockEnabled ========
460 * SYS/BIOS Clock services enable flag
461 *
462 * The following behaviors occur when {@link #clockEnabled} is
463 * set to false:
464 *
465 * @p(blist)
466 * - Static Clock creation will result in a fatal build error.
467 * - No Clock Swi is created.
468 * - The {@link ti.sysbios.knl.Clock#tickSource Clock_tickSource}
469 * is set to
470 * {@link ti.sysbios.knl.Clock#TickSource_NULL Clock_TickSource_NULL}
471 * to prevent a Timer object from being created.
472 * - For APIs that take a timeout, values other than {@link #NO_WAIT}
473 * will be equivalent to {@link #WAIT_FOREVER}.
474 * @p
475 */
476 config Bool clockEnabled = true;
477
478 /*!
479 * ======== assertsEnabled ========
480 * SYS/BIOS Assert checking in Custom SYS/BIOS library enable flag
481 *
482 * When set to true, Assert checking code is compiled into
483 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
484 *
485 * When set to false, Assert checking code is removed from
486 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
487 * This option can considerably improve runtime performance as well
488 * signficantly reduce the application's code size.
489 *
490 * see {@link #libType BIOS.libType}.
491 */
492 metaonly config Bool assertsEnabled = true;
493
494 /*!
495 * ======== logsEnabled ========
496 * SYS/BIOS Log support in Custom SYS/BIOS library enable flag
497 *
498 * When set to true, SYS/BIOS execution Log code is compiled into
499 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
500 *
501 * When set to false, all Log code is removed from
502 * the custom library created when BIOS.libType = BIOS.LibType_Custom.
503 * This option can considerably improve runtime performance as well
504 * signficantly reduce the application's code size.
505 *
506 * see {@link #libType BIOS.libType}.
507 */
508 metaonly config Bool logsEnabled = true;
509
510 /*!
511 * ======== heapSize ========
512 * Size of system heap
513 *
514 * The system heap is, by default, used to allocate instance object
515 * state structures, such as {@link ti.sysbios.knl.Task Task} objects
516 * and their stacks, {@link ti.sysbios.knl.Semaphore Semaphore} objects,
517 * etc.
518 *
519 * If the application configuration does not set
520 * Memory.defaultHeapInstance, then SYS/BIOS will create a
521 * {@link ti.sysbios.heaps.HeapMem HeapMem} heap of this size. This
522 * heap will be assigned to
523 * {@link xdc.runtime.Memory#defaultHeapInstance Memory.defaultHeapInstance}
524 * and will therefore be used as the default system heap. This heap
525 * will also be used by the SYS/BIOS version of the standard C library
526 * functions malloc(), calloc() and free().
527 */
528 config SizeT heapSize = 0x1000;
529
530 /*!
531 * ======== heapSection ========
532 * Section to place the system heap
533 *
534 * This configuration parameter allows you to specify a named output
535 * section that will contain the SYS/BIOS system heap. The system heap
536 * is, by default, used to allocate {@link ti.sysbios.knl.Task Task}
537 * stacks and instance object state structures. So, giving this section
538 * a name and explicitly placing it via a linker command file can
539 * significantly improve system performance.
540 *
541 * If heapSection is `null` (or `undefined`) the system heap is placed
542 * in the target's default data section.
543 */
544 config String heapSection = null;
545
546 /*!
547 * ======== rtsGateType ========
548 * Gate to make sure TI RTS library APIs are re-entrant
549 *
550 * The application gets to determine the type of gate (lock) that is used
551 * in the TI RTS library. The gate will be used to guarantee re-entrancy
552 * of the RTS APIs.
553 *
554 * The type of gate depends on the type of threads that are going to
555 * be calling into the RTS library. For example, if both Swi and Task
556 * threads are going to be calling the RTS library's printf, GateSwi
557 * should be used. In this case, Hwi threads are not impacted (i.e.
558 * disabled) during the printf calls from the Swi or Task threads.
559 *
560 * If NoLocking is used, the RTS lock is not plugged and re-entrancy for
561 * the TI RTS library calls are not guaranteed. The application can plug
562 * the RTS locks directly if it wants.
563 *
564 * Numerous gate types are provided by SYS/BIOS. Each has its advantages
565 * and disadvantages. The following list summarizes when each type is
566 * appropriate for protecting an underlying non-reentrant RTS library.
567 * @p(dlist)
568 * - {@link #GateHwi}:
569 * Interrupts are disabled and restored to maintain re-entrancy.
570 * Use if only making RTS calls from a Hwi, Swi and/or Task.
571 *
572 * - {@link #GateSwi}:
573 * Swis are disabled and restored to maintain re-entrancy. Use if
574 * only making RTS calls from a Swi and/or Task.
575 *
576 * - {@link #GateMutex}:
577 * A single mutex is used to maintain re-entrancy. Use if only
578 * making RTS calls from a Task. Blocks only Tasks that are
579 * also trying to execute critical regions of RTS library.
580 *
581 * - {@link #GateMutexPri}:
582 * A priority inheriting mutex is used to maintain re-entrancy.
583 * Blocks only Tasks that are also trying to execute critical
584 * regions of RTS library. Raises the priority of the Task that
585 * is executing the critical region in the RTS library to the
586 * level of the highest priority Task that is block by the mutex.
587 * @p
588 *
589 * The default value of rtsGateType depends on the type of threading
590 * model enabled by other configuration parameters.
591 * If {@link #taskEnabled} is true, {@link #GateMutex} is used.
592 * If {@link #swiEnabled} is true and {@link #taskEnabled} is false:
593 * {@link #GateSwi} is used.
594 * If both {@link #swiEnabled} and {@link #taskEnabled} are false:
595 * {@link xdc.runtime#GateNull} is used.
596 *
597 * If {@link #taskEnabled} is false, the user should not select
598 * {@link #GateMutex} (or other Task level gates). Similarly, if
599 * {@link #taskEnabled} and {@link #swiEnabled}are false, the user
600 * should not select {@link #GateSwi} or the Task level gates.
601 */
602 metaonly config RtsLockType rtsGateType;
603
604 /*!
605 * ======== startupFxns ========
606 * Functions to be executed at the beginning of BIOS_start()
607 *
608 * These user (or middleware) functions are executed before Hwis,
609 * Swis, and Tasks are started.
610 */
611 metaonly config StartupFuncPtr startupFxns[] = [];
612
613 /*!
614 * ======== addUserStartupFunction ========
615 * @_nodoc
616 * Statically add a function to the startupFxns table.
617 */
618 metaonly Void addUserStartupFunction(StartupFuncPtr func);
619
620 /*!
621 * ======== start ========
622 * Start SYS/BIOS
623 *
624 * The user's main() function is required to call this function
625 * after all other user initializations have been performed.
626 *
627 * This function does not return.
628 *
629 * This function performs any remaining SYS/BIOS initializations
630 * and then transfers control to the highest priority ready
631 * task if {@link #taskEnabled} is true. If {@link #taskEnabled}
632 * is false, control is transferred directly to the Idle Loop.
633 *
634 * The SYS/BIOS start sequence is as follows:
635 * @p(blist)
636 * - Invoke all the functions in the {@link #startupFxns} array.
637 * - call {@link ti.sysbios.hal.Hwi#enable Hwi_startup()}
638 * to enable interrupts.
639 * - if {@link #swiEnabled} is true, call
640 * {@link ti.sysbios.knl.Swi#enable Swi_startup()} to enable
641 * the Swi scheduler.
642 * - Start any statically created or constructed Timers
643 * in the {@link ti.sysbios.hal.Timer#StartMode Timer_StartMode_AUTO}
644 * mode.
645 * - if {@link #taskEnabled} is true, enable the Task scheduler
646 * and transfer the execution thread to the highest priority
647 * task in the {@link ti.sysbios.knl.Task#Mode Task_Mode_READY}
648 * mode.
649 * - Otherwise, fall directly into the Idle Loop.
650 * @p
651 *
652 */
653 @DirectCall
654 Void start();
655
656 /*!
657 * ======== exit ========
658 * Exit currently running SYS/BIOS executable
659 *
660 * This function is called when a SYS/BIOS executable needs to terminate
661 * normally. This function sets the internal SYS/BIOS threadType to
662 * {@link #ThreadType_Main} and then calls
663 * {@link xdc.runtime.System#exit System_exit}(stat), passing along
664 * the 'stat' argument.
665 *
666 * All functions bound via
667 * `{@link xdc.runtime.System#atexit System_atexit}` or the ANSI C
668 * Standard Library `atexit` function are then executed.
669 *
670 * @param(stat) exit status to return to calling environment.
671 */
672 @DirectCall
673 Void exit(Int stat);
674
675 /*!
676 * ======== getThreadType ========
677 * Get the current thread type
678 *
679 * @b(returns) Current thread type
680 */
681 @DirectCall
682 ThreadType getThreadType();
683
684 /*!
685 * @_nodoc
686 * ======== setThreadType ========
687 * Set the current thread type
688 *
689 * Called by the various threadType owners.
690 *
691 * @param(ttype) New thread type value
692 * @b(returns) Previous thread type
693 */
694 @DirectCall
695 ThreadType setThreadType(ThreadType ttype);
696
697 /*!
698 * ======== setCpuFrequnecy ========
699 * Set CPU Frequency in Hz
700 *
701 * This API is not thread safe. Please use appropriate locks.
702 */
703 @DirectCall
704 Void setCpuFreq(Types.FreqHz *freq);
705
706 /*!
707 * ======== getCpuFrequency ========
708 * Get CPU frequency in Hz
709 *
710 * This API is not thread safe. Please use appropriate locks.
711 */
712 @DirectCall
713 Void getCpuFreq(Types.FreqHz *freq);
714
715 internal:
716
717 718 719 720 721 722 723
724 metaonly config Bool buildingAppLib = true;
725
726 727 728 729
730 metaonly config Bool includeXdcRuntime = false;
731
732 733 734 735
736 metaonly config String libDir = null;
737
738 739 740 741
742 metaonly String getCCOpts(String target);
743
744 745 746 747
748 metaonly String getDefs();
749
750 751 752 753
754 metaonly String getCFiles(String target);
755
756 757 758 759
760 metaonly Any getAsmFiles(String target);
761
762 763 764 765
766 struct intSize {
767 Int intSize;
768 }
769
770 771 772 773 774 775
776 metaonly config Char bitsPerInt;
777
778 779 780 781 782
783 Void errorRaiseHook(Error.Block *eb);
784
785 786 787 788 789 790
791 config Void (*installedErrorHook)(Error.Block *);
792
793 794 795 796
797 Void startFunc();
798
799 800 801 802 803 804
805 Void registerRTSLock();
806
807 808 809 810 811 812
813 Void removeRTSLock();
814
815 816 817
818 function fireFrequencyUpdate(newFreq);
819
820 821 822 823
824 proxy RtsGateProxy inherits xdc.runtime.IGateProvider;
825
826 827 828 829
830 typedef Void (*StartFuncPtr)(void);
831
832 833 834
835 struct Module_State {
836 Types.FreqHz cpuFreq;
837 UInt rtsGateCount;
838 IArg rtsGateKey;
839 RtsGateProxy.Handle rtsGate;
840 ThreadType threadType;
841 StartFuncPtr startFunc;
842 };
843 }
844 845 846 847
848