Skip to content

Commit

Permalink
feat: updating from newer svd2rust (#63)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq <49736102+kodiakhq@users.noreply.github.com>
  • Loading branch information
xmc-action-bot[bot] and kodiakhq[bot] authored Mar 1, 2024
1 parent 7d60ff1 commit 1c5e610
Show file tree
Hide file tree
Showing 1,057 changed files with 110,581 additions and 116,053 deletions.
78 changes: 44 additions & 34 deletions src/can.rs
Original file line number Diff line number Diff line change
@@ -1,138 +1,148 @@
#[doc = r"Register block"]
#[repr(C)]
#[doc = "Register block"]
pub struct RegisterBlock {
clc: CLC,
clc: Clc,
_reserved1: [u8; 0x04],
id: ID,
fdr: FDR,
id: Id,
fdr: Fdr,
_reserved3: [u8; 0xf0],
list: [LIST; 16],
mspnd: [MSPND; 8],
list: [List; 16],
mspnd: [Mspnd; 8],
_reserved5: [u8; 0x20],
msid: [MSID; 8],
msid: [Msid; 8],
_reserved6: [u8; 0x20],
msimask: MSIMASK,
panctr: PANCTR,
mcr: MCR,
mitr: MITR,
msimask: Msimask,
panctr: Panctr,
mcr: Mcr,
mitr: Mitr,
}
impl RegisterBlock {
#[doc = "0x00 - CAN Clock Control Register"]
#[inline(always)]
pub const fn clc(&self) -> &CLC {
pub const fn clc(&self) -> &Clc {
&self.clc
}
#[doc = "0x08 - Module Identification Register"]
#[inline(always)]
pub const fn id(&self) -> &ID {
pub const fn id(&self) -> &Id {
&self.id
}
#[doc = "0x0c - CAN Fractional Divider Register"]
#[inline(always)]
pub const fn fdr(&self) -> &FDR {
pub const fn fdr(&self) -> &Fdr {
&self.fdr
}
#[doc = "0x100..0x140 - List Register"]
#[inline(always)]
pub const fn list(&self, n: usize) -> &LIST {
pub const fn list(&self, n: usize) -> &List {
&self.list[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x100..0x140 - List Register"]
#[inline(always)]
pub fn list_iter(&self) -> impl Iterator<Item = &LIST> {
pub fn list_iter(&self) -> impl Iterator<Item = &List> {
self.list.iter()
}
#[doc = "0x140..0x160 - Message Pending Register"]
#[inline(always)]
pub const fn mspnd(&self, n: usize) -> &MSPND {
pub const fn mspnd(&self, n: usize) -> &Mspnd {
&self.mspnd[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x140..0x160 - Message Pending Register"]
#[inline(always)]
pub fn mspnd_iter(&self) -> impl Iterator<Item = &MSPND> {
pub fn mspnd_iter(&self) -> impl Iterator<Item = &Mspnd> {
self.mspnd.iter()
}
#[doc = "0x180..0x1a0 - Message Index Register"]
#[inline(always)]
pub const fn msid(&self, n: usize) -> &MSID {
pub const fn msid(&self, n: usize) -> &Msid {
&self.msid[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x180..0x1a0 - Message Index Register"]
#[inline(always)]
pub fn msid_iter(&self) -> impl Iterator<Item = &MSID> {
pub fn msid_iter(&self) -> impl Iterator<Item = &Msid> {
self.msid.iter()
}
#[doc = "0x1c0 - Message Index Mask Register"]
#[inline(always)]
pub const fn msimask(&self) -> &MSIMASK {
pub const fn msimask(&self) -> &Msimask {
&self.msimask
}
#[doc = "0x1c4 - Panel Control Register"]
#[inline(always)]
pub const fn panctr(&self) -> &PANCTR {
pub const fn panctr(&self) -> &Panctr {
&self.panctr
}
#[doc = "0x1c8 - Module Control Register"]
#[inline(always)]
pub const fn mcr(&self) -> &MCR {
pub const fn mcr(&self) -> &Mcr {
&self.mcr
}
#[doc = "0x1cc - Module Interrupt Trigger Register"]
#[inline(always)]
pub const fn mitr(&self) -> &MITR {
pub const fn mitr(&self) -> &Mitr {
&self.mitr
}
}
#[doc = "CLC (rw) register accessor: CAN Clock Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`clc::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`clc::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@clc`]
module"]
pub type CLC = crate::Reg<clc::CLC_SPEC>;
#[doc(alias = "CLC")]
pub type Clc = crate::Reg<clc::ClcSpec>;
#[doc = "CAN Clock Control Register"]
pub mod clc;
#[doc = "ID (r) register accessor: Module Identification Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`id::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@id`]
module"]
pub type ID = crate::Reg<id::ID_SPEC>;
#[doc(alias = "ID")]
pub type Id = crate::Reg<id::IdSpec>;
#[doc = "Module Identification Register"]
pub mod id;
#[doc = "FDR (rw) register accessor: CAN Fractional Divider Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`fdr::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`fdr::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@fdr`]
module"]
pub type FDR = crate::Reg<fdr::FDR_SPEC>;
#[doc(alias = "FDR")]
pub type Fdr = crate::Reg<fdr::FdrSpec>;
#[doc = "CAN Fractional Divider Register"]
pub mod fdr;
#[doc = "LIST (r) register accessor: List Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`list::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@list`]
module"]
pub type LIST = crate::Reg<list::LIST_SPEC>;
#[doc(alias = "LIST")]
pub type List = crate::Reg<list::ListSpec>;
#[doc = "List Register"]
pub mod list;
#[doc = "MSPND (rw) register accessor: Message Pending Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`mspnd::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mspnd::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@mspnd`]
module"]
pub type MSPND = crate::Reg<mspnd::MSPND_SPEC>;
#[doc(alias = "MSPND")]
pub type Mspnd = crate::Reg<mspnd::MspndSpec>;
#[doc = "Message Pending Register"]
pub mod mspnd;
#[doc = "MSID (r) register accessor: Message Index Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`msid::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@msid`]
module"]
pub type MSID = crate::Reg<msid::MSID_SPEC>;
#[doc(alias = "MSID")]
pub type Msid = crate::Reg<msid::MsidSpec>;
#[doc = "Message Index Register"]
pub mod msid;
#[doc = "MSIMASK (rw) register accessor: Message Index Mask Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`msimask::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`msimask::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@msimask`]
module"]
pub type MSIMASK = crate::Reg<msimask::MSIMASK_SPEC>;
#[doc(alias = "MSIMASK")]
pub type Msimask = crate::Reg<msimask::MsimaskSpec>;
#[doc = "Message Index Mask Register"]
pub mod msimask;
#[doc = "PANCTR (rw) register accessor: Panel Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`panctr::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`panctr::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@panctr`]
module"]
pub type PANCTR = crate::Reg<panctr::PANCTR_SPEC>;
#[doc(alias = "PANCTR")]
pub type Panctr = crate::Reg<panctr::PanctrSpec>;
#[doc = "Panel Control Register"]
pub mod panctr;
#[doc = "MCR (rw) register accessor: Module Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`mcr::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mcr::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@mcr`]
module"]
pub type MCR = crate::Reg<mcr::MCR_SPEC>;
#[doc(alias = "MCR")]
pub type Mcr = crate::Reg<mcr::McrSpec>;
#[doc = "Module Control Register"]
pub mod mcr;
#[doc = "MITR (w) register accessor: Module Interrupt Trigger Register\n\nYou can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mitr::W`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@mitr`]
module"]
pub type MITR = crate::Reg<mitr::MITR_SPEC>;
#[doc(alias = "MITR")]
pub type Mitr = crate::Reg<mitr::MitrSpec>;
#[doc = "Module Interrupt Trigger Register"]
pub mod mitr;
55 changes: 23 additions & 32 deletions src/can/clc.rs
Original file line number Diff line number Diff line change
@@ -1,71 +1,62 @@
#[doc = "Register `CLC` reader"]
pub type R = crate::R<CLC_SPEC>;
pub type R = crate::R<ClcSpec>;
#[doc = "Register `CLC` writer"]
pub type W = crate::W<CLC_SPEC>;
pub type W = crate::W<ClcSpec>;
#[doc = "Field `DISR` reader - Module Disable Request Bit"]
pub type DISR_R = crate::BitReader;
pub type DisrR = crate::BitReader;
#[doc = "Field `DISR` writer - Module Disable Request Bit"]
pub type DISR_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type DisrW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `DISS` reader - Module Disable Status Bit"]
pub type DISS_R = crate::BitReader;
pub type DissR = crate::BitReader;
#[doc = "Field `EDIS` reader - Sleep Mode Enable Control"]
pub type EDIS_R = crate::BitReader;
pub type EdisR = crate::BitReader;
#[doc = "Field `EDIS` writer - Sleep Mode Enable Control"]
pub type EDIS_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type EdisW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[doc = "Bit 0 - Module Disable Request Bit"]
#[inline(always)]
pub fn disr(&self) -> DISR_R {
DISR_R::new((self.bits & 1) != 0)
pub fn disr(&self) -> DisrR {
DisrR::new((self.bits & 1) != 0)
}
#[doc = "Bit 1 - Module Disable Status Bit"]
#[inline(always)]
pub fn diss(&self) -> DISS_R {
DISS_R::new(((self.bits >> 1) & 1) != 0)
pub fn diss(&self) -> DissR {
DissR::new(((self.bits >> 1) & 1) != 0)
}
#[doc = "Bit 3 - Sleep Mode Enable Control"]
#[inline(always)]
pub fn edis(&self) -> EDIS_R {
EDIS_R::new(((self.bits >> 3) & 1) != 0)
pub fn edis(&self) -> EdisR {
EdisR::new(((self.bits >> 3) & 1) != 0)
}
}
impl W {
#[doc = "Bit 0 - Module Disable Request Bit"]
#[inline(always)]
#[must_use]
pub fn disr(&mut self) -> DISR_W<CLC_SPEC> {
DISR_W::new(self, 0)
pub fn disr(&mut self) -> DisrW<ClcSpec> {
DisrW::new(self, 0)
}
#[doc = "Bit 3 - Sleep Mode Enable Control"]
#[inline(always)]
#[must_use]
pub fn edis(&mut self) -> EDIS_W<CLC_SPEC> {
EDIS_W::new(self, 3)
}
#[doc = r" Writes raw bits to the register."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
pub fn edis(&mut self) -> EdisW<ClcSpec> {
EdisW::new(self, 3)
}
}
#[doc = "CAN Clock Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`clc::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`clc::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CLC_SPEC;
impl crate::RegisterSpec for CLC_SPEC {
pub struct ClcSpec;
impl crate::RegisterSpec for ClcSpec {
type Ux = u32;
}
#[doc = "`read()` method returns [`clc::R`](R) reader structure"]
impl crate::Readable for CLC_SPEC {}
impl crate::Readable for ClcSpec {}
#[doc = "`write(|w| ..)` method takes [`clc::W`](W) writer structure"]
impl crate::Writable for CLC_SPEC {
impl crate::Writable for ClcSpec {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets CLC to value 0x03"]
impl crate::Resettable for CLC_SPEC {
impl crate::Resettable for ClcSpec {
const RESET_VALUE: u32 = 0x03;
}
49 changes: 20 additions & 29 deletions src/can/fdr.rs
Original file line number Diff line number Diff line change
@@ -1,64 +1,55 @@
#[doc = "Register `FDR` reader"]
pub type R = crate::R<FDR_SPEC>;
pub type R = crate::R<FdrSpec>;
#[doc = "Register `FDR` writer"]
pub type W = crate::W<FDR_SPEC>;
pub type W = crate::W<FdrSpec>;
#[doc = "Field `STEP` reader - Step Value"]
pub type STEP_R = crate::FieldReader<u16>;
pub type StepR = crate::FieldReader<u16>;
#[doc = "Field `STEP` writer - Step Value"]
pub type STEP_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
pub type StepW<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
#[doc = "Field `DM` reader - Divider Mode"]
pub type DM_R = crate::FieldReader;
pub type DmR = crate::FieldReader;
#[doc = "Field `DM` writer - Divider Mode"]
pub type DM_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
pub type DmW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
impl R {
#[doc = "Bits 0:9 - Step Value"]
#[inline(always)]
pub fn step(&self) -> STEP_R {
STEP_R::new((self.bits & 0x03ff) as u16)
pub fn step(&self) -> StepR {
StepR::new((self.bits & 0x03ff) as u16)
}
#[doc = "Bits 14:15 - Divider Mode"]
#[inline(always)]
pub fn dm(&self) -> DM_R {
DM_R::new(((self.bits >> 14) & 3) as u8)
pub fn dm(&self) -> DmR {
DmR::new(((self.bits >> 14) & 3) as u8)
}
}
impl W {
#[doc = "Bits 0:9 - Step Value"]
#[inline(always)]
#[must_use]
pub fn step(&mut self) -> STEP_W<FDR_SPEC> {
STEP_W::new(self, 0)
pub fn step(&mut self) -> StepW<FdrSpec> {
StepW::new(self, 0)
}
#[doc = "Bits 14:15 - Divider Mode"]
#[inline(always)]
#[must_use]
pub fn dm(&mut self) -> DM_W<FDR_SPEC> {
DM_W::new(self, 14)
}
#[doc = r" Writes raw bits to the register."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
pub fn dm(&mut self) -> DmW<FdrSpec> {
DmW::new(self, 14)
}
}
#[doc = "CAN Fractional Divider Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`fdr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`fdr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct FDR_SPEC;
impl crate::RegisterSpec for FDR_SPEC {
pub struct FdrSpec;
impl crate::RegisterSpec for FdrSpec {
type Ux = u32;
}
#[doc = "`read()` method returns [`fdr::R`](R) reader structure"]
impl crate::Readable for FDR_SPEC {}
impl crate::Readable for FdrSpec {}
#[doc = "`write(|w| ..)` method takes [`fdr::W`](W) writer structure"]
impl crate::Writable for FDR_SPEC {
impl crate::Writable for FdrSpec {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets FDR to value 0"]
impl crate::Resettable for FDR_SPEC {
impl crate::Resettable for FdrSpec {
const RESET_VALUE: u32 = 0;
}
Loading

0 comments on commit 1c5e610

Please sign in to comment.