1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
#[doc = "Reader of register CTRL"]
pub type R = crate::R<u32, super::CTRL>;
#[doc = "Writer for register CTRL"]
pub type W = crate::W<u32, super::CTRL>;
#[doc = "Register CTRL `reset()`'s with value 0xf080_0000"]
impl crate::ResetValue for super::CTRL {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0xf080_0000
    }
}
#[doc = "Per-channel interrupt enable bit\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CHANNEL_INTERRUPT_ENABLE_A {
    #[doc = "1: CH0"]
    CH0 = 1,
    #[doc = "2: CH1"]
    CH1 = 2,
    #[doc = "4: CH2"]
    CH2 = 4,
    #[doc = "8: CH3"]
    CH3 = 8,
}
impl From<CHANNEL_INTERRUPT_ENABLE_A> for u8 {
    #[inline(always)]
    fn from(variant: CHANNEL_INTERRUPT_ENABLE_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `CHANNEL_INTERRUPT_ENABLE`"]
pub type CHANNEL_INTERRUPT_ENABLE_R = crate::R<u8, CHANNEL_INTERRUPT_ENABLE_A>;
impl CHANNEL_INTERRUPT_ENABLE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, CHANNEL_INTERRUPT_ENABLE_A> {
        use crate::Variant::*;
        match self.bits {
            1 => Val(CHANNEL_INTERRUPT_ENABLE_A::CH0),
            2 => Val(CHANNEL_INTERRUPT_ENABLE_A::CH1),
            4 => Val(CHANNEL_INTERRUPT_ENABLE_A::CH2),
            8 => Val(CHANNEL_INTERRUPT_ENABLE_A::CH3),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `CH0`"]
    #[inline(always)]
    pub fn is_ch0(&self) -> bool {
        *self == CHANNEL_INTERRUPT_ENABLE_A::CH0
    }
    #[doc = "Checks if the value of the field is `CH1`"]
    #[inline(always)]
    pub fn is_ch1(&self) -> bool {
        *self == CHANNEL_INTERRUPT_ENABLE_A::CH1
    }
    #[doc = "Checks if the value of the field is `CH2`"]
    #[inline(always)]
    pub fn is_ch2(&self) -> bool {
        *self == CHANNEL_INTERRUPT_ENABLE_A::CH2
    }
    #[doc = "Checks if the value of the field is `CH3`"]
    #[inline(always)]
    pub fn is_ch3(&self) -> bool {
        *self == CHANNEL_INTERRUPT_ENABLE_A::CH3
    }
}
#[doc = "Write proxy for field `CHANNEL_INTERRUPT_ENABLE`"]
pub struct CHANNEL_INTERRUPT_ENABLE_W<'a> {
    w: &'a mut W,
}
impl<'a> CHANNEL_INTERRUPT_ENABLE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CHANNEL_INTERRUPT_ENABLE_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "CH0"]
    #[inline(always)]
    pub fn ch0(self) -> &'a mut W {
        self.variant(CHANNEL_INTERRUPT_ENABLE_A::CH0)
    }
    #[doc = "CH1"]
    #[inline(always)]
    pub fn ch1(self) -> &'a mut W {
        self.variant(CHANNEL_INTERRUPT_ENABLE_A::CH1)
    }
    #[doc = "CH2"]
    #[inline(always)]
    pub fn ch2(self) -> &'a mut W {
        self.variant(CHANNEL_INTERRUPT_ENABLE_A::CH2)
    }
    #[doc = "CH3"]
    #[inline(always)]
    pub fn ch3(self) -> &'a mut W {
        self.variant(CHANNEL_INTERRUPT_ENABLE_A::CH3)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
        self.w
    }
}
#[doc = "Reader of field `ENABLE_CONTEXT_SWITCHING`"]
pub type ENABLE_CONTEXT_SWITCHING_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `ENABLE_CONTEXT_SWITCHING`"]
pub struct ENABLE_CONTEXT_SWITCHING_W<'a> {
    w: &'a mut W,
}
impl<'a> ENABLE_CONTEXT_SWITCHING_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 21)) | (((value as u32) & 0x01) << 21);
        self.w
    }
}
#[doc = "Reader of field `ENABLE_CONTEXT_CACHING`"]
pub type ENABLE_CONTEXT_CACHING_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `ENABLE_CONTEXT_CACHING`"]
pub struct ENABLE_CONTEXT_CACHING_W<'a> {
    w: &'a mut W,
}
impl<'a> ENABLE_CONTEXT_CACHING_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22);
        self.w
    }
}
#[doc = "Reader of field `GATHER_RESIDUAL_WRITES`"]
pub type GATHER_RESIDUAL_WRITES_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `GATHER_RESIDUAL_WRITES`"]
pub struct GATHER_RESIDUAL_WRITES_W<'a> {
    w: &'a mut W,
}
impl<'a> GATHER_RESIDUAL_WRITES_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23);
        self.w
    }
}
#[doc = "Indicates whether the SHA1/SHA2 functions are present.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PRESENT_SHA_A {
    #[doc = "0: Absent"]
    ABSENT = 0,
    #[doc = "1: Present"]
    PRESENT = 1,
}
impl From<PRESENT_SHA_A> for bool {
    #[inline(always)]
    fn from(variant: PRESENT_SHA_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `PRESENT_SHA`"]
pub type PRESENT_SHA_R = crate::R<bool, PRESENT_SHA_A>;
impl PRESENT_SHA_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PRESENT_SHA_A {
        match self.bits {
            false => PRESENT_SHA_A::ABSENT,
            true => PRESENT_SHA_A::PRESENT,
        }
    }
    #[doc = "Checks if the value of the field is `ABSENT`"]
    #[inline(always)]
    pub fn is_absent(&self) -> bool {
        *self == PRESENT_SHA_A::ABSENT
    }
    #[doc = "Checks if the value of the field is `PRESENT`"]
    #[inline(always)]
    pub fn is_present(&self) -> bool {
        *self == PRESENT_SHA_A::PRESENT
    }
}
#[doc = "Indicates whether the crypto (cipher/hash) functions are present.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PRESENT_CRYPTO_A {
    #[doc = "0: Absent"]
    ABSENT = 0,
    #[doc = "1: Present"]
    PRESENT = 1,
}
impl From<PRESENT_CRYPTO_A> for bool {
    #[inline(always)]
    fn from(variant: PRESENT_CRYPTO_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `PRESENT_CRYPTO`"]
pub type PRESENT_CRYPTO_R = crate::R<bool, PRESENT_CRYPTO_A>;
impl PRESENT_CRYPTO_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PRESENT_CRYPTO_A {
        match self.bits {
            false => PRESENT_CRYPTO_A::ABSENT,
            true => PRESENT_CRYPTO_A::PRESENT,
        }
    }
    #[doc = "Checks if the value of the field is `ABSENT`"]
    #[inline(always)]
    pub fn is_absent(&self) -> bool {
        *self == PRESENT_CRYPTO_A::ABSENT
    }
    #[doc = "Checks if the value of the field is `PRESENT`"]
    #[inline(always)]
    pub fn is_present(&self) -> bool {
        *self == PRESENT_CRYPTO_A::PRESENT
    }
}
#[doc = "Reader of field `CLKGATE`"]
pub type CLKGATE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CLKGATE`"]
pub struct CLKGATE_W<'a> {
    w: &'a mut W,
}
impl<'a> CLKGATE_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
        self.w
    }
}
#[doc = "Reader of field `SFTRST`"]
pub type SFTRST_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SFTRST`"]
pub struct SFTRST_W<'a> {
    w: &'a mut W,
}
impl<'a> SFTRST_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:7 - Per-channel interrupt enable bit"]
    #[inline(always)]
    pub fn channel_interrupt_enable(&self) -> CHANNEL_INTERRUPT_ENABLE_R {
        CHANNEL_INTERRUPT_ENABLE_R::new((self.bits & 0xff) as u8)
    }
    #[doc = "Bit 21 - Enable automatic context switching for the channels"]
    #[inline(always)]
    pub fn enable_context_switching(&self) -> ENABLE_CONTEXT_SWITCHING_R {
        ENABLE_CONTEXT_SWITCHING_R::new(((self.bits >> 21) & 0x01) != 0)
    }
    #[doc = "Bit 22 - The software must set this bit to enable the caching of contexts between the operations"]
    #[inline(always)]
    pub fn enable_context_caching(&self) -> ENABLE_CONTEXT_CACHING_R {
        ENABLE_CONTEXT_CACHING_R::new(((self.bits >> 22) & 0x01) != 0)
    }
    #[doc = "Bit 23 - The software must set this bit to enable the ragged writes to the unaligned buffers to be gathered between multiple write operations"]
    #[inline(always)]
    pub fn gather_residual_writes(&self) -> GATHER_RESIDUAL_WRITES_R {
        GATHER_RESIDUAL_WRITES_R::new(((self.bits >> 23) & 0x01) != 0)
    }
    #[doc = "Bit 28 - Indicates whether the SHA1/SHA2 functions are present."]
    #[inline(always)]
    pub fn present_sha(&self) -> PRESENT_SHA_R {
        PRESENT_SHA_R::new(((self.bits >> 28) & 0x01) != 0)
    }
    #[doc = "Bit 29 - Indicates whether the crypto (cipher/hash) functions are present."]
    #[inline(always)]
    pub fn present_crypto(&self) -> PRESENT_CRYPTO_R {
        PRESENT_CRYPTO_R::new(((self.bits >> 29) & 0x01) != 0)
    }
    #[doc = "Bit 30 - This bit must be set to zero for a normal operation"]
    #[inline(always)]
    pub fn clkgate(&self) -> CLKGATE_R {
        CLKGATE_R::new(((self.bits >> 30) & 0x01) != 0)
    }
    #[doc = "Bit 31 - Set this bit to zero to enable a normal DCP operation"]
    #[inline(always)]
    pub fn sftrst(&self) -> SFTRST_R {
        SFTRST_R::new(((self.bits >> 31) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:7 - Per-channel interrupt enable bit"]
    #[inline(always)]
    pub fn channel_interrupt_enable(&mut self) -> CHANNEL_INTERRUPT_ENABLE_W {
        CHANNEL_INTERRUPT_ENABLE_W { w: self }
    }
    #[doc = "Bit 21 - Enable automatic context switching for the channels"]
    #[inline(always)]
    pub fn enable_context_switching(&mut self) -> ENABLE_CONTEXT_SWITCHING_W {
        ENABLE_CONTEXT_SWITCHING_W { w: self }
    }
    #[doc = "Bit 22 - The software must set this bit to enable the caching of contexts between the operations"]
    #[inline(always)]
    pub fn enable_context_caching(&mut self) -> ENABLE_CONTEXT_CACHING_W {
        ENABLE_CONTEXT_CACHING_W { w: self }
    }
    #[doc = "Bit 23 - The software must set this bit to enable the ragged writes to the unaligned buffers to be gathered between multiple write operations"]
    #[inline(always)]
    pub fn gather_residual_writes(&mut self) -> GATHER_RESIDUAL_WRITES_W {
        GATHER_RESIDUAL_WRITES_W { w: self }
    }
    #[doc = "Bit 30 - This bit must be set to zero for a normal operation"]
    #[inline(always)]
    pub fn clkgate(&mut self) -> CLKGATE_W {
        CLKGATE_W { w: self }
    }
    #[doc = "Bit 31 - Set this bit to zero to enable a normal DCP operation"]
    #[inline(always)]
    pub fn sftrst(&mut self) -> SFTRST_W {
        SFTRST_W { w: self }
    }
}