Skip to content

Commit 743393a

Browse files
authored
Merge pull request #32 from riscv-rust/svd2rust0.33.4
svd2rust 0.33.4
2 parents 662320f + 0e8a781 commit 743393a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+9526
-11516
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
continue-on-error: ${{ matrix.experimental || false }}
1212
strategy:
1313
matrix:
14-
# All generated code should be running on stable now, MRSV is 1.59.0
15-
rust: [nightly, stable, 1.59.0]
14+
# All generated code should be running on stable now, MRSV is 1.65.0
15+
rust: [nightly, stable, 1.65.0]
1616

1717
include:
1818
# Nightly is only for reference and allowed to fail

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Changed
11+
- Bump MSRV to 1.65.0
12+
- Regenerate code with `svd2rust` v0.33.4
13+
1014
## [v0.11.0]
1115

1216
### Changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ description = "With svd2rust generated peripherals for Freedom E310 MCU's."
88
keywords = ["riscv", "register", "peripheral"]
99
license = "ISC"
1010
rust-version = "1.59"
11+
edition = "2021"
1112

1213
[dependencies]
13-
critical-section = { version = "1.1.1", optional = true }
14+
critical-section = { version = "1.1.3", optional = true }
1415
vcell = "0.1.3"
1516

1617
[features]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This project is developed and maintained by the [RISC-V team][team].
1212

1313
## Minimum Supported Rust Version (MSRV)
1414

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

1818
## Requirements

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![doc = r" Builder file for Peripheral access crate generated by svd2rust tool"]
12
use std::env;
23
use std::fs::File;
34
use std::io::Write;

src/aonclk.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
#[doc = r"Register block"]
21
#[repr(C)]
2+
#[doc = "Register block"]
33
pub struct RegisterBlock {
44
_reserved0: [u8; 0x70],
5+
lfrosccfg: Lfrosccfg,
6+
}
7+
impl RegisterBlock {
58
#[doc = "0x70 - AON Clock Configuration Register"]
6-
pub lfrosccfg: LFROSCCFG,
9+
#[inline(always)]
10+
pub const fn lfrosccfg(&self) -> &Lfrosccfg {
11+
&self.lfrosccfg
12+
}
713
}
8-
#[doc = "lfrosccfg (rw) register accessor: an alias for `Reg<LFROSCCFG_SPEC>`"]
9-
pub type LFROSCCFG = crate::Reg<lfrosccfg::LFROSCCFG_SPEC>;
14+
#[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`]
15+
module"]
16+
#[doc(alias = "lfrosccfg")]
17+
pub type Lfrosccfg = crate::Reg<lfrosccfg::LfrosccfgSpec>;
1018
#[doc = "AON Clock Configuration Register"]
1119
pub mod lfrosccfg;

src/aonclk/lfrosccfg.rs

