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]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn PrefetchAbort() {
|
pub unsafe extern "C" fn PrefetchAbort() {
|
||||||
|
stdio::drop_uart();
|
||||||
|
|
||||||
println!("PrefetchAbort");
|
println!("PrefetchAbort");
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn DataAbort() {
|
pub unsafe extern "C" fn DataAbort() {
|
||||||
|
stdio::drop_uart();
|
||||||
|
|
||||||
println!("DataAbort");
|
println!("DataAbort");
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,10 @@ pub fn get_uart<'a>() -> MutexGuard<'a, LazyUart> {
|
|||||||
unsafe { UART.lock() }
|
unsafe { UART.lock() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn drop_uart() {
|
||||||
|
unsafe { UART = Mutex::new(LazyUart::Uninitialized); }
|
||||||
|
}
|
||||||
|
|
||||||
/// Initializes the UART on first use through `.deref_mut()` for debug
|
/// Initializes the UART on first use through `.deref_mut()` for debug
|
||||||
/// output through the `print!` and `println!` macros.
|
/// output through the `print!` and `println!` macros.
|
||||||
pub enum LazyUart {
|
pub enum LazyUart {
|
||||||
|
Loading…
Reference in New Issue
Block a user