2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
5 #include <boot/stage2.h>
9 int dprintf(const char *fmt
, ...)
16 ret
= vsprintf(temp
, fmt
, args
);
25 volatile unsigned short *scif16
= (unsigned short*)0xffe80000;
26 volatile unsigned char *scif8
= (unsigned char*)0xffe80000;
29 /* Disable interrupts, transmit/receive, and use internal clock */
32 /* 8N1, use P0 clock */
35 /* Set baudrate, N = P0/(32*B)-1 */
36 // scif8[4] = (50000000 / (32 * baud_rate)) - 1;
38 // scif8[4] = 80; // 19200
39 // scif8[4] = 40; // 38400
40 // scif8[4] = 26; // 57600
41 scif8
[4] = 13; // 115200
43 /* Reset FIFOs, enable hardware flow control */
44 scif16
[24/2] = 4; //12;
46 for(x
= 0; x
< 100000; x
++);
47 scif16
[24/2] = 0; //8;
49 /* Disable manual pin control */
56 /* Enable transmit/receive */
59 for(x
= 0; x
< 100000; x
++);
61 serial_puts("serial initted\n");
66 /* Flush all FIFO'd bytes out of the serial port buffer */
67 static void serial_flush() {
68 volatile unsigned short *ack
= (unsigned short*)0xffe80010;
71 while (!(*ack
& 0x40))
76 static void _serial_putch(const char c
)
78 volatile unsigned short *ack
= (unsigned short*)0xffe80010;
79 volatile unsigned char *fifo
= (unsigned char*)0xffe8000c;
81 /* Wait until the transmit buffer has space */
82 while (!(*ack
& 0x20))
91 char serial_putch(const char c
)
102 void serial_puts(const char *s
)