1#[doc = "Register `CHIP_RESET` reader"]
2pub type R = crate::R<CHIP_RESET_SPEC>;
3#[doc = "Register `CHIP_RESET` writer"]
4pub type W = crate::W<CHIP_RESET_SPEC>;
5#[doc = "Field `HAD_POR` reader - Last reset was from the power-on reset or brown-out detection blocks"]
6pub type HAD_POR_R = crate::BitReader;
7#[doc = "Field `HAD_RUN` reader - Last reset was from the RUN pin"]
8pub type HAD_RUN_R = crate::BitReader;
9#[doc = "Field `HAD_PSM_RESTART` reader - Last reset was from the debug port"]
10pub type HAD_PSM_RESTART_R = crate::BitReader;
11#[doc = "Field `PSM_RESTART_FLAG` reader - This is set by psm_restart from the debugger.
12 Its purpose is to branch bootcode to a safe mode when the debugger has issued a psm_restart in order to recover from a boot lock-up.
13 In the safe mode the debugger can repair the boot code, clear this flag then reboot the processor."]
14pub type PSM_RESTART_FLAG_R = crate::BitReader;
15#[doc = "Field `PSM_RESTART_FLAG` writer - This is set by psm_restart from the debugger.
16 Its purpose is to branch bootcode to a safe mode when the debugger has issued a psm_restart in order to recover from a boot lock-up.
17 In the safe mode the debugger can repair the boot code, clear this flag then reboot the processor."]
18pub type PSM_RESTART_FLAG_W<'a, REG> = crate::BitWriter1C<'a, REG>;
19impl R {
20#[doc = "Bit 8 - Last reset was from the power-on reset or brown-out detection blocks"]
21 #[inline(always)]
22pub fn had_por(&self) -> HAD_POR_R {
23 HAD_POR_R::new(((self.bits >> 8) & 1) != 0)
24 }
25#[doc = "Bit 16 - Last reset was from the RUN pin"]
26 #[inline(always)]
27pub fn had_run(&self) -> HAD_RUN_R {
28 HAD_RUN_R::new(((self.bits >> 16) & 1) != 0)
29 }
30#[doc = "Bit 20 - Last reset was from the debug port"]
31 #[inline(always)]
32pub fn had_psm_restart(&self) -> HAD_PSM_RESTART_R {
33 HAD_PSM_RESTART_R::new(((self.bits >> 20) & 1) != 0)
34 }
35#[doc = "Bit 24 - This is set by psm_restart from the debugger.
36 Its purpose is to branch bootcode to a safe mode when the debugger has issued a psm_restart in order to recover from a boot lock-up.
37 In the safe mode the debugger can repair the boot code, clear this flag then reboot the processor."]
38 #[inline(always)]
39pub fn psm_restart_flag(&self) -> PSM_RESTART_FLAG_R {
40 PSM_RESTART_FLAG_R::new(((self.bits >> 24) & 1) != 0)
41 }
42}
43impl W {
44#[doc = "Bit 24 - This is set by psm_restart from the debugger.
45 Its purpose is to branch bootcode to a safe mode when the debugger has issued a psm_restart in order to recover from a boot lock-up.
46 In the safe mode the debugger can repair the boot code, clear this flag then reboot the processor."]
47 #[inline(always)]
48 #[must_use]
49pub fn psm_restart_flag(&mut self) -> PSM_RESTART_FLAG_W<CHIP_RESET_SPEC> {
50 PSM_RESTART_FLAG_W::new(self, 24)
51 }
52#[doc = r" Writes raw bits to the register."]
53 #[doc = r""]
54 #[doc = r" # Safety"]
55 #[doc = r""]
56 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
57 #[inline(always)]
58pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
59self.bits = bits;
60self
61}
62}
63#[doc = "Chip reset control and status
6465You can [`read`](crate::generic::Reg::read) this register and get [`chip_reset::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 [`chip_reset::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
66pub struct CHIP_RESET_SPEC;
67impl crate::RegisterSpec for CHIP_RESET_SPEC {
68type Ux = u32;
69}
70#[doc = "`read()` method returns [`chip_reset::R`](R) reader structure"]
71impl crate::Readable for CHIP_RESET_SPEC {}
72#[doc = "`write(|w| ..)` method takes [`chip_reset::W`](W) writer structure"]
73impl crate::Writable for CHIP_RESET_SPEC {
74const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
75const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x0100_0000;
76}
77#[doc = "`reset()` method sets CHIP_RESET to value 0"]
78impl crate::Resettable for CHIP_RESET_SPEC {
79const RESET_VALUE: u32 = 0;
80}