Преглед изворни кода

feat(device/console): 添加启用和禁用中断的方法 (#5)

Signed-off-by: longjin <longjin@DragonOS.org>
LoGin пре 1 месец
родитељ
комит
415ab38ff9
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      src/device/console.rs

+ 10 - 0
src/device/console.rs

@@ -144,6 +144,16 @@ impl<H: Hal, T: Transport> VirtIOConsole<H, T> {
         self.finish_receive()
     }
 
+    /// Enables interrupts from the device.
+    pub fn enable_interrupts(&mut self) {
+        self.receiveq.set_dev_notify(true);
+    }
+
+    /// Disables interrupts from the device.
+    pub fn disable_interrupts(&mut self) {
+        self.receiveq.set_dev_notify(false);
+    }
+
     /// If there is an outstanding receive request and it has finished, completes it.
     ///
     /// Returns true if new data has been received.