Same as last commit just run through the form tool (splits up large lib.rs files)

This commit is contained in:
Kjetil Kjeka
2017-09-23 20:09:53 +02:00
parent 63efe927e5
commit 7facea48b2
1680 changed files with 666069 additions and 667757 deletions

53
src/smc/mod.rs Normal file
View File

@ -0,0 +1,53 @@
use vcell::VolatileCell;
#[doc = r" Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - SMC Version ID Register"]
pub verid: VERID,
#[doc = "0x04 - SMC Parameter Register"]
pub param: PARAM,
#[doc = "0x08 - Power Mode Protection register"]
pub pmprot: PMPROT,
#[doc = "0x0c - Power Mode Control register"]
pub pmctrl: PMCTRL,
#[doc = "0x10 - Stop Control Register"]
pub stopctrl: STOPCTRL,
#[doc = "0x14 - Power Mode Status register"]
pub pmstat: PMSTAT,
}
#[doc = "SMC Version ID Register"]
pub struct VERID {
register: VolatileCell<u32>,
}
#[doc = "SMC Version ID Register"]
pub mod verid;
#[doc = "SMC Parameter Register"]
pub struct PARAM {
register: VolatileCell<u32>,
}
#[doc = "SMC Parameter Register"]
pub mod param;
#[doc = "Power Mode Protection register"]
pub struct PMPROT {
register: VolatileCell<u32>,
}
#[doc = "Power Mode Protection register"]
pub mod pmprot;
#[doc = "Power Mode Control register"]
pub struct PMCTRL {
register: VolatileCell<u32>,
}
#[doc = "Power Mode Control register"]
pub mod pmctrl;
#[doc = "Stop Control Register"]
pub struct STOPCTRL {
register: VolatileCell<u32>,
}
#[doc = "Stop Control Register"]
pub mod stopctrl;
#[doc = "Power Mode Status register"]
pub struct PMSTAT {
register: VolatileCell<u32>,
}
#[doc = "Power Mode Status register"]
pub mod pmstat;

242
src/smc/param/mod.rs Normal file
View File

