1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use super::debug_port::DPRegister;

pub trait DebugPort {
    fn version(&self) -> &'static str;
}

pub trait DPAccess<PORT, REGISTER>
where
    PORT: DebugPort,
    REGISTER: DPRegister<PORT>,
{
    type Error: std::fmt::Debug;
    fn read_dp_register(&mut self, port: &PORT) -> Result<REGISTER, Self::Error>;

    fn write_dp_register(&mut self, port: &PORT, register: REGISTER) -> Result<(), Self::Error>;
}