7 static void enable_rcv_irq();
13 #include "std_macros.h"
16 * Glue between kernel and UART driver.
18 EXTENSION class Kernel_uart : public Uart
22 * Prototype for the UART specific startup implementation.
23 * @param uart, the instantiation to start.
24 * @param port, the com port number.
26 bool startup(unsigned port, int irq=-1);
29 //---------------------------------------------------------------------------
30 IMPLEMENTATION [serial]:
44 PUBLIC static FIASCO_CONST
53 Kernel_uart::Kernel_uart()
55 char const * const cmdline = Cmdline::cmdline();
59 unsigned n = Config::default_console_uart_baudrate;
60 Uart::TransferMode m = Uart::MODE_8N1;
61 unsigned p = Config::default_console_uart;
64 if ( (s = strstr(cmdline, " -comspeed "))
65 ||(s = strstr(cmdline, " -comspeed=")))
67 if ((n = strtoul(s + 11, 0, 0)) > 115200 || n < 1)
69 puts ("-comspeed > 115200 not supported or invalid (using 115200)!");
74 if ( (s = strstr(cmdline, " -comport "))
75 ||(s = strstr(cmdline, " -comport=")))
76 p = strtoul(s + 10, 0, 0);
78 if ((s = strstr(cmdline, " -comirq=")))
79 i = strtoul(s + 9, 0, 0);
81 if (!(ok = startup(p, i)))
82 printf("Comport 0x%04x is not accepted by the uart driver!\n", p);
84 if (ok && !change_mode(m, n))
85 panic("Somthing is wrong with the baud rate (%d)!\n", n);
91 Kernel_uart::enable_rcv_irq()
93 // we must not allocate the IRQ in the constructor but here
94 // since the constructor is called before Dirq::Dirq() constructor
96 if (Irq_chip::hw_chip->alloc(&uart_irq, uart()->irq()))
98 uart_irq.alloc((Receiver*)-1);
99 uart_irq.pin()->unmask();
100 uart()->enable_rcv_irq();
104 //---------------------------------------------------------------------------
105 IMPLEMENTATION [!serial]:
108 Kernel_uart::Kernel_uart()
113 Kernel_uart::enable_rcv_irq()