corstone300_pac/ethernet/
gpt_cfg.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 `GPT_CFG` reader"]
6pub struct R(crate::R<GPT_CFG_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<GPT_CFG_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<GPT_CFG_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<GPT_CFG_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `GPT_CFG` writer"]
21pub struct W(crate::W<GPT_CFG_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<GPT_CFG_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<GPT_CFG_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<GPT_CFG_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `GPT_LOAD` reader - General Purpose Timer Pre-Load"]
42pub type GPT_LOAD_R = crate::FieldReader<u16, u16>;
43#[doc = "Field `GPT_LOAD` writer - General Purpose Timer Pre-Load"]
44pub type GPT_LOAD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GPT_CFG_SPEC, u16, u16, 16, O>;
45#[doc = "Field `TIMER_EN` reader - GP Timer Enable"]
46pub type TIMER_EN_R = crate::BitReader<bool>;
47#[doc = "Field `TIMER_EN` writer - GP Timer Enable"]
48pub type TIMER_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPT_CFG_SPEC, bool, O>;
49impl R {
50    #[doc = "Bits 0:15 - General Purpose Timer Pre-Load"]
51    #[inline(always)]
52    pub fn gpt_load(&self) -> GPT_LOAD_R {
53        GPT_LOAD_R::new((self.bits & 0xffff) as u16)
54    }
55    #[doc = "Bit 29 - GP Timer Enable"]
56    #[inline(always)]
57    pub fn timer_en(&self) -> TIMER_EN_R {
58        TIMER_EN_R::new(((self.bits >> 29) & 1) != 0)
59    }
60}
61impl W {
62    #[doc = "Bits 0:15 - General Purpose Timer Pre-Load"]
63    #[inline(always)]
64    pub fn gpt_load(&mut self) -> GPT_LOAD_W<0> {
65        GPT_LOAD_W::new(self)
66    }
67    #[doc = "Bit 29 - GP Timer Enable"]
68    #[inline(always)]
69    pub fn timer_en(&mut self) -> TIMER_EN_W<29> {
70        TIMER_EN_W::new(self)
71    }
72    #[doc = "Writes raw bits to the register."]
73    #[inline(always)]
74    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75        self.0.bits(bits);
76        self
77    }
78}
79#[doc = "General Purpose Timer Configuration\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 [gpt_cfg](index.html) module"]
80pub struct GPT_CFG_SPEC;
81impl crate::RegisterSpec for GPT_CFG_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [gpt_cfg::R](R) reader structure"]
85impl crate::Readable for GPT_CFG_SPEC {
86    type Reader = R;
87}
88#[doc = "`write(|w| ..)` method takes [gpt_cfg::W](W) writer structure"]
89impl crate::Writable for GPT_CFG_SPEC {
90    type Writer = W;
91}
92#[doc = "`reset()` method sets GPT_CFG to value 0xffff"]
93impl crate::Resettable for GPT_CFG_SPEC {
94    #[inline(always)]
95    fn reset_value() -> Self::Ux {
96        0xffff
97    }
98}