corstone300_pac/syscounter_cntrl/
cntscr.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 `CNTSCR` reader"]
6pub struct R(crate::R<CNTSCR_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<CNTSCR_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<CNTSCR_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<CNTSCR_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `CNTSCR` writer"]
21pub struct W(crate::W<CNTSCR_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<CNTSCR_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<CNTSCR_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<CNTSCR_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `ScaleVal` reader - The amount added to the Counter Count Value for every period of the counter as determined by 1/Frequency from the current operating frequency of the system counter, the counter tick"]
42pub type SCALE_VAL_R = crate::FieldReader<u32, u32>;
43#[doc = "Field `ScaleVal` writer - The amount added to the Counter Count Value for every period of the counter as determined by 1/Frequency from the current operating frequency of the system counter, the counter tick"]
44pub type SCALE_VAL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CNTSCR_SPEC, u32, u32, 32, O>;
45impl R {
46    #[doc = "Bits 0:31 - The amount added to the Counter Count Value for every period of the counter as determined by 1/Frequency from the current operating frequency of the system counter, the counter tick"]
47    #[inline(always)]
48    pub fn scale_val(&self) -> SCALE_VAL_R {
49        SCALE_VAL_R::new(self.bits)
50    }
51}
52impl W {
53    #[doc = "Bits 0:31 - The amount added to the Counter Count Value for every period of the counter as determined by 1/Frequency from the current operating frequency of the system counter, the counter tick"]
54    #[inline(always)]
55    pub fn scale_val(&mut self) -> SCALE_VAL_W<0> {
56        SCALE_VAL_W::new(self)
57    }
58    #[doc = "Writes raw bits to the register."]
59    #[inline(always)]
60    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
61        self.0.bits(bits);
62        self
63    }
64}
65#[doc = "Stores the Counter Scaling value\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 [cntscr](index.html) module"]
66pub struct CNTSCR_SPEC;
67impl crate::RegisterSpec for CNTSCR_SPEC {
68    type Ux = u32;
69}
70#[doc = "`read()` method returns [cntscr::R](R) reader structure"]
71impl crate::Readable for CNTSCR_SPEC {
72    type Reader = R;
73}
74#[doc = "`write(|w| ..)` method takes [cntscr::W](W) writer structure"]
75impl crate::Writable for CNTSCR_SPEC {
76    type Writer = W;
77}
78#[doc = "`reset()` method sets CNTSCR to value 0x0100_0000"]
79impl crate::Resettable for CNTSCR_SPEC {
80    #[inline(always)]
81    fn reset_value() -> Self::Ux {
82        0x0100_0000
83    }
84}