Changeset 561 for sbliveos2/trunk/drv16/commdbg.c
- Timestamp:
- Jul 28, 2011, 11:16:56 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sbliveos2/trunk/drv16/commdbg.c
r152 r561 53 53 54 54 char hextab[]="0123456789ABCDEF"; 55 56 #ifdef DEBUG 57 //#define MAGIC_COMM_PORT 0x3f8 // pulled from word ptr 40:0 58 #define MAGIC_COMM_PORT 0x2f8 // pulled from word ptr 40:0 59 60 61 #define UART_DATA 0x00 // UART Data port 62 #define UART_INT_ENAB 0x01 // UART Interrupt enable 63 #define UART_INT_ID 0x02 // interrupt ID 64 #define UART_LINE_CTRL 0x03 // line control registers 65 #define UART_MODEM_CTRL 0x04 // modem control register 66 #define UART_LINE_STAT 0x05 // line status register 67 #define UART_MODEM_STAT 0x06 // modem status regiser 68 #define UART_DIVISOR_LO 0x00 // divisor latch least sig 69 #define UART_DIVISOR_HI 0x01h // divisor latch most sig 70 71 #define DELAY nop 72 #endif 73 74 #ifdef DEBUG //--------------------------- CharOut - 75 void CharOut(char c) 76 { 77 _asm { 78 79 mov dx, MAGIC_COMM_PORT // address of PS/2's first COM port 80 add dx, UART_LINE_STAT 81 82 ReadyCheck: 83 in al, dx // wait for comm port ready signal 84 85 DELAY 86 DELAY 87 DELAY 88 89 test al, 020h 90 jz ReadyCheck 91 92 // Send the character 93 94 add dx, UART_DATA - UART_LINE_STAT 95 mov al,c 96 out dx, al 97 98 DELAY 99 DELAY 100 DELAY 101 } 102 } 103 #endif 104 105 #ifdef DEBUG //------------------------- StringOut - 106 void StringOut(char far *DbgStr) 107 { 108 while (*DbgStr) 109 CharOut(*DbgStr++); 110 111 if (fLineTerminate) 112 { 113 CharOut(CR); // append carriage return, 114 CharOut(LF); // linefeed 115 } 116 } 117 #endif 55 118 56 119 //-------------------- DecWordToASCII - … … 330 393 #endif //DEBUG 331 394 332 333 #ifdef DEBUG //------------------------- StringOut -334 void StringOut(char far *DbgStr)335 {336 while (*DbgStr)337 CharOut(*DbgStr++);338 339 if (fLineTerminate)340 {341 CharOut(CR); // append carriage return,342 CharOut(LF); // linefeed343 }344 }345 #endif346 347 #ifdef DEBUG348 //#define MAGIC_COMM_PORT 0x3f8 // pulled from word ptr 40:0349 #define MAGIC_COMM_PORT 0x2f8 // pulled from word ptr 40:0350 351 352 #define UART_DATA 0x00 // UART Data port353 #define UART_INT_ENAB 0x01 // UART Interrupt enable354 #define UART_INT_ID 0x02 // interrupt ID355 #define UART_LINE_CTRL 0x03 // line control registers356 #define UART_MODEM_CTRL 0x04 // modem control register357 #define UART_LINE_STAT 0x05 // line status register358 #define UART_MODEM_STAT 0x06 // modem status regiser359 #define UART_DIVISOR_LO 0x00 // divisor latch least sig360 #define UART_DIVISOR_HI 0x01h // divisor latch most sig361 362 #define DELAY nop363 #endif364 365 #ifdef DEBUG //--------------------------- CharOut -366 void CharOut(char c)367 {368 _asm {369 370 mov dx, MAGIC_COMM_PORT // address of PS/2's first COM port371 add dx, UART_LINE_STAT372 373 ReadyCheck:374 in al, dx // wait for comm port ready signal375 376 DELAY377 DELAY378 DELAY379 380 test al, 020h381 jz ReadyCheck382 383 // Send the character384 385 add dx, UART_DATA - UART_LINE_STAT386 mov al,c387 out dx, al388 389 DELAY390 DELAY391 DELAY392 }393 }394 #endif
Note:
See TracChangeset
for help on using the changeset viewer.