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
46
47
48
49
50
51
52
53
54
55
56
57
58
use crate::generic::*;
#[doc = "Platform register. Allows software to know what environment it is running in."]
#[repr(transparent)]
#[derive(Copy, Clone)]
pub struct Platform(pub u32);
impl Platform {
    pub const fn asic(&self) -> bool {
        let val = (self.0 >> 1u32) & 0x01;
        val != 0
    }
    pub fn set_asic(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 1u32)) | (((val as u32) & 0x01) << 1u32);
    }
    pub const fn fpga(&self) -> bool {
        let val = (self.0 >> 0u32) & 0x01;
        val != 0
    }
    pub fn set_fpga(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0u32)) | (((val as u32) & 0x01) << 0u32);
    }
}
impl Default for Platform {
    fn default() -> Platform {
        Platform(0)
    }
}
#[doc = "JEDEC JEP-106 compliant chip identifier."]
#[repr(transparent)]
#[derive(Copy, Clone)]
pub struct ChipId(pub u32);
impl ChipId {
    pub const fn revision(&self) -> u8 {
        let val = (self.0 >> 28u32) & 0x0f;
        val as u8
    }
    pub fn set_revision(&mut self, val: u8) {
        self.0 = (self.0 & !(0x0f << 28u32)) | (((val as u32) & 0x0f) << 28u32);
    }
    pub const fn part(&self) -> u16 {
        let val = (self.0 >> 12u32) & 0xffff;
        val as u16
    }
    pub fn set_part(&mut self, val: u16) {
        self.0 = (self.0 & !(0xffff << 12u32)) | (((val as u32) & 0xffff) << 12u32);
    }
    pub const fn manufacturer(&self) -> u16 {
        let val = (self.0 >> 0u32) & 0x0fff;
        val as u16
    }
    pub fn set_manufacturer(&mut self, val: u16) {
        self.0 = (self.0 & !(0x0fff << 0u32)) | (((val as u32) & 0x0fff) << 0u32);
    }
}
impl Default for ChipId {
    fn default() -> ChipId {
        ChipId(0)
    }
}