Skip to content

Commit

Permalink
Merge pull request #32 from riscv-rust/svd2rust0.33.4
Browse files Browse the repository at this point in the history
svd2rust 0.33.4
  • Loading branch information
almindor authored Sep 10, 2024
2 parents 662320f + 0e8a781 commit 743393a
Show file tree
Hide file tree
Showing 123 changed files with 9,526 additions and 11,516 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
continue-on-error: ${{ matrix.experimental || false }}
strategy:
matrix:
# All generated code should be running on stable now, MRSV is 1.59.0
rust: [nightly, stable, 1.59.0]
# All generated code should be running on stable now, MRSV is 1.65.0
rust: [nightly, stable, 1.65.0]

include:
# Nightly is only for reference and allowed to fail
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed
- Bump MSRV to 1.65.0
- Regenerate code with `svd2rust` v0.33.4

## [v0.11.0]

### Changed
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ description = "With svd2rust generated peripherals for Freedom E310 MCU's."
keywords = ["riscv", "register", "peripheral"]
license = "ISC"
rust-version = "1.59"
edition = "2021"

[dependencies]
critical-section = { version = "1.1.1", optional = true }
critical-section = { version = "1.1.3", optional = true }
vcell = "0.1.3"

[features]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project is developed and maintained by the [RISC-V team][team].

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.59.0 and up. It *might*
This crate is guaranteed to compile on stable Rust 1.65.0 and up. It *might*
compile with older versions but that may change in any new patch release.

