1 import xdc.rov.ViewInfo;
2
3 /*!
4 * ======== Monitor ========
5 * ROV support for the pure C "module" Mod.c[h]
6 *
7 * The file `Board_serialMon.txt` (contained in this package) illustrates
8 * how to use the runtime monitor `Mon.[ch]` with a TI-RTOS UART driver.
9 */
10 @NoRuntime
11 @HeaderName("")
12 module Monitor
13 {
14 /*!
15 * ======== rovViewInfo ========
16 * @_nodoc
17 */
18 @Facet
19 metaonly config ViewInfo.Instance rovViewInfo =
20 ViewInfo.create({
21 argsMap: [
22 ['VariableNameOrAddr',
23 {
24 description: "Variable Name/Address",
25 args: [
26 {
27 name: "name/addr",
28 type: "number",
29 defaultValue: "0"
30 },
31 {
32 name: "check",
33 type: "boolean",
34 defaultValue: "true"
35 }
36 ]
37 }
38 ],
39 ['ReadMemory',
40 {
41 description: "Memory Read Settings",
42 args: [
43 {
44 name: "addr/name",
45 type: "number",
46 defaultValue: "0"
47 },
48 {
49 name: "length",
50 type: "number",
51 defaultValue: "0"
52 },
53 {
54 name: "check",
55 type: "boolean",
56 defaultValue: "true"
57 }
58 ]
59 }
60 ],
61 ['FindSymbols',
62 {
63 description: "Find Symbol Settings",
64 args: [
65 {
66 name: "addr/name",
67 type: "number",
68 defaultValue: "0"
69 },
70 {
71 name: "radius",
72 type: "number",
73 defaultValue: "0"
74 },
75 {
76 name: "check",
77 type: "boolean",
78 defaultValue: "true"
79 }
80 ]
81 }
82 ],
83 ['ConsoleFilter',
84 {
85 description: "Console Settings",
86 args: [
87 {
88 name: "filter",
89 type: "string",
90 defaultValue: ""
91 },
92 {
93 name: "regexp",
94 type: "boolean",
95 defaultValue: "false"
96 },
97 {
98 name: "maxLines",
99 type: "number",
100 defaultValue: "1000"
101 }
102 ]
103 }
104 ]
105 ],
106 viewMap: [
107 ['Module',
108 {
109 type: ViewInfo.MODULE,
110 viewInitFxn: 'viewInitModule',
111 structName: 'ModuleView'
112 }
113 ],
114 ['Variable',
115 {
116 type: ViewInfo.MODULE,
117 viewInitFxn: 'viewInitVariable',
118 structName: 'VariableView',
119 argsName: 'VariableNameOrAddr'
120 }
121 ],
122 ['UChar',
123 {
124 type: xdc.rov.ViewInfo.MODULE_DATA,
125 viewInitFxn: 'viewInitUChar',
126 structName: 'UCharView',
127 argsName: 'ReadMemory'
128 }
129 ],
130 ['Bits16',
131 {
132 type: xdc.rov.ViewInfo.MODULE_DATA,
133 viewInitFxn: 'viewInitBits16',
134 structName: 'Bits16View',
135 argsName: 'ReadMemory'
136 }
137 ],
138 ['Bits32',
139 {
140 type: xdc.rov.ViewInfo.MODULE_DATA,
141 viewInitFxn: 'viewInitBits32',
142 structName: 'Bits32View',
143 argsName: 'ReadMemory'
144 }
145 ],
146 ['Sections',
147 {
148 type: xdc.rov.ViewInfo.MODULE_DATA,
149 viewInitFxn: 'viewInitSections',
150 structName: 'SectionView'
151 }
152 ],
153 ['Symbols',
154 {
155 type: xdc.rov.ViewInfo.MODULE_DATA,
156 viewInitFxn: 'viewInitSymbols',
157 structName: 'SymbolView',
158 argsName: 'FindSymbols'
159 }
160 ],
161 ['Console',
162 {
163 type: xdc.rov.ViewInfo.MODULE_DATA,
164 viewInitFxn: 'viewInitConsole',
165 structName: 'ConsoleEntryView',
166 argsName: 'ConsoleFilter'
167 }
168 ]
169 ]
170 });
171
172 /*!
173 * ======== ModuleView ========
174 * @_nodoc
175 */
176 metaonly struct ModuleView {
177 String command;
178 String readFxn;
179 String writeFxn;
180 }
181
182 /*!
183 * ======== SectionView ========
184 * @_nodoc
185 */
186 metaonly struct SectionView {
187 String name;
188 Ptr start;
189 Ptr end;
190 UInt len;
191 UInt gap;
192 String kind;
193 String startSym;
194 };
195
196 /*!
197 * ======== SymbolView ========
198 * @_nodoc
199 */
200 metaonly struct SymbolView {
201 String name;
202 Ptr addr;
203 String type;
204 };
205
206 /*!
207 * ======== VariableView ========
208 * @_nodoc
209 */
210 metaonly struct VariableView {
211 String name;
212 String character;
213 String int8_t;
214 String int16_t;
215 String int32_t;
216 String uint8_t;
217 String uint16_t;
218 String uint32_t;
219 String float32;
220 }
221
222 /*!
223 * ======== Bits16View ========
224 * One row of Bits16 values
225 * @_nodoc
226 */
227 metaonly struct Bits16View {
228 Ptr addr;
229 Bits16 word0;
230 Bits16 word1;
231 Bits16 word2;
232 Bits16 word3;
233 Bits16 word4;
234 Bits16 word5;
235 Bits16 word6;
236 Bits16 word7;
237 };
238
239 /*!
240 * ======== Bits32View ========
241 * One row of Bits32 values
242 * @_nodoc
243 */
244 metaonly struct Bits32View {
245 Ptr addr;
246 Bits32 word0;
247 Bits32 word1;
248 Bits32 word2;
249 Bits32 word3;
250 };
251
252 /*!
253 * ======== UCharView ========
254 * One row of UChar values
255 * @_nodoc
256 */
257 metaonly struct UCharView {
258 Ptr addr;
259 UChar byte0;
260 UChar byte1;
261 UChar byte2;
262 UChar byte3;
263 UChar byte4;
264 UChar byte5;
265 UChar byte6;
266 UChar byte7;
267 };
268
269 /*!
270 * ======== ConsoleEntryView ========
271 * Each line in the console output is an entry
272 * @_nodoc
273 */
274 metaonly struct ConsoleEntryView {
275 Bits32 lineId;
276 String entry;
277 }
278
279 /*!
280 * ======== print ========
281 * Append string to the end of the console buffer
282 *
283 * Output is displayed via this module's ROV "Console" view.
284 *
285 * Separate lines are identified by a trailing '\n' character.
286 */
287 metaonly void print(String str, ...);
288
289 /*!
290 * ======== println ========
291 * Append string plus a trailing new line to the console buffer
292 *
293 * Output is displayed via this module's ROV "Console" view.
294 */
295 metaonly void println(String str, ...);
296
297 /*! @_nodoc - target datatype used to fetch data for UCharView */
298 struct UCharBuffer {
299 UChar elem;
300 };
301
302 /*! @_nodoc - target datatype used to fetch data for Bits16View */
303 struct Bits16Buffer {
304 Bits16 elem;
305 };
306
307 /*! @_nodoc - target datatype used to fetch data for Bits32View */
308 struct Bits32Buffer {
309 Bits32 elem;
310 };
311
312 /*! @_nodoc - target datatype used to fetch data for Variable */
313 struct Float32Buffer {
314 Float elem;
315 };
316
317
318 /*! @_nodoc - matches Mon command size */
319 config Int MAXCMDSIZE = 128;
320
321 /*! @_nodoc - Mon state structure address */
322 config Ptr STATEADDR = "&monObject";
323
324 /*! @_nodoc - matches Mon state structure */
325 struct MonState {
326 Char *buffer;
327 Fxn read;
328 Fxn write;
329 };
330 }