Ver código fonte

update README, and examples/aarch64|riscv/src/main.rs for CI

Yu Chen 2 anos atrás
pai
commit
ea59435d6a

+ 15 - 2
README.md

@@ -43,5 +43,18 @@ VirtIO guest drivers in Rust. For **no_std** environment.
 
 - x86_64 (TODO)
 
-- [aarch64](./examples/aarch64)
-- [RISCV](./examples/riscv)
+### [aarch64](./examples/aarch64)
+```bash
+cd examples/aarch64
+make qemu
+```
+###  [RISCV](./examples/riscv)
+
+```bash
+cd examples/riscv
+make qemu
+```
+You will see device info & GUI Window in qemu.
+
+![gui](./examples/riscv/virtio-gpu.png)
+

+ 11 - 0
examples/aarch64/src/main.rs

@@ -152,6 +152,17 @@ fn virtio_gpu<T: Transport>(transport: T) {
         }
     }
     gpu.flush().expect("failed to flush");
+
+    //delay some time
+    info!("virtio-gpu show graphics....");
+    for _ in 0..100000 {
+        for _ in 0..100000 {
+            unsafe {
+                core::arch::asm!("nop");
+            }
+        }
+    }
+    
     info!("virtio-gpu test finished");
 }
 

+ 19 - 5
examples/riscv/src/main.rs

@@ -112,6 +112,17 @@ fn virtio_gpu<T: Transport>(transport: T) {
         }
     }
     gpu.flush().expect("failed to flush");
+    
+    //delay some time
+    info!("virtio-gpu show graphics....");
+    for _ in 0..100000 {
+        for _ in 0..100000 {
+            unsafe {
+                core::arch::asm!("nop");
+            }
+        }
+    }
+
     info!("virtio-gpu test finished");
 }
 
@@ -127,10 +138,13 @@ fn virtio_input<T: Transport>(transport: T) {
 }
 
 fn virtio_net<T: Transport>(transport: T) {
-    let mut net = VirtIONet::<HalImpl, T>::new(transport).expect("failed to create net driver");
-    let mut buf = [0u8; 0x100];
-    let len = net.recv(&mut buf).expect("failed to recv");
-    info!("recv: {:?}", &buf[..len]);
-    net.send(&buf[..len]).expect("failed to send");
+    let mut _net = VirtIONet::<HalImpl, T>::new(transport).expect("failed to create net driver");
+    
+    // TODO: add tests for CI
+
+    //let mut buf = [0u8; 0x100];
+    //let len = net.recv(&mut buf).expect("failed to recv");
+    //info!("recv: {:?}", &buf[..len]);
+    //net.send(&buf[..len]).expect("failed to send");
     info!("virtio-net test finished");
 }

BIN
examples/riscv/virtio-test-gpu.png