esp32c6/spi0/
spi_smem_ecc_ctrl.rs

1#[doc = "Register `SPI_SMEM_ECC_CTRL` reader"]
2pub type R = crate::R<SPI_SMEM_ECC_CTRL_SPEC>;
3#[doc = "Field `SPI_SMEM_ECC_ERR_INT_EN` reader - Set this bit to calculate the error times of MSPI ECC read when accesses to external RAM."]
4pub type SPI_SMEM_ECC_ERR_INT_EN_R = crate::BitReader;
5#[doc = "Field `SPI_SMEM_PAGE_SIZE` reader - Set the page size of the external RAM accessed by MSPI. 0: 256 bytes. 1: 512 bytes. 2: 1024 bytes. 3: 2048 bytes."]
6pub type SPI_SMEM_PAGE_SIZE_R = crate::FieldReader;
7#[doc = "Field `SPI_SMEM_ECC_ADDR_EN` reader - Set this bit to enable MSPI ECC address conversion, no matter MSPI accesses to the ECC region or non-ECC region of external RAM. If there is no ECC region in external RAM, this bit should be 0. Otherwise, this bit should be 1."]
8pub type SPI_SMEM_ECC_ADDR_EN_R = crate::BitReader;
9impl R {
10    #[doc = "Bit 17 - Set this bit to calculate the error times of MSPI ECC read when accesses to external RAM."]
11    #[inline(always)]
12    pub fn spi_smem_ecc_err_int_en(&self) -> SPI_SMEM_ECC_ERR_INT_EN_R {
13        SPI_SMEM_ECC_ERR_INT_EN_R::new(((self.bits >> 17) & 1) != 0)
14    }
15    #[doc = "Bits 18:19 - Set the page size of the external RAM accessed by MSPI. 0: 256 bytes. 1: 512 bytes. 2: 1024 bytes. 3: 2048 bytes."]
16    #[inline(always)]
17    pub fn spi_smem_page_size(&self) -> SPI_SMEM_PAGE_SIZE_R {
18        SPI_SMEM_PAGE_SIZE_R::new(((self.bits >> 18) & 3) as u8)
19    }
20    #[doc = "Bit 20 - Set this bit to enable MSPI ECC address conversion, no matter MSPI accesses to the ECC region or non-ECC region of external RAM. If there is no ECC region in external RAM, this bit should be 0. Otherwise, this bit should be 1."]
21    #[inline(always)]
22    pub fn spi_smem_ecc_addr_en(&self) -> SPI_SMEM_ECC_ADDR_EN_R {
23        SPI_SMEM_ECC_ADDR_EN_R::new(((self.bits >> 20) & 1) != 0)
24    }
25}
26#[cfg(feature = "impl-register-debug")]
27impl core::fmt::Debug for R {
28    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
29        f.debug_struct("SPI_SMEM_ECC_CTRL")
30            .field("spi_smem_ecc_err_int_en", &self.spi_smem_ecc_err_int_en())
31            .field("spi_smem_page_size", &self.spi_smem_page_size())
32            .field("spi_smem_ecc_addr_en", &self.spi_smem_ecc_addr_en())
33            .finish()
34    }
35}
36#[doc = "MSPI ECC control register\n\nYou can [`read`](crate::Reg::read) this register and get [`spi_smem_ecc_ctrl::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
37pub struct SPI_SMEM_ECC_CTRL_SPEC;
38impl crate::RegisterSpec for SPI_SMEM_ECC_CTRL_SPEC {
39    type Ux = u32;
40}
41#[doc = "`read()` method returns [`spi_smem_ecc_ctrl::R`](R) reader structure"]
42impl crate::Readable for SPI_SMEM_ECC_CTRL_SPEC {}
43#[doc = "`reset()` method sets SPI_SMEM_ECC_CTRL to value 0x0008_0000"]
44impl crate::Resettable for SPI_SMEM_ECC_CTRL_SPEC {
45    const RESET_VALUE: u32 = 0x0008_0000;
46}