1 | /* |
---|
2 | * monlib.c - |
---|
3 | * This file is part of the monitor code, but it is actually linked into |
---|
4 | * the application. It is built with (but not linked with) the monitor, |
---|
5 | * then the monlib.o file is linked with the application. |
---|
6 | * The only requirement on the application is that it know where the address |
---|
7 | * of the monCom function is in the monitor's space. |
---|
8 | * The monCom function will be accessible in some "well-known" way (processor |
---|
9 | * and platform dependent) so that this will not be a problem. |
---|
10 | * |
---|
11 | * This monlib.c file is a replacement for the older mechanism that was |
---|
12 | * a bit more error-prone... A table of function pointers existed at some |
---|
13 | * well-known location in the monitor, and the content of that table was |
---|
14 | * assumed to also be "well-known". This new version only assumes that the |
---|
15 | * pointer to monCom is well-known; everything else will work based on the |
---|
16 | * fact that the monitor and application will share the monlib.h header |
---|
17 | * file. |
---|
18 | * |
---|
19 | ************************************************************************** |
---|
20 | * General notice: |
---|
21 | * This code is part of a boot-monitor package developed as a generic base |
---|
22 | * platform for embedded system designs. As such, it is likely to be |
---|
23 | * distributed to various projects beyond the control of the original |
---|
24 | * author. Please notify the author of any enhancements made or bugs found |
---|
25 | * so that all may benefit from the changes. In addition, notification back |
---|
26 | * to the author will allow the new user to pick up changes that may have |
---|
27 | * been made by other users after this version of the code was distributed. |
---|
28 | * |
---|
29 | * Note1: the majority of this code was edited with 4-space tabs. |
---|
30 | * Note2: as more and more contributions are accepted, the term "author" |
---|
31 | * is becoming a mis-representation of credit. |
---|
32 | * |
---|
33 | * Original author: Ed Sutter |
---|
34 | * Email: esutter@alcatel-lucent.com |
---|
35 | * Phone: 908-582-2351 |
---|
36 | ************************************************************************** |
---|
37 | * |
---|
38 | * Ed Sutter has been informed that this code is being used in RTEMS. |
---|
39 | * |
---|
40 | * This code was reformatted by Joel Sherrill from OAR Corporation and |
---|
41 | * Fernando Nicodemos <fgnicodemos@terra.com.br> from NCB - Sistemas |
---|
42 | * Embarcados Ltda. (Brazil) to be more compliant with RTEMS coding |
---|
43 | * standards and to eliminate C++ style comments. |
---|
44 | * |
---|
45 | * $Id$ |
---|
46 | */ |
---|
47 | |
---|
48 | #include <umon/monlib.h> |
---|
49 | |
---|
50 | static int (*_tfsseek)(int,int,int); |
---|
51 | static int (*_tfsgetline)(int,char *,int); |
---|
52 | static int (*_tfsipmod)(char *,char *,int,int); |
---|
53 | static int (*_tfsinit)(void); |
---|
54 | static int (*_tfsadd)(char *,char *,char *,unsigned char *,int); |
---|
55 | static int (*_tfsunlink)(char *); |
---|
56 | static int (*_tfsrun)(char **,int); |
---|
57 | static int (*_tfsread)(int,char *,int); |
---|
58 | static int (*_tfswrite)(int,char *,int); |
---|
59 | static int (*_tfsopen)(char *,long,char *); |
---|
60 | static int (*_tfsclose)(int,char *); |
---|
61 | static int (*_printf)( |
---|
62 | char *, int,int,int,int,int,int,int,int,int,int,int,int); |
---|
63 | static int (*_cprintf)( |
---|
64 | char *, int,int,int,int,int,int,int,int,int,int,int,int); |
---|
65 | static int (*_sprintf)( |
---|
66 | char *, char *, int,int,int,int,int,int,int,int,int,int,int,int); |
---|
67 | static int (*_monrestart)(int); |
---|
68 | static int (*_rputchar)(unsigned char c); |
---|
69 | static int (*_getchar)(void); |
---|
70 | static int (*_gotachar)(void); |
---|
71 | static int (*_getbytes)(char *,int,int); |
---|
72 | static int (*_addcommand)(struct monCommand *,char *); |
---|
73 | static int (*_docommand)(char *,int); |
---|
74 | static int (*_getline)(char *,int,int); |
---|
75 | static int (*_tfsfstat)(char *,struct tfshdr *); |
---|
76 | static int (*_tfseof)(int); |
---|
77 | static int (*_decompress)(char *,int,char *); |
---|
78 | static int (*_tfstruncate)(int,long); |
---|
79 | static int (*_heapextend)(char *,int); |
---|
80 | static int (*_tfslink)(char *,char *); |
---|
81 | static int (*_pcicfgwrite)(int,int,int,int,int,unsigned long); |
---|
82 | static int (*_i2cwrite)(int,int,unsigned char *,int); |
---|
83 | static int (*_i2cread)(int,int,unsigned char *,int); |
---|
84 | static int (*_flashwrite)(char *,char *,int); |
---|
85 | static int (*_flasherase)(int); |
---|
86 | static int (*_flashinfo)(int,int *,char **); |
---|
87 | static int (*_flashoverride)(void *,int,int); |
---|
88 | static int (*_sendenet)(char *,int); |
---|
89 | static int (*_recvenet)(char *,int); |
---|
90 | static int (*_printpkt)(char *,int,int); |
---|
91 | static int (*_setenv)(char *,char *); |
---|
92 | static int (*_watchdog)(void); |
---|
93 | static int (*_timeofday)(int,void *); |
---|
94 | static int (*_montimer)(int cmd, void *arg); |
---|
95 | |
---|
96 | static char *(*_getenv)(char *); |
---|
97 | static char *(*_version)(void); |
---|
98 | static char *(*_getenvp)(void); |
---|
99 | #ifdef MALLOC_DEBUG |
---|
100 | static char *(*_malloc)(int,char *,int); |
---|
101 | static char *(*_realloc)(char *buf,int,char *,int); |
---|
102 | #else |
---|
103 | static char *(*_malloc)(int); |
---|
104 | static char *(*_realloc)(char *,int); |
---|
105 | #endif |
---|
106 | static char *(*_getsym)(char *,char *,int); |
---|
107 | |
---|
108 | static void (*_intsrestore)(unsigned long); |
---|
109 | static void (*_appexit)(int); |
---|
110 | static void (*_free)(char *); |
---|
111 | static void (*_getargv)(int *,char ***); |
---|
112 | static void (*_profiler)(void *); |
---|
113 | static void (*_bbc)(char *,int); |
---|
114 | static void (*_memtrace)( |
---|
115 | char *, int,int,int,int,int,int,int,int,int,int,int,int); |
---|
116 | static void (*_appwarmstart)(unsigned long); |
---|
117 | static void (*_mondelay)(long); |
---|
118 | static void (*_printmem)(char *,int,int); |
---|
119 | |
---|
120 | static long (*_tfsctrl)(int,long,long); |
---|
121 | static long (*_tfstell)(int); |
---|
122 | static long (*_portcmd)(int,void *); |
---|
123 | |
---|
124 | static struct tfshdr *(*_tfsnext)(struct tfshdr *); |
---|
125 | static struct tfshdr *(*_tfsstat)(char *); |
---|
126 | |
---|
127 | static unsigned long (*_i2cctrl)(int,int,unsigned long,unsigned long); |
---|
128 | static unsigned long (*_pcicfgread)(int,int,int,int,int); |
---|
129 | static unsigned long (*_pcictrl)(int,int,unsigned long,unsigned long); |
---|
130 | static unsigned long (*_crc32)(unsigned char *,unsigned long); |
---|
131 | static unsigned long (*_intsoff)(void); |
---|
132 | static unsigned long (*_assign_handler)(long,unsigned long,unsigned long); |
---|
133 | |
---|
134 | static unsigned short (*_xcrc16)(unsigned char *,unsigned long); |
---|
135 | |
---|
136 | |
---|
137 | static void (*_monlock)(void); |
---|
138 | static void (*_monunlock)(void); |
---|
139 | static int (*_moncom)(int,void *,void *, void *); |
---|
140 | |
---|
141 | /************************************************************************** |
---|
142 | * |
---|
143 | * The following macros support the default monitor lock/unlock mechanism when |
---|
144 | * they point to monLock and monUnlock. If something other than the default |
---|
145 | * is to be used, then simply redefine them here. Refer to the monitor |
---|
146 | * app note that discusses multi-tasking access to the monitor API for more |
---|
147 | * information. |
---|
148 | * |
---|
149 | * TFS_MONLOCK/UNLOCK: |
---|
150 | * Lock/unlock for functions that access TFS flash space: |
---|
151 | */ |
---|
152 | #define TFS_MONLOCK monLock |
---|
153 | #define TFS_MONUNLOCK monUnlock |
---|
154 | |
---|
155 | /* ENV_MONLOCK/UNLOCK: |
---|
156 | * Lock/unlock for functions that access monitor shell variables: |
---|
157 | */ |
---|
158 | #define ENV_MONLOCK monLock |
---|
159 | #define ENV_MONUNLOCK monUnlock |
---|
160 | |
---|
161 | /* CONSOLE_MONLOCK/UNLOCK: |
---|
162 | * Lock/unlock for functions in the monitor that deal with console output. |
---|
163 | */ |
---|
164 | #define CONSOLE_MONLOCK monLock |
---|
165 | #define CONSOLE_MONUNLOCK monUnlock |
---|
166 | |
---|
167 | /* HEAP_MONLOCK/UNLOCK: |
---|
168 | * Lock/unlock for functions in the monitor that deal with the heap. |
---|
169 | */ |
---|
170 | #define HEAP_MONLOCK monLock |
---|
171 | #define HEAP_MONUNLOCK monUnlock |
---|
172 | |
---|
173 | /* BLOCKING_MONLOCK/UNLOCK: |
---|
174 | * Lock/unlock for functions in the monitor that block waiting for |
---|
175 | * console input. |
---|
176 | */ |
---|
177 | #define BLOCKING_MONLOCK monLock |
---|
178 | #define BLOCKING_MONUNLOCK monUnlock |
---|
179 | |
---|
180 | /* GENERIC_MONLOCK/UNLOCK: |
---|
181 | * Lock/unlock for all functions not covered by the above macros. |
---|
182 | */ |
---|
183 | #define GENERIC_MONLOCK monLock |
---|
184 | #define GENERIC_MONUNLOCK monUnlock |
---|
185 | |
---|
186 | /************************************************************************** |
---|
187 | * |
---|
188 | * monConnect(): |
---|
189 | * This must be the first call by the application code to talk to the |
---|
190 | * monitor. It is expecting three incoming function pointers: |
---|
191 | * |
---|
192 | * mon: Points to the monitor's _moncom function; |
---|
193 | * This is a "well-known" address because the monitor and |
---|
194 | * application code (two separately linked binaries) must |
---|
195 | * know it. |
---|
196 | * lock: Points to a function in the application code that will be |
---|
197 | * used by the monitor as a lock-out function (some kind of |
---|
198 | * semaphore in the application). |
---|
199 | * unlock: Points to a function in the application code that will be |
---|
200 | * used by the monitor as an un-lock-out function (undo whatever |
---|
201 | * lock-out mechanism was done by lock). |
---|
202 | */ |
---|
203 | int |
---|
204 | monConnect(int (*mon)(int,void *,void *,void *), |
---|
205 | void (*lock)(void), void (*unlock)(void)) |
---|
206 | { |
---|
207 | int rc = 0; |
---|
208 | |
---|
209 | /* Assign incoming lock and unlock functions... */ |
---|
210 | _monlock = lock; |
---|
211 | _monunlock = unlock; |
---|
212 | |
---|
213 | /* If the mon pointer is non-zero, then make the mon_ connections... */ |
---|
214 | if (mon) { |
---|
215 | |
---|
216 | _moncom = mon; |
---|
217 | |
---|
218 | /* Make the connections between "mon_" functions that are */ |
---|
219 | /* symbolically accessible by the application and the corresponding */ |
---|
220 | /* functions that exists in the monitor. */ |
---|
221 | rc += _moncom(GETMONFUNC_PUTCHAR,&_rputchar,0,0); |
---|
222 | rc += _moncom(GETMONFUNC_GETCHAR,&_getchar,0,0); |
---|
223 | rc += _moncom(GETMONFUNC_GOTACHAR,&_gotachar,0,0); |
---|
224 | rc += _moncom(GETMONFUNC_GETBYTES,&_getbytes,0,0); |
---|
225 | rc += _moncom(GETMONFUNC_PRINTF,&_printf,0,0); |
---|
226 | rc += _moncom(GETMONFUNC_CPRINTF,&_cprintf,0,0); |
---|
227 | rc += _moncom(GETMONFUNC_SPRINTF,&_sprintf,0,0); |
---|
228 | rc += _moncom(GETMONFUNC_RESTART,&_monrestart,0,0); |
---|
229 | rc += _moncom(GETMONFUNC_GETENV,&_getenv,0,0); |
---|
230 | rc += _moncom(GETMONFUNC_SETENV,&_setenv,0,0); |
---|
231 | rc += _moncom(GETMONFUNC_TFSINIT,&_tfsinit,0,0); |
---|
232 | rc += _moncom(GETMONFUNC_TFSADD,&_tfsadd,0,0); |
---|
233 | rc += _moncom(GETMONFUNC_TFSUNLINK,&_tfsunlink,0,0); |
---|
234 | rc += _moncom(GETMONFUNC_TFSRUN,&_tfsrun,0,0); |
---|
235 | rc += _moncom(GETMONFUNC_TFSNEXT,&_tfsnext,0,0); |
---|
236 | rc += _moncom(GETMONFUNC_TFSSTAT,&_tfsstat,0,0); |
---|
237 | rc += _moncom(GETMONFUNC_TFSREAD,&_tfsread,0,0); |
---|
238 | rc += _moncom(GETMONFUNC_TFSWRITE,&_tfswrite,0,0); |
---|
239 | rc += _moncom(GETMONFUNC_TFSOPEN,&_tfsopen,0,0); |
---|
240 | rc += _moncom(GETMONFUNC_TFSCLOSE,&_tfsclose,0,0); |
---|
241 | rc += _moncom(GETMONFUNC_TFSSEEK,&_tfsseek,0,0); |
---|
242 | rc += _moncom(GETMONFUNC_TFSGETLINE,&_tfsgetline,0,0); |
---|
243 | rc += _moncom(GETMONFUNC_TFSIPMOD,&_tfsipmod,0,0); |
---|
244 | rc += _moncom(GETMONFUNC_TFSCTRL,&_tfsctrl,0,0); |
---|
245 | rc += _moncom(GETMONFUNC_ADDCOMMAND,&_addcommand,0,0); |
---|
246 | rc += _moncom(GETMONFUNC_DOCOMMAND,&_docommand,0,0); |
---|
247 | rc += _moncom(GETMONFUNC_GETARGV,&_getargv,0,0); |
---|
248 | rc += _moncom(GETMONFUNC_CRC16,&_xcrc16,0,0); |
---|
249 | rc += _moncom(GETMONFUNC_CRC32,&_crc32,0,0); |
---|
250 | rc += _moncom(GETMONFUNC_INTSOFF,&_intsoff,0,0); |
---|
251 | rc += _moncom(GETMONFUNC_INTSRESTORE,&_intsrestore,0,0); |
---|
252 | rc += _moncom(GETMONFUNC_APPEXIT,&_appexit,0,0); |
---|
253 | rc += _moncom(GETMONFUNC_MALLOC,&_malloc,0,0); |
---|
254 | rc += _moncom(GETMONFUNC_FREE,&_free,0,0); |
---|
255 | rc += _moncom(GETMONFUNC_GETLINE,&_getline,0,0); |
---|
256 | rc += _moncom(GETMONFUNC_TFSFSTAT,&_tfsfstat,0,0); |
---|
257 | rc += _moncom(GETMONFUNC_TFSEOF,&_tfseof,0,0); |
---|
258 | rc += _moncom(GETMONFUNC_DECOMPRESS,&_decompress,0,0); |
---|
259 | rc += _moncom(GETMONFUNC_TFSTRUNCATE,&_tfstruncate,0,0); |
---|
260 | rc += _moncom(GETMONFUNC_HEAPXTEND,&_heapextend,0,0); |
---|
261 | rc += _moncom(GETMONFUNC_PROFILER,&_profiler,0,0); |
---|
262 | rc += _moncom(GETMONFUNC_TFSLINK,&_tfslink,0,0); |
---|
263 | rc += _moncom(GETMONFUNC_BBC,&_bbc,0,0); |
---|
264 | rc += _moncom(GETMONFUNC_MEMTRACE,&_memtrace,0,0); |
---|
265 | rc += _moncom(GETMONFUNC_TFSTELL,&_tfstell,0,0); |
---|
266 | rc += _moncom(GETMONFUNC_VERSION,&_version,0,0); |
---|
267 | rc += _moncom(GETMONFUNC_WARMSTART,&_appwarmstart,0,0); |
---|
268 | rc += _moncom(GETMONFUNC_PCICFGREAD,&_pcicfgread,0,0); |
---|
269 | rc += _moncom(GETMONFUNC_PCICFGWRITE,&_pcicfgwrite,0,0); |
---|
270 | rc += _moncom(GETMONFUNC_PCICONTROL,&_pcictrl,0,0); |
---|
271 | rc += _moncom(GETMONFUNC_I2CREAD,&_i2cread,0,0); |
---|
272 | rc += _moncom(GETMONFUNC_I2CWRITE,&_i2cwrite,0,0); |
---|
273 | rc += _moncom(GETMONFUNC_I2CCONTROL,&_i2cctrl,0,0); |
---|
274 | rc += _moncom(GETMONFUNC_MONDELAY,&_mondelay,0,0); |
---|
275 | rc += _moncom(GETMONFUNC_GETENVP,&_getenvp,0,0); |
---|
276 | rc += _moncom(GETMONFUNC_REALLOC,&_realloc,0,0); |
---|
277 | rc += _moncom(GETMONFUNC_SENDENETPKT,&_sendenet,0,0); |
---|
278 | rc += _moncom(GETMONFUNC_RECVENETPKT,&_recvenet,0,0); |
---|
279 | rc += _moncom(GETMONFUNC_GETSYM,&_getsym,0,0); |
---|
280 | rc += _moncom(GETMONFUNC_PRINTPKT,&_printpkt,0,0); |
---|
281 | rc += _moncom(GETMONFUNC_FLASHWRITE,&_flashwrite,0,0); |
---|
282 | rc += _moncom(GETMONFUNC_FLASHERASE,&_flasherase,0,0); |
---|
283 | rc += _moncom(GETMONFUNC_FLASHINFO,&_flashinfo,0,0); |
---|
284 | rc += _moncom(GETMONFUNC_ASSIGNHDLR,&_assign_handler,0,0); |
---|
285 | rc += _moncom(GETMONFUNC_WATCHDOG,&_watchdog,0,0); |
---|
286 | rc += _moncom(GETMONFUNC_PRINTMEM,&_printmem,0,0); |
---|
287 | rc += _moncom(GETMONFUNC_PORTCMD,&_portcmd,0,0); |
---|
288 | rc += _moncom(GETMONFUNC_TIMEOFDAY,&_timeofday,0,0); |
---|
289 | rc += _moncom(GETMONFUNC_TIMER,&_montimer,0,0); |
---|
290 | rc += _moncom(GETMONFUNC_FLASHOVRRD,&_flashoverride,0,0); |
---|
291 | } |
---|
292 | return(rc); |
---|
293 | } |
---|
294 | |
---|
295 | /* ignorelock: |
---|
296 | * Used as a back-door to disable the monLock()/monUnlock() stuff. |
---|
297 | * This is useful if the application CLI falls through to the monitor's |
---|
298 | * CLI and you are using the "call" command in the monitor to execute some |
---|
299 | * function that has a mon_xxx function in it. In this case, the fact that |
---|
300 | * the application has fallen through to the monitor means that the lock |
---|
301 | * is already active, so when the function tries to call some other mon_xxx |
---|
302 | * function it won't be able to because of the lock already being set. |
---|
303 | * |
---|
304 | * With these functions in the application space, the user can do the |
---|
305 | * following: |
---|
306 | * call %DisableLock |
---|
307 | * call %Func_with_monXXX_in_it |
---|
308 | * call %EnableLock |
---|
309 | * |
---|
310 | * Note that this is NOT to be used by application code, it is simply a |
---|
311 | * back-door mechanism to allow "call" from the CLI to invoke functions |
---|
312 | * that have mon_XXX functionality in them. |
---|
313 | */ |
---|
314 | static int ignorelock = 0; |
---|
315 | |
---|
316 | void |
---|
317 | DisableMonLock(void) |
---|
318 | { |
---|
319 | ignorelock = 2; |
---|
320 | } |
---|
321 | |
---|
322 | void |
---|
323 | EnableMonLock(void) |
---|
324 | { |
---|
325 | ignorelock = 0; |
---|
326 | } |
---|
327 | |
---|
328 | /* monLock() & monUnlock(): |
---|
329 | * Used by all of the wrapper functions below this point to call |
---|
330 | * the function pointed to by _monlock & _monunlock function pointers |
---|
331 | * (if set). |
---|
332 | * These functions must test both the function pointer and the state |
---|
333 | * of the ignorelock variable. The function DisableMonLock() sets the |
---|
334 | * ignorelock variable to 2 because it is being executed through "call" |
---|
335 | * which means that the lock is active. |
---|
336 | */ |
---|
337 | static void |
---|
338 | monLock(void) |
---|
339 | { |
---|
340 | if (_monlock) { |
---|
341 | switch(ignorelock) { |
---|
342 | case 1: |
---|
343 | break; |
---|
344 | case 2: |
---|
345 | ignorelock--; |
---|
346 | break; |
---|
347 | default: |
---|
348 | _monlock(); |
---|
349 | break; |
---|
350 | } |
---|
351 | } |
---|
352 | } |
---|
353 | |
---|
354 | static void |
---|
355 | monUnlock(void) |
---|
356 | { |
---|
357 | if (_monunlock) { |
---|
358 | switch(ignorelock) { |
---|
359 | case 1: |
---|
360 | break; |
---|
361 | case 2: |
---|
362 | ignorelock--; |
---|
363 | default: |
---|
364 | _monunlock(); |
---|
365 | break; |
---|
366 | } |
---|
367 | } |
---|
368 | } |
---|
369 | |
---|
370 | int |
---|
371 | mon_com(int cmd, void *arg1, void *arg2, void *arg3) |
---|
372 | { |
---|
373 | int ret; |
---|
374 | |
---|
375 | GENERIC_MONLOCK(); |
---|
376 | ret = _moncom(cmd,arg1,arg2,arg3); |
---|
377 | GENERIC_MONUNLOCK(); |
---|
378 | return(ret); |
---|
379 | } |
---|
380 | |
---|
381 | int |
---|
382 | mon_putchar(char c) |
---|
383 | { |
---|
384 | int ret; |
---|
385 | |
---|
386 | CONSOLE_MONLOCK(); |
---|
387 | ret = _rputchar(c); |
---|
388 | CONSOLE_MONUNLOCK(); |
---|
389 | return(ret); |
---|
390 | } |
---|
391 | |
---|
392 | int |
---|
393 | mon_getchar(void) |
---|
394 | { |
---|
395 | int ret; |
---|
396 | |
---|
397 | BLOCKING_MONLOCK(); |
---|
398 | ret = _getchar(); |
---|
399 | BLOCKING_MONUNLOCK(); |
---|
400 | return(ret); |
---|
401 | } |
---|
402 | |
---|
403 | int |
---|
404 | mon_gotachar(void) |
---|
405 | { |
---|
406 | int ret; |
---|
407 | |
---|
408 | GENERIC_MONLOCK(); |
---|
409 | ret = _gotachar(); |
---|
410 | GENERIC_MONUNLOCK(); |
---|
411 | return(ret); |
---|
412 | } |
---|
413 | |
---|
414 | int |
---|
415 | mon_getbytes(char *buf,int cnt,int block) |
---|
416 | { |
---|
417 | int ret; |
---|
418 | |
---|
419 | BLOCKING_MONLOCK(); |
---|
420 | ret = _getbytes(buf,cnt,block); |
---|
421 | BLOCKING_MONUNLOCK(); |
---|
422 | return(ret); |
---|
423 | } |
---|
424 | |
---|
425 | int |
---|
426 | mon_printf( |
---|
427 | char *fmt, |
---|
428 | int a1, int a2, int a3, int a4, int a5, int a6, |
---|
429 | int a7, int a8, int a9, int a10, int a11, int a12 |
---|
430 | ) |
---|
431 | { |
---|
432 | int ret; |
---|
433 | |
---|
434 | CONSOLE_MONLOCK(); |
---|
435 | ret = _printf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); |
---|
436 | CONSOLE_MONUNLOCK(); |
---|
437 | return(ret); |
---|
438 | } |
---|
439 | |
---|
440 | int |
---|
441 | mon_cprintf( |
---|
442 | char *fmt, |
---|
443 | int a1, int a2, int a3, int a4, int a5, int a6, |
---|
444 | int a7, int a8, int a9, int a10, int a11, int a12 |
---|
445 | ) |
---|
446 | { |
---|
447 | int ret; |
---|
448 | |
---|
449 | CONSOLE_MONLOCK(); |
---|
450 | ret = _cprintf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); |
---|
451 | CONSOLE_MONUNLOCK(); |
---|
452 | return(ret); |
---|
453 | } |
---|
454 | |
---|
455 | int |
---|
456 | mon_sprintf( |
---|
457 | char *buf, |
---|
458 | char *fmt, |
---|
459 | int a1, int a2, int a3, int a4, int a5, int a6, |
---|
460 | int a7, int a8, int a9, int a10, int a11, int a12 |
---|
461 | ) |
---|
462 | { |
---|
463 | int ret; |
---|
464 | |
---|
465 | GENERIC_MONLOCK(); |
---|
466 | ret = _sprintf(buf,fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); |
---|
467 | GENERIC_MONUNLOCK(); |
---|
468 | return(ret); |
---|
469 | } |
---|
470 | |
---|
471 | int |
---|
472 | mon_restart(int val) |
---|
473 | { |
---|
474 | int ret; |
---|
475 | |
---|
476 | GENERIC_MONLOCK(); |
---|
477 | ret = _monrestart(val); |
---|
478 | GENERIC_MONUNLOCK(); |
---|
479 | return(ret); |
---|
480 | } |
---|
481 | |
---|
482 | char * |
---|
483 | mon_getenvp(void) |
---|
484 | { |
---|
485 | char *ret; |
---|
486 | |
---|
487 | ENV_MONLOCK(); |
---|
488 | ret = _getenvp(); |
---|
489 | ENV_MONUNLOCK(); |
---|
490 | return(ret); |
---|
491 | } |
---|
492 | |
---|
493 | char * |
---|
494 | mon_getenv(char *name) |
---|
495 | { |
---|
496 | char *ret; |
---|
497 | |
---|
498 | ENV_MONLOCK(); |
---|
499 | ret = _getenv(name); |
---|
500 | ENV_MONUNLOCK(); |
---|
501 | return(ret); |
---|
502 | } |
---|
503 | |
---|
504 | int |
---|
505 | mon_setenv(char *name,char *val) |
---|
506 | { |
---|
507 | int ret; |
---|
508 | |
---|
509 | ENV_MONLOCK(); |
---|
510 | ret = _setenv(name,val); |
---|
511 | ENV_MONUNLOCK(); |
---|
512 | return(ret); |
---|
513 | } |
---|
514 | |
---|
515 | char * |
---|
516 | mon_getsym(char *name,char *buf, int bufsize) |
---|
517 | { |
---|
518 | char *ret; |
---|
519 | |
---|
520 | ENV_MONLOCK(); |
---|
521 | ret = _getsym(name,buf,bufsize); |
---|
522 | ENV_MONUNLOCK(); |
---|
523 | return(ret); |
---|
524 | } |
---|
525 | |
---|
526 | int |
---|
527 | mon_tfsinit(void) |
---|
528 | { |
---|
529 | int ret; |
---|
530 | |
---|
531 | TFS_MONLOCK(); |
---|
532 | ret = _tfsinit(); |
---|
533 | TFS_MONUNLOCK(); |
---|
534 | return(ret); |
---|
535 | } |
---|
536 | |
---|
537 | int |
---|
538 | mon_tfsadd(char *name, char *info, char *flags, unsigned char *src, int size) |
---|
539 | { |
---|
540 | int ret; |
---|
541 | |
---|
542 | TFS_MONLOCK(); |
---|
543 | ret = _tfsadd(name,info,flags,src,size); |
---|
544 | TFS_MONUNLOCK(); |
---|
545 | return(ret); |
---|
546 | } |
---|
547 | |
---|
548 | int |
---|
549 | mon_tfslink(char *src, char *target) |
---|
550 | { |
---|
551 | int ret; |
---|
552 | |
---|
553 | TFS_MONLOCK(); |
---|
554 | ret = _tfslink(src,target); |
---|
555 | TFS_MONUNLOCK(); |
---|
556 | return(ret); |
---|
557 | } |
---|
558 | |
---|
559 | int |
---|
560 | mon_tfsunlink(char *name) |
---|
561 | { |
---|
562 | int ret; |
---|
563 | |
---|
564 | TFS_MONLOCK(); |
---|
565 | ret = _tfsunlink(name); |
---|
566 | TFS_MONUNLOCK(); |
---|
567 | return(ret); |
---|
568 | } |
---|
569 | |
---|
570 | int |
---|
571 | mon_tfsrun(char **name,int verbose) |
---|
572 | { |
---|
573 | int ret; |
---|
574 | |
---|
575 | TFS_MONLOCK(); |
---|
576 | ret = _tfsrun(name,verbose); |
---|
577 | TFS_MONUNLOCK(); |
---|
578 | return(ret); |
---|
579 | } |
---|
580 | |
---|
581 | struct tfshdr * |
---|
582 | mon_tfsnext(struct tfshdr *fp) |
---|
583 | { |
---|
584 | struct tfshdr *ret; |
---|
585 | |
---|
586 | TFS_MONLOCK(); |
---|
587 | ret = _tfsnext(fp); |
---|
588 | TFS_MONUNLOCK(); |
---|
589 | return(ret); |
---|
590 | } |
---|
591 | |
---|
592 | int |
---|
593 | mon_tfstruncate(int tfd, long len) |
---|
594 | { |
---|
595 | int ret; |
---|
596 | |
---|
597 | TFS_MONLOCK(); |
---|
598 | ret = _tfstruncate(tfd,len); |
---|
599 | TFS_MONUNLOCK(); |
---|
600 | return(ret); |
---|
601 | } |
---|
602 | |
---|
603 | int |
---|
604 | mon_tfseof(int tfd) |
---|
605 | { |
---|
606 | int ret; |
---|
607 | |
---|
608 | TFS_MONLOCK(); |
---|
609 | ret = _tfseof(tfd); |
---|
610 | TFS_MONUNLOCK(); |
---|
611 | return(ret); |
---|
612 | } |
---|
613 | |
---|
614 | int |
---|
615 | mon_tfsfstat(char *name, struct tfshdr *fp) |
---|
616 | { |
---|
617 | int ret; |
---|
618 | |
---|
619 | TFS_MONLOCK(); |
---|
620 | ret = _tfsfstat(name,fp); |
---|
621 | TFS_MONUNLOCK(); |
---|
622 | return(ret); |
---|
623 | } |
---|
624 | |
---|
625 | struct tfshdr * |
---|
626 | mon_tfsstat(char *name) |
---|
627 | { |
---|
628 | struct tfshdr *ret; |
---|
629 | |
---|
630 | TFS_MONLOCK(); |
---|
631 | ret = _tfsstat(name); |
---|
632 | TFS_MONUNLOCK(); |
---|
633 | return(ret); |
---|
634 | } |
---|
635 | |
---|
636 | int |
---|
637 | mon_tfsread(int fd, char *buf, int cnt) |
---|
638 | { |
---|
639 | int ret; |
---|
640 | |
---|
641 | TFS_MONLOCK(); |
---|
642 | ret = _tfsread(fd,buf,cnt); |
---|
643 | TFS_MONUNLOCK(); |
---|
644 | return(ret); |
---|
645 | } |
---|
646 | |
---|
647 | int |
---|
648 | mon_tfswrite(int fd, char *buf, int cnt) |
---|
649 | { |
---|
650 | int ret; |
---|
651 | |
---|
652 | TFS_MONLOCK(); |
---|
653 | ret = _tfswrite(fd,buf,cnt); |
---|
654 | TFS_MONUNLOCK(); |
---|
655 | return(ret); |
---|
656 | } |
---|
657 | |
---|
658 | int |
---|
659 | mon_tfsopen(char *file,long flagmode,char *buf) |
---|
660 | { |
---|
661 | int ret; |
---|
662 | |
---|
663 | TFS_MONLOCK(); |
---|
664 | ret = _tfsopen(file,flagmode,buf); |
---|
665 | TFS_MONUNLOCK(); |
---|
666 | return(ret); |
---|
667 | } |
---|
668 | |
---|
669 | int |
---|
670 | mon_tfsclose(int fd,char *info) |
---|
671 | { |
---|
672 | int ret; |
---|
673 | |
---|
674 | TFS_MONLOCK(); |
---|
675 | ret = _tfsclose(fd,info); |
---|
676 | TFS_MONUNLOCK(); |
---|
677 | return(ret); |
---|
678 | } |
---|
679 | |
---|
680 | int |
---|
681 | mon_tfsseek(int fd, int offset, int whence) |
---|
682 | { |
---|
683 | int ret; |
---|
684 | |
---|
685 | TFS_MONLOCK(); |
---|
686 | ret = _tfsseek(fd,offset,whence); |
---|
687 | TFS_MONUNLOCK(); |
---|
688 | return(ret); |
---|
689 | } |
---|
690 | |
---|
691 | int |
---|
692 | mon_tfsgetline(int fd,char *bp,int max) |
---|
693 | { |
---|
694 | int ret; |
---|
695 | |
---|
696 | TFS_MONLOCK(); |
---|
697 | ret = _tfsgetline(fd,bp,max); |
---|
698 | TFS_MONUNLOCK(); |
---|
699 | return(ret); |
---|
700 | } |
---|
701 | |
---|
702 | int |
---|
703 | mon_tfsipmod(char *name,char *buf,int offset,int size) |
---|
704 | { |
---|
705 | int ret; |
---|
706 | |
---|
707 | TFS_MONLOCK(); |
---|
708 | ret = _tfsipmod(name,buf,offset,size); |
---|
709 | TFS_MONUNLOCK(); |
---|
710 | return(ret); |
---|
711 | } |
---|
712 | |
---|
713 | long |
---|
714 | mon_tfsctrl(int rqst,long arg1,long arg2) |
---|
715 | { |
---|
716 | long ret; |
---|
717 | |
---|
718 | TFS_MONLOCK(); |
---|
719 | ret = _tfsctrl(rqst,arg1,arg2); |
---|
720 | TFS_MONUNLOCK(); |
---|
721 | return(ret); |
---|
722 | } |
---|
723 | |
---|
724 | long |
---|
725 | mon_tfstell(int fd) |
---|
726 | { |
---|
727 | long ret; |
---|
728 | |
---|
729 | TFS_MONLOCK(); |
---|
730 | ret = _tfstell(fd); |
---|
731 | TFS_MONUNLOCK(); |
---|
732 | return(ret); |
---|
733 | } |
---|
734 | |
---|
735 | int |
---|
736 | mon_addcommand(struct monCommand *cmdlist, char *cmdlvl) |
---|
737 | { |
---|
738 | int ret; |
---|
739 | |
---|
740 | GENERIC_MONLOCK(); |
---|
741 | ret = _addcommand(cmdlist,cmdlvl); |
---|
742 | GENERIC_MONUNLOCK(); |
---|
743 | return(ret); |
---|
744 | } |
---|
745 | |
---|
746 | int |
---|
747 | mon_docommand(char *cmdline,int verbose) |
---|
748 | { |
---|
749 | int ret; |
---|
750 | |
---|
751 | GENERIC_MONLOCK(); |
---|
752 | ret = _docommand(cmdline,verbose); |
---|
753 | GENERIC_MONUNLOCK(); |
---|
754 | return(ret); |
---|
755 | } |
---|
756 | |
---|
757 | void |
---|
758 | mon_getargv(int *argc,char ***argv) |
---|
759 | { |
---|
760 | GENERIC_MONLOCK(); |
---|
761 | _getargv(argc,argv); |
---|
762 | GENERIC_MONUNLOCK(); |
---|
763 | } |
---|
764 | |
---|
765 | unsigned short |
---|
766 | mon_xcrc16(char *buf,long nbytes) |
---|
767 | { |
---|
768 | unsigned short ret; |
---|
769 | |
---|
770 | GENERIC_MONLOCK(); |
---|
771 | ret = _xcrc16((unsigned char *)buf,nbytes); |
---|
772 | GENERIC_MONUNLOCK(); |
---|
773 | return(ret); |
---|
774 | } |
---|
775 | |
---|
776 | unsigned long |
---|
777 | mon_intsoff(void) |
---|
778 | { |
---|
779 | unsigned long ret; |
---|
780 | |
---|
781 | GENERIC_MONLOCK(); |
---|
782 | ret = _intsoff(); |
---|
783 | GENERIC_MONUNLOCK(); |
---|
784 | return(ret); |
---|
785 | } |
---|
786 | |
---|
787 | void |
---|
788 | mon_intsrestore(unsigned long msr) |
---|
789 | { |
---|
790 | GENERIC_MONLOCK(); |
---|
791 | _intsrestore(msr); |
---|
792 | GENERIC_MONUNLOCK(); |
---|
793 | } |
---|
794 | |
---|
795 | void |
---|
796 | mon_appexit(int val) |
---|
797 | { |
---|
798 | GENERIC_MONLOCK(); |
---|
799 | _appexit(val); |
---|
800 | GENERIC_MONUNLOCK(); |
---|
801 | } |
---|
802 | |
---|
803 | #ifdef MALLOC_DEBUG |
---|
804 | char * |
---|
805 | mon_malloc(int size,char *fname,int fline) |
---|
806 | { |
---|
807 | char *ret; |
---|
808 | |
---|
809 | HEAP_MONLOCK(); |
---|
810 | ret = _malloc(size,fname,fline); |
---|
811 | HEAP_MONUNLOCK(); |
---|
812 | return(ret); |
---|
813 | } |
---|
814 | |
---|
815 | char * |
---|
816 | mon_realloc(char *buf, int size, char *fname, int fline) |
---|
817 | { |
---|
818 | char *ret; |
---|
819 | |
---|
820 | HEAP_MONLOCK(); |
---|
821 | ret = _realloc(buf,size, fname, fline); |
---|
822 | HEAP_MONUNLOCK(); |
---|
823 | return(ret); |
---|
824 | } |
---|
825 | #else |
---|
826 | char * |
---|
827 | mon_malloc(int size) |
---|
828 | { |
---|
829 | char *ret; |
---|
830 | |
---|
831 | HEAP_MONLOCK(); |
---|
832 | ret = _malloc(size); |
---|
833 | HEAP_MONUNLOCK(); |
---|
834 | return(ret); |
---|
835 | } |
---|
836 | |
---|
837 | char * |
---|
838 | mon_realloc(char *buf, int size) |
---|
839 | { |
---|
840 | char *ret; |
---|
841 | |
---|
842 | HEAP_MONLOCK(); |
---|
843 | ret = _realloc(buf,size); |
---|
844 | HEAP_MONUNLOCK(); |
---|
845 | return(ret); |
---|
846 | } |
---|
847 | #endif |
---|
848 | |
---|
849 | void |
---|
850 | mon_free(char *cp) |
---|
851 | { |
---|
852 | HEAP_MONLOCK(); |
---|
853 | _free(cp); |
---|
854 | HEAP_MONUNLOCK(); |
---|
855 | } |
---|
856 | |
---|
857 | int |
---|
858 | mon_getline(char *buf,int max,int ledit) |
---|
859 | { |
---|
860 | int ret; |
---|
861 | |
---|
862 | BLOCKING_MONLOCK(); |
---|
863 | ret = _getline(buf,max,ledit); |
---|
864 | BLOCKING_MONUNLOCK(); |
---|
865 | return(ret); |
---|
866 | } |
---|
867 | |
---|
868 | int |
---|
869 | mon_decompress(char *src,int srcsize,char *dest) |
---|
870 | { |
---|
871 | int ret; |
---|
872 | |
---|
873 | GENERIC_MONLOCK(); |
---|
874 | ret = _decompress(src,srcsize,dest); |
---|
875 | GENERIC_MONUNLOCK(); |
---|
876 | return(ret); |
---|
877 | } |
---|
878 | |
---|
879 | int |
---|
880 | mon_heapextend(char *base,int size) |
---|
881 | { |
---|
882 | int ret; |
---|
883 | |
---|
884 | GENERIC_MONLOCK(); |
---|
885 | ret = _heapextend(base,size); |
---|
886 | GENERIC_MONUNLOCK(); |
---|
887 | return(ret); |
---|
888 | } |
---|
889 | |
---|
890 | void |
---|
891 | mon_bbc(char *filename, int lineno) |
---|
892 | { |
---|
893 | _bbc(filename, lineno); |
---|
894 | } |
---|
895 | |
---|
896 | void |
---|
897 | mon_profiler(void *pdata) |
---|
898 | { |
---|
899 | _profiler(pdata); |
---|
900 | } |
---|
901 | |
---|
902 | void |
---|
903 | mon_memtrace( |
---|
904 | char *fmt, |
---|
905 | int a1, int a2, int a3, int a4, int a5, int a6, |
---|
906 | int a7, int a8, int a9, int a10, int a11, int a12 |
---|
907 | ) |
---|
908 | { |
---|
909 | _memtrace(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); |
---|
910 | } |
---|
911 | |
---|
912 | char * |
---|
913 | mon_version(void) |
---|
914 | { |
---|
915 | char *ret; |
---|
916 | |
---|
917 | GENERIC_MONLOCK(); |
---|
918 | ret = _version(); |
---|
919 | GENERIC_MONUNLOCK(); |
---|
920 | return(ret); |
---|
921 | } |
---|
922 | |
---|
923 | void |
---|
924 | mon_warmstart(unsigned long mask) |
---|
925 | { |
---|
926 | GENERIC_MONLOCK(); |
---|
927 | _appwarmstart(mask); |
---|
928 | GENERIC_MONUNLOCK(); |
---|
929 | } |
---|
930 | |
---|
931 | int |
---|
932 | mon_pcicfgwrite(int interface,int bus,int dev,int func,int reg, |
---|
933 | unsigned long val) |
---|
934 | { |
---|
935 | int retval; |
---|
936 | |
---|
937 | GENERIC_MONLOCK(); |
---|
938 | retval = _pcicfgwrite(interface,bus,dev,func,reg,val); |
---|
939 | GENERIC_MONUNLOCK(); |
---|
940 | return(retval); |
---|
941 | } |
---|
942 | |
---|
943 | unsigned long |
---|
944 | mon_pcicfgread(int interface,int bus,int dev, int func,int reg) |
---|
945 | { |
---|
946 | unsigned long retval; |
---|
947 | |
---|
948 | GENERIC_MONLOCK(); |
---|
949 | retval = _pcicfgread(interface,bus,dev,func,reg); |
---|
950 | GENERIC_MONUNLOCK(); |
---|
951 | return(retval); |
---|
952 | } |
---|
953 | |
---|
954 | unsigned long |
---|
955 | mon_pcictrl(int interface, int cmd, unsigned long arg1, unsigned long arg2) |
---|
956 | { |
---|
957 | unsigned long val; |
---|
958 | |
---|
959 | GENERIC_MONLOCK(); |
---|
960 | val = _pcictrl(interface,cmd,arg1,arg2); |
---|
961 | GENERIC_MONUNLOCK(); |
---|
962 | return(val); |
---|
963 | } |
---|
964 | |
---|
965 | unsigned long |
---|
966 | mon_i2cctrl(int interface, int cmd, unsigned long arg1, unsigned long arg2) |
---|
967 | { |
---|
968 | unsigned long val; |
---|
969 | |
---|
970 | GENERIC_MONLOCK(); |
---|
971 | val = _i2cctrl(interface,cmd,arg1,arg2); |
---|
972 | GENERIC_MONUNLOCK(); |
---|
973 | return(val); |
---|
974 | } |
---|
975 | |
---|
976 | int |
---|
977 | mon_i2cwrite(int interface, int bigaddr, unsigned char *data, int len) |
---|
978 | { |
---|
979 | int val; |
---|
980 | |
---|
981 | GENERIC_MONLOCK(); |
---|
982 | val = _i2cwrite(interface,bigaddr,data,len); |
---|
983 | GENERIC_MONUNLOCK(); |
---|
984 | return(val); |
---|
985 | } |
---|
986 | |
---|
987 | int |
---|
988 | mon_i2cread(int interface, int bigaddr, unsigned char *data, int len) |
---|
989 | { |
---|
990 | int val; |
---|
991 | |
---|
992 | GENERIC_MONLOCK(); |
---|
993 | val = _i2cread(interface,bigaddr,data,len); |
---|
994 | GENERIC_MONUNLOCK(); |
---|
995 | return(val); |
---|
996 | } |
---|
997 | |
---|
998 | void |
---|
999 | mon_delay(long msec) |
---|
1000 | { |
---|
1001 | GENERIC_MONLOCK(); |
---|
1002 | _mondelay(msec); |
---|
1003 | GENERIC_MONUNLOCK(); |
---|
1004 | } |
---|
1005 | |
---|
1006 | int |
---|
1007 | mon_timer(int cmd, void *arg) |
---|
1008 | { |
---|
1009 | int ret; |
---|
1010 | |
---|
1011 | GENERIC_MONLOCK(); |
---|
1012 | ret = _montimer(cmd, arg); |
---|
1013 | GENERIC_MONUNLOCK(); |
---|
1014 | return(ret); |
---|
1015 | } |
---|
1016 | |
---|
1017 | int |
---|
1018 | mon_sendenetpkt(char *pkt,int size) |
---|
1019 | { |
---|
1020 | int ret; |
---|
1021 | |
---|
1022 | GENERIC_MONLOCK(); |
---|
1023 | ret = _sendenet(pkt,size); |
---|
1024 | GENERIC_MONUNLOCK(); |
---|
1025 | return(ret); |
---|
1026 | } |
---|
1027 | |
---|
1028 | int |
---|
1029 | mon_recvenetpkt(char *pkt,int size) |
---|
1030 | { |
---|
1031 | int ret; |
---|
1032 | |
---|
1033 | GENERIC_MONLOCK(); |
---|
1034 | ret = _recvenet(pkt,size); |
---|
1035 | GENERIC_MONUNLOCK(); |
---|
1036 | return(ret); |
---|
1037 | } |
---|
1038 | |
---|
1039 | void |
---|
1040 | mon_printpkt(char *buf,int size, int incoming) |
---|
1041 | { |
---|
1042 | GENERIC_MONLOCK(); |
---|
1043 | _printpkt(buf,size,incoming); |
---|
1044 | GENERIC_MONUNLOCK(); |
---|
1045 | } |
---|
1046 | |
---|
1047 | int |
---|
1048 | mon_flashoverride(void *flashinfo,int get,int bank) |
---|
1049 | { |
---|
1050 | int ret; |
---|
1051 | |
---|
1052 | TFS_MONLOCK(); |
---|
1053 | ret = _flashoverride(flashinfo,get,bank); |
---|
1054 | TFS_MONUNLOCK(); |
---|
1055 | return(ret); |
---|
1056 | } |
---|
1057 | |
---|
1058 | int |
---|
1059 | mon_flashwrite(char *dest,char *src,int bytecnt) |
---|
1060 | { |
---|
1061 | int ret; |
---|
1062 | |
---|
1063 | TFS_MONLOCK(); |
---|
1064 | ret = _flashwrite(dest,src,bytecnt); |
---|
1065 | TFS_MONUNLOCK(); |
---|
1066 | return(ret); |
---|
1067 | } |
---|
1068 | |
---|
1069 | int |
---|
1070 | mon_flasherase(int snum) |
---|
1071 | { |
---|
1072 | int ret; |
---|
1073 | |
---|
1074 | TFS_MONLOCK(); |
---|
1075 | ret = _flasherase(snum); |
---|
1076 | TFS_MONUNLOCK(); |
---|
1077 | return(ret); |
---|
1078 | } |
---|
1079 | |
---|
1080 | int |
---|
1081 | mon_flashinfo(int snum, int *size, char **base) |
---|
1082 | { |
---|
1083 | int ret; |
---|
1084 | |
---|
1085 | TFS_MONLOCK(); |
---|
1086 | ret = _flashinfo(snum,size,base); |
---|
1087 | TFS_MONUNLOCK(); |
---|
1088 | return(ret); |
---|
1089 | } |
---|
1090 | |
---|
1091 | unsigned long |
---|
1092 | mon_assignhandler(long hnum, unsigned long arg1, unsigned long arg2) |
---|
1093 | { |
---|
1094 | int ret; |
---|
1095 | |
---|
1096 | GENERIC_MONLOCK(); |
---|
1097 | ret = _assign_handler(hnum,arg1,arg2); |
---|
1098 | GENERIC_MONUNLOCK(); |
---|
1099 | return(ret); |
---|
1100 | } |
---|
1101 | |
---|
1102 | int |
---|
1103 | mon_watchdog(void) |
---|
1104 | { |
---|
1105 | int ret; |
---|
1106 | |
---|
1107 | GENERIC_MONLOCK(); |
---|
1108 | ret = _watchdog(); |
---|
1109 | GENERIC_MONUNLOCK(); |
---|
1110 | return(ret); |
---|
1111 | } |
---|
1112 | |
---|
1113 | void |
---|
1114 | mon_printmem(char *mem, int size, int ascii) |
---|
1115 | { |
---|
1116 | GENERIC_MONLOCK(); |
---|
1117 | _printmem(mem,size,ascii); |
---|
1118 | GENERIC_MONUNLOCK(); |
---|
1119 | } |
---|
1120 | |
---|
1121 | long |
---|
1122 | mon_portcmd(int cmd, void *arg) |
---|
1123 | { |
---|
1124 | long ret; |
---|
1125 | |
---|
1126 | GENERIC_MONLOCK(); |
---|
1127 | ret = _portcmd(cmd,arg); |
---|
1128 | GENERIC_MONUNLOCK(); |
---|
1129 | return(ret); |
---|
1130 | } |
---|
1131 | |
---|
1132 | int |
---|
1133 | mon_timeofday(int cmd, void *arg) |
---|
1134 | { |
---|
1135 | int ret; |
---|
1136 | |
---|
1137 | GENERIC_MONLOCK(); |
---|
1138 | ret = _timeofday(cmd,arg); |
---|
1139 | GENERIC_MONUNLOCK(); |
---|
1140 | return(ret); |
---|
1141 | } |
---|