Lines changed: 42 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,85 @@
11
#[doc = "Register `lfrosccfg` reader"]
2-
pub struct R(crate::R<LFROSCCFG_SPEC>);
3-
impl core::ops::Deref for R {
4-
type Target = crate::R<LFROSCCFG_SPEC>;
5-
#[inline(always)]
6-
fn deref(&self) -> &Self::Target {
7-
&self.0
8-
}
9-
}
10-
impl From<crate::R<LFROSCCFG_SPEC>> for R {
11-
#[inline(always)]
12-
fn from(reader: crate::R<LFROSCCFG_SPEC>) -> Self {
13-
R(reader)
14-
}
15-
}
2+
pub type R = crate::R<LfrosccfgSpec>;
163
#[doc = "Register `lfrosccfg` writer"]
17-
pub struct W(crate::W<LFROSCCFG_SPEC>);
18-
impl core::ops::Deref for W {
19-
type Target = crate::W<LFROSCCFG_SPEC>;
20-
#[inline(always)]
21-
fn deref(&self) -> &Self::Target {
22-
&self.0
23-
}
24-
}
25-
impl core::ops::DerefMut for W {
26-
#[inline(always)]
27-
fn deref_mut(&mut self) -> &mut Self::Target {
28-
&mut self.0
29-
}
30-
}
31-
impl From<crate::W<LFROSCCFG_SPEC>> for W {
32-
#[inline(always)]
33-
fn from(writer: crate::W<LFROSCCFG_SPEC>) -> Self {
34-
W(writer)
35-
}
36-
}
4+
pub type W = crate::W<LfrosccfgSpec>;
375
#[doc = "Field `div` reader - "]
38-
pub type DIV_R = crate::FieldReader<u8, u8>;
6+
pub type DivR = crate::FieldReader;
397
#[doc = "Field `div` writer - "]
40-
pub type DIV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, LFROSCCFG_SPEC, u8, u8, 6, O>;
8+
pub type DivW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
419
#[doc = "Field `trim` reader - "]
42-
pub type TRIM_R = crate::FieldReader<u8, u8>;
10+
pub type TrimR = crate::FieldReader;
4311
#[doc = "Field `trim` writer - "]
44-
pub type TRIM_W<'a, const O: u8> = crate::FieldWriter<'a, u32, LFROSCCFG_SPEC, u8, u8, 5, O>;
12+
pub type TrimW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
4513
#[doc = "Field `enable` reader - "]
46-
pub type ENABLE_R = crate::BitReader<bool>;
14+
pub type EnableR = crate::BitReader;
4715
#[doc = "Field `enable` writer - "]
48-
pub type ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, LFROSCCFG_SPEC, bool, O>;
16+
pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
4917
#[doc = "Field `ready` reader - "]
50-
pub type READY_R = crate::BitReader<bool>;
18+
pub type ReadyR = crate::BitReader;
5119
#[doc = "Field `ready` writer - "]
52-
pub type READY_W<'a, const O: u8> = crate::BitWriter<'a, u32, LFROSCCFG_SPEC, bool, O>;
20+
pub type ReadyW<'a, REG> = crate::BitWriter<'a, REG>;
5321
impl R {
5422
#[doc = "Bits 0:5"]
5523
#[inline(always)]
56-
pub fn div(&self) -> DIV_R {
57-
DIV_R::new((self.bits & 0x3f) as u8)
24+
pub fn div(&self) -> DivR {
25+
DivR::new((self.bits & 0x3f) as u8)
5826
}
5927
#[doc = "Bits 16:20"]
6028
#[inline(always)]
61-
pub fn trim(&self) -> TRIM_R {
62-
TRIM_R::new(((self.bits >> 16) & 0x1f) as u8)
29+
pub fn trim(&self) -> TrimR {
30+
TrimR::new(((self.bits >> 16) & 0x1f) as u8)
6331
}
6432
#[doc = "Bit 30"]
6533
#[inline(always)]
66-
pub fn enable(&self) -> ENABLE_R {
67-
ENABLE_R::new(((self.bits >> 30) & 1) != 0)
34+
pub fn enable(&self) -> EnableR {
35+
EnableR::new(((self.bits >> 30) & 1) != 0)
6836
}
6937
#[doc = "Bit 31"]
7038
#[inline(always)]
71-
pub fn ready(&self) -> READY_R {
72-
READY_R::new(((self.bits >> 31) & 1) != 0)
39+
pub fn ready(&self) -> ReadyR {
40+
ReadyR::new(((self.bits >> 31) & 1) != 0)
7341
}
7442
}
7543
impl W {
7644
#[doc = "Bits 0:5"]
7745
#[inline(always)]
78-
pub fn div(&mut self) -> DIV_W<0> {
79-
DIV_W::new(self)
46+
#[must_use]
47+
pub fn div(&mut self) -> DivW<LfrosccfgSpec> {
48+
DivW::new(self, 0)
8049
}
8150
#[doc = "Bits 16:20"]
8251
#[inline(always)]
83-
pub fn trim(&mut self) -> TRIM_W<16> {
84-
TRIM_W::new(self)
52+
#[must_use]
53+
pub fn trim(&mut self) -> TrimW<LfrosccfgSpec> {
54+
TrimW::new(self, 16)
8555
}
8656
#[doc = "Bit 30"]
8757
#[inline(always)]
88-
pub fn enable(&mut self) -> ENABLE_W<30> {
89-
ENABLE_W::new(self)
58+
#[must_use]
59+
pub fn enable(&mut self) -> EnableW<LfrosccfgSpec> {
60+
EnableW::new(self, 30)
9061
}
9162
#[doc = "Bit 31"]
9263
#[inline(always)]
93-
pub fn ready(&mut self) -> READY_W<31> {
94-
READY_W::new(self)
95-
}
96-
#[doc = "Writes raw bits to the register."]
97-
#[inline(always)]
98-
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
99-
self.0.bits(bits);
100-
self
64+
#[must_use]
65+
pub fn ready(&mut self) -> ReadyW<LfrosccfgSpec> {
66+
ReadyW::new(self, 31)
10167
}
10268
}
103-
#[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"]
104-
pub struct LFROSCCFG_SPEC;
105-
impl crate::RegisterSpec for LFROSCCFG_SPEC {
69+
#[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)."]
70+
pub struct LfrosccfgSpec;
71+
impl crate::RegisterSpec for LfrosccfgSpec {
10672
type Ux = u32;
10773
}
108-
#[doc = "`read()` method returns [lfrosccfg::R](R) reader structure"]
109-
impl crate::Readable for LFROSCCFG_SPEC {
110-
type Reader = R;
111-
}
112-
#[doc = "`write(|w| ..)` method takes [lfrosccfg::W](W) writer structure"]
113-
impl crate::Writable for LFROSCCFG_SPEC {
114-
type Writer = W;
74+
#[doc = "`read()` method returns [`lfrosccfg::R`](R) reader structure"]
75+
impl crate::Readable for LfrosccfgSpec {}
76+
#[doc = "`write(|w| ..)` method takes [`lfrosccfg::W`](W) writer structure"]
77+
impl crate::Writable for LfrosccfgSpec {
78+
type Safety = crate::Unsafe;
79+
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
80+
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
11581
}
11682
#[doc = "`reset()` method sets lfrosccfg to value 0"]
117-
impl crate::Resettable for LFROSCCFG_SPEC {
118-
#[inline(always)]
119-
fn reset_value() -> Self::Ux {
120-
0
121-
}
83+
impl crate::Resettable for LfrosccfgSpec {
84+
const RESET_VALUE: u32 = 0;
12285
}

src/backup.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
#[doc = r"Register block"]
21
#[repr(C)]
2+
#[doc = "Register block"]
33
pub struct RegisterBlock {
44
_reserved0: [u8; 0x80],
5+
backup: [Backup; 16],
6+
}
7+
impl RegisterBlock {
8+
#[doc = "0x80..0xc0 - Backup Register"]
9+
#[inline(always)]
10+
pub const fn backup(&self, n: usize) -> &Backup {
11+
&self.backup[n]
12+
}
13+
#[doc = "Iterator for array of:"]
514
#[doc = "0x80..0xc0 - Backup Register"]
6-
pub backup: [BACKUP; 16],
15+
#[inline(always)]
16+
pub fn backup_iter(&self) -> impl Iterator<Item = &Backup> {
17+
self.backup.iter()
18+
}
719
}
8-
#[doc = "backup (rw) register accessor: an alias for `Reg<BACKUP_SPEC>`"]
9-
pub type BACKUP = crate::Reg<backup::BACKUP_SPEC>;
20+
#[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`]
21+
module"]
22+
#[doc(alias = "backup")]
23+
pub type Backup = crate::Reg<backup::BackupSpec>;
1024
#[doc = "Backup Register"]
1125
pub mod backup;

src/backup/backup.rs

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,28 @@
11
#[doc = "Register `backup[%s]` reader"]
2-
pub struct R(crate::R<BACKUP_SPEC>);
3-
impl core::ops::Deref for R {
4-
type Target = crate::R<BACKUP_SPEC>;
5-
#[inline(always)]
6-
fn deref(&self) -> &Self::Target {
7-
&self.0
8-
}
9-
}
10-
impl From<crate::R<BACKUP_SPEC>> for R {
11-
#[inline(always)]
12-
fn from(reader: crate::R<BACKUP_SPEC>) -> Self {
13-
R(reader)
14-
}
15-
}
2+
pub type R = crate::R<BackupSpec>;
163
#[doc = "Register `backup[%s]` writer"]
17-
pub struct W(crate::W<BACKUP_SPEC>);
18-
impl core::ops::Deref for W {
19-
type Target = crate::W<BACKUP_SPEC>;
20-
#[inline(always)]
21-
fn deref(&self) -> &Self::Target {
22-
&self.0
23-
}
24-
}
25-
impl core::ops::DerefMut for W {
26-
#[inline(always)]
27-
fn deref_mut(&mut self) -> &mut Self::Target {
28-
&mut self.0
4+
pub type W = crate::W<BackupSpec>;
5+
impl core::fmt::Debug for R {
6+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
7+
write!(f, "{}", self.bits())
298
}
309
}
31-
impl From<crate::W<BACKUP_SPEC>> for W {
32-
#[inline(always)]
33-
fn from(writer: crate::W<BACKUP_SPEC>) -> Self {
34-
W(writer)
35-
}
36-
}
37-
impl W {
38-
#[doc = "Writes raw bits to the register."]
39-
#[inline(always)]
40-
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
41-
self.0.bits(bits);
42-
self
43-
}
44-
}
45-
#[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"]
46-
pub struct BACKUP_SPEC;
47-
impl crate::RegisterSpec for BACKUP_SPEC {
10+
impl W {}
11+
#[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)."]
12+
pub struct BackupSpec;
13+
impl crate::RegisterSpec for BackupSpec {
4814
type Ux = u32;
4915
}
50-
#[doc = "`read()` method returns [backup::R](R) reader structure"]
51-
impl crate::Readable for BACKUP_SPEC {
52-
type Reader = R;
53-
}
54-
#[doc = "`write(|w| ..)` method takes [backup::W](W) writer structure"]
55-
impl crate::Writable for BACKUP_SPEC {
56-
type Writer = W;
16+
#[doc = "`read()` method returns [`backup::R`](R) reader structure"]
17+
impl crate::Readable for BackupSpec {}
18+
#[doc = "`write(|w| ..)` method takes [`backup::W`](W) writer structure"]
19+
impl crate::Writable for BackupSpec {
20+
type Safety = crate::Unsafe;
21+
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
22+
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
5723
}
5824
#[doc = "`reset()` method sets backup[%s]
5925
to value 0"]
60-
impl crate::Resettable for BACKUP_SPEC {
61-
#[inline(always)]
62-
fn reset_value() -> Self::Ux {
63-
0
64-
}
26+
impl crate::Resettable for BackupSpec {
27+
const RESET_VALUE: u32 = 0;
6528
}

0 commit comments

Comments
 (0)