Skip to content

Commit

Permalink
Define MAC RST bit on 32, C2, C3, S2, S3 (#315)
Browse files Browse the repository at this point in the history
* Rename register, add known bits

* Trailing spaces

* Define MAC RST bit on C2, C3, S2, S3
  • Loading branch information
bugadani authored Feb 5, 2025
1 parent c002f7c commit e5fc973
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 102 deletions.
16 changes: 8 additions & 8 deletions esp32/src/dport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct RegisterBlock {
perip_rst_en: PERIP_RST_EN,
slave_spi_config: SLAVE_SPI_CONFIG,
wifi_clk_en: WIFI_CLK_EN,
core_rst_en: CORE_RST_EN,
wifi_rst_en: WIFI_RST_EN,
bt_lpck_div_int: BT_LPCK_DIV_INT,
bt_lpck_div_frac: BT_LPCK_DIV_FRAC,
cpu_intr_from_cpu_0: CPU_INTR_FROM_CPU_0,
Expand Down Expand Up @@ -633,10 +633,10 @@ impl RegisterBlock {
pub const fn wifi_clk_en(&self) -> &WIFI_CLK_EN {
&self.wifi_clk_en
}
#[doc = "0xd0 - "]
#[doc = "0xd0 - Wifi peripheral reset control"]
#[inline(always)]
pub const fn core_rst_en(&self) -> &CORE_RST_EN {
&self.core_rst_en
pub const fn wifi_rst_en(&self) -> &WIFI_RST_EN {
&self.wifi_rst_en
}
#[doc = "0xd4 - "]
#[inline(always)]
Expand Down Expand Up @@ -2422,10 +2422,6 @@ pub mod slave_spi_config;
pub type WIFI_CLK_EN = crate::Reg<wifi_clk_en::WIFI_CLK_EN_SPEC>;
#[doc = ""]
pub mod wifi_clk_en;
#[doc = "CORE_RST_EN (rw) register accessor: \n\nYou can [`read`](crate::Reg::read) this register and get [`core_rst_en::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`core_rst_en::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@core_rst_en`] module"]
pub type CORE_RST_EN = crate::Reg<core_rst_en::CORE_RST_EN_SPEC>;
#[doc = ""]
pub mod core_rst_en;
#[doc = "BT_LPCK_DIV_INT (rw) register accessor: \n\nYou can [`read`](crate::Reg::read) this register and get [`bt_lpck_div_int::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`bt_lpck_div_int::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@bt_lpck_div_int`] module"]
pub type BT_LPCK_DIV_INT = crate::Reg<bt_lpck_div_int::BT_LPCK_DIV_INT_SPEC>;
#[doc = ""]
Expand Down Expand Up @@ -3758,3 +3754,7 @@ pub mod app_vecbase_set;
pub type DATE = crate::Reg<date::DATE_SPEC>;
#[doc = ""]
pub mod date;
#[doc = "WIFI_RST_EN (rw) register accessor: Wifi peripheral reset control\n\nYou can [`read`](crate::Reg::read) this register and get [`wifi_rst_en::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`wifi_rst_en::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@wifi_rst_en`] module"]
pub type WIFI_RST_EN = crate::Reg<wifi_rst_en::WIFI_RST_EN_SPEC>;
#[doc = "Wifi peripheral reset control"]
pub mod wifi_rst_en;
47 changes: 0 additions & 47 deletions esp32/src/dport/core_rst_en.rs

This file was deleted.

92 changes: 92 additions & 0 deletions esp32/src/dport/wifi_rst_en.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#[doc = "Register `WIFI_RST_EN` reader"]
pub type R = crate::R<WIFI_RST_EN_SPEC>;
#[doc = "Register `WIFI_RST_EN` writer"]
pub type W = crate::W<WIFI_RST_EN_SPEC>;
#[doc = "Field `MAC_RST` reader - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type MAC_RST_R = crate::BitReader;
#[doc = "Field `MAC_RST` writer - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type MAC_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `SDIO_RST` reader - Set this bit to reset SDIO module. Clear the bit to release SDIO module."]
pub type SDIO_RST_R = crate::BitReader;
#[doc = "Field `SDIO_RST` writer - Set this bit to reset SDIO module. Clear the bit to release SDIO module."]
pub type SDIO_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `SDIO_HOST_RST` reader - Set this bit to reset SD/MMC module. Clear the bit to release SD/MMC module."]
pub type SDIO_HOST_RST_R = crate::BitReader;
#[doc = "Field `SDIO_HOST_RST` writer - Set this bit to reset SD/MMC module. Clear the bit to release SD/MMC module."]
pub type SDIO_HOST_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `EMAC_RST` reader - Set this bit to reset Ethernet MAC module. Clear the bit to release Ethernet MAC module."]
pub type EMAC_RST_R = crate::BitReader;
#[doc = "Field `EMAC_RST` writer - Set this bit to reset Ethernet MAC module. Clear the bit to release Ethernet MAC module."]
pub type EMAC_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[doc = "Bit 2 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn mac_rst(&self) -> MAC_RST_R {
MAC_RST_R::new(((self.bits >> 2) & 1) != 0)
}
#[doc = "Bit 5 - Set this bit to reset SDIO module. Clear the bit to release SDIO module."]
#[inline(always)]
pub fn sdio_rst(&self) -> SDIO_RST_R {
SDIO_RST_R::new(((self.bits >> 5) & 1) != 0)
}
#[doc = "Bit 6 - Set this bit to reset SD/MMC module. Clear the bit to release SD/MMC module."]
#[inline(always)]
pub fn sdio_host_rst(&self) -> SDIO_HOST_RST_R {
SDIO_HOST_RST_R::new(((self.bits >> 6) & 1) != 0)
}
#[doc = "Bit 7 - Set this bit to reset Ethernet MAC module. Clear the bit to release Ethernet MAC module."]
#[inline(always)]
pub fn emac_rst(&self) -> EMAC_RST_R {
EMAC_RST_R::new(((self.bits >> 7) & 1) != 0)
}
}
#[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("WIFI_RST_EN")
.field("emac_rst", &self.emac_rst())
.field("sdio_host_rst", &self.sdio_host_rst())
.field("sdio_rst", &self.sdio_rst())
.field("mac_rst", &self.mac_rst())
.finish()
}
}
impl W {
#[doc = "Bit 2 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn mac_rst(&mut self) -> MAC_RST_W<WIFI_RST_EN_SPEC> {
MAC_RST_W::new(self, 2)
}
#[doc = "Bit 5 - Set this bit to reset SDIO module. Clear the bit to release SDIO module."]
#[inline(always)]
pub fn sdio_rst(&mut self) -> SDIO_RST_W<WIFI_RST_EN_SPEC> {
SDIO_RST_W::new(self, 5)
}
#[doc = "Bit 6 - Set this bit to reset SD/MMC module. Clear the bit to release SD/MMC module."]
#[inline(always)]
pub fn sdio_host_rst(&mut self) -> SDIO_HOST_RST_W<WIFI_RST_EN_SPEC> {
SDIO_HOST_RST_W::new(self, 6)
}
#[doc = "Bit 7 - Set this bit to reset Ethernet MAC module. Clear the bit to release Ethernet MAC module."]
#[inline(always)]
pub fn emac_rst(&mut self) -> EMAC_RST_W<WIFI_RST_EN_SPEC> {
EMAC_RST_W::new(self, 7)
}
}
#[doc = "Wifi peripheral reset control\n\nYou can [`read`](crate::Reg::read) this register and get [`wifi_rst_en::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`wifi_rst_en::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct WIFI_RST_EN_SPEC;
impl crate::RegisterSpec for WIFI_RST_EN_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`wifi_rst_en::R`](R) reader structure"]
impl crate::Readable for WIFI_RST_EN_SPEC {}
#[doc = "`write(|w| ..)` method takes [`wifi_rst_en::W`](W) writer structure"]
impl crate::Writable for WIFI_RST_EN_SPEC {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets WIFI_RST_EN to value 0"]
impl crate::Resettable for WIFI_RST_EN_SPEC {
const RESET_VALUE: u32 = 0;
}
27 changes: 27 additions & 0 deletions esp32/svd/patches/esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,30 @@ TWAI0:
bitWidth: 1
_include:
- "esp32-wifi.yaml"

DPORT:
_delete: CORE_RST_EN
_add:
WIFI_RST_EN:
description: "Wifi peripheral reset control"
addressOffset: 0xD0
size: 32
access: read-write
resetValue: 0x0
fields:
EMAC_RST:
description: "Set this bit to reset Ethernet MAC module. Clear the bit to release Ethernet MAC module."
bitOffset: 7
bitWidth: 1
SDIO_HOST_RST:
description: "Set this bit to reset SD/MMC module. Clear the bit to release SD/MMC module."
bitOffset: 6
bitWidth: 1
SDIO_RST:
description: "Set this bit to reset SDIO module. Clear the bit to release SDIO module."
bitOffset: 5
bitWidth: 1
MAC_RST:
description: "Set this bit to reset MAC module. Clear the bit to release MAC module."
bitOffset: 2
bitWidth: 1
37 changes: 26 additions & 11 deletions esp32c2/src/apb_ctrl/wifi_rst_en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,45 @@
pub type R = crate::R<WIFI_RST_EN_SPEC>;
#[doc = "Register `WIFI_RST_EN` writer"]
pub type W = crate::W<WIFI_RST_EN_SPEC>;
#[doc = "Field `WIFI_RST` reader - reg_wifi_rst"]
pub type WIFI_RST_R = crate::FieldReader<u32>;
#[doc = "Field `WIFI_RST` writer - reg_wifi_rst"]
pub type WIFI_RST_W<'a, REG> = crate::FieldWriter<'a, REG, 32, u32>;
#[doc = "Field `MAC_RST` reader - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type MAC_RST_R = crate::BitReader;
#[doc = "Field `MAC_RST` writer - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type MAC_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `BLE_RPA_RST` reader - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type BLE_RPA_RST_R = crate::BitReader;
#[doc = "Field `BLE_RPA_RST` writer - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type BLE_RPA_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[doc = "Bits 0:31 - reg_wifi_rst"]
#[doc = "Bit 2 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn wifi_rst(&self) -> WIFI_RST_R {
WIFI_RST_R::new(self.bits)
pub fn mac_rst(&self) -> MAC_RST_R {
MAC_RST_R::new(((self.bits >> 2) & 1) != 0)
}
#[doc = "Bit 3 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn ble_rpa_rst(&self) -> BLE_RPA_RST_R {
BLE_RPA_RST_R::new(((self.bits >> 3) & 1) != 0)
}
}
#[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("WIFI_RST_EN")
.field("wifi_rst", &self.wifi_rst())
.field("mac_rst", &self.mac_rst())
.field("ble_rpa_rst", &self.ble_rpa_rst())
.finish()
}
}
impl W {
#[doc = "Bits 0:31 - reg_wifi_rst"]
#[doc = "Bit 2 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn mac_rst(&mut self) -> MAC_RST_W<WIFI_RST_EN_SPEC> {
MAC_RST_W::new(self, 2)
}
#[doc = "Bit 3 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn wifi_rst(&mut self) -> WIFI_RST_W<WIFI_RST_EN_SPEC> {
WIFI_RST_W::new(self, 0)
pub fn ble_rpa_rst(&mut self) -> BLE_RPA_RST_W<WIFI_RST_EN_SPEC> {
BLE_RPA_RST_W::new(self, 3)
}
}
#[doc = "APB_CTRL_WIFI_RST_EN_REG\n\nYou can [`read`](crate::Reg::read) this register and get [`wifi_rst_en::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`wifi_rst_en::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
Expand Down
17 changes: 14 additions & 3 deletions esp32c2/svd/patches/esp32c2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ I2C0:
name: INT_ST
_include:
- ../../../common_patches/i2c0.yaml

