x86: add puts() impl to com-port
This commit is contained in:
parent
b60cc4df52
commit
1ad90ce181
@ -31,22 +31,35 @@ impl DebugSink for Port {
|
||||
self.send_byte(c)
|
||||
}
|
||||
|
||||
fn puts(&self, s: &str) -> Result<(), Error> {
|
||||
let mut inner = self.inner.lock();
|
||||
for b in s.bytes() {
|
||||
inner.write(b)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn supports_control_sequences(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl SerialDevice for Port {
|
||||
fn send_byte(&self, byte: u8) -> Result<(), Error> {
|
||||
let inner = self.inner.lock();
|
||||
|
||||
while inner.lsr.read() & Self::LSR_THRE == 0 {
|
||||
impl Inner {
|
||||
fn write(&mut self, byte: u8) -> Result<(), Error> {
|
||||
while self.lsr.read() & Port::LSR_THRE == 0 {
|
||||
core::hint::spin_loop();
|
||||
}
|
||||
|
||||
inner.dr.write(byte);
|
||||
self.dr.write(byte);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl SerialDevice for Port {
|
||||
fn send_byte(&self, byte: u8) -> Result<(), Error> {
|
||||
let mut inner = self.inner.lock();
|
||||
inner.write(byte)
|
||||
}
|
||||
|
||||
fn is_terminal(&self) -> bool {
|
||||
false
|
||||
|
Loading…
x
Reference in New Issue
Block a user