atsam4s16c_pac/matrix/
matrix_scfg.rs1#[doc = "Register `MATRIX_SCFG[%s]` reader"]
2pub struct R(crate::R<MATRIX_SCFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<MATRIX_SCFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<MATRIX_SCFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<MATRIX_SCFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `MATRIX_SCFG[%s]` writer"]
17pub struct W(crate::W<MATRIX_SCFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<MATRIX_SCFG_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<MATRIX_SCFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<MATRIX_SCFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SLOT_CYCLE` reader - Maximum Number of Allowed Cycles for a Burst"]
38pub type SLOT_CYCLE_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `SLOT_CYCLE` writer - Maximum Number of Allowed Cycles for a Burst"]
40pub type SLOT_CYCLE_W<'a, const O: u8> =
41 crate::FieldWriter<'a, u32, MATRIX_SCFG_SPEC, u8, u8, 8, O>;
42#[doc = "Field `DEFMSTR_TYPE` reader - Default Master Type"]
43pub type DEFMSTR_TYPE_R = crate::FieldReader<u8, DEFMSTR_TYPE_A>;
44#[doc = "Default Master Type"]
45#[derive(Clone, Copy, Debug, PartialEq, Eq)]
46#[repr(u8)]
47pub enum DEFMSTR_TYPE_A {
48 #[doc = "0: At the end of current slave access, if no other master request is pending, the slave is disconnected from all masters.This results in having a one cycle latency for the first access of a burst transfer or for a single access."]
49 NO_DEFAULT = 0,
50 #[doc = "1: At the end of current slave access, if no other master request is pending, the slave stays connected to the last master having accessed it.This results in not having the one cycle latency when the last master tries to access the slave again."]
51 LAST = 1,
52 #[doc = "2: At the end of the current slave access, if no other master request is pending, the slave connects to the fixed master the number that has been written in the FIXED_DEFMSTR field.This results in not having the one cycle latency when the fixed master tries to access the slave again."]
53 FIXED = 2,
54}
55impl From<DEFMSTR_TYPE_A> for u8 {
56 #[inline(always)]
57 fn from(variant: DEFMSTR_TYPE_A) -> Self {
58 variant as _
59 }
60}
61impl DEFMSTR_TYPE_R {
62 #[doc = "Get enumerated values variant"]
63 #[inline(always)]
64 pub fn variant(&self) -> Option<DEFMSTR_TYPE_A> {
65 match self.bits {
66 0 => Some(DEFMSTR_TYPE_A::NO_DEFAULT),
67 1 => Some(DEFMSTR_TYPE_A::LAST),
68 2 => Some(DEFMSTR_TYPE_A::FIXED),
69 _ => None,
70 }
71 }
72 #[doc = "Checks if the value of the field is `NO_DEFAULT`"]
73 #[inline(always)]
74 pub fn is_no_default(&self) -> bool {
75 *self == DEFMSTR_TYPE_A::NO_DEFAULT
76 }
77 #[doc = "Checks if the value of the field is `LAST`"]
78 #[inline(always)]
79 pub fn is_last(&self) -> bool {
80 *self == DEFMSTR_TYPE_A::LAST
81 }
82 #[doc = "Checks if the value of the field is `FIXED`"]
83 #[inline(always)]
84 pub fn is_fixed(&self) -> bool {
85 *self == DEFMSTR_TYPE_A::FIXED
86 }
87}
88#[doc = "Field `DEFMSTR_TYPE` writer - Default Master Type"]
89pub type DEFMSTR_TYPE_W<'a, const O: u8> =
90 crate::FieldWriter<'a, u32, MATRIX_SCFG_SPEC, u8, DEFMSTR_TYPE_A, 2, O>;
91impl<'a, const O: u8> DEFMSTR_TYPE_W<'a, O> {
92 #[doc = "At the end of current slave access, if no other master request is pending, the slave is disconnected from all masters.This results in having a one cycle latency for the first access of a burst transfer or for a single access."]
93 #[inline(always)]
94 pub fn no_default(self) -> &'a mut W {
95 self.variant(DEFMSTR_TYPE_A::NO_DEFAULT)
96 }
97 #[doc = "At the end of current slave access, if no other master request is pending, the slave stays connected to the last master having accessed it.This results in not having the one cycle latency when the last master tries to access the slave again."]
98 #[inline(always)]
99 pub fn last(self) -> &'a mut W {
100 self.variant(DEFMSTR_TYPE_A::LAST)
101 }
102 #[doc = "At the end of the current slave access, if no other master request is pending, the slave connects to the fixed master the number that has been written in the FIXED_DEFMSTR field.This results in not having the one cycle latency when the fixed master tries to access the slave again."]
103 #[inline(always)]
104 pub fn fixed(self) -> &'a mut W {
105 self.variant(DEFMSTR_TYPE_A::FIXED)
106 }
107}
108#[doc = "Field `FIXED_DEFMSTR` reader - Fixed Default Master"]
109pub type FIXED_DEFMSTR_R = crate::FieldReader<u8, u8>;
110#[doc = "Field `FIXED_DEFMSTR` writer - Fixed Default Master"]
111pub type FIXED_DEFMSTR_W<'a, const O: u8> =
112 crate::FieldWriter<'a, u32, MATRIX_SCFG_SPEC, u8, u8, 3, O>;
113#[doc = "Field `ARBT` reader - Arbitration Type"]
114pub type ARBT_R = crate::FieldReader<u8, ARBT_A>;
115#[doc = "Arbitration Type"]
116#[derive(Clone, Copy, Debug, PartialEq, Eq)]
117#[repr(u8)]
118pub enum ARBT_A {
119 #[doc = "0: Round-robin arbitration"]
120 ROUND_ROBIN = 0,
121 #[doc = "1: Fixed priority arbitration"]
122 FIXED_PRIORITY = 1,
123}
124impl From<ARBT_A> for u8 {
125 #[inline(always)]
126 fn from(variant: ARBT_A) -> Self {
127 variant as _
128 }
129}
130impl ARBT_R {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub fn variant(&self) -> Option<ARBT_A> {
134 match self.bits {
135 0 => Some(ARBT_A::ROUND_ROBIN),
136 1 => Some(ARBT_A::FIXED_PRIORITY),
137 _ => None,
138 }
139 }
140 #[doc = "Checks if the value of the field is `ROUND_ROBIN`"]
141 #[inline(always)]
142 pub fn is_round_robin(&self) -> bool {
143 *self == ARBT_A::ROUND_ROBIN
144 }
145 #[doc = "Checks if the value of the field is `FIXED_PRIORITY`"]
146 #[inline(always)]
147 pub fn is_fixed_priority(&self) -> bool {
148 *self == ARBT_A::FIXED_PRIORITY
149 }
150}
151#[doc = "Field `ARBT` writer - Arbitration Type"]
152pub type ARBT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, MATRIX_SCFG_SPEC, u8, ARBT_A, 2, O>;
153impl<'a, const O: u8> ARBT_W<'a, O> {
154 #[doc = "Round-robin arbitration"]
155 #[inline(always)]
156 pub fn round_robin(self) -> &'a mut W {
157 self.variant(ARBT_A::ROUND_ROBIN)
158 }
159 #[doc = "Fixed priority arbitration"]
160 #[inline(always)]
161 pub fn fixed_priority(self) -> &'a mut W {
162 self.variant(ARBT_A::FIXED_PRIORITY)
163 }
164}
165impl R {
166 #[doc = "Bits 0:7 - Maximum Number of Allowed Cycles for a Burst"]
167 #[inline(always)]
168 pub fn slot_cycle(&self) -> SLOT_CYCLE_R {
169 SLOT_CYCLE_R::new((self.bits & 0xff) as u8)
170 }
171 #[doc = "Bits 16:17 - Default Master Type"]
172 #[inline(always)]
173 pub fn defmstr_type(&self) -> DEFMSTR_TYPE_R {
174 DEFMSTR_TYPE_R::new(((self.bits >> 16) & 3) as u8)
175 }
176 #[doc = "Bits 18:20 - Fixed Default Master"]
177 #[inline(always)]
178 pub fn fixed_defmstr(&self) -> FIXED_DEFMSTR_R {
179 FIXED_DEFMSTR_R::new(((self.bits >> 18) & 7) as u8)
180 }
181 #[doc = "Bits 24:25 - Arbitration Type"]
182 #[inline(always)]
183 pub fn arbt(&self) -> ARBT_R {
184 ARBT_R::new(((self.bits >> 24) & 3) as u8)
185 }
186}
187impl W {
188 #[doc = "Bits 0:7 - Maximum Number of Allowed Cycles for a Burst"]
189 #[inline(always)]
190 #[must_use]
191 pub fn slot_cycle(&mut self) -> SLOT_CYCLE_W<0> {
192 SLOT_CYCLE_W::new(self)
193 }
194 #[doc = "Bits 16:17 - Default Master Type"]
195 #[inline(always)]
196 #[must_use]
197 pub fn defmstr_type(&mut self) -> DEFMSTR_TYPE_W<16> {
198 DEFMSTR_TYPE_W::new(self)
199 }
200 #[doc = "Bits 18:20 - Fixed Default Master"]
201 #[inline(always)]
202 #[must_use]
203 pub fn fixed_defmstr(&mut self) -> FIXED_DEFMSTR_W<18> {
204 FIXED_DEFMSTR_W::new(self)
205 }
206 #[doc = "Bits 24:25 - Arbitration Type"]
207 #[inline(always)]
208 #[must_use]
209 pub fn arbt(&mut self) -> ARBT_W<24> {
210 ARBT_W::new(self)
211 }
212 #[doc = "Writes raw bits to the register."]
213 #[inline(always)]
214 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
215 self.0.bits(bits);
216 self
217 }
218}
219#[doc = "Slave Configuration Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [matrix_scfg](index.html) module"]
220pub struct MATRIX_SCFG_SPEC;
221impl crate::RegisterSpec for MATRIX_SCFG_SPEC {
222 type Ux = u32;
223}
224#[doc = "`read()` method returns [matrix_scfg::R](R) reader structure"]
225impl crate::Readable for MATRIX_SCFG_SPEC {
226 type Reader = R;
227}
228#[doc = "`write(|w| ..)` method takes [matrix_scfg::W](W) writer structure"]
229impl crate::Writable for MATRIX_SCFG_SPEC {
230 type Writer = W;
231 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
232 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
233}