mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 17:26:31 +00:00
将tty输出接入串口 (#555)
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user