Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


SSL protocol.rs   Interaktion und
PortierbarkeitRust

 

use num_enum::{IntoPrimitive, TryFromPrimitive};
use strum_macros::{EnumString, EnumVariantNames};

pub const START_BYTE: u8 = 0x5A;

// The default, minimum-required max packet size for any bootrom appears to be 32 bytes: (a command
// packet with 7 parameters).
//
// RT500RM 18.7.2.6.5 Command packet:
// "Parameters: The parameters are word-length (32 bits). With the default maximum packet size of
// 32 bytes, a command packet can contain up to 7 parameters."
//
// RT500RM 18.7.2.11.1.3 HID Reports:
// "minimum boot ROM packet size of 32 bytes"
pub const MIN_MAX_PACKET_SIZE: usize = 32;

// RT500RM 18.7.2.6.3 Framing packet
pub const FRAMING_HEADER_SIZE: usize = 6;

#[derive(Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
#[repr(u8)]
pub enum FramingPacketType {
    /// The previous packet was received successfully; the sending of more packets is allowed.
    Ack = 0xA1,

    /// The previous packet was corrupted and must be re-sent.
    Nak = 0xA2,

    /// Data phase is being aborted.
    AckAbort = 0xA3,

    /// The framing packet contains a command packet payload.
    Command = 0xA4,

    /// The framing packet contains a data packet payload.
    Data = 0xA5,

    /// Sent to verify the other side is alive. Also used for UART autobaud.
    Ping = 0xA6,

    /// A response to Ping; contains the framing protocol version number and options.
    PingResponse = 0xA7,
}

pub const COMMAND_MAX_PARAMS: usize = 7;

pub const COMMAND_FLAG_HAS_DATA: u8 = 1 << 0;

#[derive(Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
#[repr(u8)]
pub enum CommandTag {
    // RT500RM Table 104. Command Tags
    FlashEraseAll = 0x01,
    FlashEraseRegion = 0x02,
    ReadMemory = 0x03,
    WriteMemory = 0x04,
    FillMemory = 0x05,
    GetProperty = 0x07,
    ReceiveSbFile = 0x08,
    Execute = 0x09,
    Call = 0x0A,
    Reset = 0x0B,
    SetProperty = 0x0C,
    EfuseProgram = 0x0E,
    EfuseRead = 0x0F,
    ConfigureMemory = 0x11,
    KeyProvision = 0x15,
}

#[allow(clippy::enum_variant_names)] // We want to use the names from the manual.
#[derive(Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
#[repr(u8)]
pub enum ResponseTag {
    // RT500RM Table 105. Response Tags
    GenericResponse = 0xA0,
    ReadMemoryResponse = 0xA3,
    GetPropertyResponse = 0xA7,
    FlashReadOnceResponse = 0xAF,
    KeyProvisionResponse = 0xB5,
}

#[derive(
    Clone, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive, EnumString, EnumVariantNames,
)]
#[repr(u32)]
pub enum PropertyTag {
    // RT500RM 18.7.2.7.17 Supported properties in GetProperty and SetProperty
    CurrentVersion = 1,
    AvailablePeripherals = 2,
    FlashStartAddress = 3,
    FlashSizeInBytes = 4,
    FlashSectorSize = 5,
    AvailableCommands = 7,
    CRCCheckStatus = 8,
    VerifyWrites = 10,
    MaxPacketSize = 11,
    // kReservedRegions = ??,
    RAMStartAddress = 14,
    RAMSizeInBytes = 15,
    SecurityState = 17,
    UniqueDeviceId = 18,
    TargetVersion = 24,
    FlashPageSize = 27,
    IrqNotifierPin = 28,
}

Messung
CHZG
909810096

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.28Angebot  ¤

*Eine klare Vorstellung vom Zielzustand







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,049
#Domains=861,433