Browse Source

feat(virtio-blk): add interrupt enable and disable function for virtio-blk (#4)

LoGin 11 tháng trước cách đây
mục cha
commit
f91c807965
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      src/device/blk.rs

+ 10 - 0
src/device/blk.rs

@@ -96,6 +96,16 @@ impl<H: Hal, T: Transport> VirtIOBlk<H, T> {
         self.transport.ack_interrupt()
     }
 
+    /// Enables interrupts from the device.
+    pub fn enable_interrupts(&mut self) {
+        self.queue.set_dev_notify(true);
+    }
+
+    /// Disables interrupts from the device.
+    pub fn disable_interrupts(&mut self) {
+        self.queue.set_dev_notify(false);
+    }
+
     /// Sends the given request to the device and waits for a response, with no extra data.
     fn request(&mut self, request: BlkReq) -> Result {
         let mut resp = BlkResp::default();