Created
February 27, 2018 14:45
-
-
Save jamesmunns/d854a6c2665cca59edb88143d82a19c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[doc = "Factory Information Configuration Registers"] | |
pub struct FICR { | |
_marker: PhantomData<*const ()>, | |
} | |
unsafe impl Send for FICR {} | |
impl FICR { | |
#[doc = r" Returns a pointer to the register block"] | |
pub fn ptr() -> *const ficr::RegisterBlock { | |
0x1000_0000 as *const _ | |
} | |
} | |
impl Deref for FICR { | |
type Target = ficr::RegisterBlock; | |
fn deref(&self) -> &ficr::RegisterBlock { | |
unsafe { &*FICR::ptr() } | |
} | |
} | |
#[doc = "Factory Information Configuration Registers"] | |
pub mod ficr { | |
use vcell::VolatileCell; | |
#[doc = r" Register block"] | |
#[repr(C)] | |
pub struct RegisterBlock { | |
_reserved0: [u8; 16usize], | |
#[doc = "0x10 - Code memory page size"] | |
pub codepagesize: CODEPAGESIZE, | |
#[doc = "0x14 - Code memory size"] | |
pub codesize: CODESIZE, | |
_reserved1: [u8; 72usize], | |
#[doc = "0x60 - Description collection[0]: Device identifier"] | |
pub deviceid: [DEVICEID; 2], | |
_reserved2: [u8; 24usize], | |
#[doc = "0x80 - Description collection[0]: Encryption Root, word 0"] | |
pub er: [ER; 4], | |
#[doc = "0x90 - Description collection[0]: Identity Root, word 0"] | |
pub ir: [IR; 4], | |
#[doc = "0xa0 - Device address type"] | |
pub deviceaddrtype: DEVICEADDRTYPE, | |
#[doc = "0xa4 - Description collection[0]: Device address 0"] | |
pub deviceaddr: [DEVICEADDR; 2], | |
} | |
#[doc = "Code memory page size"] | |
pub struct CODEPAGESIZE { | |
register: VolatileCell<u32>, | |
} | |
#[doc = "Code memory page size"] | |
pub mod codepagesize { | |
#[doc = r" Value read from the register"] | |
pub struct R { | |
bits: u32, | |
} | |
impl super::CODEPAGESIZE { | |
#[doc = r" Reads the contents of the register"] | |
#[inline] | |
pub fn read(&self) -> R { | |
R { | |
bits: self.register.get(), | |
} | |
} | |
} | |
#[doc = r" Value of the field"] | |
pub struct CODEPAGESIZER { | |
bits: u32, | |
} | |
impl CODEPAGESIZER { | |
#[doc = r" Value of the field as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
} | |
impl R { | |
#[doc = r" Value of the register as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
#[doc = "Bits 0:31 - Code memory page size"] | |
#[inline] | |
pub fn codepagesize(&self) -> CODEPAGESIZER { | |
let bits = { | |
const MASK: u32 = 0xffff_ffff; | |
const OFFSET: u8 = 0; | |
((self.bits >> OFFSET) & MASK as u32) as u32 | |
}; | |
CODEPAGESIZER { bits } | |
} | |
} | |
} | |
#[doc = "Code memory size"] | |
pub struct CODESIZE { | |
register: VolatileCell<u32>, | |
} | |
#[doc = "Code memory size"] | |
pub mod codesize { | |
#[doc = r" Value read from the register"] | |
pub struct R { | |
bits: u32, | |
} | |
impl super::CODESIZE { | |
#[doc = r" Reads the contents of the register"] | |
#[inline] | |
pub fn read(&self) -> R { | |
R { | |
bits: self.register.get(), | |
} | |
} | |
} | |
#[doc = r" Value of the field"] | |
pub struct CODESIZER { | |
bits: u32, | |
} | |
impl CODESIZER { | |
#[doc = r" Value of the field as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
} | |
impl R { | |
#[doc = r" Value of the register as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
#[doc = "Bits 0:31 - Code memory size in number of pages"] | |
#[inline] | |
pub fn codesize(&self) -> CODESIZER { | |
let bits = { | |
const MASK: u32 = 0xffff_ffff; | |
const OFFSET: u8 = 0; | |
((self.bits >> OFFSET) & MASK as u32) as u32 | |
}; | |
CODESIZER { bits } | |
} | |
} | |
} | |
#[doc = "Description collection[0]: Device identifier"] | |
pub struct DEVICEID { | |
register: VolatileCell<u32>, | |
} | |
#[doc = "Description collection[0]: Device identifier"] | |
pub mod deviceid { | |
#[doc = r" Value read from the register"] | |
pub struct R { | |
bits: u32, | |
} | |
impl super::DEVICEID { | |
#[doc = r" Reads the contents of the register"] | |
#[inline] | |
pub fn read(&self) -> R { | |
R { | |
bits: self.register.get(), | |
} | |
} | |
} | |
#[doc = r" Value of the field"] | |
pub struct DEVICEIDR { | |
bits: u32, | |
} | |
impl DEVICEIDR { | |
#[doc = r" Value of the field as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
} | |
impl R { | |
#[doc = r" Value of the register as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
#[doc = "Bits 0:31 - 64 bit unique device identifier"] | |
#[inline] | |
pub fn deviceid(&self) -> DEVICEIDR { | |
let bits = { | |
const MASK: u32 = 0xffff_ffff; | |
const OFFSET: u8 = 0; | |
((self.bits >> OFFSET) & MASK as u32) as u32 | |
}; | |
DEVICEIDR { bits } | |
} | |
} | |
} | |
#[doc = "Description collection[0]: Encryption Root, word 0"] | |
pub struct ER { | |
register: VolatileCell<u32>, | |
} | |
#[doc = "Description collection[0]: Encryption Root, word 0"] | |
pub mod er { | |
#[doc = r" Value read from the register"] | |
pub struct R { | |
bits: u32, | |
} | |
impl super::ER { | |
#[doc = r" Reads the contents of the register"] | |
#[inline] | |
pub fn read(&self) -> R { | |
R { | |
bits: self.register.get(), | |
} | |
} | |
} | |
#[doc = r" Value of the field"] | |
pub struct ERR { | |
bits: u32, | |
} | |
impl ERR { | |
#[doc = r" Value of the field as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
} | |
impl R { | |
#[doc = r" Value of the register as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
#[doc = "Bits 0:31 - Encryption Root, word n"] | |
#[inline] | |
pub fn er(&self) -> ERR { | |
let bits = { | |
const MASK: u32 = 0xffff_ffff; | |
const OFFSET: u8 = 0; | |
((self.bits >> OFFSET) & MASK as u32) as u32 | |
}; | |
ERR { bits } | |
} | |
} | |
} | |
#[doc = "Description collection[0]: Identity Root, word 0"] | |
pub struct IR { | |
register: VolatileCell<u32>, | |
} | |
#[doc = "Description collection[0]: Identity Root, word 0"] | |
pub mod ir { | |
#[doc = r" Value read from the register"] | |
pub struct R { | |
bits: u32, | |
} | |
impl super::IR { | |
#[doc = r" Reads the contents of the register"] | |
#[inline] | |
pub fn read(&self) -> R { | |
R { | |
bits: self.register.get(), | |
} | |
} | |
} | |
#[doc = r" Value of the field"] | |
pub struct IRR { | |
bits: u32, | |
} | |
impl IRR { | |
#[doc = r" Value of the field as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
} | |
impl R { | |
#[doc = r" Value of the register as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
#[doc = "Bits 0:31 - Identity Root, word n"] | |
#[inline] | |
pub fn ir(&self) -> IRR { | |
let bits = { | |
const MASK: u32 = 0xffff_ffff; | |
const OFFSET: u8 = 0; | |
((self.bits >> OFFSET) & MASK as u32) as u32 | |
}; | |
IRR { bits } | |
} | |
} | |
} | |
#[doc = "Device address type"] | |
pub struct DEVICEADDRTYPE { | |
register: VolatileCell<u32>, | |
} | |
#[doc = "Device address type"] | |
pub mod deviceaddrtype { | |
#[doc = r" Value read from the register"] | |
pub struct R { | |
bits: u32, | |
} | |
impl super::DEVICEADDRTYPE { | |
#[doc = r" Reads the contents of the register"] | |
#[inline] | |
pub fn read(&self) -> R { | |
R { | |
bits: self.register.get(), | |
} | |
} | |
} | |
#[doc = "Possible values of the field `DEVICEADDRTYPE`"] | |
#[derive(Clone, Copy, Debug, PartialEq)] | |
pub enum DEVICEADDRTYPER { | |
#[doc = "Public address"] | |
PUBLIC, | |
#[doc = "Random address"] | |
RANDOM, | |
} | |
impl DEVICEADDRTYPER { | |
#[doc = r" Returns `true` if the bit is clear (0)"] | |
#[inline] | |
pub fn bit_is_clear(&self) -> bool { | |
!self.bit() | |
} | |
#[doc = r" Returns `true` if the bit is set (1)"] | |
#[inline] | |
pub fn bit_is_set(&self) -> bool { | |
self.bit() | |
} | |
#[doc = r" Value of the field as raw bits"] | |
#[inline] | |
pub fn bit(&self) -> bool { | |
match *self { | |
DEVICEADDRTYPER::PUBLIC => false, | |
DEVICEADDRTYPER::RANDOM => true, | |
} | |
} | |
#[allow(missing_docs)] | |
#[doc(hidden)] | |
#[inline] | |
pub fn _from(value: bool) -> DEVICEADDRTYPER { | |
match value { | |
false => DEVICEADDRTYPER::PUBLIC, | |
true => DEVICEADDRTYPER::RANDOM, | |
} | |
} | |
#[doc = "Checks if the value of the field is `PUBLIC`"] | |
#[inline] | |
pub fn is_public(&self) -> bool { | |
*self == DEVICEADDRTYPER::PUBLIC | |
} | |
#[doc = "Checks if the value of the field is `RANDOM`"] | |
#[inline] | |
pub fn is_random(&self) -> bool { | |
*self == DEVICEADDRTYPER::RANDOM | |
} | |
} | |
impl R { | |
#[doc = r" Value of the register as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
#[doc = "Bit 0 - Device address type"] | |
#[inline] | |
pub fn deviceaddrtype(&self) -> DEVICEADDRTYPER { | |
DEVICEADDRTYPER::_from({ | |
const MASK: bool = true; | |
const OFFSET: u8 = 0; | |
((self.bits >> OFFSET) & MASK as u32) != 0 | |
}) | |
} | |
} | |
} | |
#[doc = "Description collection[0]: Device address 0"] | |
pub struct DEVICEADDR { | |
register: VolatileCell<u32>, | |
} | |
#[doc = "Description collection[0]: Device address 0"] | |
pub mod deviceaddr { | |
#[doc = r" Value read from the register"] | |
pub struct R { | |
bits: u32, | |
} | |
impl super::DEVICEADDR { | |
#[doc = r" Reads the contents of the register"] | |
#[inline] | |
pub fn read(&self) -> R { | |
R { | |
bits: self.register.get(), | |
} | |
} | |
} | |
#[doc = r" Value of the field"] | |
pub struct DEVICEADDRR { | |
bits: u32, | |
} | |
impl DEVICEADDRR { | |
#[doc = r" Value of the field as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
} | |
impl R { | |
#[doc = r" Value of the register as raw bits"] | |
#[inline] | |
pub fn bits(&self) -> u32 { | |
self.bits | |
} | |
#[doc = "Bits 0:31 - 48 bit device address"] | |
#[inline] | |
pub fn deviceaddr(&self) -> DEVICEADDRR { | |
let bits = { | |
const MASK: u32 = 0xffff_ffff; | |
const OFFSET: u8 = 0; | |
((self.bits >> OFFSET) & MASK as u32) as u32 | |
}; | |
DEVICEADDRR { bits } | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment