1 /*!
2 * ======== Reset ========
3 * Startup reset function manager
4 *
5 * This module defines an initial reset function and can be used without
6 * requiring any other `xdc.runtime` module. The reset function is called
7 * as early as possible in the application startup and is intended for
8 * platform-specific hardware initialization.
9 *
10 * The reset function sequentially calls each of the functions added to the
11 * `{@link #fxns}` array starting from index 0. If
12 * `{@link Startup#resetFxn Startup.resetFxn}` is defined, it is called
13 * before any of the functions defined by the `fxns` array.
14 *
15 * By providing an array of startup functions, rather than a single function
16 * as `{@ilnk Startup}` does, modules that need very early initialization
17 * can simply add their initialization to the list of functions to be called
18 * without having to implement a "chaining" mechanism or requiring the user
19 * to implement and maintain an application reset function.
20 *
21 * @a(Warning)
22 * The reset function is _not_ supported on all platforms and, as a result,
23 * you should never place any "portable" code that is required for your
24 * application in this function. Use the `@{link Startup}` module to
25 * define required application startup functions.
26 *
27 * @see Startup
28 */
29 @Template("xdc/runtime/Reset.xdt")
30 metaonly module Reset
31 {
32 /*!
33 * ======== fxns ========
34 * List of functions to call at reset
35 *
36 * This array defines the functions that will be executed by the reset
37 * initialization function (`xdc_runtime_Startup_reset__I`) _in addition
38 * to_ the function specified by `@{link Startup#resetFxn}`.
39 *
40 * The following code fragment shows how to add the externally defined
41 * function `myReset()` to this array.
42 * @p(code)
43 * var Reset = xdc.useModule("xdc.runtime.Reset");
44 * Reset.fxns[Reset.fxns.length++] = "&myReset";
45 * @p
46 *
47 * @a(Warning)
48 * Although the functions specified in `fxns[]` are ordinary C functions,
49 * they are often called _before_ the C runtime is fully initialized;
50 * e.g., they may be called _before_ static variables are initialized.
51 * Reset functions should only assume that a minimal execution stack has
52 * initialized.
53 *
54 * @see Startup#resetFxn
55 */
56 metaonly config xdc.runtime.Startup.InitFxn fxns[] = [];
57 }
58 59 60
61