Skip to content

Commit a409545

Browse files
committed
Fix merge conflict
1 parent 81d61d9 commit a409545

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

src/x86_64.rs

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,32 @@
11
use core::fmt;
22

3-
use x86_64::instructions::port::Port;
3+
use x86_64::instructions::port::{Port, PortReadOnly, PortWriteOnly};
44

55
use crate::LineStsFlags;
66

77
/// An interface to a serial port that allows sending out individual bytes.
88
pub struct SerialPort {
99
data: Port<u8>,
10-
int_en: Port<u8>,
11-
fifo_ctrl: Port<u8>,
12-
line_ctrl: Port<u8>,
13-
modem_ctrl: Port<u8>,
14-
line_sts: Port<u8>,
10+
int_en: PortWriteOnly<u8>,
11+
fifo_ctrl: PortWriteOnly<u8>,
12+
line_ctrl: PortWriteOnly<u8>,
13+
modem_ctrl: PortWriteOnly<u8>,
14+
line_sts: PortReadOnly<u8>,
1515
}
1616

1717
impl SerialPort {
1818
/// Creates a new serial port interface on the given I/O port.
1919
///
2020
/// This function is unsafe because the caller must ensure that the given base address
2121
/// really points to a serial port device.
22-
#[cfg(feature = "nightly")]
2322
pub const unsafe fn new(base: u16) -> Self {
2423
Self {
2524
data: Port::new(base),
26-
int_en: Port::new(base + 1),
27-
fifo_ctrl: Port::new(base + 2),
28-
line_ctrl: Port::new(base + 3),
29-
modem_ctrl: Port::new(base + 4),
30-
line_sts: Port::new(base + 5),
31-
}
32-
}
33-
34-
/// Creates a new serial port interface on the given I/O port.
35-
///
36-
/// This function is unsafe because the caller must ensure that the given base address
37-
/// really points to a serial port device.
38-
#[cfg(feature = "stable")]
39-
pub unsafe fn new(base: u16) -> Self {
40-
Self {
41-
data: Port::new(base),
42-
int_en: Port::new(base + 1),
43-
fifo_ctrl: Port::new(base + 2),
44-
line_ctrl: Port::new(base + 3),
45-
modem_ctrl: Port::new(base + 4),
46-
line_sts: Port::new(base + 5),
25+
int_en: PortWriteOnly::new(base + 1),
26+
fifo_ctrl: PortWriteOnly::new(base + 2),
27+
line_ctrl: PortWriteOnly::new(base + 3),
28+
modem_ctrl: PortWriteOnly::new(base + 4),
29+
line_sts: PortReadOnly::new(base + 5),
4730
}
4831
}
4932

@@ -93,11 +76,11 @@ impl SerialPort {
9376
self.data.write(b' ');
9477
wait_for!(self.line_sts().contains(LineStsFlags::OUTPUT_EMPTY));
9578
self.data.write(8)
96-
},
79+
}
9780
_ => {
9881
wait_for!(self.line_sts().contains(LineStsFlags::OUTPUT_EMPTY));
9982
self.data.write(data);
100-
},
83+
}
10184
}
10285
}
10386
}

0 commit comments

Comments
 (0)