mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
raw pointer dance for debug UART
This commit is contained in:
parent
95611d9598
commit
64612352d3
3 changed files with 9 additions and 6 deletions
|
|
@ -10,7 +10,7 @@ macro_rules! print {
|
||||||
#[allow(unused_unsafe)]
|
#[allow(unused_unsafe)]
|
||||||
unsafe {
|
unsafe {
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
if let Some(stream) = crate::debug::shell::OUTPUT.as_mut() {
|
if let Some(stream) = &mut *(&raw mut crate::debug::shell::OUTPUT) {
|
||||||
write!(stream, $($args)+).unwrap();
|
write!(stream, $($args)+).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
// SPDX-FileCopyrightText: 2024 bunnie <bunnie@kosagi.com>
|
// SPDX-FileCopyrightText: 2024 bunnie <bunnie@kosagi.com>
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||||
|
#![allow(static_mut_refs)]
|
||||||
|
|
||||||
use utralib::generated::*;
|
use utralib::generated::*;
|
||||||
use xous_kernel::{MemoryFlags, MemoryType};
|
use xous_kernel::{MemoryFlags, MemoryType};
|
||||||
|
|
||||||
|
|
@ -119,14 +122,14 @@ pub fn init() {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
UART = Some(uart);
|
UART = Some(uart);
|
||||||
crate::debug::shell::init(UART.as_mut().unwrap());
|
crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap());
|
||||||
|
|
||||||
// Claim UART interrupt.
|
// Claim UART interrupt.
|
||||||
println!("Claiming IRQ {} via syscall...", utra::uart::UART_IRQ);
|
println!("Claiming IRQ {} via syscall...", utra::uart::UART_IRQ);
|
||||||
xous_kernel::claim_interrupt(
|
xous_kernel::claim_interrupt(
|
||||||
utra::uart::UART_IRQ,
|
utra::uart::UART_IRQ,
|
||||||
Uart::irq,
|
Uart::irq,
|
||||||
(UART.as_mut().unwrap() as *mut Uart) as *mut usize,
|
((&mut *(&raw mut UART)).as_mut().unwrap() as *mut Uart) as *mut usize,
|
||||||
)
|
)
|
||||||
.expect("Couldn't claim debug interrupt");
|
.expect("Couldn't claim debug interrupt");
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +155,7 @@ pub fn init() {
|
||||||
uart.init();
|
uart.init();
|
||||||
unsafe {
|
unsafe {
|
||||||
UART = Some(uart);
|
UART = Some(uart);
|
||||||
crate::debug::shell::init(UART.as_mut().unwrap());
|
crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,14 +86,14 @@ pub fn init() {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
UART = Some(uart);
|
UART = Some(uart);
|
||||||
crate::debug::shell::init(UART.as_mut().unwrap());
|
crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap());
|
||||||
|
|
||||||
// Claim UART interrupt.
|
// Claim UART interrupt.
|
||||||
println!("Claiming IRQ {} via syscall...", utra::uart::UART_IRQ);
|
println!("Claiming IRQ {} via syscall...", utra::uart::UART_IRQ);
|
||||||
xous_kernel::claim_interrupt(
|
xous_kernel::claim_interrupt(
|
||||||
utra::uart::UART_IRQ,
|
utra::uart::UART_IRQ,
|
||||||
Uart::irq,
|
Uart::irq,
|
||||||
(UART.as_mut().unwrap() as *mut Uart) as *mut usize,
|
((&mut *(&raw mut UART)).as_mut().unwrap() as *mut Uart) as *mut usize,
|
||||||
)
|
)
|
||||||
.expect("Couldn't claim debug interrupt");
|
.expect("Couldn't claim debug interrupt");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue