Browse Source

Downgrade embedded-hal

luojia65 3 years ago
parent
commit
685739c8d4
3 changed files with 10 additions and 8 deletions
  1. 3 1
      CHANGELOG.md
  2. 1 1
      Cargo.toml
  3. 6 6
      src/legacy_stdio.rs

+ 3 - 1
CHANGELOG.md

@@ -11,10 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Added a test kernel to test SBI function on RustSBI implementations
 - Support device tree binary in K210 platform
 - Support SBI v0.3 hart suspend function
+- Support PMU extension trait and init function
 
 ### Modified
 - Reform RustSBI project into a library
-- Function `rustsbi::ecall` now require 5 input parameters
+- Function `rustsbi::ecall` now require `a0`-`a5` input parameters
 - Enhanced in-line code documents from SBI standard
 - Now IPI module requires to return an `SbiRet` value
 - Remove use of `global_asm` and `llvm_asm` in test kernel
@@ -23,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Use `mtval` to read instruction on QEMU; still need to be kept on K210 as 1.9.1 does not define this register behavior
 - Modify second parameter of `enter_privileged` to `opaque` other than `dtb_pa`
 - Dump all trap frame registers when exception happened in reference implementations
+- Downgrade `embedded-hal` to version `0.2.6`
 
 ### Fixed
 - Test kernel console now will lock before `println` line is finished

+ 1 - 1
Cargo.toml

@@ -21,7 +21,7 @@ targets = [
 ]
 
 [dependencies]
-embedded-hal = "1.0.0-alpha.1"
+embedded-hal = "0.2.6"
 nb = "1.0"
 riscv = "0.6"
 spin = "0.7"

+ 6 - 6
src/legacy_stdio.rs

@@ -30,14 +30,14 @@ where
     fn getchar(&mut self) -> u8 {
         // 直接调用embedded-hal里面的函数
         // 关于unwrap:因为这个是legacy函数,这里没有详细的处理流程,就panic掉
-        block!(self.inner.try_read()).ok().unwrap()
+        block!(self.inner.read()).ok().unwrap()
     }
 
     fn putchar(&mut self, ch: u8) {
         // 直接调用函数写一个字节
-        block!(self.inner.try_write(ch)).ok();
+        block!(self.inner.write(ch)).ok();
         // 写一次flush一次,因为是legacy,就不考虑效率了
-        block!(self.inner.try_flush()).ok();
+        block!(self.inner.flush()).ok();
     }
 }
 
@@ -50,12 +50,12 @@ where
     R: Read<u8> + Send + 'static,
 {
     fn getchar(&mut self) -> u8 {
-        block!(self.1.try_read()).ok().unwrap()
+        block!(self.1.read()).ok().unwrap()
     }
 
     fn putchar(&mut self, ch: u8) {
-        block!(self.0.try_write(ch)).ok();
-        block!(self.0.try_flush()).ok();
+        block!(self.0.write(ch)).ok();
+        block!(self.0.flush()).ok();
     }
 }