corstone300_pac/isram0mpc/
ctrl.rs

1// Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
2//
3// SPDX-License-Identifier: MIT
4
5#[doc = "Register `CTRL` reader"]
6pub struct R(crate::R<CTRL_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<CTRL_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<CTRL_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `CTRL` writer"]
21pub struct W(crate::W<CTRL_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<CTRL_SPEC>;
24    #[inline(always)]
25    fn deref(&self) -> &Self::Target {
26        &self.0
27    }
28}
29impl core::ops::DerefMut for W {
30    #[inline(always)]
31    fn deref_mut(&mut self) -> &mut Self::Target {
32        &mut self.0
33    }
34}
35impl From<crate::W<CTRL_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `CFG_SEC_RESP` reader - Security error response configuration"]
42pub type CFG_SEC_RESP_R = crate::BitReader<CFG_SEC_RESP_A>;
43#[doc = "Security error response configuration\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum CFG_SEC_RESP_A {
46    #[doc = "0: Read-As-Zero - Writes ignored"]
47    RAZ_WI = 0,
48    #[doc = "1: Bus Error"]
49    BUSERROR = 1,
50}
51impl From<CFG_SEC_RESP_A> for bool {
52    #[inline(always)]
53    fn from(variant: CFG_SEC_RESP_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl CFG_SEC_RESP_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> CFG_SEC_RESP_A {
61        match self.bits {
62            false => CFG_SEC_RESP_A::RAZ_WI,
63            true => CFG_SEC_RESP_A::BUSERROR,
64        }
65    }
66    #[doc = "Checks if the value of the field is `RAZ_WI`"]
67    #[inline(always)]
68    pub fn is_raz_wi(&self) -> bool {
69        *self == CFG_SEC_RESP_A::RAZ_WI
70    }
71    #[doc = "Checks if the value of the field is `BUSERROR`"]
72    #[inline(always)]
73    pub fn is_buserror(&self) -> bool {
74        *self == CFG_SEC_RESP_A::BUSERROR
75    }
76}
77#[doc = "Field `CFG_SEC_RESP` writer - Security error response configuration"]
78pub type CFG_SEC_RESP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, CFG_SEC_RESP_A, O>;
79impl<'a, const O: u8> CFG_SEC_RESP_W<'a, O> {
80    #[doc = "Read-As-Zero - Writes ignored"]
81    #[inline(always)]
82    pub fn raz_wi(self) -> &'a mut W {
83        self.variant(CFG_SEC_RESP_A::RAZ_WI)
84    }
85    #[doc = "Bus Error"]
86    #[inline(always)]
87    pub fn buserror(self) -> &'a mut W {
88        self.variant(CFG_SEC_RESP_A::BUSERROR)
89    }
90}
91#[doc = "Field `DATA_IF_GATING_REQ` reader - Data interface gating request"]
92pub type DATA_IF_GATING_REQ_R = crate::BitReader<bool>;
93#[doc = "Field `DATA_IF_GATING_REQ` writer - Data interface gating request"]
94pub type DATA_IF_GATING_REQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
95#[doc = "Field `DATA_IF_GATING_ACK` reader - Data interface gating acknowledge (RO)"]
96pub type DATA_IF_GATING_ACK_R = crate::BitReader<bool>;
97#[doc = "Field `AUTO_INCREMENT` reader - Auto-increment"]
98pub type AUTO_INCREMENT_R = crate::BitReader<bool>;
99#[doc = "Field `AUTO_INCREMENT` writer - Auto-increment"]
100pub type AUTO_INCREMENT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
101#[doc = "Field `SEC_LOCKDOWN` reader - Security lockdown"]
102pub type SEC_LOCKDOWN_R = crate::BitReader<bool>;
103#[doc = "Field `SEC_LOCKDOWN` writer - Security lockdown"]
104pub type SEC_LOCKDOWN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
105impl R {
106    #[doc = "Bit 4 - Security error response configuration"]
107    #[inline(always)]
108    pub fn cfg_sec_resp(&self) -> CFG_SEC_RESP_R {
109        CFG_SEC_RESP_R::new(((self.bits >> 4) & 1) != 0)
110    }
111    #[doc = "Bit 6 - Data interface gating request"]
112    #[inline(always)]
113    pub fn data_if_gating_req(&self) -> DATA_IF_GATING_REQ_R {
114        DATA_IF_GATING_REQ_R::new(((self.bits >> 6) & 1) != 0)
115    }
116    #[doc = "Bit 7 - Data interface gating acknowledge (RO)"]
117    #[inline(always)]
118    pub fn data_if_gating_ack(&self) -> DATA_IF_GATING_ACK_R {
119        DATA_IF_GATING_ACK_R::new(((self.bits >> 7) & 1) != 0)
120    }
121    #[doc = "Bit 8 - Auto-increment"]
122    #[inline(always)]
123    pub fn auto_increment(&self) -> AUTO_INCREMENT_R {
124        AUTO_INCREMENT_R::new(((self.bits >> 8) & 1) != 0)
125    }
126    #[doc = "Bit 31 - Security lockdown"]
127    #[inline(always)]
128    pub fn sec_lockdown(&self) -> SEC_LOCKDOWN_R {
129        SEC_LOCKDOWN_R::new(((self.bits >> 31) & 1) != 0)
130    }
131}
132impl W {
133    #[doc = "Bit 4 - Security error response configuration"]
134    #[inline(always)]
135    pub fn cfg_sec_resp(&mut self) -> CFG_SEC_RESP_W<4> {
136        CFG_SEC_RESP_W::new(self)
137    }
138    #[doc = "Bit 6 - Data interface gating request"]
139    #[inline(always)]
140    pub fn data_if_gating_req(&mut self) -> DATA_IF_GATING_REQ_W<6> {
141        DATA_IF_GATING_REQ_W::new(self)
142    }
143    #[doc = "Bit 8 - Auto-increment"]
144    #[inline(always)]
145    pub fn auto_increment(&mut self) -> AUTO_INCREMENT_W<8> {
146        AUTO_INCREMENT_W::new(self)
147    }
148    #[doc = "Bit 31 - Security lockdown"]
149    #[inline(always)]
150    pub fn sec_lockdown(&mut self) -> SEC_LOCKDOWN_W<31> {
151        SEC_LOCKDOWN_W::new(self)
152    }
153    #[doc = "Writes raw bits to the register."]
154    #[inline(always)]
155    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
156        self.0.bits(bits);
157        self
158    }
159}
160#[doc = "MPC Control register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrl](index.html) module"]
161pub struct CTRL_SPEC;
162impl crate::RegisterSpec for CTRL_SPEC {
163    type Ux = u32;
164}
165#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
166impl crate::Readable for CTRL_SPEC {
167    type Reader = R;
168}
169#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
170impl crate::Writable for CTRL_SPEC {
171    type Writer = W;
172}
173#[doc = "`reset()` method sets CTRL to value 0"]
174impl crate::Resettable for CTRL_SPEC {
175    #[inline(always)]
176    fn reset_value() -> Self::Ux {
177        0
178    }
179}