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
#[doc = "Register `M%s_MODE_CTRL` reader"]
pub type R = crate::R<M_MODE_CTRL_SPEC>;
#[doc = "Register `M%s_MODE_CTRL` writer"]
pub type W = crate::W<M_MODE_CTRL_SPEC>;
#[doc = "M0 security level mode: 2'd3: ree_mode2. 2'd2: ree_mode1. 2'd1: ree_mode0. 2'd0: tee_mode\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SECURITY_MODE {
    #[doc = "0: Tee mode"]
    Tee = 0,
    #[doc = "1: Ree0 mode"]
    Ree0 = 1,
    #[doc = "2: Ree1 mode"]
    Ree1 = 2,
    #[doc = "3: Ree2 mode"]
    Ree2 = 3,
}
impl From<SECURITY_MODE> for u8 {
    #[inline(always)]
    fn from(variant: SECURITY_MODE) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for SECURITY_MODE {
    type Ux = u8;
}
impl crate::IsEnum for SECURITY_MODE {}
#[doc = "Field `MODE` reader - M0 security level mode: 2'd3: ree_mode2. 2'd2: ree_mode1. 2'd1: ree_mode0. 2'd0: tee_mode"]
pub type MODE_R = crate::FieldReader<SECURITY_MODE>;
impl MODE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> SECURITY_MODE {
        match self.bits {
            0 => SECURITY_MODE::Tee,
            1 => SECURITY_MODE::Ree0,
            2 => SECURITY_MODE::Ree1,
            3 => SECURITY_MODE::Ree2,
            _ => unreachable!(),
        }
    }
    #[doc = "Tee mode"]
    #[inline(always)]
    pub fn is_tee(&self) -> bool {
        *self == SECURITY_MODE::Tee
    }
    #[doc = "Ree0 mode"]
    #[inline(always)]
    pub fn is_ree0(&self) -> bool {
        *self == SECURITY_MODE::Ree0
    }
    #[doc = "Ree1 mode"]
    #[inline(always)]
    pub fn is_ree1(&self) -> bool {
        *self == SECURITY_MODE::Ree1
    }
    #[doc = "Ree2 mode"]
    #[inline(always)]
    pub fn is_ree2(&self) -> bool {
        *self == SECURITY_MODE::Ree2
    }
}
#[doc = "Field `MODE` writer - M0 security level mode: 2'd3: ree_mode2. 2'd2: ree_mode1. 2'd1: ree_mode0. 2'd0: tee_mode"]
pub type MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SECURITY_MODE, crate::Safe>;
impl<'a, REG> MODE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Tee mode"]
    #[inline(always)]
    pub fn tee(self) -> &'a mut crate::W<REG> {
        self.variant(SECURITY_MODE::Tee)
    }
    #[doc = "Ree0 mode"]
    #[inline(always)]
    pub fn ree0(self) -> &'a mut crate::W<REG> {
        self.variant(SECURITY_MODE::Ree0)
    }
    #[doc = "Ree1 mode"]
    #[inline(always)]
    pub fn ree1(self) -> &'a mut crate::W<REG> {
        self.variant(SECURITY_MODE::Ree1)
    }
    #[doc = "Ree2 mode"]
    #[inline(always)]
    pub fn ree2(self) -> &'a mut crate::W<REG> {
        self.variant(SECURITY_MODE::Ree2)
    }
}
impl R {
    #[doc = "Bits 0:1 - M0 security level mode: 2'd3: ree_mode2. 2'd2: ree_mode1. 2'd1: ree_mode0. 2'd0: tee_mode"]
    #[inline(always)]
    pub fn mode(&self) -> MODE_R {
        MODE_R::new((self.bits & 3) as u8)
    }
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("M_MODE_CTRL")
            .field("mode", &self.mode())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:1 - M0 security level mode: 2'd3: ree_mode2. 2'd2: ree_mode1. 2'd1: ree_mode0. 2'd0: tee_mode"]
    #[inline(always)]
    #[must_use]
    pub fn mode(&mut self) -> MODE_W<M_MODE_CTRL_SPEC> {
        MODE_W::new(self, 0)
    }
}
#[doc = "Tee mode control register\n\nYou can [`read`](crate::Reg::read) this register and get [`m_mode_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`m_mode_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct M_MODE_CTRL_SPEC;
impl crate::RegisterSpec for M_MODE_CTRL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [`m_mode_ctrl::R`](R) reader structure"]
impl crate::Readable for M_MODE_CTRL_SPEC {}
#[doc = "`write(|w| ..)` method takes [`m_mode_ctrl::W`](W) writer structure"]
impl crate::Writable for M_MODE_CTRL_SPEC {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets M%s_MODE_CTRL to value 0"]
impl crate::Resettable for M_MODE_CTRL_SPEC {
    const RESET_VALUE: u32 = 0;
}