aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe/addr.rs
blob: 81b6becaa03c2f3cf386a2be2615f7d9d7a4c7c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use super::register::{Readable, Register, Writable, R as GenR, W as GenW};

/// § 32.8.7.2
/// Address of the Data Buffer.
///
/// Offset: 0x00 & 0x10
/// Reset: 0xxxxxxxxx
/// Property: NA
pub type Addr = Register<u32, _Addr>;
impl Readable for Addr {}
impl Writable for Addr {}

pub type R = GenR<u32, Addr>;
pub type W = GenW<u32, Addr>;

pub struct _Addr;

impl R {
    pub fn addr(&self) -> AddrR {
        AddrR::new(self.bits)
    }
}

impl W {
    pub fn addr(&mut self) -> AddrW {
        AddrW { w: self }
    }
}

/// Data Pointer Address Value
///
/// These bits define the data pointer address as an absolute double
/// word address in RAM. The two least significant bits must be zero
/// to ensure the descriptor is 32-bit aligned.
pub type AddrR = GenR<u32, Addr>;

pub struct AddrW<'a> {
    w: &'a mut W,
}

impl<'a> AddrW<'a> {
    pub unsafe fn bits(self, bits: u32) -> &'a mut W {
        self.w.bits(bits)
    }
}