1 2 3 4 5 6 7 8 9 10 11 12
13 14 15
16
17 package xdc.runtime;
18
19 /*!
20 * ======== Reset ========
21 * Startup reset function manager
22 *
23 * This module defines an initial reset function and can be used without
24 * requiring any other `xdc.runtime` module. The reset function is called
25 * as early as possible in the application startup and is intended for
26 * platform-specific hardware initialization.
27 *
28 * The reset function sequentially calls each of the functions added to the
29 * `{@link #fxns}` array starting from index 0. If
30 * `{@link Startup#resetFxn Startup.resetFxn}` is defined, it is called
31 * before any of the functions defined by the `fxns` array.
32 *
33 * By providing an array of startup functions, rather than a single function
34 * as `{@link Startup}` does, modules that need very early initialization
35 * can simply add their initialization to the list of functions to be called
36 * without having to implement a "chaining" mechanism or requiring the user
37 * to implement and maintain an application reset function.
38 *
39 * @a(Warning)
40 * The reset function is _not_ supported on all platforms and, as a result,
41 * you should never place any "portable" code that is required for your
42 * application in this function. Use the `{@link Startup}` module to
43 * define required application startup functions.
44 *
45 * @see Startup
46 */
47 @Template("xdc/runtime/Reset.xdt")
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