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

Commit 50e1b16

Browse files
Javier-varezandre-richter
authored andcommitted
Add CNTV_CVAL_EL0 register
1 parent ef805f3 commit 50e1b16

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

src/registers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mod cntp_ctl_el0;
1212
mod cntp_tval_el0;
1313
mod cntpct_el0;
1414
mod cntv_ctl_el0;
15+
mod cntv_cval_el0;
1516
mod cntv_tval_el0;
1617
mod cntvct_el0;
1718
mod cntvoff_el2;
@@ -60,6 +61,7 @@ pub use cntp_ctl_el0::CNTP_CTL_EL0;
6061
pub use cntp_tval_el0::CNTP_TVAL_EL0;
6162
pub use cntpct_el0::CNTPCT_EL0;
6263
pub use cntv_ctl_el0::CNTV_CTL_EL0;
64+
pub use cntv_cval_el0::CNTV_CVAL_EL0;
6365
pub use cntv_tval_el0::CNTV_TVAL_EL0;
6466
pub use cntvct_el0::CNTVCT_EL0;
6567
pub use cntvoff_el2::CNTVOFF_EL2;

src/registers/cntv_cval_el0.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
//
3+
// Copyright (c) 2018-2022 by the author(s)
4+
//
5+
// Author(s):
6+
// - Andre Richter <andre.o.richter@gmail.com>
7+
// - Javier Alvarez <javier.alvarez@allthingsembedded.net>
8+
9+
//! Counter-timer Virtual Timer CompareValue register - EL0
10+
//!
11+
//! Holds the compare value for the virtual timer.
12+
//!
13+
//! When CNTV_CTL_EL0.ENABLE is 1, the timer condition is met when (CNTVCT_EL0 - CompareValue) is
14+
//! greater than or equal to zero. This means that CompareValue acts like a 64-bit upcounter timer.
15+
//!
16+
//! When the timer condition is met:
17+
//! - CNTV_CTL_EL0.ISTATUS is set to 1.
18+
//! - If CNTV_CTL_EL0.IMASK is 0, an interrupt is generated.
19+
//!
20+
//! When CNTV_CTL_EL0.ENABLE is 0, the timer condition is not met, but CNTVCT_EL0 continues to
21+
//! count.
22+
//!
23+
//! If the Generic counter is implemented at a size less than 64 bits, then this field is permitted
24+
//! to be implemented at the same width as the counter, and the upper bits are RES0.
25+
//!
26+
//! The value of this field is treated as zero-extended in all counter calculations.
27+
//!
28+
//! The reset behaviour of this field is:
29+
//! - On a Warm reset, this field resets to an architecturally UNKNOWN value.
30+
31+
use tock_registers::interfaces::{Readable, Writeable};
32+
33+
pub struct Reg;
34+
35+
impl Readable for Reg {
36+
type T = u64;
37+
type R = ();
38+
39+
sys_coproc_read_raw!(u64, "CNTV_CVAL_EL0", "x");
40+
}
41+
42+
impl Writeable for Reg {
43+
type T = u64;
44+
type R = ();
45+
46+
sys_coproc_write_raw!(u64, "CNTV_CVAL_EL0", "x");
47+
}
48+
49+
pub const CNTV_CVAL_EL0: Reg = Reg {};

0 commit comments

Comments
 (0)