Notify debug: readers of new input after all input is processed
This commit is contained in:
@@ -2,7 +2,7 @@ use core::fmt::{self, Write};
|
||||
use core::ptr;
|
||||
|
||||
use crate::device::gic;
|
||||
use crate::scheme::debug::debug_input;
|
||||
use crate::scheme::debug::{debug_input, debug_notify};
|
||||
|
||||
bitflags! {
|
||||
/// UARTFR
|
||||
@@ -138,6 +138,7 @@ impl SerialPort {
|
||||
while self.line_sts().contains(UartFrFlags::RXFF) {
|
||||
debug_input(self.read_reg(self.data_reg) as u8);
|
||||
}
|
||||
debug_notify();
|
||||
}
|
||||
|
||||
pub fn send(&mut self, data: u8) {
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::context::timeout;
|
||||
use crate::device::{local_apic, ioapic, pic};
|
||||
use crate::device::serial::{COM1, COM2};
|
||||
use crate::ipi::{ipi, IpiKind, IpiTarget};
|
||||
use crate::scheme::debug::debug_input;
|
||||
use crate::scheme::debug::{debug_input, debug_notify};
|
||||
use crate::{context, time};
|
||||
|
||||
//resets to 0 in context::switch()
|
||||
@@ -208,6 +208,7 @@ interrupt!(com2, || {
|
||||
while let Some(c) = COM2.lock().receive() {
|
||||
debug_input(c);
|
||||
}
|
||||
debug_notify();
|
||||
eoi(3);
|
||||
});
|
||||
|
||||
@@ -215,6 +216,7 @@ interrupt!(com1, || {
|
||||
while let Some(c) = COM1.lock().receive() {
|
||||
debug_input(c);
|
||||
}
|
||||
debug_notify();
|
||||
eoi(4);
|
||||
});
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ fn handles_mut() -> RwLockWriteGuard<'static, BTreeMap<usize, Handle>> {
|
||||
/// Add to the input queue
|
||||
pub fn debug_input(data: u8) {
|
||||
INPUT.call_once(init_input).send(data);
|
||||
}
|
||||
|
||||
// Notify readers of input updates
|
||||
pub fn debug_notify() {
|
||||
for (id, _handle) in handles().iter() {
|
||||
event::trigger(SCHEME_ID.load(Ordering::SeqCst), *id, EVENT_READ);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user