1#[doc = "Register `CTRL` reader"]
2pub type R = crate::R<CTRL_SPEC>;
3#[doc = "Register `CTRL` writer"]
4pub type W = crate::W<CTRL_SPEC>;
5#[doc = "Field `SM_ENABLE` reader - Enable/disable each of the four state machines by writing 1/0 to each of these four bits. When disabled, a state machine will cease executing instructions, except those written directly to SMx_INSTR by the system. Multiple bits can be set/cleared at once to run/halt multiple state machines simultaneously."]
6pub type SM_ENABLE_R = crate::FieldReader;
7#[doc = "Field `SM_ENABLE` writer - Enable/disable each of the four state machines by writing 1/0 to each of these four bits. When disabled, a state machine will cease executing instructions, except those written directly to SMx_INSTR by the system. Multiple bits can be set/cleared at once to run/halt multiple state machines simultaneously."]
8pub type SM_ENABLE_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "Field `SM_RESTART` reader - Write 1 to instantly clear internal SM state which may be otherwise difficult to access and will affect future execution.
10
11 Specifically, the following are cleared: input and output shift counters; the contents of the input shift register; the delay counter; the waiting-on-IRQ state; any stalled instruction written to SMx_INSTR or run by OUT/MOV EXEC; any pin write left asserted due to OUT_STICKY.
12
13 The program counter, the contents of the output shift register and the X/Y scratch registers are not affected."]
14pub type SM_RESTART_R = crate::FieldReader;
15#[doc = "Field `SM_RESTART` writer - Write 1 to instantly clear internal SM state which may be otherwise difficult to access and will affect future execution.
16
17 Specifically, the following are cleared: input and output shift counters; the contents of the input shift register; the delay counter; the waiting-on-IRQ state; any stalled instruction written to SMx_INSTR or run by OUT/MOV EXEC; any pin write left asserted due to OUT_STICKY.
18
19 The program counter, the contents of the output shift register and the X/Y scratch registers are not affected."]
20pub type SM_RESTART_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
21#[doc = "Field `CLKDIV_RESTART` reader - Restart a state machine's clock divider from an initial phase of 0. Clock dividers are free-running, so once started, their output (including fractional jitter) is completely determined by the integer/fractional divisor configured in SMx_CLKDIV. This means that, if multiple clock dividers with the same divisor are restarted simultaneously, by writing multiple 1 bits to this field, the execution clocks of those state machines will run in precise lockstep.
22
23 Note that setting/clearing SM_ENABLE does not stop the clock divider from running, so once multiple state machines' clocks are synchronised, it is safe to disable/reenable a state machine, whilst keeping the clock dividers in sync.
24
25 Note also that CLKDIV_RESTART can be written to whilst the state machine is running, and this is useful to resynchronise clock dividers after the divisors (SMx_CLKDIV) have been changed on-the-fly."]
26pub type CLKDIV_RESTART_R = crate::FieldReader;
27#[doc = "Field `CLKDIV_RESTART` writer - Restart a state machine's clock divider from an initial phase of 0. Clock dividers are free-running, so once started, their output (including fractional jitter) is completely determined by the integer/fractional divisor configured in SMx_CLKDIV. This means that, if multiple clock dividers with the same divisor are restarted simultaneously, by writing multiple 1 bits to this field, the execution clocks of those state machines will run in precise lockstep.
28
29 Note that setting/clearing SM_ENABLE does not stop the clock divider from running, so once multiple state machines' clocks are synchronised, it is safe to disable/reenable a state machine, whilst keeping the clock dividers in sync.
30
31 Note also that CLKDIV_RESTART can be written to whilst the state machine is running, and this is useful to resynchronise clock dividers after the divisors (SMx_CLKDIV) have been changed on-the-fly."]
32pub type CLKDIV_RESTART_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
33impl R {
34 #[doc = "Bits 0:3 - Enable/disable each of the four state machines by writing 1/0 to each of these four bits. When disabled, a state machine will cease executing instructions, except those written directly to SMx_INSTR by the system. Multiple bits can be set/cleared at once to run/halt multiple state machines simultaneously."]
35 #[inline(always)]
36 pub fn sm_enable(&self) -> SM_ENABLE_R {
37 SM_ENABLE_R::new((self.bits & 0x0f) as u8)
38 }
39 #[doc = "Bits 4:7 - Write 1 to instantly clear internal SM state which may be otherwise difficult to access and will affect future execution.
40
41 Specifically, the following are cleared: input and output shift counters; the contents of the input shift register; the delay counter; the waiting-on-IRQ state; any stalled instruction written to SMx_INSTR or run by OUT/MOV EXEC; any pin write left asserted due to OUT_STICKY.
42
43 The program counter, the contents of the output shift register and the X/Y scratch registers are not affected."]
44 #[inline(always)]
45 pub fn sm_restart(&self) -> SM_RESTART_R {
46 SM_RESTART_R::new(((self.bits >> 4) & 0x0f) as u8)
47 }
48 #[doc = "Bits 8:11 - Restart a state machine's clock divider from an initial phase of 0. Clock dividers are free-running, so once started, their output (including fractional jitter) is completely determined by the integer/fractional divisor configured in SMx_CLKDIV. This means that, if multiple clock dividers with the same divisor are restarted simultaneously, by writing multiple 1 bits to this field, the execution clocks of those state machines will run in precise lockstep.
49
50 Note that setting/clearing SM_ENABLE does not stop the clock divider from running, so once multiple state machines' clocks are synchronised, it is safe to disable/reenable a state machine, whilst keeping the clock dividers in sync.
51
52 Note also that CLKDIV_RESTART can be written to whilst the state machine is running, and this is useful to resynchronise clock dividers after the divisors (SMx_CLKDIV) have been changed on-the-fly."]
53 #[inline(always)]
54 pub fn clkdiv_restart(&self) -> CLKDIV_RESTART_R {
55 CLKDIV_RESTART_R::new(((self.bits >> 8) & 0x0f) as u8)
56 }
57}
58impl W {
59 #[doc = "Bits 0:3 - Enable/disable each of the four state machines by writing 1/0 to each of these four bits. When disabled, a state machine will cease executing instructions, except those written directly to SMx_INSTR by the system. Multiple bits can be set/cleared at once to run/halt multiple state machines simultaneously."]
60 #[inline(always)]
61 #[must_use]
62 pub fn sm_enable(&mut self) -> SM_ENABLE_W<CTRL_SPEC> {
63 SM_ENABLE_W::new(self, 0)
64 }
65 #[doc = "Bits 4:7 - Write 1 to instantly clear internal SM state which may be otherwise difficult to access and will affect future execution.
66
67 Specifically, the following are cleared: input and output shift counters; the contents of the input shift register; the delay counter; the waiting-on-IRQ state; any stalled instruction written to SMx_INSTR or run by OUT/MOV EXEC; any pin write left asserted due to OUT_STICKY.
68
69 The program counter, the contents of the output shift register and the X/Y scratch registers are not affected."]
70 #[inline(always)]
71 #[must_use]
72 pub fn sm_restart(&mut self) -> SM_RESTART_W<CTRL_SPEC> {
73 SM_RESTART_W::new(self, 4)
74 }
75 #[doc = "Bits 8:11 - Restart a state machine's clock divider from an initial phase of 0. Clock dividers are free-running, so once started, their output (including fractional jitter) is completely determined by the integer/fractional divisor configured in SMx_CLKDIV. This means that, if multiple clock dividers with the same divisor are restarted simultaneously, by writing multiple 1 bits to this field, the execution clocks of those state machines will run in precise lockstep.
76
77 Note that setting/clearing SM_ENABLE does not stop the clock divider from running, so once multiple state machines' clocks are synchronised, it is safe to disable/reenable a state machine, whilst keeping the clock dividers in sync.
78
79 Note also that CLKDIV_RESTART can be written to whilst the state machine is running, and this is useful to resynchronise clock dividers after the divisors (SMx_CLKDIV) have been changed on-the-fly."]
80 #[inline(always)]
81 #[must_use]
82 pub fn clkdiv_restart(&mut self) -> CLKDIV_RESTART_W<CTRL_SPEC> {
83 CLKDIV_RESTART_W::new(self, 8)
84 }
85 #[doc = r" Writes raw bits to the register."]
86 #[doc = r""]
87 #[doc = r" # Safety"]
88 #[doc = r""]
89 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
90 #[inline(always)]
91 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
92 self.bits = bits;
93 self
94 }
95}
96#[doc = "PIO control register
97
98You can [`read`](crate::generic::Reg::read) this register and get [`ctrl::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 [`ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct CTRL_SPEC;
100impl crate::RegisterSpec for CTRL_SPEC {
101 type Ux = u32;
102}
103#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
104impl crate::Readable for CTRL_SPEC {}
105#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
106impl crate::Writable for CTRL_SPEC {
107 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
108 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
109}
110#[doc = "`reset()` method sets CTRL to value 0"]
111impl crate::Resettable for CTRL_SPEC {
112 const RESET_VALUE: u32 = 0;
113}