RTC_CNTL:
_include: ../../../common_patches/rtc_cntl_int_strip.yaml

Expand All @@ -48,7 +48,7 @@ LEDC:
_modify:
OVF:
name: TIMER0_OVF
_include:
_include:
- ../../../common_patches/ledc_collect.yaml
- ../../../common_patches/ledc_int.yaml

Expand All @@ -68,6 +68,17 @@ APB_CTRL:
_modify:
"*":
modifiedWriteValues: oneToClear
WIFI_RST_EN:
_delete: WIFI_RST
_add:
MAC_RST:
description: "Set this bit to reset MAC module. Clear the bit to release MAC module."
bitOffset: 2
bitWidth: 1
BLE_RPA_RST:
description: "Set this bit to reset BLE RPA module. Clear the bit to release BLE RPA module."
bitOffset: 27
bitWidth: 1

ECC:
_include: ../../../common_patches/ecc_int_strip.yaml
Expand Down Expand Up @@ -108,7 +119,7 @@ SPI2:
_include: ../../../common_patches/spi_dma_int_strip.yaml

SYSTIMER:
_include:
_include:
- ../../../common_patches/int_strip.yaml
- ../../../common_patches/systimer.yaml

Expand Down
22 changes: 11 additions & 11 deletions esp32c3/src/apb_ctrl/wifi_rst_en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
pub type R = crate::R<WIFI_RST_EN_SPEC>;
#[doc = "Register `WIFI_RST_EN` writer"]
pub type W = crate::W<WIFI_RST_EN_SPEC>;
#[doc = "Field `WIFI_RST` reader - reg_wifi_rst"]
pub type WIFI_RST_R = crate::FieldReader<u32>;
#[doc = "Field `WIFI_RST` writer - reg_wifi_rst"]
pub type WIFI_RST_W<'a, REG> = crate::FieldWriter<'a, REG, 32, u32>;
#[doc = "Field `MAC_RST` reader - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type MAC_RST_R = crate::BitReader;
#[doc = "Field `MAC_RST` writer - Set this bit to reset MAC module. Clear the bit to release MAC module."]
pub type MAC_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[doc = "Bits 0:31 - reg_wifi_rst"]
#[doc = "Bit 2 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn wifi_rst(&self) -> WIFI_RST_R {
WIFI_RST_R::new(self.bits)
pub fn mac_rst(&self) -> MAC_RST_R {
MAC_RST_R::new(((self.bits >> 2) & 1) != 0)
}
}
#[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("WIFI_RST_EN")
.field("wifi_rst", &self.wifi_rst())
.field("mac_rst", &self.mac_rst())
.finish()
}
}
impl W {
#[doc = "Bits 0:31 - reg_wifi_rst"]
#[doc = "Bit 2 - Set this bit to reset MAC module. Clear the bit to release MAC module."]
#[inline(always)]
pub fn wifi_rst(&mut self) -> WIFI_RST_W<WIFI_RST_EN_SPEC> {
WIFI_RST_W::new(self, 0)
pub fn mac_rst(&mut self) -> MAC_RST_W<WIFI_RST_EN_SPEC> {
MAC_RST_W::new(self, 2)
}
}
#[doc = "APB_CTRL_WIFI_RST_EN_REG\n\nYou can [`read`](crate::Reg::read) this register and get [`wifi_rst_en::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`wifi_rst_en::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
Expand Down
7 changes: 7 additions & 0 deletions esp32c3/svd/patches/esp32c3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ APB_CTRL:
_modify:
"*":
modifiedWriteValues: oneToClear
WIFI_RST_EN:
_delete: WIFI_RST
_add:
MAC_RST:
description: "Set this bit to reset MAC module. Clear the bit to release MAC module."
bitOffset: 2
bitWidth: 1

EXTMEM:
_include: ../../../common_patches/extmem_cache_int_strip.yaml
Expand Down
Loading

0 comments on commit e5fc973

Please sign in to comment.