1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 08:06:17 +04:00

Fix bcm2837 serial

This commit is contained in:
Jiajie Chen 2020-06-23 19:59:36 +08:00
parent 55de8e6dcf
commit d895f43d9a
5 changed files with 14 additions and 10 deletions

6
kernel/Cargo.lock generated
View File

@ -186,7 +186,7 @@ dependencies = [
[[package]]
name = "executor"
version = "0.6.0"
source = "git+https://github.com/rcore-os/executor.git?rev=b8af982#b8af982dfe918e25fac303573c5f28dbf061fcb0"
source = "git+https://github.com/rcore-os/executor.git?rev=7cf7ac0#7cf7ac0e9ff27086b41621ca7096520a1f3f6a57"
dependencies = [
"aarch64",
"executor-macros",
@ -200,7 +200,7 @@ dependencies = [
[[package]]
name = "executor-macros"
version = "0.0.1"
source = "git+https://github.com/rcore-os/executor.git?rev=b8af982#b8af982dfe918e25fac303573c5f28dbf061fcb0"
source = "git+https://github.com/rcore-os/executor.git?rev=7cf7ac0#7cf7ac0e9ff27086b41621ca7096520a1f3f6a57"
dependencies = [
"proc-macro2",
"quote",
@ -723,7 +723,7 @@ checksum = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316"
[[package]]
name = "trapframe"
version = "0.3.0"
source = "git+https://github.com/rcore-os/trapframe-rs?rev=3e3f5ab#3e3f5ab99946b91b76ac79287ea37c1401728772"
source = "git+https://github.com/rcore-os/trapframe-rs?rev=3125cef#3125cef8b69fb2c29961e36c47ff30d7ccd4b675"
dependencies = [
"aarch64",
"raw-cpuid",

View File

@ -54,7 +54,7 @@ bit_field = "0.10"
buddy_system_allocator = "0.4.0"
compression = { version = "0.1.4", default-features = false, features = ["gzip"] }
device_tree = { git = "https://github.com/rcore-os/device_tree-rs", rev = "2fa8411c" }
executor = { git = "https://github.com/rcore-os/executor.git", rev = "b8af982" }
executor = { git = "https://github.com/rcore-os/executor.git", rev = "7cf7ac0" }
isomorphic_drivers = { git = "https://github.com/rcore-os/isomorphic_drivers", rev = "fcf694d2", features = ["log"] }
lazy_static = { version = "1.4", features = ["spin_no_std"] }
log = "0.4"
@ -74,7 +74,7 @@ rcore-fs-devfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "517af47"
rlibc = "1.0"
smoltcp = { git = "https://github.com/rcore-os/smoltcp", rev = "5bd87c7c", default-features = false, features = ["alloc", "log", "ethernet", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw"] }
spin = "0.5"
trapframe = { git = "https://github.com/rcore-os/trapframe-rs", rev = "3e3f5ab" }
trapframe = { git = "https://github.com/rcore-os/trapframe-rs", rev = "3125cef" }
virtio-drivers = { git = "https://github.com/rcore-os/virtio-drivers", rev = "dfa70e14" }
volatile = "0.2"
woke = "0.0.2"

View File

@ -64,7 +64,7 @@ pub extern "C" fn trap_handler(tf: &mut TrapFrame) {
kind: Kind::from(tf.trap_num >> 16),
};
let esr = ESR_EL1.get() as u32;
info!(
trace!(
"Exception @ CPU{}: {:?}, ESR: {:#x}, ELR: {:#x?}",
crate::arch::cpu::id(),
info,

View File

@ -23,7 +23,7 @@ impl Driver for Bcm2837Intc {
for intr in Controller::new().pending_interrupts() {
res |= manager.try_handle_interrupt(Some(intr as usize));
}
true
res
}
fn device_type(&self) -> DeviceType {
@ -65,6 +65,8 @@ fn init() -> Arc<Bcm2837Intc> {
// register under root irq manager
// 0x10002: from lower el, irq
IRQ_MANAGER.write().register_irq(0x10002, intc.clone());
// 0x10001: from current el, irq
IRQ_MANAGER.write().register_irq(0x10001, intc.clone());
intc
}

View File

@ -19,6 +19,8 @@ impl Driver for Bcm2837Serial {
fn try_handle_interrupt(&self, irq: Option<usize>) -> bool {
let mu = self.mu.lock();
if mu.interrupt_is_pending(MiniUartInterruptId::Recive) {
// avoid deadlock
drop(mu);
let c = self.read();
crate::trap::serial(c);
true
@ -50,9 +52,9 @@ impl SerialDriver for Bcm2837Serial {
}
pub fn driver_init() {
let serial = Arc::new(Bcm2837Serial {
mu: Mutex::new(MiniUart::new()),
});
let mut mu = MiniUart::new();
mu.init();
let serial = Arc::new(Bcm2837Serial { mu: Mutex::new(mu) });
DRIVERS.write().push(serial.clone());
SERIAL_DRIVERS.write().push(serial.clone());
BCM2837_INTC.register_local_irq(Interrupt::Aux as u8 as usize, serial);