esp32p4/efuse/
cmd.rs

1#[doc = "Register `CMD` reader"]
2pub type R = crate::R<CMD_SPEC>;
3#[doc = "Register `CMD` writer"]
4pub type W = crate::W<CMD_SPEC>;
5#[doc = "Field `READ_CMD` reader - Set this bit to send read command."]
6pub type READ_CMD_R = crate::BitReader;
7#[doc = "Field `READ_CMD` writer - Set this bit to send read command."]
8pub type READ_CMD_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `PGM_CMD` reader - Set this bit to send programming command."]
10pub type PGM_CMD_R = crate::BitReader;
11#[doc = "Field `PGM_CMD` writer - Set this bit to send programming command."]
12pub type PGM_CMD_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `BLK_NUM` reader - The serial number of the block to be programmed. Value 0-10 corresponds to block number 0-10, respectively."]
14pub type BLK_NUM_R = crate::FieldReader;
15#[doc = "Field `BLK_NUM` writer - The serial number of the block to be programmed. Value 0-10 corresponds to block number 0-10, respectively."]
16pub type BLK_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
17impl R {
18    #[doc = "Bit 0 - Set this bit to send read command."]
19    #[inline(always)]
20    pub fn read_cmd(&self) -> READ_CMD_R {
21        READ_CMD_R::new((self.bits & 1) != 0)
22    }
23    #[doc = "Bit 1 - Set this bit to send programming command."]
24    #[inline(always)]
25    pub fn pgm_cmd(&self) -> PGM_CMD_R {
26        PGM_CMD_R::new(((self.bits >> 1) & 1) != 0)
27    }
28    #[doc = "Bits 2:5 - The serial number of the block to be programmed. Value 0-10 corresponds to block number 0-10, respectively."]
29    #[inline(always)]
30    pub fn blk_num(&self) -> BLK_NUM_R {
31        BLK_NUM_R::new(((self.bits >> 2) & 0x0f) as u8)
32    }
33}
34#[cfg(feature = "impl-register-debug")]
35impl core::fmt::Debug for R {
36    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
37        f.debug_struct("CMD")
38            .field("read_cmd", &format_args!("{}", self.read_cmd().bit()))
39            .field("pgm_cmd", &format_args!("{}", self.pgm_cmd().bit()))
40            .field("blk_num", &format_args!("{}", self.blk_num().bits()))
41            .finish()
42    }
43}
44#[cfg(feature = "impl-register-debug")]
45impl core::fmt::Debug for crate::generic::Reg<CMD_SPEC> {
46    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
47        core::fmt::Debug::fmt(&self.read(), f)
48    }
49}
50impl W {
51    #[doc = "Bit 0 - Set this bit to send read command."]
52    #[inline(always)]
53    #[must_use]
54    pub fn read_cmd(&mut self) -> READ_CMD_W<CMD_SPEC> {
55        READ_CMD_W::new(self, 0)
56    }
57    #[doc = "Bit 1 - Set this bit to send programming command."]
58    #[inline(always)]
59    #[must_use]
60    pub fn pgm_cmd(&mut self) -> PGM_CMD_W<CMD_SPEC> {
61        PGM_CMD_W::new(self, 1)
62    }
63    #[doc = "Bits 2:5 - The serial number of the block to be programmed. Value 0-10 corresponds to block number 0-10, respectively."]
64    #[inline(always)]
65    #[must_use]
66    pub fn blk_num(&mut self) -> BLK_NUM_W<CMD_SPEC> {
67        BLK_NUM_W::new(self, 2)
68    }
69}
70#[doc = "eFuse command register.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cmd::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 [`cmd::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
71pub struct CMD_SPEC;
72impl crate::RegisterSpec for CMD_SPEC {
73    type Ux = u32;
74}
75#[doc = "`read()` method returns [`cmd::R`](R) reader structure"]
76impl crate::Readable for CMD_SPEC {}
77#[doc = "`write(|w| ..)` method takes [`cmd::W`](W) writer structure"]
78impl crate::Writable for CMD_SPEC {
79    type Safety = crate::Unsafe;
80    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
81    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
82}
83#[doc = "`reset()` method sets CMD to value 0"]
84impl crate::Resettable for CMD_SPEC {
85    const RESET_VALUE: u32 = 0;
86}