Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
shzhxh authored Jul 18, 2022
2 parents 0de8051 + aeee46d commit acef3f9
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 63 deletions.
93 changes: 56 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions drivers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ graphic = ["rcore-console"]
mock = ["async-std", "sdl2"]
virtio = ["virtio-drivers"]
loopback = []
board-d1 = ["d1-pac"]

[dependencies]
log = "0.4"
Expand Down Expand Up @@ -56,3 +57,4 @@ x86_64 = "0.14"

[target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies]
riscv = "0.8"
d1-pac = { version = "0.0.24", optional = true }
9 changes: 4 additions & 5 deletions drivers/src/builder/devicetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
//!
//! Specification: <https://github.com/devicetree-org/devicetree-specification/releases/download/v0.3/devicetree-specification-v0.3.pdf>.
use alloc::{collections::BTreeMap, sync::Arc, vec::Vec};

use super::IoMapper;
use crate::{
utils::devicetree::{
parse_interrupts, parse_reg, Devicetree, InheritProps, InterruptsProp, Node, StringList,
},
Device, DeviceError, DeviceResult, VirtAddr,
};
use alloc::{collections::BTreeMap, sync::Arc, vec::Vec};

const MODULE: &str = "device-tree";

Expand Down Expand Up @@ -136,6 +135,7 @@ impl<M: IoMapper> DevicetreeDriverBuilder<M> {
}
}

#[allow(dead_code)]
#[allow(unused_imports)]
#[allow(unused_variables)]
#[allow(unreachable_code)]
Expand Down Expand Up @@ -259,9 +259,8 @@ impl<M: IoMapper> DevicetreeDriverBuilder<M> {
c if c.contains("ns16550a") => {
Arc::new(unsafe { Uart16550Mmio::<u8>::new(base_vaddr?) })
}
c if c.contains("allwinner,sun20i-uart") => {
Arc::new(unsafe { Uart16550Mmio::<u32>::new(base_vaddr?) })
}
#[cfg(feature = "board-d1")]
c if c.contains("allwinner,sun20i-uart") => Arc::new(UartAllwinner::new(base_vaddr?)),
_ => return Err(DeviceError::NotSupported),
});

Expand Down
4 changes: 4 additions & 0 deletions drivers/src/uart/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
mod buffered;
mod uart_16550;
#[cfg(feature = "board-d1")]
mod uart_allwinner;
#[cfg(target_arch = "aarch64")]
mod uart_pl011;

Expand All @@ -10,5 +12,7 @@ pub use uart_16550::Uart16550Mmio;

#[cfg(target_arch = "x86_64")]
pub use uart_16550::Uart16550Pmio;
#[cfg(feature = "board-d1")]
pub use uart_allwinner::UartAllwinner;
#[cfg(target_arch = "aarch64")]
pub use uart_pl011::Pl011Uart;
Loading

0 comments on commit acef3f9

Please sign in to comment.