Skip to content

Commit

Permalink
Update svd2rust (again), make byte-aligned memory blocks word-align…
Browse files Browse the repository at this point in the history
…ed (#170)

* Use latest `svd2rust` (again)

* Convert byte-aligned memory regions to word-aligned

* Regenerate PACs

* Align AES for S2/S3 with ESP32

* Fix size of registers in memory regions

* Regenerate PACs

* Fix patch for ESP32-S2
  • Loading branch information
jessebraham authored Nov 29, 2023
1 parent 5706943 commit 30ef05f
Show file tree
Hide file tree
Showing 291 changed files with 10,298 additions and 3,446 deletions.
36 changes: 24 additions & 12 deletions esp32/src/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pub struct RegisterBlock {
idle: IDLE,
mode: MODE,
_reserved3: [u8; 0x04],
key_: [KEY_; 8],
text_: [TEXT_; 4],
key: [KEY; 8],
text: [TEXT; 4],
endian: ENDIAN,
}
impl RegisterBlock {
Expand All @@ -28,13 +28,25 @@ impl RegisterBlock {
}
#[doc = "0x10..0x30 - "]
#[inline(always)]
pub const fn key_(&self, n: usize) -> &KEY_ {
&self.key_[n]
pub const fn key(&self, n: usize) -> &KEY {
&self.key[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x10..0x30 - "]
#[inline(always)]
pub fn key_iter(&self) -> impl Iterator<Item = &KEY> {
self.key.iter()
}
#[doc = "0x30..0x40 - "]
#[inline(always)]
pub const fn text(&self, n: usize) -> &TEXT {
&self.text[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x30..0x40 - "]
#[inline(always)]
pub const fn text_(&self, n: usize) -> &TEXT_ {
&self.text_[n]
pub fn text_iter(&self) -> impl Iterator<Item = &TEXT> {
self.text.iter()
}
#[doc = "0x40 - "]
#[inline(always)]
Expand All @@ -54,14 +66,14 @@ pub mod idle;
pub type MODE = crate::Reg<mode::MODE_SPEC>;
#[doc = ""]
pub mod mode;
#[doc = "KEY_ (rw) register accessor: \n\nYou can [`read`](crate::generic::Reg::read) this register and get [`key_::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 [`key_::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@key_`] module"]
pub type KEY_ = crate::Reg<key_::KEY__SPEC>;
#[doc = "KEY (rw) register accessor: \n\nYou can [`read`](crate::generic::Reg::read) this register and get [`key::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 [`key::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@key`] module"]
pub type KEY = crate::Reg<key::KEY_SPEC>;
#[doc = ""]
pub mod key_;
#[doc = "TEXT_ (rw) register accessor: \n\nYou can [`read`](crate::generic::Reg::read) this register and get [`text_::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 [`text_::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@text_`] module"]
pub type TEXT_ = crate::Reg<text_::TEXT__SPEC>;
pub mod key;
#[doc = "TEXT (rw) register accessor: \n\nYou can [`read`](crate::generic::Reg::read) this register and get [`text::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 [`text::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@text`] module"]
pub type TEXT = crate::Reg<text::TEXT_SPEC>;
#[doc = ""]
pub mod text_;
pub mod text;
#[doc = "ENDIAN (rw) register accessor: \n\nYou can [`read`](crate::generic::Reg::read) this register and get [`endian::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 [`endian::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@endian`] module"]
pub type ENDIAN = crate::Reg<endian::ENDIAN_SPEC>;
#[doc = ""]
Expand Down
32 changes: 16 additions & 16 deletions esp32/src/aes/key_.rs → esp32/src/aes/key.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[doc = "Register `KEY_%s` reader"]
pub type R = crate::R<KEY__SPEC>;
#[doc = "Register `KEY_%s` writer"]
pub type W = crate::W<KEY__SPEC>;
#[doc = "Register `KEY[%s]` reader"]
pub type R = crate::R<KEY_SPEC>;
#[doc = "Register `KEY[%s]` writer"]
pub type W = crate::W<KEY_SPEC>;
#[doc = "Field `KEY` reader - AES key material register."]
pub type KEY_R = crate::FieldReader;
#[doc = "Field `KEY` writer - AES key material register."]
Expand All @@ -16,13 +16,13 @@ impl R {
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("KEY_")
f.debug_struct("KEY")
.field("key", &format_args!("{}", self.key().bits()))
.finish()
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for crate::generic::Reg<KEY__SPEC> {
impl core::fmt::Debug for crate::generic::Reg<KEY_SPEC> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(&self.read(), f)
}
Expand All @@ -31,7 +31,7 @@ impl W {
#[doc = "Bits 0:7 - AES key material register."]
#[inline(always)]
#[must_use]
pub fn key(&mut self) -> KEY_W<KEY__SPEC> {
pub fn key(&mut self) -> KEY_W<KEY_SPEC> {
KEY_W::new(self, 0)
}
#[doc = r" Writes raw bits to the register."]
Expand All @@ -45,19 +45,19 @@ impl W {
self
}
}
#[doc = "\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`key_::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 [`key_::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct KEY__SPEC;
impl crate::RegisterSpec for KEY__SPEC {
#[doc = "\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`key::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 [`key::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct KEY_SPEC;
impl crate::RegisterSpec for KEY_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`key_::R`](R) reader structure"]
impl crate::Readable for KEY__SPEC {}
#[doc = "`write(|w| ..)` method takes [`key_::W`](W) writer structure"]
impl crate::Writable for KEY__SPEC {
#[doc = "`read()` method returns [`key::R`](R) reader structure"]
impl crate::Readable for KEY_SPEC {}
#[doc = "`write(|w| ..)` method takes [`key::W`](W) writer structure"]
impl crate::Writable for KEY_SPEC {
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets KEY_%s to value 0"]
impl crate::Resettable for KEY__SPEC {
#[doc = "`reset()` method sets KEY[%s] to value 0"]
impl crate::Resettable for KEY_SPEC {
const RESET_VALUE: Self::Ux = 0;
}
32 changes: 16 additions & 16 deletions esp32/src/aes/text_.rs → esp32/src/aes/text.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[doc = "Register `TEXT_%s` reader"]
pub type R = crate::R<TEXT__SPEC>;
#[doc = "Register `TEXT_%s` writer"]
pub type W = crate::W<TEXT__SPEC>;
#[doc = "Register `TEXT[%s]` reader"]
pub type R = crate::R<TEXT_SPEC>;
#[doc = "Register `TEXT[%s]` writer"]
pub type W = crate::W<TEXT_SPEC>;
#[doc = "Field `TEXT` reader - Plaintext and ciphertext register."]
pub type TEXT_R = crate::FieldReader;
#[doc = "Field `TEXT` writer - Plaintext and ciphertext register."]
Expand All @@ -16,13 +16,13 @@ impl R {
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TEXT_")
f.debug_struct("TEXT")
.field("text", &format_args!("{}", self.text().bits()))
.finish()
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for crate::generic::Reg<TEXT__SPEC> {
impl core::fmt::Debug for crate::generic::Reg<TEXT_SPEC> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(&self.read(), f)
}
Expand All @@ -31,7 +31,7 @@ impl W {
#[doc = "Bits 0:7 - Plaintext and ciphertext register."]
#[inline(always)]
#[must_use]
pub fn text(&mut self) -> TEXT_W<TEXT__SPEC> {
pub fn text(&mut self) -> TEXT_W<TEXT_SPEC> {
TEXT_W::new(self, 0)
}
#[doc = r" Writes raw bits to the register."]
Expand All @@ -45,19 +45,19 @@ impl W {
self
}
}
#[doc = "\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`text_::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 [`text_::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct TEXT__SPEC;
impl crate::RegisterSpec for TEXT__SPEC {
#[doc = "\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`text::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 [`text::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct TEXT_SPEC;
impl crate::RegisterSpec for TEXT_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`text_::R`](R) reader structure"]
impl crate::Readable for TEXT__SPEC {}
#[doc = "`write(|w| ..)` method takes [`text_::W`](W) writer structure"]
impl crate::Writable for TEXT__SPEC {
#[doc = "`read()` method returns [`text::R`](R) reader structure"]
impl crate::Readable for TEXT_SPEC {}
#[doc = "`write(|w| ..)` method takes [`text::W`](W) writer structure"]
impl crate::Writable for TEXT_SPEC {
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets TEXT_%s to value 0"]
impl crate::Resettable for TEXT__SPEC {
#[doc = "`reset()` method sets TEXT[%s] to value 0"]
impl crate::Resettable for TEXT_SPEC {
const RESET_VALUE: Self::Ux = 0;
}
28 changes: 20 additions & 8 deletions esp32/src/apb_ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,50 +56,62 @@ impl RegisterBlock {
pub const fn apb_saradc_sar1_patt_tab(&self, n: usize) -> &APB_SARADC_SAR1_PATT_TAB {
&self.apb_saradc_sar1_patt_tab[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x1c..0x2c - "]
#[inline(always)]
pub fn apb_saradc_sar1_patt_tab_iter(&self) -> impl Iterator<Item = &APB_SARADC_SAR1_PATT_TAB> {
self.apb_saradc_sar1_patt_tab.iter()
}
#[doc = "0x1c - APB_SARADC_SAR1_PATT_TAB1"]
#[inline(always)]
pub const fn apb_saradc_sar1_patt_tab1(&self) -> &APB_SARADC_SAR1_PATT_TAB {
&self.apb_saradc_sar1_patt_tab(0)
self.apb_saradc_sar1_patt_tab(0)
}
#[doc = "0x20 - APB_SARADC_SAR1_PATT_TAB2"]
#[inline(always)]
pub const fn apb_saradc_sar1_patt_tab2(&self) -> &APB_SARADC_SAR1_PATT_TAB {
&self.apb_saradc_sar1_patt_tab(1)
self.apb_saradc_sar1_patt_tab(1)
}
#[doc = "0x24 - APB_SARADC_SAR1_PATT_TAB3"]
#[inline(always)]
pub const fn apb_saradc_sar1_patt_tab3(&self) -> &APB_SARADC_SAR1_PATT_TAB {
&self.apb_saradc_sar1_patt_tab(2)
self.apb_saradc_sar1_patt_tab(2)
}
#[doc = "0x28 - APB_SARADC_SAR1_PATT_TAB4"]
#[inline(always)]
pub const fn apb_saradc_sar1_patt_tab4(&self) -> &APB_SARADC_SAR1_PATT_TAB {
&self.apb_saradc_sar1_patt_tab(3)
self.apb_saradc_sar1_patt_tab(3)
}
#[doc = "0x2c..0x3c - "]
#[inline(always)]
pub const fn apb_saradc_sar2_patt_tab(&self, n: usize) -> &APB_SARADC_SAR2_PATT_TAB {
&self.apb_saradc_sar2_patt_tab[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x2c..0x3c - "]
#[inline(always)]
pub fn apb_saradc_sar2_patt_tab_iter(&self) -> impl Iterator<Item = &APB_SARADC_SAR2_PATT_TAB> {
self.apb_saradc_sar2_patt_tab.iter()
}
#[doc = "0x2c - APB_SARADC_SAR2_PATT_TAB1"]
#[inline(always)]
pub const fn apb_saradc_sar2_patt_tab1(&self) -> &APB_SARADC_SAR2_PATT_TAB {
&self.apb_saradc_sar2_patt_tab(0)
self.apb_saradc_sar2_patt_tab(0)
}
#[doc = "0x30 - APB_SARADC_SAR2_PATT_TAB2"]
#[inline(always)]
pub const fn apb_saradc_sar2_patt_tab2(&self) -> &APB_SARADC_SAR2_PATT_TAB {
&self.apb_saradc_sar2_patt_tab(1)
self.apb_saradc_sar2_patt_tab(1)
}
#[doc = "0x34 - APB_SARADC_SAR2_PATT_TAB3"]
#[inline(always)]
pub const fn apb_saradc_sar2_patt_tab3(&self) -> &APB_SARADC_SAR2_PATT_TAB {
&self.apb_saradc_sar2_patt_tab(2)
self.apb_saradc_sar2_patt_tab(2)
}
#[doc = "0x38 - APB_SARADC_SAR2_PATT_TAB4"]
#[inline(always)]
pub const fn apb_saradc_sar2_patt_tab4(&self) -> &APB_SARADC_SAR2_PATT_TAB {
&self.apb_saradc_sar2_patt_tab(3)
self.apb_saradc_sar2_patt_tab(3)
}
#[doc = "0x3c - "]
#[inline(always)]
Expand Down
6 changes: 6 additions & 0 deletions esp32/src/flash_encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ impl RegisterBlock {
pub const fn buffer_(&self, n: usize) -> &BUFFER_ {
&self.buffer_[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x00..0x20 - "]
#[inline(always)]
pub fn buffer__iter(&self) -> impl Iterator<Item = &BUFFER_> {
self.buffer_.iter()
}
#[doc = "0x20 - "]
#[inline(always)]
pub const fn start(&self) -> &START {
Expand Down
Loading

0 comments on commit 30ef05f

Please sign in to comment.