Skip to content

Commit 82a9c11

Browse files
authored
add debug data transfer registers (#3)
1 parent 75204e2 commit 82a9c11

File tree

5 files changed

+157
-0
lines changed

5 files changed

+157
-0
lines changed

src/registers.rs

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ mod csselr_el1;
2626
mod currentel;
2727
mod dacr32_el2;
2828
mod daif;
29+
mod dbgdtr_el0;
30+
mod dbgdtrrx_el0;
31+
mod dbgdtrtx_el0;
2932
mod elr_el1;
3033
mod elr_el2;
3134
mod elr_el3;
@@ -42,6 +45,7 @@ mod id_aa64mmfr2_el1;
4245
mod lr;
4346
mod mair_el1;
4447
mod mair_el2;
48+
mod mdccsr_el0;
4549
mod midr_el1;
4650
mod mpidr_el1;
4751
mod oslar_el1;
@@ -91,6 +95,9 @@ pub use csselr_el1::CSSELR_EL1;
9195
pub use currentel::CurrentEL;
9296
pub use dacr32_el2::DACR32_EL2;
9397
pub use daif::DAIF;
98+
pub use dbgdtr_el0::DBGDTR_EL0;
99+
pub use dbgdtrrx_el0::DBGDTRRX_EL0;
100+
pub use dbgdtrtx_el0::DBGDTRTX_EL0;
94101
pub use elr_el1::ELR_EL1;
95102
pub use elr_el2::ELR_EL2;
96103
pub use elr_el3::ELR_EL3;
@@ -107,6 +114,7 @@ pub use id_aa64mmfr2_el1::ID_AA64MMFR2_EL1;
107114
pub use lr::LR;
108115
pub use mair_el1::MAIR_EL1;
109116
pub use mair_el2::MAIR_EL2;
117+
pub use mdccsr_el0::MDCCSR_EL0;
110118
pub use midr_el1::MIDR_EL1;
111119
pub use mpidr_el1::MPIDR_EL1;
112120
pub use oslar_el1::OSLAR_EL1;

src/registers/dbgdtr_el0.rs

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
//
3+
// Copyright (c) 2020-2022 by the author(s)
4+
//
5+
// Author(s):
6+
// - Chris Brown <[email protected]>
7+
8+
//! Debug Data Transfer Register, half-duplex
9+
//!
10+
//! Transfers 64 bits of data between the PE and an external debugger. Can transfer both ways using
11+
//! only a single register.
12+
13+
use tock_registers::{
14+
interfaces::{Readable, Writeable},
15+
register_bitfields,
16+
};
17+
18+
register_bitfields! {u64,
19+
pub DBGDTR_EL0 [
20+
/// Writes to this register set DTRRX to the value in this field and do not change RXfull.
21+
///
22+
/// Reads of this register:
23+
///
24+
/// - If RXfull is set to 1, return the last value written to DTRTX.
25+
/// - If RXfull is set to 0, return an UNKNOWN value.
26+
///
27+
/// After the read, RXfull is cleared to 0.
28+
HighWord OFFSET(32) NUMBITS(32) [],
29+
30+
/// Writes to this register set DTRTX to the value in this field and set TXfull to 1.
31+
///
32+
/// Reads of this register:
33+
///
34+
/// - If RXfull is set to 1, return the last value written to DTRRX.
35+
/// - If RXfull is set to 0, return an UNKNOWN value.
36+
///
37+
/// After the read, RXfull is cleared to 0.
38+
LowWord OFFSET(0) NUMBITS(32) []
39+
]
40+
}
41+
42+
pub struct Reg;
43+
44+
impl Readable for Reg {
45+
type T = u64;
46+
type R = DBGDTR_EL0::Register;
47+
48+
sys_coproc_read_raw!(u64, "DBGDTR_EL0", "x");
49+
}
50+
51+
impl Writeable for Reg {
52+
type T = u64;
53+
type R = DBGDTR_EL0::Register;
54+
55+
sys_coproc_write_raw!(u64, "DBGDTR_EL0", "x");
56+
}
57+
58+
pub const DBGDTR_EL0: Reg = Reg {};

src/registers/dbgdtrrx_el0.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
//
3+
// Copyright (c) 2020-2022 by the author(s)
4+
//
5+
// Author(s):
6+
// - Chris Brown <[email protected]>
7+
8+
//! Debug Data Transfer Register, Receive
9+
//!
10+
//! Transfers data from an external debugger to the PE. For example, it is used by a debugger
11+
//! transferring commands and data to a debug target. See DBGDTR_EL0 for additional architectural
12+
//! mappings. It is a component of the Debug Communications Channel.
13+
14+
use tock_registers::interfaces::Readable;
15+
16+
pub struct Reg;
17+
18+
impl Readable for Reg {
19+
type T = u64;
20+
type R = ();
21+
22+
sys_coproc_read_raw!(u64, "DBGDTRRX_EL0", "x");
23+
}
24+
25+
pub const DBGDTRRX_EL0: Reg = Reg {};

src/registers/dbgdtrtx_el0.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
//
3+
// Copyright (c) 2020-2022 by the author(s)
4+
//
5+
// Author(s):
6+
// - Chris Brown <[email protected]>
7+
8+
//! Debug Data Transfer Register, Transmit
9+
//!
10+
//! Transfers data from the PE to an external debugger. For example, it is used by a debug target
11+
//! to transfer data to the debugger. See DBGDTR_EL0 for additional architectural mappings. It is a
12+
//! component of the Debug Communication Channel.
13+
14+
use tock_registers::interfaces::Writeable;
15+
16+
pub struct Reg;
17+
18+
impl Writeable for Reg {
19+
type T = u64;
20+
type R = ();
21+
22+
sys_coproc_write_raw!(u64, "DBGDTRTX_EL0", "x");
23+
}
24+
25+
pub const DBGDTRTX_EL0: Reg = Reg {};

src/registers/mdccsr_el0.rs

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
//
3+
// Copyright (c) 2020-2022 by the author(s)
4+
//
5+
// Author(s):
6+
// - Chris Brown <[email protected]>
7+
8+
//! Monitor DCC Status Register
9+
//!
10+
//! Transfers data from an external debugger to the PE. For example, it is used by a debugger
11+
//! transferring commands and data to a debug target. See DBGDTR_EL0 for additional architectural
12+
//! mappings. It is a component of the Debug Communications Channel.
13+
14+
use tock_registers::{interfaces::Readable, register_bitfields};
15+
16+
register_bitfields! {u64,
17+
pub MDCCSR_EL0 [
18+
/// DTRRX full. Read-only view of the equivalent bit in the EDSCR.
19+
RXfull OFFSET(30) NUMBITS(1) [
20+
NotFull = 0,
21+
Full = 1
22+
],
23+
24+
/// DTRTX full. Read-only view of the equivalent bit in the EDSCR.
25+
TXfull OFFSET(29) NUMBITS(1) [
26+
NotFull = 0,
27+
Full = 1
28+
]
29+
]
30+
}
31+
32+
pub struct Reg;
33+
34+
impl Readable for Reg {
35+
type T = u64;
36+
type R = MDCCSR_EL0::Register;
37+
38+
sys_coproc_read_raw!(u64, "MDCCSR_EL0", "x");
39+
}
40+
41+
pub const MDCCSR_EL0: Reg = Reg {};

0 commit comments

Comments
 (0)