Merge pull request #46 from Jackey-Huo/dev

HTIF interface read enabled for rocket-chip
master
Chen 6 years ago committed by GitHub
commit 2a4747abaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,7 +29,14 @@ impl Stdin {
return c;
}
}
#[cfg(not(feature = "board_k210"))]
#[cfg(feature = "board_rocket_chip")]
loop {
let c = crate::arch::io::getchar();
if c != '\0' && c as u8 != 254 {
return c;
}
}
#[cfg(not(any(feature = "board_k210", feature = "board_rocket_chip")))]
loop {
let mut buf_lock = self.buf.lock();
match buf_lock.pop_front() {
@ -41,7 +48,12 @@ impl Stdin {
}
}
pub fn can_read(&self) -> bool {
self.buf.lock().len() > 0
// Currently, rocket-chip implementation rely on htif interface, the serial interrupt DO
// NOT work, so return true always
#[cfg(feature = "board_rocket_chip")]
return true;
#[cfg(not(feature = "board_rocket_chip"))]
return self.buf.lock().len() > 0;
}
}

@ -4,6 +4,7 @@ use crate::fs::ROOT_INODE;
use crate::process::*;
use alloc::string::String;
use alloc::vec::Vec;
use crate::arch::io;
#[cfg(not(feature = "run_cmdline"))]
pub fn add_user_shell() {
@ -44,6 +45,7 @@ pub fn add_user_shell() {
let inode = ROOT_INODE.lookup(&cmdline).unwrap();
processor().manager().add(Thread::new_user(
&inode,
"/busybox",
cmdline.split(' ').map(|s| s.into()).collect(),
Vec::new(),
));

Loading…
Cancel
Save