## Requirements
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![doc = r" Builder file for Peripheral access crate generated by svd2rust tool"]
use std::env;
use std::fs::File;
use std::io::Write;
Expand Down
16 changes: 12 additions & 4 deletions src/aonclk.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#[doc = r"Register block"]
#[repr(C)]
#[doc = "Register block"]
pub struct RegisterBlock {
_reserved0: [u8; 0x70],
lfrosccfg: Lfrosccfg,
}
impl RegisterBlock {
#[doc = "0x70 - AON Clock Configuration Register"]
pub lfrosccfg: LFROSCCFG,
#[inline(always)]
pub const fn lfrosccfg(&self) -> &Lfrosccfg {
&self.lfrosccfg
}
}
#[doc = "lfrosccfg (rw) register accessor: an alias for `Reg<LFROSCCFG_SPEC>`"]
pub type LFROSCCFG = crate::Reg<lfrosccfg::LFROSCCFG_SPEC>;
#[doc = "lfrosccfg (rw) register accessor: AON Clock Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`lfrosccfg::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`lfrosccfg::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@lfrosccfg`]
module"]
#[doc(alias = "lfrosccfg")]
pub type Lfrosccfg = crate::Reg<lfrosccfg::LfrosccfgSpec>;
#[doc = "AON Clock Configuration Register"]
pub mod lfrosccfg;
121 changes: 42 additions & 79 deletions src/aonclk/lfrosccfg.rs
Original file line number Diff line number Diff line change
@@ -1,122 +1,85 @@
#[doc = "Register `lfrosccfg` reader"]
pub struct R(crate::R<LFROSCCFG_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<LFROSCCFG_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<LFROSCCFG_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<LFROSCCFG_SPEC>) -> Self {
R(reader)
}
}
pub type R = crate::R<LfrosccfgSpec>;
#[doc = "Register `lfrosccfg` writer"]
pub struct W(crate::W<LFROSCCFG_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<LFROSCCFG_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<LFROSCCFG_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<LFROSCCFG_SPEC>) -> Self {
W(writer)
}
}
pub type W = crate::W<LfrosccfgSpec>;
#[doc = "Field `div` reader - "]
pub type DIV_R = crate::FieldReader<u8, u8>;
pub type DivR = crate::FieldReader;
#[doc = "Field `div` writer - "]
pub type DIV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, LFROSCCFG_SPEC, u8, u8, 6, O>;
pub type DivW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
#[doc = "Field `trim` reader - "]
pub type TRIM_R = crate::FieldReader<u8, u8>;
pub type TrimR = crate::FieldReader;
#[doc = "Field `trim` writer - "]
pub type TRIM_W<'a, const O: u8> = crate::FieldWriter<'a, u32, LFROSCCFG_SPEC, u8, u8, 5, O>;
pub type TrimW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
#[doc = "Field `enable` reader - "]
pub type ENABLE_R = crate::BitReader<bool>;
pub type EnableR = crate::BitReader;
#[doc = "Field `enable` writer - "]
pub type ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, LFROSCCFG_SPEC, bool, O>;
pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `ready` reader - "]
pub type READY_R = crate::BitReader<bool>;
pub type ReadyR = crate::BitReader;
#[doc = "Field `ready` writer - "]
pub type READY_W<'a, const O: u8> = crate::BitWriter<'a, u32, LFROSCCFG_SPEC, bool, O>;
pub type ReadyW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[doc = "Bits 0:5"]
#[inline(always)]
pub fn div(&self) -> DIV_R {
DIV_R::new((self.bits & 0x3f) as u8)
pub fn div(&self) -> DivR {
DivR::new((self.bits & 0x3f) as u8)
}
#[doc = "Bits 16:20"]
#[inline(always)]
pub fn trim(&self) -> TRIM_R {
TRIM_R::new(((self.bits >> 16) & 0x1f) as u8)
pub fn trim(&self) -> TrimR {
TrimR::new(((self.bits >> 16) & 0x1f) as u8)
}
#[doc = "Bit 30"]
#[inline(always)]
pub fn enable(&self) -> ENABLE_R {
ENABLE_R::new(((self.bits >> 30) & 1) != 0)
pub fn enable(&self) -> EnableR {
EnableR::new(((self.bits >> 30) & 1) != 0)
}
#[doc = "Bit 31"]
#[inline(always)]
pub fn ready(&self) -> READY_R {
READY_R::new(((self.bits >> 31) & 1) != 0)
pub fn ready(&self) -> ReadyR {
ReadyR::new(((self.bits >> 31) & 1) != 0)
}
}
impl W {
#[doc = "Bits 0:5"]
#[inline(always)]
pub fn div(&mut self) -> DIV_W<0> {
DIV_W::new(self)
#[must_use]
pub fn div(&mut self) -> DivW<LfrosccfgSpec> {
DivW::new(self, 0)
}
#[doc = "Bits 16:20"]
#[inline(always)]
pub fn trim(&mut self) -> TRIM_W<16> {
TRIM_W::new(self)
#[must_use]
pub fn trim(&mut self) -> TrimW<LfrosccfgSpec> {
TrimW::new(self, 16)
}
#[doc = "Bit 30"]
#[inline(always)]
pub fn enable(&mut self) -> ENABLE_W<30> {
ENABLE_W::new(self)
#[must_use]
pub fn enable(&mut self) -> EnableW<LfrosccfgSpec> {
EnableW::new(self, 30)
}
#[doc = "Bit 31"]
#[inline(always)]
pub fn ready(&mut self) -> READY_W<31> {
READY_W::new(self)
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
#[must_use]
pub fn ready(&mut self) -> ReadyW<LfrosccfgSpec> {
ReadyW::new(self, 31)
}
}
#[doc = "AON Clock Configuration Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lfrosccfg](index.html) module"]
pub struct LFROSCCFG_SPEC;
impl crate::RegisterSpec for LFROSCCFG_SPEC {
#[doc = "AON Clock Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`lfrosccfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`lfrosccfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct LfrosccfgSpec;
impl crate::RegisterSpec for LfrosccfgSpec {
type Ux = u32;
}
#[doc = "`read()` method returns [lfrosccfg::R](R) reader structure"]
impl crate::Readable for LFROSCCFG_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [lfrosccfg::W](W) writer structure"]
impl crate::Writable for LFROSCCFG_SPEC {
type Writer = W;
#[doc = "`read()` method returns [`lfrosccfg::R`](R) reader structure"]
impl crate::Readable for LfrosccfgSpec {}
#[doc = "`write(|w| ..)` method takes [`lfrosccfg::W`](W) writer structure"]
impl crate::Writable for LfrosccfgSpec {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets lfrosccfg to value 0"]
impl crate::Resettable for LFROSCCFG_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
impl crate::Resettable for LfrosccfgSpec {
const RESET_VALUE: u32 = 0;
}
22 changes: 18 additions & 4 deletions src/backup.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
#[doc = r"Register block"]
#[repr(C)]
#[doc = "Register block"]
pub struct RegisterBlock {
_reserved0: [u8; 0x80],
backup: [Backup; 16],
}
impl RegisterBlock {
#[doc = "0x80..0xc0 - Backup Register"]
#[inline(always)]
pub const fn backup(&self, n: usize) -> &Backup {
&self.backup[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x80..0xc0 - Backup Register"]
pub backup: [BACKUP; 16],
#[inline(always)]
pub fn backup_iter(&self) -> impl Iterator<Item = &Backup> {
self.backup.iter()
}
}
#[doc = "backup (rw) register accessor: an alias for `Reg<BACKUP_SPEC>`"]
pub type BACKUP = crate::Reg<backup::BACKUP_SPEC>;
#[doc = "backup (rw) register accessor: Backup Register\n\nYou can [`read`](crate::Reg::read) this register and get [`backup::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`backup::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@backup`]
module"]
#[doc(alias = "backup")]
pub type Backup = crate::Reg<backup::BackupSpec>;
#[doc = "Backup Register"]
pub mod backup;
73 changes: 18 additions & 55 deletions src/backup/backup.rs
Original file line number Diff line number Diff line change
@@ -1,65 +1,28 @@
#[doc = "Register `backup[%s]` reader"]
pub struct R(crate::R<BACKUP_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<BACKUP_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<BACKUP_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<BACKUP_SPEC>) -> Self {
R(reader)
}
}
pub type R = crate::R<BackupSpec>;
#[doc = "Register `backup[%s]` writer"]
pub struct W(crate::W<BACKUP_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<BACKUP_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
pub type W = crate::W<BackupSpec>;
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
write!(f, "{}", self.bits())
}
}
impl From<crate::W<BACKUP_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<BACKUP_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "Backup Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [backup](index.html) module"]
pub struct BACKUP_SPEC;
impl crate::RegisterSpec for BACKUP_SPEC {
impl W {}
#[doc = "Backup Register\n\nYou can [`read`](crate::Reg::read) this register and get [`backup::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`backup::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct BackupSpec;
impl crate::RegisterSpec for BackupSpec {
type Ux = u32;
}
#[doc = "`read()` method returns [backup::R](R) reader structure"]
impl crate::Readable for BACKUP_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [backup::W](W) writer structure"]
impl crate::Writable for BACKUP_SPEC {
type Writer = W;
#[doc = "`read()` method returns [`backup::R`](R) reader structure"]
impl crate::Readable for BackupSpec {}
#[doc = "`write(|w| ..)` method takes [`backup::W`](W) writer structure"]
impl crate::Writable for BackupSpec {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets backup[%s]
to value 0"]
impl crate::Resettable for BACKUP_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
impl crate::Resettable for BackupSpec {
const RESET_VALUE: u32 = 0;
}
Loading

0 comments on commit 743393a

Please sign in to comment.