rust-embedded-talk/example-source/msp432p401r/src/aes256/aesastat.rs

541 lines
14 KiB
Rust

#[doc = r" Value read from the register"]
pub struct R {
bits: u16,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u16,
}
impl super::AESASTAT {
#[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 `AESBUSY`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AESBUSYR {
#[doc = "Not busy"]
AESBUSY_0,
#[doc = "Busy"]
AESBUSY_1,
}
impl AESBUSYR {
#[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 {
AESBUSYR::AESBUSY_0 => false,
AESBUSYR::AESBUSY_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> AESBUSYR {
match value {
false => AESBUSYR::AESBUSY_0,
true => AESBUSYR::AESBUSY_1,
}
}
#[doc = "Checks if the value of the field is `AESBUSY_0`"]
#[inline]
pub fn is_aesbusy_0(&self) -> bool {
*self == AESBUSYR::AESBUSY_0
}
#[doc = "Checks if the value of the field is `AESBUSY_1`"]
#[inline]
pub fn is_aesbusy_1(&self) -> bool {
*self == AESBUSYR::AESBUSY_1
}
}
#[doc = "Possible values of the field `AESKEYWR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AESKEYWRR {
#[doc = "Not all bytes written"]
AESKEYWR_0,
#[doc = "All bytes written"]
AESKEYWR_1,
}
impl AESKEYWRR {
#[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 {
AESKEYWRR::AESKEYWR_0 => false,
AESKEYWRR::AESKEYWR_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> AESKEYWRR {
match value {
false => AESKEYWRR::AESKEYWR_0,
true => AESKEYWRR::AESKEYWR_1,
}
}
#[doc = "Checks if the value of the field is `AESKEYWR_0`"]
#[inline]
pub fn is_aeskeywr_0(&self) -> bool {
*self == AESKEYWRR::AESKEYWR_0
}
#[doc = "Checks if the value of the field is `AESKEYWR_1`"]
#[inline]
pub fn is_aeskeywr_1(&self) -> bool {
*self == AESKEYWRR::AESKEYWR_1
}
}
#[doc = "Possible values of the field `AESDINWR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AESDINWRR {
#[doc = "Not all bytes written"]
AESDINWR_0,
#[doc = "All bytes written"]
AESDINWR_1,
}
impl AESDINWRR {
#[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 {
AESDINWRR::AESDINWR_0 => false,
AESDINWRR::AESDINWR_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> AESDINWRR {
match value {
false => AESDINWRR::AESDINWR_0,
true => AESDINWRR::AESDINWR_1,
}
}
#[doc = "Checks if the value of the field is `AESDINWR_0`"]
#[inline]
pub fn is_aesdinwr_0(&self) -> bool {
*self == AESDINWRR::AESDINWR_0
}
#[doc = "Checks if the value of the field is `AESDINWR_1`"]
#[inline]
pub fn is_aesdinwr_1(&self) -> bool {
*self == AESDINWRR::AESDINWR_1
}
}
#[doc = "Possible values of the field `AESDOUTRD`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AESDOUTRDR {
#[doc = "Not all bytes read"]
AESDOUTRD_0,
#[doc = "All bytes read"]
AESDOUTRD_1,
}
impl AESDOUTRDR {
#[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 {
AESDOUTRDR::AESDOUTRD_0 => false,
AESDOUTRDR::AESDOUTRD_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> AESDOUTRDR {
match value {
false => AESDOUTRDR::AESDOUTRD_0,
true => AESDOUTRDR::AESDOUTRD_1,
}
}
#[doc = "Checks if the value of the field is `AESDOUTRD_0`"]
#[inline]
pub fn is_aesdoutrd_0(&self) -> bool {
*self == AESDOUTRDR::AESDOUTRD_0
}
#[doc = "Checks if the value of the field is `AESDOUTRD_1`"]
#[inline]
pub fn is_aesdoutrd_1(&self) -> bool {
*self == AESDOUTRDR::AESDOUTRD_1
}
}
#[doc = r" Value of the field"]
pub struct AESKEYCNTXR {
bits: u8,
}
impl AESKEYCNTXR {
#[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 AESDINCNTXR {
bits: u8,
}
impl AESDINCNTXR {
#[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 AESDOUTCNTXR {
bits: u8,
}
impl AESDOUTCNTXR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = "Values that can be written to the field `AESBUSY`"]
pub enum AESBUSYW {
#[doc = "Not busy"]
AESBUSY_0,
#[doc = "Busy"]
AESBUSY_1,
}
impl AESBUSYW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
AESBUSYW::AESBUSY_0 => false,
AESBUSYW::AESBUSY_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _AESBUSYW<'a> {
w: &'a mut W,
}
impl<'a> _AESBUSYW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: AESBUSYW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Not busy"]
#[inline]
pub fn aesbusy_0(self) -> &'a mut W {
self.variant(AESBUSYW::AESBUSY_0)
}
#[doc = "Busy"]
#[inline]
pub fn aesbusy_1(self) -> &'a mut W {
self.variant(AESBUSYW::AESBUSY_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 = 0;
self.w.bits &= !((MASK as u16) << OFFSET);
self.w.bits |= ((value & MASK) as u16) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `AESKEYWR`"]
pub enum AESKEYWRW {
#[doc = "Not all bytes written"]
AESKEYWR_0,
#[doc = "All bytes written"]
AESKEYWR_1,
}
impl AESKEYWRW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
AESKEYWRW::AESKEYWR_0 => false,
AESKEYWRW::AESKEYWR_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _AESKEYWRW<'a> {
w: &'a mut W,
}
impl<'a> _AESKEYWRW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: AESKEYWRW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Not all bytes written"]
#[inline]
pub fn aeskeywr_0(self) -> &'a mut W {
self.variant(AESKEYWRW::AESKEYWR_0)
}
#[doc = "All bytes written"]
#[inline]
pub fn aeskeywr_1(self) -> &'a mut W {
self.variant(AESKEYWRW::AESKEYWR_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 = 1;
self.w.bits &= !((MASK as u16) << OFFSET);
self.w.bits |= ((value & MASK) as u16) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `AESDINWR`"]
pub enum AESDINWRW {
#[doc = "Not all bytes written"]
AESDINWR_0,
#[doc = "All bytes written"]
AESDINWR_1,
}
impl AESDINWRW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
AESDINWRW::AESDINWR_0 => false,
AESDINWRW::AESDINWR_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _AESDINWRW<'a> {
w: &'a mut W,
}
impl<'a> _AESDINWRW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: AESDINWRW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Not all bytes written"]
#[inline]
pub fn aesdinwr_0(self) -> &'a mut W {
self.variant(AESDINWRW::AESDINWR_0)
}
#[doc = "All bytes written"]
#[inline]
pub fn aesdinwr_1(self) -> &'a mut W {
self.variant(AESDINWRW::AESDINWR_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 = 2;
self.w.bits &= !((MASK as u16) << OFFSET);
self.w.bits |= ((value & MASK) as u16) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u16 {
self.bits
}
#[doc = "Bit 0 - AES accelerator module busy"]
#[inline]
pub fn aesbusy(&self) -> AESBUSYR {
AESBUSYR::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u16) != 0
})
}
#[doc = "Bit 1 - All 16 bytes written to AESAKEY"]
#[inline]
pub fn aeskeywr(&self) -> AESKEYWRR {
AESKEYWRR::_from({
const MASK: bool = true;
const OFFSET: u8 = 1;
((self.bits >> OFFSET) & MASK as u16) != 0
})
}
#[doc = "Bit 2 - All 16 bytes written to AESADIN, AESAXDIN or AESAXIN"]
#[inline]
pub fn aesdinwr(&self) -> AESDINWRR {
AESDINWRR::_from({
const MASK: bool = true;
const OFFSET: u8 = 2;
((self.bits >> OFFSET) & MASK as u16) != 0
})
}
#[doc = "Bit 3 - All 16 bytes read from AESADOUT"]
#[inline]
pub fn aesdoutrd(&self) -> AESDOUTRDR {
AESDOUTRDR::_from({
const MASK: bool = true;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u16) != 0
})
}
#[doc = "Bits 4:7 - Bytes written via AESAKEY for AESKLx=00, half-words written via AESAKEY"]
#[inline]
pub fn aeskeycntx(&self) -> AESKEYCNTXR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u16) as u8
};
AESKEYCNTXR { bits }
}
#[doc = "Bits 8:11 - Bytes written via AESADIN, AESAXDIN or AESAXIN"]
#[inline]
pub fn aesdincntx(&self) -> AESDINCNTXR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 8;
((self.bits >> OFFSET) & MASK as u16) as u8
};
AESDINCNTXR { bits }
}
#[doc = "Bits 12:15 - Bytes read via AESADOUT"]
#[inline]
pub fn aesdoutcntx(&self) -> AESDOUTCNTXR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 12;
((self.bits >> OFFSET) & MASK as u16) as u8
};
AESDOUTCNTXR { bits }
}
}
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: u16) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - AES accelerator module busy"]
#[inline]
pub fn aesbusy(&mut self) -> _AESBUSYW {
_AESBUSYW { w: self }
}
#[doc = "Bit 1 - All 16 bytes written to AESAKEY"]
#[inline]
pub fn aeskeywr(&mut self) -> _AESKEYWRW {
_AESKEYWRW { w: self }
}
#[doc = "Bit 2 - All 16 bytes written to AESADIN, AESAXDIN or AESAXIN"]
#[inline]
pub fn aesdinwr(&mut self) -> _AESDINWRW {
_AESDINWRW { w: self }
}
}