#[doc = "Register `AESACTL0` reader"]
pub type R = crate::R<Aesactl0Spec>;
#[doc = "Register `AESACTL0` writer"]
pub type W = crate::W<Aesactl0Spec>;
#[doc = "AES Operation Bit: 0\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Aesop {
#[doc = "0: AES Operation: Encrypt"]
Aesop0 = 0,
#[doc = "1: AES Operation: Decrypt (same Key)"]
Aesop1 = 1,
#[doc = "2: AES Operation: Generate first round Key"]
Aesop2 = 2,
#[doc = "3: AES Operation: Decrypt (first round Key)"]
Aesop3 = 3,
}
impl From<Aesop> for u8 {
#[inline(always)]
fn from(variant: Aesop) -> Self {
variant as _
}
}
impl crate::FieldSpec for Aesop {
type Ux = u8;
}
impl crate::IsEnum for Aesop {}
#[doc = "Field `AESOP` reader - AES Operation Bit: 0"]
pub type AesopR = crate::FieldReader<Aesop>;
impl AesopR {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub const fn variant(&self) -> Aesop {
match self.bits {
0 => Aesop::Aesop0,
1 => Aesop::Aesop1,
2 => Aesop::Aesop2,
3 => Aesop::Aesop3,
_ => unreachable!(),
}
}
#[doc = "AES Operation: Encrypt"]
#[inline(always)]
pub fn is_aesop_0(&self) -> bool {
*self == Aesop::Aesop0
}
#[doc = "AES Operation: Decrypt (same Key)"]
#[inline(always)]
pub fn is_aesop_1(&self) -> bool {
*self == Aesop::Aesop1
}
#[doc = "AES Operation: Generate first round Key"]
#[inline(always)]
pub fn is_aesop_2(&self) -> bool {
*self == Aesop::Aesop2
}
#[doc = "AES Operation: Decrypt (first round Key)"]
#[inline(always)]
pub fn is_aesop_3(&self) -> bool {
*self == Aesop::Aesop3
}
}
#[doc = "Field `AESOP` writer - AES Operation Bit: 0"]
pub type AesopW<'a, REG> = crate::FieldWriter<'a, REG, 2, Aesop, crate::Safe>;
impl<'a, REG> AesopW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[doc = "AES Operation: Encrypt"]
#[inline(always)]
pub fn aesop_0(self) -> &'a mut crate::W<REG> {
self.variant(Aesop::Aesop0)
}
#[doc = "AES Operation: Decrypt (same Key)"]
#[inline(always)]
pub fn aesop_1(self) -> &'a mut crate::W<REG> {
self.variant(Aesop::Aesop1)
}
#[doc = "AES Operation: Generate first round Key"]
#[inline(always)]
pub fn aesop_2(self) -> &'a mut crate::W<REG> {
self.variant(Aesop::Aesop2)
}
#[doc = "AES Operation: Decrypt (first round Key)"]
#[inline(always)]
pub fn aesop_3(self) -> &'a mut crate::W<REG> {
self.variant(Aesop::Aesop3)
}
}
#[doc = "Field `AESSWRST` reader - AES Software Reset"]
pub type AesswrstR = crate::BitReader;
#[doc = "Field `AESSWRST` writer - AES Software Reset"]
pub type AesswrstW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `AESRDYIFG` reader - AES ready interrupt flag"]
pub type AesrdyifgR = crate::BitReader;
#[doc = "Field `AESRDYIFG` writer - AES ready interrupt flag"]
pub type AesrdyifgW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `AESERRFG` reader - AES Error Flag"]
pub type AeserrfgR = crate::BitReader;
#[doc = "Field `AESERRFG` writer - AES Error Flag"]
pub type AeserrfgW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `AESRDYIE` reader - AES ready interrupt enable"]
pub type AesrdyieR = crate::BitReader;
#[doc = "Field `AESRDYIE` writer - AES ready interrupt enable"]
pub type AesrdyieW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[doc = "Bits 0:1 - AES Operation Bit: 0"]
#[inline(always)]
pub fn aesop(&self) -> AesopR {
AesopR::new((self.bits & 3) as u8)
}
#[doc = "Bit 7 - AES Software Reset"]
#[inline(always)]
pub fn aesswrst(&self) -> AesswrstR {
AesswrstR::new(((self.bits >> 7) & 1) != 0)
}
#[doc = "Bit 8 - AES ready interrupt flag"]
#[inline(always)]
pub fn aesrdyifg(&self) -> AesrdyifgR {
AesrdyifgR::new(((self.bits >> 8) & 1) != 0)
}
#[doc = "Bit 11 - AES Error Flag"]
#[inline(always)]
pub fn aeserrfg(&self) -> AeserrfgR {
AeserrfgR::new(((self.bits >> 11) & 1) != 0)
}
#[doc = "Bit 12 - AES ready interrupt enable"]
#[inline(always)]
pub fn aesrdyie(&self) -> AesrdyieR {
AesrdyieR::new(((self.bits >> 12) & 1) != 0)
}
}
impl W {
#[doc = "Bits 0:1 - AES Operation Bit: 0"]
#[inline(always)]
pub fn aesop(&mut self) -> AesopW<'_, Aesactl0Spec> {
AesopW::new(self, 0)
}
#[doc = "Bit 7 - AES Software Reset"]
#[inline(always)]
pub fn aesswrst(&mut self) -> AesswrstW<'_, Aesactl0Spec> {
AesswrstW::new(self, 7)
}
#[doc = "Bit 8 - AES ready interrupt flag"]
#[inline(always)]
pub fn aesrdyifg(&mut self) -> AesrdyifgW<'_, Aesactl0Spec> {
AesrdyifgW::new(self, 8)
}
#[doc = "Bit 11 - AES Error Flag"]
#[inline(always)]
pub fn aeserrfg(&mut self) -> AeserrfgW<'_, Aesactl0Spec> {
AeserrfgW::new(self, 11)
}
#[doc = "Bit 12 - AES ready interrupt enable"]
#[inline(always)]
pub fn aesrdyie(&mut self) -> AesrdyieW<'_, Aesactl0Spec> {
AesrdyieW::new(self, 12)
}
}
#[doc = "AES accelerator control register 0\n\nYou can [`read`](crate::Reg::read) this register and get [`aesactl0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`aesactl0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Aesactl0Spec;
impl crate::RegisterSpec for Aesactl0Spec {
type Ux = u16;
}
#[doc = "`read()` method returns [`aesactl0::R`](R) reader structure"]
impl crate::Readable for Aesactl0Spec {}
#[doc = "`write(|w| ..)` method takes [`aesactl0::W`](W) writer structure"]
impl crate::Writable for Aesactl0Spec {
type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets AESACTL0 to value 0"]
impl crate::Resettable for Aesactl0Spec {}