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