forked from M-Labs/zynq-rs
libboard_zynq::stdio: add drop_uart()
drops locks and causes reinitialization which is needed for exceptions and clock canges.
This commit is contained in:
parent
99a2e5d621
commit
77f440db33
|
@ -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 {}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue