summaryrefslogtreecommitdiff
path: root/src/serial/buffer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/serial/buffer.rs')
-rw-r--r--src/serial/buffer.rs36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/serial/buffer.rs b/src/serial/buffer.rs
index f40771f..b0f704e 100644
--- a/src/serial/buffer.rs
+++ b/src/serial/buffer.rs
@@ -1,35 +1,35 @@
-use crate::sync::NullLock;
use crate::sync::interface::Mutex;
+use crate::sync::NullLock;
use uart_16550::SerialPort;
pub struct Serial {
- buffer: Option<SerialPort>,
+ buffer: Option<SerialPort>,
}
impl Serial {
- pub const fn new() -> Self {
- Serial { buffer: None }
- }
+ pub const fn new() -> Self {
+ Serial { buffer: None }
+ }
}
impl NullLock<Serial> {
- pub fn init(&self) {
- self.lock(|serial| {
- let mut serial_port = unsafe { SerialPort::new(0x3F8) };
- serial_port.init();
- serial.buffer = Some(serial_port);
- });
- }
+ pub fn init(&self) {
+ self.lock(|serial| {
+ let mut serial_port = unsafe { SerialPort::new(0x3F8) };
+ serial_port.init();
+ serial.buffer = Some(serial_port);
+ });
+ }
}
#[doc(hidden)]
pub fn _print(args: ::core::fmt::Arguments) {
- use core::fmt::Write;
- SERIAL1.lock(|serial| {
- if let Some(buffer) = &mut serial.buffer {
- buffer.write_fmt(args).expect("printing to serial failed!");
- }
- })
+ use core::fmt::Write;
+ SERIAL1.lock(|serial| {
+ if let Some(buffer) = &mut serial.buffer {
+ buffer.write_fmt(args).expect("printing to serial failed!");
+ }
+ })
}
/// Prints to the host through the serial interface.