@ -0,0 +1,242 @@
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::PARAM {
#[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 `EHSRUN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EHSRUNR {
#[doc = "The feature is not available."]
_0,
#[doc = "The feature is available."]
_1,
}
impl EHSRUNR {
#[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 {
EHSRUNR::_0 => false,
EHSRUNR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> EHSRUNR {
match value {
false => EHSRUNR::_0,
true => EHSRUNR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == EHSRUNR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == EHSRUNR::_1
}
}
#[doc = "Possible values of the field `ELLS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ELLSR {
#[doc = "The feature is not available."]
_0,
#[doc = "The feature is available."]
_1,
}
impl ELLSR {
#[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 {
ELLSR::_0 => false,
ELLSR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> ELLSR {
match value {
false => ELLSR::_0,
true => ELLSR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == ELLSR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == ELLSR::_1
}
}
#[doc = "Possible values of the field `ELLS2`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ELLS2R {
#[doc = "The feature is not available."]
_0,
#[doc = "The feature is available."]
_1,
}
impl ELLS2R {
#[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 {
ELLS2R::_0 => false,
ELLS2R::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> ELLS2R {
match value {
false => ELLS2R::_0,
true => ELLS2R::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == ELLS2R::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == ELLS2R::_1
}
}
#[doc = "Possible values of the field `EVLLS0`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EVLLS0R {
#[doc = "The feature is not available."]
_0,
#[doc = "The feature is available."]
_1,
}
impl EVLLS0R {
#[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 {
EVLLS0R::_0 => false,
EVLLS0R::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> EVLLS0R {
match value {
false => EVLLS0R::_0,
true => EVLLS0R::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == EVLLS0R::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == EVLLS0R::_1
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 0 - Existence of HSRUN feature"]
#[inline]
pub fn ehsrun(&self) -> EHSRUNR {
EHSRUNR::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 3 - Existence of LLS feature"]
#[inline]
pub fn ells(&self) -> ELLSR {
ELLSR::_from({
const MASK: bool = true;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 5 - Existence of LLS2 feature"]
#[inline]
pub fn ells2(&self) -> ELLS2R {
ELLS2R::_from({
const MASK: bool = true;
const OFFSET: u8 = 5;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 6 - Existence of VLLS0 feature"]
#[inline]
pub fn evlls0(&self) -> EVLLS0R {
EVLLS0R::_from({
const MASK: bool = true;
const OFFSET: u8 = 6;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}

358
src/smc/pmctrl/mod.rs Normal file
View File

@ -0,0 +1,358 @@
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::PMCTRL {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R { bits: self.register.get() }
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = "Possible values of the field `STOPM`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STOPMR {
#[doc = "Normal Stop (STOP)"]
_000,
#[doc = "Very-Low-Power Stop (VLPS)"]
_010,
#[doc = "Reseved"]
_110,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl STOPMR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
STOPMR::_000 => 0,
STOPMR::_010 => 2,
STOPMR::_110 => 6,
STOPMR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> STOPMR {
match value {
0 => STOPMR::_000,
2 => STOPMR::_010,
6 => STOPMR::_110,
i => STOPMR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `_000`"]
#[inline]
pub fn is_000(&self) -> bool {
*self == STOPMR::_000
}
#[doc = "Checks if the value of the field is `_010`"]
#[inline]
pub fn is_010(&self) -> bool {
*self == STOPMR::_010
}
#[doc = "Checks if the value of the field is `_110`"]
#[inline]
pub fn is_110(&self) -> bool {
*self == STOPMR::_110
}
}
#[doc = "Possible values of the field `VLPSA`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VLPSAR {
#[doc = "The previous stop mode entry was successful."]
_0,
#[doc = "The previous stop mode entry was aborted."]
_1,
}
impl VLPSAR {
#[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 {
VLPSAR::_0 => false,
VLPSAR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> VLPSAR {
match value {
false => VLPSAR::_0,
true => VLPSAR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == VLPSAR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == VLPSAR::_1
}
}
#[doc = "Possible values of the field `RUNM`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RUNMR {
#[doc = "Normal Run mode (RUN)"]
_00,
#[doc = "Very-Low-Power Run mode (VLPR)"]
_10,
#[doc = "High Speed Run mode (HSRUN)"]
_11,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl RUNMR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
RUNMR::_00 => 0,
RUNMR::_10 => 2,
RUNMR::_11 => 3,
RUNMR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> RUNMR {
match value {
0 => RUNMR::_00,
2 => RUNMR::_10,
3 => RUNMR::_11,
i => RUNMR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `_00`"]
#[inline]
pub fn is_00(&self) -> bool {
*self == RUNMR::_00
}
#[doc = "Checks if the value of the field is `_10`"]
#[inline]
pub fn is_10(&self) -> bool {
*self == RUNMR::_10
}
#[doc = "Checks if the value of the field is `_11`"]
#[inline]
pub fn is_11(&self) -> bool {
*self == RUNMR::_11
}
}
#[doc = "Values that can be written to the field `STOPM`"]
pub enum STOPMW {
#[doc = "Normal Stop (STOP)"]
_000,
#[doc = "Very-Low-Power Stop (VLPS)"]
_010,
#[doc = "Reseved"]
_110,
}
impl STOPMW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
STOPMW::_000 => 0,
STOPMW::_010 => 2,
STOPMW::_110 => 6,
}
}
}
#[doc = r" Proxy"]
pub struct _STOPMW<'a> {
w: &'a mut W,
}
impl<'a> _STOPMW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: STOPMW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "Normal Stop (STOP)"]
#[inline]
pub fn _000(self) -> &'a mut W {
self.variant(STOPMW::_000)
}
#[doc = "Very-Low-Power Stop (VLPS)"]
#[inline]
pub fn _010(self) -> &'a mut W {
self.variant(STOPMW::_010)
}
#[doc = "Reseved"]
#[inline]
pub fn _110(self) -> &'a mut W {
self.variant(STOPMW::_110)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `RUNM`"]
pub enum RUNMW {
#[doc = "Normal Run mode (RUN)"]
_00,
#[doc = "Very-Low-Power Run mode (VLPR)"]
_10,
#[doc = "High Speed Run mode (HSRUN)"]
_11,
}
impl RUNMW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
RUNMW::_00 => 0,
RUNMW::_10 => 2,
RUNMW::_11 => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _RUNMW<'a> {
w: &'a mut W,
}
impl<'a> _RUNMW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: RUNMW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "Normal Run mode (RUN)"]
#[inline]
pub fn _00(self) -> &'a mut W {
self.variant(RUNMW::_00)
}
#[doc = "Very-Low-Power Run mode (VLPR)"]
#[inline]
pub fn _10(self) -> &'a mut W {
self.variant(RUNMW::_10)
}
#[doc = "High Speed Run mode (HSRUN)"]
#[inline]
pub fn _11(self) -> &'a mut W {
self.variant(RUNMW::_11)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 5;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:2 - Stop Mode Control"]
#[inline]
pub fn stopm(&self) -> STOPMR {
STOPMR::_from({
const MASK: u8 = 7;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 3 - Very Low Power Stop Aborted"]
#[inline]
pub fn vlpsa(&self) -> VLPSAR {
VLPSAR::_from({
const MASK: bool = true;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 5:6 - Run Mode Control"]
#[inline]
pub fn runm(&self) -> RUNMR {
RUNMR::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 5;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:2 - Stop Mode Control"]
#[inline]
pub fn stopm(&mut self) -> _STOPMW {
_STOPMW { w: self }
}
#[doc = "Bits 5:6 - Run Mode Control"]
#[inline]
pub fn runm(&mut self) -> _RUNMW {
_RUNMW { w: self }
}
}

300
src/smc/pmprot/mod.rs Normal file
View File

@ -0,0 +1,300 @@
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::PMPROT {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R { bits: self.register.get() }
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = "Possible values of the field `AVLP`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AVLPR {
#[doc = "VLPR and VLPS are not allowed."]
_0,
#[doc = "VLPR and VLPS are allowed."]
_1,
}
impl AVLPR {
#[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 {
AVLPR::_0 => false,
AVLPR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> AVLPR {
match value {
false => AVLPR::_0,
true => AVLPR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == AVLPR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == AVLPR::_1
}
}
#[doc = "Possible values of the field `AHSRUN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AHSRUNR {
#[doc = "HSRUN is not allowed"]
_0,
#[doc = "HSRUN is allowed"]
_1,
}
impl AHSRUNR {
#[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 {
AHSRUNR::_0 => false,
AHSRUNR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> AHSRUNR {
match value {
false => AHSRUNR::_0,
true => AHSRUNR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == AHSRUNR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == AHSRUNR::_1
}
}
#[doc = "Values that can be written to the field `AVLP`"]
pub enum AVLPW {
#[doc = "VLPR and VLPS are not allowed."]
_0,
#[doc = "VLPR and VLPS are allowed."]
_1,
}
impl AVLPW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
AVLPW::_0 => false,
AVLPW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _AVLPW<'a> {
w: &'a mut W,
}
impl<'a> _AVLPW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: AVLPW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "VLPR and VLPS are not allowed."]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(AVLPW::_0)
}
#[doc = "VLPR and VLPS are allowed."]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(AVLPW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 5;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `AHSRUN`"]
pub enum AHSRUNW {
#[doc = "HSRUN is not allowed"]
_0,
#[doc = "HSRUN is allowed"]
_1,
}
impl AHSRUNW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
AHSRUNW::_0 => false,
AHSRUNW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _AHSRUNW<'a> {
w: &'a mut W,
}
impl<'a> _AHSRUNW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: AHSRUNW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "HSRUN is not allowed"]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(AHSRUNW::_0)
}
#[doc = "HSRUN is allowed"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(AHSRUNW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 7;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 5 - Allow Very-Low-Power Modes"]
#[inline]
pub fn avlp(&self) -> AVLPR {
AVLPR::_from({
const MASK: bool = true;
const OFFSET: u8 = 5;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 7 - Allow High Speed Run mode"]
#[inline]
pub fn ahsrun(&self) -> AHSRUNR {
AHSRUNR::_from({
const MASK: bool = true;
const OFFSET: u8 = 7;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 5 - Allow Very-Low-Power Modes"]
#[inline]
pub fn avlp(&mut self) -> _AVLPW {
_AVLPW { w: self }
}
#[doc = "Bit 7 - Allow High Speed Run mode"]
#[inline]
pub fn ahsrun(&mut self) -> _AHSRUNW {
_AHSRUNW { w: self }
}
}

39
src/smc/pmstat/mod.rs Normal file
View File

@ -0,0 +1,39 @@
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::PMSTAT {
#[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 PMSTATR {
bits: u8,
}
impl PMSTATR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:7 - Power Mode Status"]
#[inline]
pub fn pmstat(&self) -> PMSTATR {
let bits = {
const MASK: u8 = 255;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u8
};
PMSTATR { bits }
}
}

165
src/smc/stopctrl/mod.rs Normal file
View File

@ -0,0 +1,165 @@
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::STOPCTRL {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R { bits: self.register.get() }
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = "Possible values of the field `STOPO`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STOPOR {
#[doc = "STOP1 - Stop with both system and bus clocks disabled"]
_01,
#[doc = "STOP2 - Stop with system clock disabled and bus clock enabled"]
_10,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl STOPOR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
STOPOR::_01 => 1,
STOPOR::_10 => 2,
STOPOR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> STOPOR {
match value {
1 => STOPOR::_01,
2 => STOPOR::_10,
i => STOPOR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `_01`"]
#[inline]
pub fn is_01(&self) -> bool {
*self == STOPOR::_01
}
#[doc = "Checks if the value of the field is `_10`"]
#[inline]
pub fn is_10(&self) -> bool {
*self == STOPOR::_10
}
}
#[doc = "Values that can be written to the field `STOPO`"]
pub enum STOPOW {
#[doc = "STOP1 - Stop with both system and bus clocks disabled"]
_01,
#[doc = "STOP2 - Stop with system clock disabled and bus clock enabled"]
_10,
}
impl STOPOW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
STOPOW::_01 => 1,
STOPOW::_10 => 2,
}
}
}
#[doc = r" Proxy"]
pub struct _STOPOW<'a> {
w: &'a mut W,
}
impl<'a> _STOPOW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: STOPOW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "STOP1 - Stop with both system and bus clocks disabled"]
#[inline]
pub fn _01(self) -> &'a mut W {
self.variant(STOPOW::_01)
}
#[doc = "STOP2 - Stop with system clock disabled and bus clock enabled"]
#[inline]
pub fn _10(self) -> &'a mut W {
self.variant(STOPOW::_10)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 6;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 6:7 - Stop Option"]
#[inline]
pub fn stopo(&self) -> STOPOR {
STOPOR::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 6;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 3 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 6:7 - Stop Option"]
#[inline]
pub fn stopo(&mut self) -> _STOPOW {
_STOPOW { w: self }
}
}

101
src/smc/verid/mod.rs Normal file
View File

@ -0,0 +1,101 @@
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::VERID {
#[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 `FEATURE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FEATURER {
#[doc = "Standard features implemented"]
_0,
#[doc = r" Reserved"]
_Reserved(u16),
}
impl FEATURER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u16 {
match *self {
FEATURER::_0 => 0,
FEATURER::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u16) -> FEATURER {
match value {
0 => FEATURER::_0,
i => FEATURER::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == FEATURER::_0
}
}
#[doc = r" Value of the field"]
pub struct MINORR {
bits: u8,
}
impl MINORR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct MAJORR {
bits: u8,
}
impl MAJORR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:15 - Feature Specification Number"]
#[inline]
pub fn feature(&self) -> FEATURER {
FEATURER::_from({
const MASK: u16 = 65535;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u16
})
}
#[doc = "Bits 16:23 - Minor Version Number"]
#[inline]
pub fn minor(&self) -> MINORR {
let bits = {
const MASK: u8 = 255;
const OFFSET: u8 = 16;
((self.bits >> OFFSET) & MASK as u32) as u8
};
MINORR { bits }
}
#[doc = "Bits 24:31 - Major Version Number"]
#[inline]
pub fn major(&self) -> MAJORR {
let bits = {
const MASK: u8 = 255;
const OFFSET: u8 = 24;
((self.bits >> OFFSET) & MASK as u32) as u8
};
MAJORR { bits }
}
}