将tty输出接入串口 (#555)

This commit is contained in:
GnoCiYeH
2024-03-04 14:10:26 +08:00
committed by GitHub
parent cf45dede2e
commit f3b05a97ec
3 changed files with 15 additions and 12 deletions

View File

@ -4,6 +4,7 @@ use alloc::{string::String, sync::Arc, vec::Vec};
use system_error::SystemError;
use crate::{
driver::serial::serial8250::send_to_default_serial8250_port,
libs::{
rwlock::{RwLock, RwLockReadGuard, RwLockUpgradableGuard, RwLockWriteGuard},
spinlock::{SpinLock, SpinLockGuard},
@ -72,6 +73,13 @@ impl TtyCore {
self.line_discipline.clone()
}
pub fn write_without_serial(&self, buf: &[u8], nr: usize) -> Result<usize, SystemError> {
self.core
.driver()
.driver_funcs()
.write(self.core(), buf, nr)
}
pub fn reopen(&self) -> Result<(), SystemError> {
let tty_core = self.core();
let driver = tty_core.driver();
@ -404,6 +412,7 @@ impl TtyOperation for TtyCore {
#[inline]
fn write(&self, tty: &TtyCoreData, buf: &[u8], nr: usize) -> Result<usize, SystemError> {
send_to_default_serial8250_port(buf);
return self.core().tty_driver.driver_funcs().write(tty, buf, nr);
}