1 2 3 4 5 6 7 8 9 10 11 12
13 14 15
16 package xdc.runtime;
17
18 /*!
19 * ======== ISystemSupport ========
20 * Interface to core system functions.
21 *
22 * Each embedded system requires implementations of these functions but
23 * the behavior of these functions varies depending on the context of the
24 * embedded system. For example, some systems will implement `exit()` as
25 * an infinite loop because the executable is designed to *never* exit.
26 */
27 interface ISystemSupport {
28
29 /*!
30 * ======== abort ========
31 * Backend for `{@link System#abort()}`
32 *
33 * This function is called by `{@link System#abort()}` prior to calling
34 * the ANSI C Standard library function `abort()`. So, to ensure the
35 * abort processing of the system's ANSI C Standard library completes,
36 * this function should return to its caller.
37 *
38 * @param(str) message to output just prior to aborting
39 *
40 * If non-`NULL`, this string should be output just prior to
41 * terminating.
42 */
43 Void abort(String str);
44
45 /*!
46 * ======== exit ========
47 * Backend for `{@link System#exit()}`
48 *
49 * This function is called as part the normal "atexit" processing
50 * performed by the ANSI C Standard Library's `exit()` function;
51 * `{@link System#exit()}` directly calls ANSI `exit()`.
52 *
53 * This function is called after all "atexit" handlers bound via
54 * `{@link System#atexit()}` are run and it
55 * is always called while "inside" the the `System` gate.
56 *
57 * To ensure that all exit processing of the system's ANSI C
58 * Standard Library completes, this function should return to its caller.
59 * Exit handlers bound using the ANSI C Standard Library `atexit()`
60 * function may run before or after this function.
61 *
62 * @param(stat) status value passed to all "atexit" handlers
63 *
64 * This value is passed to all "atexit" handles bound via
65 * `{@link System#atexit()}`. If the application exits via the
66 * ANSI C Standard `exit()` function rather than via System_exit(),
67 * `stat` will be equal to `{@link System#STATUS_UNKNOWN}`.
68 *
69 * @see System#atexit
70 */
71 Void exit(Int stat);
72
73 /*!
74 * ======== flush ========
75 * Backend for `{@link System#flush()}`
76 *
77 * This function is simply called by `{@link System#flush System_flush}`
78 * to output any characters buffered by the underlying `SystemSupport`
79 * module to an output device.
80 */
81 Void flush();
82
83 /*!
84 * ======== putch ========
85 * Backend for `{@link System#printf()}` and `{@link System#putch()}`
86 *
87 * Output a single character. This function is called by
88 * `{@link System#printf System_printf()}` to write each character
89 * of formated output specified by its arguments.
90
91 *
92 * @param(ch) character to output
93 */
94 Void putch(Char ch);
95
96 /*!
97 * ======== ready ========
98 * Test if character output can proceed
99 *
100 * This function is called by `{@link System}` prior to performing
101 * any character output. If this function returns `FALSE`, the `System`
102 * functions that would normally call `putch()` simply return
103 * (with an appropriate error status) without ever calling
104 * `{@link #putch}`.
105 */
106 Bool ready();
107 }
108 109 110
111