Finish serial initialization

Signed-off-by: Harry Chen <i@harrychen.xyz>
master
Harry Chen 6 years ago
parent 4e3b2fb80f
commit 85245c4e21

@ -74,9 +74,6 @@ pub extern fn rust_trap(tf: &mut TrapFrame) {
fn external() {
// TODO
#[cfg(feature = "board_u540")]
unsafe { super::board::handle_external_interrupt(); }
// true means handled, false otherwise
let handlers = [try_process_serial, try_process_drivers];
for handler in handlers.iter() {
@ -87,7 +84,6 @@ fn external() {
}
fn try_process_serial() -> bool {
// TODO
match super::io::getchar_option() {
Some(ch) => {
crate::trap::serial(ch);

@ -59,8 +59,7 @@ pub fn putfmt(fmt: Arguments) {
SerialPort.write_fmt(fmt).unwrap();
}
pub fn init(serial_base_addr: usize) {
COM1 = serial_base_addr;
pub fn init() {
// Turn off the FIFO
write(COM1 + COM_FCR, 0 as u8);
// Set speed; requires DLAB latch
@ -77,7 +76,8 @@ pub fn init(serial_base_addr: usize) {
write(COM1 + COM_IER, COM_IER_RDI);
}
static mut COM1: usize = 0;
#[cfg(feature = "board_malta")]
const COM1 :usize = 0xbf000900; // 16550 Base Address
const COM_RX :usize = 0; // In: Receive buffer (DLAB=0)
const COM_TX :usize = 0; // Out: Transmit buffer (DLAB=0)

Loading…
Cancel
Save