esp32c3/spi1/
flash_sus_ctrl.rs

1#[doc = "Register `FLASH_SUS_CTRL` reader"]
2pub type R = crate::R<FLASH_SUS_CTRL_SPEC>;
3#[doc = "Register `FLASH_SUS_CTRL` writer"]
4pub type W = crate::W<FLASH_SUS_CTRL_SPEC>;
5#[doc = "Field `FLASH_PER` reader - program erase resume bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
6pub type FLASH_PER_R = crate::BitReader;
7#[doc = "Field `FLASH_PER` writer - program erase resume bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
8pub type FLASH_PER_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `FLASH_PES` reader - program erase suspend bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
10pub type FLASH_PES_R = crate::BitReader;
11#[doc = "Field `FLASH_PES` writer - program erase suspend bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
12pub type FLASH_PES_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `FLASH_PER_WAIT_EN` reader - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase resume command is sent. 0: SPI1 does not wait after program erase resume command is sent."]
14pub type FLASH_PER_WAIT_EN_R = crate::BitReader;
15#[doc = "Field `FLASH_PER_WAIT_EN` writer - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase resume command is sent. 0: SPI1 does not wait after program erase resume command is sent."]
16pub type FLASH_PER_WAIT_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `FLASH_PES_WAIT_EN` reader - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase suspend command is sent. 0: SPI1 does not wait after program erase suspend command is sent."]
18pub type FLASH_PES_WAIT_EN_R = crate::BitReader;
19#[doc = "Field `FLASH_PES_WAIT_EN` writer - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase suspend command is sent. 0: SPI1 does not wait after program erase suspend command is sent."]
20pub type FLASH_PES_WAIT_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `PES_PER_EN` reader - Set this bit to enable PES end triggers PER transfer option. If this bit is 0, application should send PER after PES is done."]
22pub type PES_PER_EN_R = crate::BitReader;
23#[doc = "Field `PES_PER_EN` writer - Set this bit to enable PES end triggers PER transfer option. If this bit is 0, application should send PER after PES is done."]
24pub type PES_PER_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `FLASH_PES_EN` reader - Set this bit to enable Auto-suspending function."]
26pub type FLASH_PES_EN_R = crate::BitReader;
27#[doc = "Field `FLASH_PES_EN` writer - Set this bit to enable Auto-suspending function."]
28pub type FLASH_PES_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `PESR_END_MSK` reader - The mask value when check SUS/SUS1/SUS2 status bit. If the read status value is status_in\\[15:0\\](only status_in\\[7:0\\] is valid when only one byte of data is read out, status_in\\[15:0\\] is valid when two bytes of data are read out), SUS/SUS1/SUS2 = status_in\\[15:0\\]^ SPI_MEM_PESR_END_MSK\\[15:0\\]."]
30pub type PESR_END_MSK_R = crate::FieldReader<u16>;
31#[doc = "Field `PESR_END_MSK` writer - The mask value when check SUS/SUS1/SUS2 status bit. If the read status value is status_in\\[15:0\\](only status_in\\[7:0\\] is valid when only one byte of data is read out, status_in\\[15:0\\] is valid when two bytes of data are read out), SUS/SUS1/SUS2 = status_in\\[15:0\\]^ SPI_MEM_PESR_END_MSK\\[15:0\\]."]
32pub type PESR_END_MSK_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
33#[doc = "Field `RD_SUS_2B` reader - 1: Read two bytes when check flash SUS/SUS1/SUS2 status bit. 0: Read one byte when check flash SUS/SUS1/SUS2 status bit"]
34pub type RD_SUS_2B_R = crate::BitReader;
35#[doc = "Field `RD_SUS_2B` writer - 1: Read two bytes when check flash SUS/SUS1/SUS2 status bit. 0: Read one byte when check flash SUS/SUS1/SUS2 status bit"]
36pub type RD_SUS_2B_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `PER_END_EN` reader - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the resume status of flash. 0: Only need to check WIP is 0."]
38pub type PER_END_EN_R = crate::BitReader;
39#[doc = "Field `PER_END_EN` writer - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the resume status of flash. 0: Only need to check WIP is 0."]
40pub type PER_END_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `PES_END_EN` reader - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the suspend status of flash. 0: Only need to check WIP is 0."]
42pub type PES_END_EN_R = crate::BitReader;
43#[doc = "Field `PES_END_EN` writer - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the suspend status of flash. 0: Only need to check WIP is 0."]
44pub type PES_END_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
45#[doc = "Field `SUS_TIMEOUT_CNT` reader - When SPI1 checks SUS/SUS1/SUS2 bits fail for SPI_MEM_SUS_TIMEOUT_CNT\\[6:0\\] times, it will be treated as check pass."]
46pub type SUS_TIMEOUT_CNT_R = crate::FieldReader;
47#[doc = "Field `SUS_TIMEOUT_CNT` writer - When SPI1 checks SUS/SUS1/SUS2 bits fail for SPI_MEM_SUS_TIMEOUT_CNT\\[6:0\\] times, it will be treated as check pass."]
48pub type SUS_TIMEOUT_CNT_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
49impl R {
50    #[doc = "Bit 0 - program erase resume bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
51    #[inline(always)]
52    pub fn flash_per(&self) -> FLASH_PER_R {
53        FLASH_PER_R::new((self.bits & 1) != 0)
54    }
55    #[doc = "Bit 1 - program erase suspend bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
56    #[inline(always)]
57    pub fn flash_pes(&self) -> FLASH_PES_R {
58        FLASH_PES_R::new(((self.bits >> 1) & 1) != 0)
59    }
60    #[doc = "Bit 2 - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase resume command is sent. 0: SPI1 does not wait after program erase resume command is sent."]
61    #[inline(always)]
62    pub fn flash_per_wait_en(&self) -> FLASH_PER_WAIT_EN_R {
63        FLASH_PER_WAIT_EN_R::new(((self.bits >> 2) & 1) != 0)
64    }
65    #[doc = "Bit 3 - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase suspend command is sent. 0: SPI1 does not wait after program erase suspend command is sent."]
66    #[inline(always)]
67    pub fn flash_pes_wait_en(&self) -> FLASH_PES_WAIT_EN_R {
68        FLASH_PES_WAIT_EN_R::new(((self.bits >> 3) & 1) != 0)
69    }
70    #[doc = "Bit 4 - Set this bit to enable PES end triggers PER transfer option. If this bit is 0, application should send PER after PES is done."]
71    #[inline(always)]
72    pub fn pes_per_en(&self) -> PES_PER_EN_R {
73        PES_PER_EN_R::new(((self.bits >> 4) & 1) != 0)
74    }
75    #[doc = "Bit 5 - Set this bit to enable Auto-suspending function."]
76    #[inline(always)]
77    pub fn flash_pes_en(&self) -> FLASH_PES_EN_R {
78        FLASH_PES_EN_R::new(((self.bits >> 5) & 1) != 0)
79    }
80    #[doc = "Bits 6:21 - The mask value when check SUS/SUS1/SUS2 status bit. If the read status value is status_in\\[15:0\\](only status_in\\[7:0\\] is valid when only one byte of data is read out, status_in\\[15:0\\] is valid when two bytes of data are read out), SUS/SUS1/SUS2 = status_in\\[15:0\\]^ SPI_MEM_PESR_END_MSK\\[15:0\\]."]
81    #[inline(always)]
82    pub fn pesr_end_msk(&self) -> PESR_END_MSK_R {
83        PESR_END_MSK_R::new(((self.bits >> 6) & 0xffff) as u16)
84    }
85    #[doc = "Bit 22 - 1: Read two bytes when check flash SUS/SUS1/SUS2 status bit. 0: Read one byte when check flash SUS/SUS1/SUS2 status bit"]
86    #[inline(always)]
87    pub fn rd_sus_2b(&self) -> RD_SUS_2B_R {
88        RD_SUS_2B_R::new(((self.bits >> 22) & 1) != 0)
89    }
90    #[doc = "Bit 23 - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the resume status of flash. 0: Only need to check WIP is 0."]
91    #[inline(always)]
92    pub fn per_end_en(&self) -> PER_END_EN_R {
93        PER_END_EN_R::new(((self.bits >> 23) & 1) != 0)
94    }
95    #[doc = "Bit 24 - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the suspend status of flash. 0: Only need to check WIP is 0."]
96    #[inline(always)]
97    pub fn pes_end_en(&self) -> PES_END_EN_R {
98        PES_END_EN_R::new(((self.bits >> 24) & 1) != 0)
99    }
100    #[doc = "Bits 25:31 - When SPI1 checks SUS/SUS1/SUS2 bits fail for SPI_MEM_SUS_TIMEOUT_CNT\\[6:0\\] times, it will be treated as check pass."]
101    #[inline(always)]
102    pub fn sus_timeout_cnt(&self) -> SUS_TIMEOUT_CNT_R {
103        SUS_TIMEOUT_CNT_R::new(((self.bits >> 25) & 0x7f) as u8)
104    }
105}
106#[cfg(feature = "impl-register-debug")]
107impl core::fmt::Debug for R {
108    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
109        f.debug_struct("FLASH_SUS_CTRL")
110            .field("flash_per", &self.flash_per())
111            .field("flash_pes", &self.flash_pes())
112            .field("flash_per_wait_en", &self.flash_per_wait_en())
113            .field("flash_pes_wait_en", &self.flash_pes_wait_en())
114            .field("pes_per_en", &self.pes_per_en())
115            .field("flash_pes_en", &self.flash_pes_en())
116            .field("pesr_end_msk", &self.pesr_end_msk())
117            .field("rd_sus_2b", &self.rd_sus_2b())
118            .field("per_end_en", &self.per_end_en())
119            .field("pes_end_en", &self.pes_end_en())
120            .field("sus_timeout_cnt", &self.sus_timeout_cnt())
121            .finish()
122    }
123}
124impl W {
125    #[doc = "Bit 0 - program erase resume bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
126    #[inline(always)]
127    pub fn flash_per(&mut self) -> FLASH_PER_W<FLASH_SUS_CTRL_SPEC> {
128        FLASH_PER_W::new(self, 0)
129    }
130    #[doc = "Bit 1 - program erase suspend bit, program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable."]
131    #[inline(always)]
132    pub fn flash_pes(&mut self) -> FLASH_PES_W<FLASH_SUS_CTRL_SPEC> {
133        FLASH_PES_W::new(self, 1)
134    }
135    #[doc = "Bit 2 - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase resume command is sent. 0: SPI1 does not wait after program erase resume command is sent."]
136    #[inline(always)]
137    pub fn flash_per_wait_en(&mut self) -> FLASH_PER_WAIT_EN_W<FLASH_SUS_CTRL_SPEC> {
138        FLASH_PER_WAIT_EN_W::new(self, 2)
139    }
140    #[doc = "Bit 3 - 1: SPI1 waits (SPI_MEM_CS_HOLD_DELAY_RES\\[9:0\\] * 4 or *128) SPI_CLK cycles after program erase suspend command is sent. 0: SPI1 does not wait after program erase suspend command is sent."]
141    #[inline(always)]
142    pub fn flash_pes_wait_en(&mut self) -> FLASH_PES_WAIT_EN_W<FLASH_SUS_CTRL_SPEC> {
143        FLASH_PES_WAIT_EN_W::new(self, 3)
144    }
145    #[doc = "Bit 4 - Set this bit to enable PES end triggers PER transfer option. If this bit is 0, application should send PER after PES is done."]
146    #[inline(always)]
147    pub fn pes_per_en(&mut self) -> PES_PER_EN_W<FLASH_SUS_CTRL_SPEC> {
148        PES_PER_EN_W::new(self, 4)
149    }
150    #[doc = "Bit 5 - Set this bit to enable Auto-suspending function."]
151    #[inline(always)]
152    pub fn flash_pes_en(&mut self) -> FLASH_PES_EN_W<FLASH_SUS_CTRL_SPEC> {
153        FLASH_PES_EN_W::new(self, 5)
154    }
155    #[doc = "Bits 6:21 - The mask value when check SUS/SUS1/SUS2 status bit. If the read status value is status_in\\[15:0\\](only status_in\\[7:0\\] is valid when only one byte of data is read out, status_in\\[15:0\\] is valid when two bytes of data are read out), SUS/SUS1/SUS2 = status_in\\[15:0\\]^ SPI_MEM_PESR_END_MSK\\[15:0\\]."]
156    #[inline(always)]
157    pub fn pesr_end_msk(&mut self) -> PESR_END_MSK_W<FLASH_SUS_CTRL_SPEC> {
158        PESR_END_MSK_W::new(self, 6)
159    }
160    #[doc = "Bit 22 - 1: Read two bytes when check flash SUS/SUS1/SUS2 status bit. 0: Read one byte when check flash SUS/SUS1/SUS2 status bit"]
161    #[inline(always)]
162    pub fn rd_sus_2b(&mut self) -> RD_SUS_2B_W<FLASH_SUS_CTRL_SPEC> {
163        RD_SUS_2B_W::new(self, 22)
164    }
165    #[doc = "Bit 23 - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the resume status of flash. 0: Only need to check WIP is 0."]
166    #[inline(always)]
167    pub fn per_end_en(&mut self) -> PER_END_EN_W<FLASH_SUS_CTRL_SPEC> {
168        PER_END_EN_W::new(self, 23)
169    }
170    #[doc = "Bit 24 - 1: Both WIP and SUS/SUS1/SUS2 bits should be checked to insure the suspend status of flash. 0: Only need to check WIP is 0."]
171    #[inline(always)]
172    pub fn pes_end_en(&mut self) -> PES_END_EN_W<FLASH_SUS_CTRL_SPEC> {
173        PES_END_EN_W::new(self, 24)
174    }
175    #[doc = "Bits 25:31 - When SPI1 checks SUS/SUS1/SUS2 bits fail for SPI_MEM_SUS_TIMEOUT_CNT\\[6:0\\] times, it will be treated as check pass."]
176    #[inline(always)]
177    pub fn sus_timeout_cnt(&mut self) -> SUS_TIMEOUT_CNT_W<FLASH_SUS_CTRL_SPEC> {
178        SUS_TIMEOUT_CNT_W::new(self, 25)
179    }
180}
181#[doc = "SPI1 flash suspend control register\n\nYou can [`read`](crate::Reg::read) this register and get [`flash_sus_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`flash_sus_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
182pub struct FLASH_SUS_CTRL_SPEC;
183impl crate::RegisterSpec for FLASH_SUS_CTRL_SPEC {
184    type Ux = u32;
185}
186#[doc = "`read()` method returns [`flash_sus_ctrl::R`](R) reader structure"]
187impl crate::Readable for FLASH_SUS_CTRL_SPEC {}
188#[doc = "`write(|w| ..)` method takes [`flash_sus_ctrl::W`](W) writer structure"]
189impl crate::Writable for FLASH_SUS_CTRL_SPEC {
190    type Safety = crate::Unsafe;
191    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
192    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
193}
194#[doc = "`reset()` method sets FLASH_SUS_CTRL to value 0x0800_2000"]
195impl crate::Resettable for FLASH_SUS_CTRL_SPEC {
196    const RESET_VALUE: u32 = 0x0800_2000;
197}