Switch to uart2 on malta to get interrupts (not working)

Signed-off-by: Harry Chen <i@harrychen.xyz>
master
Harry Chen 6 years ago
parent b1fa65b9c9
commit ecdbc9fd7a

@ -134,7 +134,13 @@ qemu_opts += \
-kernel $(kernel_img)
else ifeq ($(arch), mipsel)
ifeq ($(board), $(filter $(board), malta mipssim))
ifeq ($(board), malta)
qemu_opts += \
-machine $(board) \
-serial null -serial null -serial mon:stdio \
-kernel $(kernel_img)
endif
ifeq ($(board), mipssim)
qemu_opts += \
-machine $(board) \
-serial mon:stdio \

@ -1,5 +1,6 @@
use once::*;
use alloc::string::String;
use mips::registers::cp0;
#[path = "../../../../drivers/serial/16550_reg.rs"]
pub mod serial;
@ -12,7 +13,14 @@ pub mod consts;
/// Initialize serial port first
pub fn init_serial_early() {
assert_has_not_been_called!("board::init must be called only once");
serial::init(0xb80003f8);
// initialize serial driver
serial::init(0xbf000900);
// Enable serial interrupt
unsafe {
let mut status = cp0::status::read();
status.enable_hard_int2();
cp0::status::write(status);
}
println!("Hello QEMU Malta!");
}

@ -75,7 +75,7 @@ pub extern fn rust_trap(tf: &mut TrapFrame) {
fn interrupt_dispatcher(tf: &mut TrapFrame) {
let pint = tf.cause.pending_interrupt();
trace!(" Interrupt {:?} ", tf.cause.pending_interrupt());
trace!(" Interrupt {:08b} ", pint);
if (pint & 0b100_000_00) != 0 {
timer();
} else if (pint & 0b011_111_00) != 0 {
@ -86,7 +86,6 @@ fn interrupt_dispatcher(tf: &mut TrapFrame) {
}
fn external() {
// TODO
// true means handled, false otherwise
let handlers = [try_process_serial, try_process_drivers];
for handler in handlers.iter() {
@ -99,6 +98,7 @@ fn external() {
fn try_process_serial() -> bool {
match super::io::getchar_option() {
Some(ch) => {
trace!("Get char {} from serial", ch);
crate::trap::serial(ch);
true
}

Loading…
Cancel
Save