Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Add CNTV_CVAL_EL0 register
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier-varez authored and andre-richter committed Mar 18, 2022
1 parent ef805f3 commit 50e1b16
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/registers.rs
Expand Up @@ -12,6 +12,7 @@ mod cntp_ctl_el0;
mod cntp_tval_el0;
mod cntpct_el0;
mod cntv_ctl_el0;
mod cntv_cval_el0;
mod cntv_tval_el0;
mod cntvct_el0;
mod cntvoff_el2;
Expand Down Expand Up @@ -60,6 +61,7 @@ pub use cntp_ctl_el0::CNTP_CTL_EL0;
pub use cntp_tval_el0::CNTP_TVAL_EL0;
pub use cntpct_el0::CNTPCT_EL0;
pub use cntv_ctl_el0::CNTV_CTL_EL0;
pub use cntv_cval_el0::CNTV_CVAL_EL0;
pub use cntv_tval_el0::CNTV_TVAL_EL0;
pub use cntvct_el0::CNTVCT_EL0;
pub use cntvoff_el2::CNTVOFF_EL2;
Expand Down
49 changes: 49 additions & 0 deletions src/registers/cntv_cval_el0.rs
@@ -0,0 +1,49 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Copyright (c) 2018-2022 by the author(s)
//
// Author(s):
// - Andre Richter <andre.o.richter@gmail.com>
// - Javier Alvarez <javier.alvarez@allthingsembedded.net>

//! Counter-timer Virtual Timer CompareValue register - EL0
//!
//! Holds the compare value for the virtual timer.
//!
//! When CNTV_CTL_EL0.ENABLE is 1, the timer condition is met when (CNTVCT_EL0 - CompareValue) is
//! greater than or equal to zero. This means that CompareValue acts like a 64-bit upcounter timer.
//!
//! When the timer condition is met:
//! - CNTV_CTL_EL0.ISTATUS is set to 1.
//! - If CNTV_CTL_EL0.IMASK is 0, an interrupt is generated.
//!
//! When CNTV_CTL_EL0.ENABLE is 0, the timer condition is not met, but CNTVCT_EL0 continues to
//! count.
//!
//! If the Generic counter is implemented at a size less than 64 bits, then this field is permitted
//! to be implemented at the same width as the counter, and the upper bits are RES0.
//!
//! The value of this field is treated as zero-extended in all counter calculations.
//!
//! The reset behaviour of this field is:
//! - On a Warm reset, this field resets to an architecturally UNKNOWN value.

use tock_registers::interfaces::{Readable, Writeable};

pub struct Reg;

impl Readable for Reg {
type T = u64;
type R = ();

sys_coproc_read_raw!(u64, "CNTV_CVAL_EL0", "x");
}

impl Writeable for Reg {
type T = u64;
type R = ();

sys_coproc_write_raw!(u64, "CNTV_CVAL_EL0", "x");
}

pub const CNTV_CVAL_EL0: Reg = Reg {};

0 comments on commit 50e1b16

Please sign in to comment.