fn write_command_header(
        &self,
        cmd: Command,
        cmd_format: Format,
        callseq: Sequence,
        key: KeyID,
    ) -> Result<(), CommandResult> {
        match cmd {
            Command::InitRng
            | Command::Rng
            | Command::LoadPlainKey
            | Command::EncCbc
            | Command::DecCbc
            | Command::GenerateMac
            | Command::VerifyMac => (),
            _ => unimplemented!("Command {:?}", cmd),
        };

        #[rustfmt::skip]
        self.cse_pram.embedded_ram0.write(|w| unsafe {
            w.byte_0().bits(cmd as u8)
                .byte_1().bits(cmd_format as u8)
                .byte_2().bits(callseq as u8)
                .byte_3().bits(key as u8)
        });

        // Wait until the operation has finished
        while self.ftfc.fstat.read().ccif().bit_is_clear() {}

        let status = CommandResult::from_u16(self.read_command_halfword(ERROR_BITS_OFFSET));
        match status {
            CommandResult::NoError => Ok(()),
            _ => Err(status),
        }
    }
/// Writes the command header to `CSE_PRAM`, triggering the CSEc operation.
/// Blocks until the operation has finished.
Writes the command header to `CSE_PRAM`, triggering the CSEc operation.
Blocks until the operation has finished.
Writes the command header to ` CSE_PRAM ` triggering the CSEc operation . Blocks until the operation has finished .
fn write_command_header(
        &self,
        cmd: Command,
        cmd_format: Format,
        callseq: Sequence,
        key: KeyID,
    ) -> Result<(), CommandResult> {
        match cmd {
            Command::InitRng
            | Command::Rng
            | Command::LoadPlainKey
            | Command::EncCbc
            | Command::DecCbc
            | Command::GenerateMac
            | Command::VerifyMac => (),
            _ => unimplemented!("Command {:?}", cmd),
        };
        #[rustfmt::skip]
        self.cse_pram.embedded_ram0.write(|w| unsafe {
            w.byte_0().bits(cmd as u8)
                .byte_1().bits(cmd_format as u8)
                .byte_2().bits(callseq as u8)
                .byte_3().bits(key as u8)
        });
        // Wait until the operation has finished
        while self.ftfc.fstat.read().ccif().bit_is_clear() {}
        let status = CommandResult::from_u16(self.read_command_halfword(ERROR_BITS_OFFSET));
        match status {
            CommandResult::NoError => Ok(()),
            _ => Err(status),
        }
    }
fn write_command_header ( & self , cmd : Command , cmd_format : Format , callseq : Sequence , key : KeyID , ) -> Result < ( ) , CommandResult > { match cmd { Command :: InitRng | Command :: Rng | Command :: LoadPlainKey | Command :: EncCbc | Command :: DecCbc | Command :: GenerateMac | Command :: VerifyMac => ( ) , _ => unimplemented ! ( " " cmd ) , } ; # [ rustfmt :: skip ] self . cse_pram . embedded_ram0 . write ( | w | unsafe { w . byte_0 ( ) . bits ( cmd as u8 ) . byte_1 ( ) . bits ( cmd_format as u8 ) . byte_2 ( ) . bits ( callseq as u8 ) . byte_3 ( ) . bits ( key as u8 ) } ) ; // Wait until the operation has finished while self . ftfc . fstat . read ( ) . ccif ( ) . bit_is_clear ( ) { } let status = CommandResult :: from_u16 ( self . read_command_halfword ( ERROR_BITS_OFFSET ) ) ; match status { CommandResult :: NoError => Ok ( ( ) ) , _ => Err ( status ) , } }
Writes the command header to `CSE_PRAM`, triggering the CSEc operation.
Writes the command header to ` CSE_PRAM ` triggering the CSEc operation .
&self
cmd
Command
cmd_format
Format
callseq
Sequence
key
KeyID