File indexing completed on 2025-05-11 08:22:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #define _INSIDE_MONLIB
0047 #include <umon/monlib.h>
0048
0049 static int (*_tfsseek)(int,int,int);
0050 static int (*_tfsgetline)(int,char *,int);
0051 static int (*_tfsipmod)(char *,char *,int,int);
0052 static int (*_tfsinit)(void);
0053 static int (*_tfsadd)(char *,char *,char *,unsigned char *,int);
0054 static int (*_tfsunlink)(char *);
0055 static int (*_tfsrun)(char **,int);
0056 static int (*_tfsread)(int,char *,int);
0057 static int (*_tfswrite)(int,char *,int);
0058 static int (*_tfsopen)(char *,long,char *);
0059 static int (*_tfsclose)(int,char *);
0060 static int (*_printf)(
0061 char *, int,int,int,int,int,int,int,int,int,int,int,int);
0062 static int (*_cprintf)(
0063 char *, int,int,int,int,int,int,int,int,int,int,int,int);
0064 static int (*_sprintf)(
0065 char *, char *, int,int,int,int,int,int,int,int,int,int,int,int);
0066 static int (*_monrestart)(int);
0067 static int (*_rputchar)(unsigned char c);
0068 static int (*_getchar)(void);
0069 static int (*_gotachar)(void);
0070 static int (*_getbytes)(char *,int,int);
0071 static int (*_addcommand)(struct monCommand *,char *);
0072 static int (*_docommand)(char *,int);
0073 static int (*_getline)(char *,int,int);
0074 static int (*_tfsfstat)(char *,struct tfshdr *);
0075 static int (*_tfseof)(int);
0076 static int (*_decompress)(char *,int,char *);
0077 static int (*_tfstruncate)(int,long);
0078 static int (*_heapextend)(char *,int);
0079 static int (*_tfslink)(char *,char *);
0080 static int (*_pcicfgwrite)(int,int,int,int,int,unsigned long);
0081 static int (*_i2cwrite)(int,int,unsigned char *,int);
0082 static int (*_i2cread)(int,int,unsigned char *,int);
0083 static int (*_flashwrite)(char *,char *,int);
0084 static int (*_flasherase)(int);
0085 static int (*_flashinfo)(int,int *,char **);
0086 static int (*_flashoverride)(void *,int,int);
0087 static int (*_sendenet)(char *,int);
0088 static int (*_recvenet)(char *,int);
0089 static int (*_printpkt)(char *,int,int);
0090 static int (*_setenv)(char *,char *);
0091 static int (*_watchdog)(void);
0092 static int (*_timeofday)(int,void *);
0093 static int (*_montimer)(int cmd, void *arg);
0094
0095 static char *(*_getenv)(char *);
0096 static char *(*_version)(void);
0097 static char *(*_getenvp)(void);
0098 #ifdef MALLOC_DEBUG
0099 static char *(*_malloc)(int,char *,int);
0100 static char *(*_realloc)(char *buf,int,char *,int);
0101 #else
0102 static char *(*_malloc)(int);
0103 static char *(*_realloc)(char *,int);
0104 #endif
0105 static char *(*_getsym)(char *,char *,int);
0106
0107 static void (*_intsrestore)(unsigned long);
0108 static void (*_appexit)(int);
0109 static void (*_free)(char *);
0110 static void (*_getargv)(int *,char ***);
0111 static void (*_profiler)(void *);
0112 static void (*_bbc)(char *,int);
0113 static void (*_memtrace)(
0114 char *, int,int,int,int,int,int,int,int,int,int,int,int);
0115 static void (*_appwarmstart)(unsigned long);
0116 static void (*_mondelay)(long);
0117 static void (*_printmem)(char *,int,int);
0118
0119 static long (*_tfsctrl)(int,long,long);
0120 static long (*_tfstell)(int);
0121 static long (*_portcmd)(int,void *);
0122
0123 static struct tfshdr *(*_tfsnext)(struct tfshdr *);
0124 static struct tfshdr *(*_tfsstat)(char *);
0125
0126 static unsigned long (*_i2cctrl)(int,int,unsigned long,unsigned long);
0127 static unsigned long (*_pcicfgread)(int,int,int,int,int);
0128 static unsigned long (*_pcictrl)(int,int,unsigned long,unsigned long);
0129 static unsigned long (*_crc32)(unsigned char *,unsigned long);
0130 static unsigned long (*_intsoff)(void);
0131 static unsigned long (*_assign_handler)(long,unsigned long,unsigned long);
0132
0133 static unsigned short (*_xcrc16)(unsigned char *,unsigned long);
0134
0135
0136 static void (*_monlock)(void);
0137 static void (*_monunlock)(void);
0138 static int (*_moncom)(int,void *,void *, void *);
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151 #define TFS_MONLOCK monLock
0152 #define TFS_MONUNLOCK monUnlock
0153
0154
0155
0156
0157 #define ENV_MONLOCK monLock
0158 #define ENV_MONUNLOCK monUnlock
0159
0160
0161
0162
0163 #define CONSOLE_MONLOCK monLock
0164 #define CONSOLE_MONUNLOCK monUnlock
0165
0166
0167
0168
0169 #define HEAP_MONLOCK monLock
0170 #define HEAP_MONUNLOCK monUnlock
0171
0172
0173
0174
0175
0176 #define BLOCKING_MONLOCK monLock
0177 #define BLOCKING_MONUNLOCK monUnlock
0178
0179
0180
0181
0182 #define GENERIC_MONLOCK monLock
0183 #define GENERIC_MONUNLOCK monUnlock
0184
0185
0186
0187
0188 extern void mon_memtrace(
0189 char *fmt,
0190 int a1, int a2, int a3, int a4, int a5, int a6,
0191 int a7, int a8, int a9, int a10, int a11, int a12
0192 );
0193 extern int mon_printf(
0194 char *fmt,
0195 int a1, int a2, int a3, int a4, int a5, int a6,
0196 int a7, int a8, int a9, int a10, int a11, int a12
0197 );
0198 extern int mon_cprintf(
0199 char *fmt,
0200 int a1, int a2, int a3, int a4, int a5, int a6,
0201 int a7, int a8, int a9, int a10, int a11, int a12
0202 );
0203 extern int mon_sprintf(
0204 char *buf,
0205 char *fmt,
0206 int a1, int a2, int a3, int a4, int a5, int a6,
0207 int a7, int a8, int a9, int a10, int a11, int a12
0208 );
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227 int
0228 monConnect(int (*mon)(int,void *,void *,void *),
0229 void (*lock)(void), void (*unlock)(void))
0230 {
0231 int rc = 0;
0232
0233
0234 _monlock = lock;
0235 _monunlock = unlock;
0236
0237
0238 if (mon) {
0239
0240 _moncom = mon;
0241
0242
0243
0244
0245 rc += _moncom(GETMONFUNC_PUTCHAR,&_rputchar,0,0);
0246 rc += _moncom(GETMONFUNC_GETCHAR,&_getchar,0,0);
0247 rc += _moncom(GETMONFUNC_GOTACHAR,&_gotachar,0,0);
0248 rc += _moncom(GETMONFUNC_GETBYTES,&_getbytes,0,0);
0249 rc += _moncom(GETMONFUNC_PRINTF,&_printf,0,0);
0250 rc += _moncom(GETMONFUNC_CPRINTF,&_cprintf,0,0);
0251 rc += _moncom(GETMONFUNC_SPRINTF,&_sprintf,0,0);
0252 rc += _moncom(GETMONFUNC_RESTART,&_monrestart,0,0);
0253 rc += _moncom(GETMONFUNC_GETENV,&_getenv,0,0);
0254 rc += _moncom(GETMONFUNC_SETENV,&_setenv,0,0);
0255 rc += _moncom(GETMONFUNC_TFSINIT,&_tfsinit,0,0);
0256 rc += _moncom(GETMONFUNC_TFSADD,&_tfsadd,0,0);
0257 rc += _moncom(GETMONFUNC_TFSUNLINK,&_tfsunlink,0,0);
0258 rc += _moncom(GETMONFUNC_TFSRUN,&_tfsrun,0,0);
0259 rc += _moncom(GETMONFUNC_TFSNEXT,&_tfsnext,0,0);
0260 rc += _moncom(GETMONFUNC_TFSSTAT,&_tfsstat,0,0);
0261 rc += _moncom(GETMONFUNC_TFSREAD,&_tfsread,0,0);
0262 rc += _moncom(GETMONFUNC_TFSWRITE,&_tfswrite,0,0);
0263 rc += _moncom(GETMONFUNC_TFSOPEN,&_tfsopen,0,0);
0264 rc += _moncom(GETMONFUNC_TFSCLOSE,&_tfsclose,0,0);
0265 rc += _moncom(GETMONFUNC_TFSSEEK,&_tfsseek,0,0);
0266 rc += _moncom(GETMONFUNC_TFSGETLINE,&_tfsgetline,0,0);
0267 rc += _moncom(GETMONFUNC_TFSIPMOD,&_tfsipmod,0,0);
0268 rc += _moncom(GETMONFUNC_TFSCTRL,&_tfsctrl,0,0);
0269 rc += _moncom(GETMONFUNC_ADDCOMMAND,&_addcommand,0,0);
0270 rc += _moncom(GETMONFUNC_DOCOMMAND,&_docommand,0,0);
0271 rc += _moncom(GETMONFUNC_GETARGV,&_getargv,0,0);
0272 rc += _moncom(GETMONFUNC_CRC16,&_xcrc16,0,0);
0273 rc += _moncom(GETMONFUNC_CRC32,&_crc32,0,0);
0274 rc += _moncom(GETMONFUNC_INTSOFF,&_intsoff,0,0);
0275 rc += _moncom(GETMONFUNC_INTSRESTORE,&_intsrestore,0,0);
0276 rc += _moncom(GETMONFUNC_APPEXIT,&_appexit,0,0);
0277 rc += _moncom(GETMONFUNC_MALLOC,&_malloc,0,0);
0278 rc += _moncom(GETMONFUNC_FREE,&_free,0,0);
0279 rc += _moncom(GETMONFUNC_GETLINE,&_getline,0,0);
0280 rc += _moncom(GETMONFUNC_TFSFSTAT,&_tfsfstat,0,0);
0281 rc += _moncom(GETMONFUNC_TFSEOF,&_tfseof,0,0);
0282 rc += _moncom(GETMONFUNC_DECOMPRESS,&_decompress,0,0);
0283 rc += _moncom(GETMONFUNC_TFSTRUNCATE,&_tfstruncate,0,0);
0284 rc += _moncom(GETMONFUNC_HEAPXTEND,&_heapextend,0,0);
0285 rc += _moncom(GETMONFUNC_PROFILER,&_profiler,0,0);
0286 rc += _moncom(GETMONFUNC_TFSLINK,&_tfslink,0,0);
0287 rc += _moncom(GETMONFUNC_BBC,&_bbc,0,0);
0288 rc += _moncom(GETMONFUNC_MEMTRACE,&_memtrace,0,0);
0289 rc += _moncom(GETMONFUNC_TFSTELL,&_tfstell,0,0);
0290 rc += _moncom(GETMONFUNC_VERSION,&_version,0,0);
0291 rc += _moncom(GETMONFUNC_WARMSTART,&_appwarmstart,0,0);
0292 rc += _moncom(GETMONFUNC_PCICFGREAD,&_pcicfgread,0,0);
0293 rc += _moncom(GETMONFUNC_PCICFGWRITE,&_pcicfgwrite,0,0);
0294 rc += _moncom(GETMONFUNC_PCICONTROL,&_pcictrl,0,0);
0295 rc += _moncom(GETMONFUNC_I2CREAD,&_i2cread,0,0);
0296 rc += _moncom(GETMONFUNC_I2CWRITE,&_i2cwrite,0,0);
0297 rc += _moncom(GETMONFUNC_I2CCONTROL,&_i2cctrl,0,0);
0298 rc += _moncom(GETMONFUNC_MONDELAY,&_mondelay,0,0);
0299 rc += _moncom(GETMONFUNC_GETENVP,&_getenvp,0,0);
0300 rc += _moncom(GETMONFUNC_REALLOC,&_realloc,0,0);
0301 rc += _moncom(GETMONFUNC_SENDENETPKT,&_sendenet,0,0);
0302 rc += _moncom(GETMONFUNC_RECVENETPKT,&_recvenet,0,0);
0303 rc += _moncom(GETMONFUNC_GETSYM,&_getsym,0,0);
0304 rc += _moncom(GETMONFUNC_PRINTPKT,&_printpkt,0,0);
0305 rc += _moncom(GETMONFUNC_FLASHWRITE,&_flashwrite,0,0);
0306 rc += _moncom(GETMONFUNC_FLASHERASE,&_flasherase,0,0);
0307 rc += _moncom(GETMONFUNC_FLASHINFO,&_flashinfo,0,0);
0308 rc += _moncom(GETMONFUNC_ASSIGNHDLR,&_assign_handler,0,0);
0309 rc += _moncom(GETMONFUNC_WATCHDOG,&_watchdog,0,0);
0310 rc += _moncom(GETMONFUNC_PRINTMEM,&_printmem,0,0);
0311 rc += _moncom(GETMONFUNC_PORTCMD,&_portcmd,0,0);
0312 rc += _moncom(GETMONFUNC_TIMEOFDAY,&_timeofday,0,0);
0313 rc += _moncom(GETMONFUNC_TIMER,&_montimer,0,0);
0314 rc += _moncom(GETMONFUNC_FLASHOVRRD,&_flashoverride,0,0);
0315 }
0316 return(rc);
0317 }
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338 static int ignorelock = 0;
0339
0340 #if KEEP_TO_STAY_IN_SYNC_WITH_UPSTREAM_BUT_UNUSED
0341 static void
0342 DisableMonLock(void)
0343 {
0344 ignorelock = 2;
0345 }
0346
0347 static void
0348 EnableMonLock(void)
0349 {
0350 ignorelock = 0;
0351 }
0352 #endif
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363 static void
0364 monLock(void)
0365 {
0366 if (_monlock) {
0367 switch(ignorelock) {
0368 case 1:
0369 break;
0370 case 2:
0371 ignorelock--;
0372 break;
0373 default:
0374 _monlock();
0375 break;
0376 }
0377 }
0378 }
0379
0380 static void
0381 monUnlock(void)
0382 {
0383 if (_monunlock) {
0384 switch(ignorelock) {
0385 case 1:
0386 break;
0387 case 2:
0388 ignorelock--;
0389 default:
0390 _monunlock();
0391 break;
0392 }
0393 }
0394 }
0395
0396 int
0397 mon_com(int cmd, void *arg1, void *arg2, void *arg3)
0398 {
0399 int ret;
0400
0401 GENERIC_MONLOCK();
0402 ret = _moncom(cmd,arg1,arg2,arg3);
0403 GENERIC_MONUNLOCK();
0404 return(ret);
0405 }
0406
0407 int
0408 mon_putchar(char c)
0409 {
0410 int ret;
0411
0412 CONSOLE_MONLOCK();
0413 ret = _rputchar(c);
0414 CONSOLE_MONUNLOCK();
0415 return(ret);
0416 }
0417
0418 int
0419 mon_getchar(void)
0420 {
0421 int ret;
0422
0423 BLOCKING_MONLOCK();
0424 ret = _getchar();
0425 BLOCKING_MONUNLOCK();
0426 return(ret);
0427 }
0428
0429 int
0430 mon_gotachar(void)
0431 {
0432 int ret;
0433
0434 GENERIC_MONLOCK();
0435 ret = _gotachar();
0436 GENERIC_MONUNLOCK();
0437 return(ret);
0438 }
0439
0440 int
0441 mon_getbytes(char *buf,int cnt,int block)
0442 {
0443 int ret;
0444
0445 BLOCKING_MONLOCK();
0446 ret = _getbytes(buf,cnt,block);
0447 BLOCKING_MONUNLOCK();
0448 return(ret);
0449 }
0450
0451 int
0452 mon_printf(
0453 char *fmt,
0454 int a1, int a2, int a3, int a4, int a5, int a6,
0455 int a7, int a8, int a9, int a10, int a11, int a12
0456 )
0457 {
0458 int ret;
0459
0460 CONSOLE_MONLOCK();
0461 ret = _printf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
0462 CONSOLE_MONUNLOCK();
0463 return(ret);
0464 }
0465
0466 int
0467 mon_cprintf(
0468 char *fmt,
0469 int a1, int a2, int a3, int a4, int a5, int a6,
0470 int a7, int a8, int a9, int a10, int a11, int a12
0471 )
0472 {
0473 int ret;
0474
0475 CONSOLE_MONLOCK();
0476 ret = _cprintf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
0477 CONSOLE_MONUNLOCK();
0478 return(ret);
0479 }
0480
0481 int
0482 mon_sprintf(
0483 char *buf,
0484 char *fmt,
0485 int a1, int a2, int a3, int a4, int a5, int a6,
0486 int a7, int a8, int a9, int a10, int a11, int a12
0487 )
0488 {
0489 int ret;
0490
0491 GENERIC_MONLOCK();
0492 ret = _sprintf(buf,fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
0493 GENERIC_MONUNLOCK();
0494 return(ret);
0495 }
0496
0497 int
0498 mon_restart(int val)
0499 {
0500 int ret;
0501
0502 GENERIC_MONLOCK();
0503 ret = _monrestart(val);
0504 GENERIC_MONUNLOCK();
0505 return(ret);
0506 }
0507
0508 char *
0509 mon_getenvp(void)
0510 {
0511 char *ret;
0512
0513 ENV_MONLOCK();
0514 ret = _getenvp();
0515 ENV_MONUNLOCK();
0516 return(ret);
0517 }
0518
0519 char *
0520 mon_getenv(char *name)
0521 {
0522 char *ret;
0523
0524 ENV_MONLOCK();
0525 ret = _getenv(name);
0526 ENV_MONUNLOCK();
0527 return(ret);
0528 }
0529
0530 int
0531 mon_setenv(char *name,char *val)
0532 {
0533 int ret;
0534
0535 ENV_MONLOCK();
0536 ret = _setenv(name,val);
0537 ENV_MONUNLOCK();
0538 return(ret);
0539 }
0540
0541 char *
0542 mon_getsym(char *name,char *buf, int bufsize)
0543 {
0544 char *ret;
0545
0546 ENV_MONLOCK();
0547 ret = _getsym(name,buf,bufsize);
0548 ENV_MONUNLOCK();
0549 return(ret);
0550 }
0551
0552 int
0553 mon_tfsinit(void)
0554 {
0555 int ret;
0556
0557 TFS_MONLOCK();
0558 ret = _tfsinit();
0559 TFS_MONUNLOCK();
0560 return(ret);
0561 }
0562
0563 int
0564 mon_tfsadd(char *name, char *info, char *flags, unsigned char *src, int size)
0565 {
0566 int ret;
0567
0568 TFS_MONLOCK();
0569 ret = _tfsadd(name,info,flags,src,size);
0570 TFS_MONUNLOCK();
0571 return(ret);
0572 }
0573
0574 int
0575 mon_tfslink(char *src, char *target)
0576 {
0577 int ret;
0578
0579 TFS_MONLOCK();
0580 ret = _tfslink(src,target);
0581 TFS_MONUNLOCK();
0582 return(ret);
0583 }
0584
0585 int
0586 mon_tfsunlink(char *name)
0587 {
0588 int ret;
0589
0590 TFS_MONLOCK();
0591 ret = _tfsunlink(name);
0592 TFS_MONUNLOCK();
0593 return(ret);
0594 }
0595
0596 int
0597 mon_tfsrun(char **name,int verbose)
0598 {
0599 int ret;
0600
0601 TFS_MONLOCK();
0602 ret = _tfsrun(name,verbose);
0603 TFS_MONUNLOCK();
0604 return(ret);
0605 }
0606
0607 struct tfshdr *
0608 mon_tfsnext(struct tfshdr *fp)
0609 {
0610 struct tfshdr *ret;
0611
0612 TFS_MONLOCK();
0613 ret = _tfsnext(fp);
0614 TFS_MONUNLOCK();
0615 return(ret);
0616 }
0617
0618 int
0619 mon_tfstruncate(int tfd, long len)
0620 {
0621 int ret;
0622
0623 TFS_MONLOCK();
0624 ret = _tfstruncate(tfd,len);
0625 TFS_MONUNLOCK();
0626 return(ret);
0627 }
0628
0629 int
0630 mon_tfseof(int tfd)
0631 {
0632 int ret;
0633
0634 TFS_MONLOCK();
0635 ret = _tfseof(tfd);
0636 TFS_MONUNLOCK();
0637 return(ret);
0638 }
0639
0640 int
0641 mon_tfsfstat(char *name, struct tfshdr *fp)
0642 {
0643 int ret;
0644
0645 TFS_MONLOCK();
0646 ret = _tfsfstat(name,fp);
0647 TFS_MONUNLOCK();
0648 return(ret);
0649 }
0650
0651 struct tfshdr *
0652 mon_tfsstat(char *name)
0653 {
0654 struct tfshdr *ret;
0655
0656 TFS_MONLOCK();
0657 ret = _tfsstat(name);
0658 TFS_MONUNLOCK();
0659 return(ret);
0660 }
0661
0662 int
0663 mon_tfsread(int fd, char *buf, int cnt)
0664 {
0665 int ret;
0666
0667 TFS_MONLOCK();
0668 ret = _tfsread(fd,buf,cnt);
0669 TFS_MONUNLOCK();
0670 return(ret);
0671 }
0672
0673 int
0674 mon_tfswrite(int fd, char *buf, int cnt)
0675 {
0676 int ret;
0677
0678 TFS_MONLOCK();
0679 ret = _tfswrite(fd,buf,cnt);
0680 TFS_MONUNLOCK();
0681 return(ret);
0682 }
0683
0684 int
0685 mon_tfsopen(char *file,long flagmode,char *buf)
0686 {
0687 int ret;
0688
0689 TFS_MONLOCK();
0690 ret = _tfsopen(file,flagmode,buf);
0691 TFS_MONUNLOCK();
0692 return(ret);
0693 }
0694
0695 int
0696 mon_tfsclose(int fd,char *info)
0697 {
0698 int ret;
0699
0700 TFS_MONLOCK();
0701 ret = _tfsclose(fd,info);
0702 TFS_MONUNLOCK();
0703 return(ret);
0704 }
0705
0706 int
0707 mon_tfsseek(int fd, int offset, int whence)
0708 {
0709 int ret;
0710
0711 TFS_MONLOCK();
0712 ret = _tfsseek(fd,offset,whence);
0713 TFS_MONUNLOCK();
0714 return(ret);
0715 }
0716
0717 int
0718 mon_tfsgetline(int fd,char *bp,int max)
0719 {
0720 int ret;
0721
0722 TFS_MONLOCK();
0723 ret = _tfsgetline(fd,bp,max);
0724 TFS_MONUNLOCK();
0725 return(ret);
0726 }
0727
0728 int
0729 mon_tfsipmod(char *name,char *buf,int offset,int size)
0730 {
0731 int ret;
0732
0733 TFS_MONLOCK();
0734 ret = _tfsipmod(name,buf,offset,size);
0735 TFS_MONUNLOCK();
0736 return(ret);
0737 }
0738
0739 long
0740 mon_tfsctrl(int rqst,long arg1,long arg2)
0741 {
0742 long ret;
0743
0744 TFS_MONLOCK();
0745 ret = _tfsctrl(rqst,arg1,arg2);
0746 TFS_MONUNLOCK();
0747 return(ret);
0748 }
0749
0750 long
0751 mon_tfstell(int fd)
0752 {
0753 long ret;
0754
0755 TFS_MONLOCK();
0756 ret = _tfstell(fd);
0757 TFS_MONUNLOCK();
0758 return(ret);
0759 }
0760
0761 int
0762 mon_addcommand(struct monCommand *cmdlist, char *cmdlvl)
0763 {
0764 int ret;
0765
0766 GENERIC_MONLOCK();
0767 ret = _addcommand(cmdlist,cmdlvl);
0768 GENERIC_MONUNLOCK();
0769 return(ret);
0770 }
0771
0772 int
0773 mon_docommand(char *cmdline,int verbose)
0774 {
0775 int ret;
0776
0777 GENERIC_MONLOCK();
0778 ret = _docommand(cmdline,verbose);
0779 GENERIC_MONUNLOCK();
0780 return(ret);
0781 }
0782
0783 void
0784 mon_getargv(int *argc,char ***argv)
0785 {
0786 GENERIC_MONLOCK();
0787 _getargv(argc,argv);
0788 GENERIC_MONUNLOCK();
0789 }
0790
0791 unsigned short
0792 mon_xcrc16(char *buf,long nbytes)
0793 {
0794 unsigned short ret;
0795
0796 GENERIC_MONLOCK();
0797 ret = _xcrc16((unsigned char *)buf,nbytes);
0798 GENERIC_MONUNLOCK();
0799 return(ret);
0800 }
0801
0802 unsigned long
0803 mon_intsoff(void)
0804 {
0805 unsigned long ret;
0806
0807 GENERIC_MONLOCK();
0808 ret = _intsoff();
0809 GENERIC_MONUNLOCK();
0810 return(ret);
0811 }
0812
0813 void
0814 mon_intsrestore(unsigned long msr)
0815 {
0816 GENERIC_MONLOCK();
0817 _intsrestore(msr);
0818 GENERIC_MONUNLOCK();
0819 }
0820
0821 void
0822 mon_appexit(int val)
0823 {
0824 GENERIC_MONLOCK();
0825 _appexit(val);
0826 GENERIC_MONUNLOCK();
0827 }
0828
0829 #ifdef MALLOC_DEBUG
0830 char *
0831 mon_malloc(int size,char *fname,int fline)
0832 {
0833 char *ret;
0834
0835 HEAP_MONLOCK();
0836 ret = _malloc(size,fname,fline);
0837 HEAP_MONUNLOCK();
0838 return(ret);
0839 }
0840
0841 char *
0842 mon_realloc(char *buf, int size, char *fname, int fline)
0843 {
0844 char *ret;
0845
0846 HEAP_MONLOCK();
0847 ret = _realloc(buf,size, fname, fline);
0848 HEAP_MONUNLOCK();
0849 return(ret);
0850 }
0851 #else
0852 char *
0853 mon_malloc(int size)
0854 {
0855 char *ret;
0856
0857 HEAP_MONLOCK();
0858 ret = _malloc(size);
0859 HEAP_MONUNLOCK();
0860 return(ret);
0861 }
0862
0863 char *
0864 mon_realloc(char *buf, int size)
0865 {
0866 char *ret;
0867
0868 HEAP_MONLOCK();
0869 ret = _realloc(buf,size);
0870 HEAP_MONUNLOCK();
0871 return(ret);
0872 }
0873 #endif
0874
0875 void
0876 mon_free(char *cp)
0877 {
0878 HEAP_MONLOCK();
0879 _free(cp);
0880 HEAP_MONUNLOCK();
0881 }
0882
0883 int
0884 mon_getline(char *buf,int max,int ledit)
0885 {
0886 int ret;
0887
0888 BLOCKING_MONLOCK();
0889 ret = _getline(buf,max,ledit);
0890 BLOCKING_MONUNLOCK();
0891 return(ret);
0892 }
0893
0894 int
0895 mon_decompress(char *src,int srcsize,char *dest)
0896 {
0897 int ret;
0898
0899 GENERIC_MONLOCK();
0900 ret = _decompress(src,srcsize,dest);
0901 GENERIC_MONUNLOCK();
0902 return(ret);
0903 }
0904
0905 int
0906 mon_heapextend(char *base,int size)
0907 {
0908 int ret;
0909
0910 GENERIC_MONLOCK();
0911 ret = _heapextend(base,size);
0912 GENERIC_MONUNLOCK();
0913 return(ret);
0914 }
0915
0916 void
0917 mon_bbc(char *filename, int lineno)
0918 {
0919 _bbc(filename, lineno);
0920 }
0921
0922 void
0923 mon_profiler(void *pdata)
0924 {
0925 _profiler(pdata);
0926 }
0927
0928 void
0929 mon_memtrace(
0930 char *fmt,
0931 int a1, int a2, int a3, int a4, int a5, int a6,
0932 int a7, int a8, int a9, int a10, int a11, int a12
0933 )
0934 {
0935 _memtrace(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
0936 }
0937
0938 char *
0939 mon_version(void)
0940 {
0941 char *ret;
0942
0943 GENERIC_MONLOCK();
0944 ret = _version();
0945 GENERIC_MONUNLOCK();
0946 return(ret);
0947 }
0948
0949 void
0950 mon_warmstart(unsigned long mask)
0951 {
0952 GENERIC_MONLOCK();
0953 _appwarmstart(mask);
0954 GENERIC_MONUNLOCK();
0955 }
0956
0957 int
0958 mon_pcicfgwrite(int interface,int bus,int dev,int func,int reg,
0959 unsigned long val)
0960 {
0961 int retval;
0962
0963 GENERIC_MONLOCK();
0964 retval = _pcicfgwrite(interface,bus,dev,func,reg,val);
0965 GENERIC_MONUNLOCK();
0966 return(retval);
0967 }
0968
0969 unsigned long
0970 mon_pcicfgread(int interface,int bus,int dev, int func,int reg)
0971 {
0972 unsigned long retval;
0973
0974 GENERIC_MONLOCK();
0975 retval = _pcicfgread(interface,bus,dev,func,reg);
0976 GENERIC_MONUNLOCK();
0977 return(retval);
0978 }
0979
0980 unsigned long
0981 mon_pcictrl(int interface, int cmd, unsigned long arg1, unsigned long arg2)
0982 {
0983 unsigned long val;
0984
0985 GENERIC_MONLOCK();
0986 val = _pcictrl(interface,cmd,arg1,arg2);
0987 GENERIC_MONUNLOCK();
0988 return(val);
0989 }
0990
0991 unsigned long
0992 mon_i2cctrl(int interface, int cmd, unsigned long arg1, unsigned long arg2)
0993 {
0994 unsigned long val;
0995
0996 GENERIC_MONLOCK();
0997 val = _i2cctrl(interface,cmd,arg1,arg2);
0998 GENERIC_MONUNLOCK();
0999 return(val);
1000 }
1001
1002 int
1003 mon_i2cwrite(int interface, int bigaddr, unsigned char *data, int len)
1004 {
1005 int val;
1006
1007 GENERIC_MONLOCK();
1008 val = _i2cwrite(interface,bigaddr,data,len);
1009 GENERIC_MONUNLOCK();
1010 return(val);
1011 }
1012
1013 int
1014 mon_i2cread(int interface, int bigaddr, unsigned char *data, int len)
1015 {
1016 int val;
1017
1018 GENERIC_MONLOCK();
1019 val = _i2cread(interface,bigaddr,data,len);
1020 GENERIC_MONUNLOCK();
1021 return(val);
1022 }
1023
1024 void
1025 mon_delay(long msec)
1026 {
1027 GENERIC_MONLOCK();
1028 _mondelay(msec);
1029 GENERIC_MONUNLOCK();
1030 }
1031
1032 int
1033 mon_timer(int cmd, void *arg)
1034 {
1035 int ret;
1036
1037 GENERIC_MONLOCK();
1038 ret = _montimer(cmd, arg);
1039 GENERIC_MONUNLOCK();
1040 return(ret);
1041 }
1042
1043 int
1044 mon_sendenetpkt(char *pkt,int size)
1045 {
1046 int ret;
1047
1048 GENERIC_MONLOCK();
1049 ret = _sendenet(pkt,size);
1050 GENERIC_MONUNLOCK();
1051 return(ret);
1052 }
1053
1054 int
1055 mon_recvenetpkt(char *pkt,int size)
1056 {
1057 int ret;
1058
1059 GENERIC_MONLOCK();
1060 ret = _recvenet(pkt,size);
1061 GENERIC_MONUNLOCK();
1062 return(ret);
1063 }
1064
1065 void
1066 mon_printpkt(char *buf,int size, int incoming)
1067 {
1068 GENERIC_MONLOCK();
1069 _printpkt(buf,size,incoming);
1070 GENERIC_MONUNLOCK();
1071 }
1072
1073 int
1074 mon_flashoverride(void *flashinfo,int get,int bank)
1075 {
1076 int ret;
1077
1078 TFS_MONLOCK();
1079 ret = _flashoverride(flashinfo,get,bank);
1080 TFS_MONUNLOCK();
1081 return(ret);
1082 }
1083
1084 int
1085 mon_flashwrite(char *dest,char *src,int bytecnt)
1086 {
1087 int ret;
1088
1089 TFS_MONLOCK();
1090 ret = _flashwrite(dest,src,bytecnt);
1091 TFS_MONUNLOCK();
1092 return(ret);
1093 }
1094
1095 int
1096 mon_flasherase(int snum)
1097 {
1098 int ret;
1099
1100 TFS_MONLOCK();
1101 ret = _flasherase(snum);
1102 TFS_MONUNLOCK();
1103 return(ret);
1104 }
1105
1106 int
1107 mon_flashinfo(int snum, int *size, char **base)
1108 {
1109 int ret;
1110
1111 TFS_MONLOCK();
1112 ret = _flashinfo(snum,size,base);
1113 TFS_MONUNLOCK();
1114 return(ret);
1115 }
1116
1117 unsigned long
1118 mon_assignhandler(long hnum, unsigned long arg1, unsigned long arg2)
1119 {
1120 int ret;
1121
1122 GENERIC_MONLOCK();
1123 ret = _assign_handler(hnum,arg1,arg2);
1124 GENERIC_MONUNLOCK();
1125 return(ret);
1126 }
1127
1128 int
1129 mon_watchdog(void)
1130 {
1131 int ret;
1132
1133 GENERIC_MONLOCK();
1134 ret = _watchdog();
1135 GENERIC_MONUNLOCK();
1136 return(ret);
1137 }
1138
1139 void
1140 mon_printmem(char *mem, int size, int ascii)
1141 {
1142 GENERIC_MONLOCK();
1143 _printmem(mem,size,ascii);
1144 GENERIC_MONUNLOCK();
1145 }
1146
1147 long
1148 mon_portcmd(int cmd, void *arg)
1149 {
1150 long ret;
1151
1152 GENERIC_MONLOCK();
1153 ret = _portcmd(cmd,arg);
1154 GENERIC_MONUNLOCK();
1155 return(ret);
1156 }
1157
1158 int
1159 mon_timeofday(int cmd, void *arg)
1160 {
1161 int ret;
1162
1163 GENERIC_MONLOCK();
1164 ret = _timeofday(cmd,arg);
1165 GENERIC_MONUNLOCK();
1166 return(ret);
1167 }