e65c12bdb4efbc26b5608c4986bdbc8efd59546f
3 * Copyright (C) 2001 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 ULONG DebugPrintMask
= DPRINT_WARNING
| DPRINT_MEMORY
;
38 ULONG DebugPort
= RS232
; //SCREEN;
40 ULONG BaudRate
= 19200;
44 if (DebugPort
== RS232
)
46 Rs232PortInitialize(ComPort
, BaudRate
);
50 void DebugPrint(ULONG Mask
, char *format
, ...)
52 int *dataptr
= (int *) &format
;
53 char c
, *ptr
, str
[16];
58 // Mask out unwanted debug messages
59 if (!(Mask
& DebugPrintMask
))
66 while ((c
= *(format
++)))
74 switch (c
= *(format
++))
76 case 'd': case 'u': case 'x':
77 *convert_to_ascii(str
, c
, *((unsigned long *) dataptr
++)) = 0;
89 *p
= (*(dataptr
++))&0xff;
94 ptr
= (char *)(*(dataptr
++));
96 while ((c
= *(ptr
++)))
107 if (DebugPort
== RS232
)
109 for (i
=0; buffer
[i
] != 0; i
++)
111 Rs232PortPutByte(buffer
[i
]);
112 if (buffer
[i
] == '\n')
114 Rs232PortPutByte('\r');
124 #endif // defined DEBUG