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() { fn external() {
// TODO // TODO
#[cfg(feature = "board_u540")]
unsafe { super::board::handle_external_interrupt(); }
// true means handled, false otherwise // true means handled, false otherwise
let handlers = [try_process_serial, try_process_drivers]; let handlers = [try_process_serial, try_process_drivers];
for handler in handlers.iter() { for handler in handlers.iter() {
@ -87,7 +84,6 @@ fn external() {
} }
fn try_process_serial() -> bool { fn try_process_serial() -> bool {
// TODO
match super::io::getchar_option() { match super::io::getchar_option() {
Some(ch) => { Some(ch) => {
crate::trap::serial(ch); crate::trap::serial(ch);

@ -59,8 +59,7 @@ pub fn putfmt(fmt: Arguments) {
SerialPort.write_fmt(fmt).unwrap(); SerialPort.write_fmt(fmt).unwrap();
} }
pub fn init(serial_base_addr: usize) { pub fn init() {
COM1 = serial_base_addr;
// Turn off the FIFO // Turn off the FIFO
write(COM1 + COM_FCR, 0 as u8); write(COM1 + COM_FCR, 0 as u8);
// Set speed; requires DLAB latch // Set speed; requires DLAB latch
@ -77,7 +76,8 @@ pub fn init(serial_base_addr: usize) {
write(COM1 + COM_IER, COM_IER_RDI); 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_RX :usize = 0; // In: Receive buffer (DLAB=0)
const COM_TX :usize = 0; // Out: Transmit buffer (DLAB=0) const COM_TX :usize = 0; // Out: Transmit buffer (DLAB=0)

Loading…
Cancel
Save