corstone300_pac/syscounter_cntrl/
cntsr.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 `CNTSR` reader"]
6pub struct R(crate::R<CNTSR_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<CNTSR_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<CNTSR_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<CNTSR_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Field `DBGH` reader - Indicates whether the counter is halted because the Halt-on-Debug signal is asserted"]
21pub type DBGH_R = crate::FieldReader<u8, DBGH_A>;
22#[doc = "Indicates whether the counter is halted because the Halt-on-Debug signal is asserted\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24#[repr(u8)]
25pub enum DBGH_A {
26    #[doc = "0: Counter is not halted"]
27    NOHALT = 0,
28    #[doc = "1: Counter is halted"]
29    HALT = 1,
30}
31impl From<DBGH_A> for u8 {
32    #[inline(always)]
33    fn from(variant: DBGH_A) -> Self {
34        variant as _
35    }
36}
37impl DBGH_R {
38    #[doc = "Get enumerated values variant"]
39    #[inline(always)]
40    pub fn variant(&self) -> Option<DBGH_A> {
41        match self.bits {
42            0 => Some(DBGH_A::NOHALT),
43            1 => Some(DBGH_A::HALT),
44            _ => None,
45        }
46    }
47    #[doc = "Checks if the value of the field is `NOHALT`"]
48    #[inline(always)]
49    pub fn is_nohalt(&self) -> bool {
50        *self == DBGH_A::NOHALT
51    }
52    #[doc = "Checks if the value of the field is `HALT`"]
53    #[inline(always)]
54    pub fn is_halt(&self) -> bool {
55        *self == DBGH_A::HALT
56    }
57}
58impl R {
59    #[doc = "Bits 1:4 - Indicates whether the counter is halted because the Halt-on-Debug signal is asserted"]
60    #[inline(always)]
61    pub fn dbgh(&self) -> DBGH_R {
62        DBGH_R::new(((self.bits >> 1) & 0x0f) as u8)
63    }
64}
65#[doc = "Counter frequency status information\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cntsr](index.html) module"]
66pub struct CNTSR_SPEC;
67impl crate::RegisterSpec for CNTSR_SPEC {
68    type Ux = u32;
69}
70#[doc = "`read()` method returns [cntsr::R](R) reader structure"]
71impl crate::Readable for CNTSR_SPEC {
72    type Reader = R;
73}
74#[doc = "`reset()` method sets CNTSR to value 0"]
75impl crate::Resettable for CNTSR_SPEC {
76    #[inline(always)]
77    fn reset_value() -> Self::Ux {
78        0
79    }
80}