1 2 3 4 5 6 7 8 9 10 11 12
13 14 15
16 package xdc.runtime;
17
18 /*!
19 * ======== SysCallback ========
20 * ISystemSupport implementation for user callback functions
21 *
22 * This module provides a implementation of the `{@link ISystemSupport}`
23 * interface that simply calls back the user defined functions to enable the
24 * System module's functionality.
25 *
26 * Configuration is as shown below.
27 * @p(code)
28 *
29 * var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
30 * SysCallback.abortFxn = "&userAbort";
31 * SysCallback.exitFxn = "&userExit";
32 * SysCallback.flushFxn = "&userFlush";
33 * SysCallback.putchFxn = "&userPutch";
34 * SysCallback.readyFxn = "&userReady";
35 *
36 * @p
37 *
38 */
39 module SysCallback inherits xdc.runtime.ISystemSupport
40 {
41 /*!
42 * ======== AbortFxn ========
43 * Abort function signature
44 */
45 typedef Void (*AbortFxn)(CString);
46
47 /*!
48 * ======== defaultAbort ========
49 * Default abort function that does nothing
50 *
51 * This default abort function spins forever and never returns.
52 */
53 extern Void defaultAbort(CString) = xdc_runtime_SysCallback_defaultAbort;
54
55 /*!
56 * ======== ExitFxn ========
57 * Exit function signature
58 */
59 typedef Void (*ExitFxn)(Int);
60
61 /*!
62 * ======== defaultExit ========
63 * Default exit function that does nothing
64 *
65 * The default exit function does nothing and returns.
66 */
67 extern Void defaultExit(Int) = xdc_runtime_SysCallback_defaultExit;
68
69 /*!
70 * ======== FlushFxn ========
71 * Flush function signature
72 */
73 typedef Void (*FlushFxn)();
74
75 /*!
76 * ======== defaultFlush ========
77 * Default flush function that does nothing
78 *
79 * The default flush function does nothing and returns.
80 */
81 extern Void defaultFlush() = xdc_runtime_SysCallback_defaultFlush;
82
83 /*!
84 * ======== PutchFxn ========
85 * Putch function signature
86 */
87 typedef Void (*PutchFxn)(Char);
88
89 /*!
90 * ======== defaultPutch ========
91 * Default putch function that does nothing
92 *
93 * The default putch function drops the characters.
94 */
95 extern Void defaultPutch(Char) = xdc_runtime_SysCallback_defaultPutch;
96
97 /*!
98 * ======== ReadyFxn ========
99 * Ready function signature
100 */
101 typedef Bool (*ReadyFxn)();
102
103 /*!
104 * ======== defaultReady ========
105 * Default ready function that does nothing
106 *
107 * The default ready function returns `TRUE` always.
108 */
109 extern Bool defaultReady() = xdc_runtime_SysCallback_defaultReady;
110
111 /*!
112 * ======== abortFxn =========
113 * User supplied abort function
114 *
115 * This function is called when the application calls
116 * `{@link System#abort()}` function. If the user supplied funtion
117 * returns, the abort function of the ANSI C Standard library is called.
118 * For more information see the `{@link System#abort()}` documentation.
119 *
120 * By default, this function is configured with a default abort function.
121 * This default abort function spins forever and never returns.
122 */
123 config AbortFxn abortFxn = "&xdc_runtime_SysCallback_defaultAbort";
124
125 /*!
126 * ======== exitFxn =========
127 * User supplied exit function
128 *
129 * This function is called when the application calls
130 * `{@link System#exit()}` function. If the user supplied function
131 * returns, the ANSI C Standard Library atexit processing will be
132 * completed. For more information see the `{@link System#exit()}`
133 * documentation.
134 *
135 * By default, this function is configured with a default exit function.
136 * The default exit function does nothing and returns.
137 */
138 config ExitFxn exitFxn = "&xdc_runtime_SysCallback_defaultExit";
139
140 /*!
141 * ======== flushFxn =========
142 * User supplied flush function
143 *
144 * This function is called when the application calls
145 * `{@link System#flush()}` function.
146 *
147 * By default, this function is configured with a default flush function.
148 * The default flush function does nothing and returns.
149 */
150 config FlushFxn flushFxn = "&xdc_runtime_SysCallback_defaultFlush";
151
152 /*!
153 * ======== putchFxn =========
154 * User supplied character output function
155 *
156 * This function is called whenever the `System` module needs to output
157 * a character; e.g., during `{@link System#printf()}` or
158 * `{@link System#putch()}`.
159 *
160 * By default, this function is configured with a default putch function.
161 * The default putch function drops the characters.
162 */
163 config PutchFxn putchFxn = "&xdc_runtime_SysCallback_defaultPutch";
164
165 /*!
166 * ======== readyFxn =========
167 * User supplied ready function
168 *
169 * This function is called by the `System` module prior to performing any
170 * character output to check if the `SystemSupport` module is ready to
171 * accept the character. For more information see the
172 * `{@link ISystemSupport#ready()}` documentation.
173 *
174 * By default, this function is configured with a default ready function.
175 * The default ready function returns `TRUE` always.
176 */
177 config ReadyFxn readyFxn = "&xdc_runtime_SysCallback_defaultReady";
178 }
179 180 181
182