mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-23 00:16:17 +04:00
fix getchar on K210
This commit is contained in:
parent
4b17055f30
commit
0d957ff1a6
@ -33,9 +33,11 @@ fn putchar(c: u8) {
|
|||||||
|
|
||||||
pub fn getchar() -> char {
|
pub fn getchar() -> char {
|
||||||
let c = if cfg!(feature = "board_k210") {
|
let c = if cfg!(feature = "board_k210") {
|
||||||
unsafe {
|
loop {
|
||||||
while RXDATA.read_volatile() & (1 << 31) == 0 {}
|
let rxdata = unsafe { RXDATA.read_volatile() };
|
||||||
(RXDATA as *const u8).read_volatile()
|
if rxdata & (1 << 31) == 0 {
|
||||||
|
break rxdata as u8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if cfg!(feature = "m_mode") {
|
} else if cfg!(feature = "m_mode") {
|
||||||
(super::BBL.mcall_console_getchar)() as u8
|
(super::BBL.mcall_console_getchar)() as u8
|
||||||
|
@ -40,7 +40,7 @@ fn get_line() -> String {
|
|||||||
loop {
|
loop {
|
||||||
let c = get_char();
|
let c = get_char();
|
||||||
match c {
|
match c {
|
||||||
'\u{7f}' /* '\b' */ => {
|
'\u{8}' | '\u{7f}' /* '\b' */ => {
|
||||||
if s.pop().is_some() {
|
if s.pop().is_some() {
|
||||||
print!("\u{7f}");
|
print!("\u{7f}");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user