1
0
Fork 0

libboard_zynq::stdio: add drop_uart()

drops locks and causes reinitialization which is needed for exceptions
and clock canges.
This commit is contained in:
Astro 2020-01-23 22:34:37 +01:00
parent 99a2e5d621
commit 77f440db33
2 changed files with 9 additions and 1 deletions

View File

@ -1,13 +1,17 @@
use libboard_zynq::println;
use libboard_zynq::{println, stdio};
#[no_mangle]
pub unsafe extern "C" fn PrefetchAbort() {
stdio::drop_uart();
println!("PrefetchAbort");
loop {}
}
#[no_mangle]
pub unsafe extern "C" fn DataAbort() {
stdio::drop_uart();
println!("DataAbort");
loop {}
}

View File

@ -10,6 +10,10 @@ pub fn get_uart<'a>() -> MutexGuard<'a, LazyUart> {
unsafe { UART.lock() }
}
pub fn drop_uart() {
unsafe { UART = Mutex::new(LazyUart::Uninitialized); }
}
/// Initializes the UART on first use through `.deref_mut()` for debug
/// output through the `print!` and `println!` macros.
pub enum LazyUart {