|
| 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