lib.rs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //! Low level access to RISC-V processors
  2. //!
  3. //! # Minimum Supported Rust Version (MSRV)
  4. //!
  5. //! This crate is guaranteed to compile on stable Rust 1.59 and up. It *might*
  6. //! compile with older versions but that may change in any new patch release.
  7. //!
  8. //! # Features
  9. //!
  10. //! This crate provides:
  11. //!
  12. //! - Access to core registers like `mstatus` or `mcause`.
  13. //! - Interrupt manipulation mechanisms.
  14. //! - Wrappers around assembly instructions like `WFI`.
  15. //!
  16. //! # Optional features
  17. //!
  18. //! ## `critical-section-single-hart`
  19. //!
  20. //! This feature enables a [`critical-section`](https://github.com/rust-embedded/critical-section)
  21. //! implementation suitable for single-hart targets, based on disabling interrupts globally.
  22. //!
  23. //! It is **unsound** to enable it on multi-hart targets,
  24. //! and may cause functional problems in systems where some interrupts must be not be disabled
  25. //! or critical sections are managed as part of an RTOS. In these cases, you should use
  26. //! a target-specific implementation instead, typically provided by a HAL or RTOS crate.
  27. #![no_std]
  28. pub mod asm;
  29. pub mod delay;
  30. pub mod interrupt;
  31. pub mod register;
  32. #[macro_use]
  33. mod macros;
  34. #[cfg(all(riscv, feature = "critical-section-single-hart"))]
  35. mod critical_section;
  36. /// Used to reexport items for use in macros. Do not use directly.
  37. /// Not covered by semver guarantees.
  38. #[doc(hidden)]
  39. pub mod _export {
  40. pub use critical_section;
  41. }