4 #include <geekos/irq.h>
5 #include <geekos/string.h>
7 #include <geekos/screen.h>
10 #define DEFAULT_SERIAL_ADDR 0x3F8
14 #define SERIAL_PRINT 1
16 #ifndef SERIAL_PRINT_DEBUG
17 #define SERIAL_PRINT_DEBUG 1
19 #ifndef SERIAL_PRINT_DEBUG_LEVEL
20 #define SERIAL_PRINT_DEBUG_LEVEL 10
23 #define SERIAL_PRINT_MAXBUF 256
27 #define SerialPrint(format, args...) \
29 char buf[SERIAL_PRINT_MAXBUF]; \
30 snprintf( buf, SERIAL_PRINT_MAXBUF, format, ## args ) ; \
31 SerialPutLineN(buf, SERIAL_PRINT_MAXBUF); \
34 #define SerialPrint(format, args...) do {} while (0)
38 #define PrintBoth(format, args...) \
40 Print(format, ## args); \
41 SerialPrint(format, ##args); \
45 #if SERIAL_PRINT_DEBUG
46 #define SerialPrintLevel(level, format, args...) \
48 char buf[SERIAL_PRINT_MAXBUF]; \
49 if (level >= SERIAL_PRINT_DEBUG_LEVEL ) { \
50 snprintf( buf, SERIAL_PRINT_MAXBUF, format, ## args ) ; \
51 SerialPutLineN(buf, SERIAL_PRINT_MAXBUF); \
55 #define SerialPrintLevel(level, format, args...) do {} while (0)
59 void SerialPutLine(char * line);
60 void SerialPutLineN(char * line, int len);
63 void SerialPrintHex(unsigned char x);
64 void SerialMemDump(unsigned char *start, int n);
67 void InitSerialAddr(unsigned short io_addr);