pub struct SebootFrame { /* private fields */ }Expand description
SEBOOT command frame builder.
Builds frames according to the official HiSilicon SEBOOT protocol.
Implementations§
Source§impl SebootFrame
impl SebootFrame
Sourcepub fn new(frame_type: CommandType) -> Self
pub fn new(frame_type: CommandType) -> Self
Create a new frame with the given command type.
Sourcepub fn handshake(baud_rate: u32) -> Self
pub fn handshake(baud_rate: u32) -> Self
Build handshake frame.
Frame structure (18 bytes total):
- Magic: 4 bytes (0xDEADBEEF)
- Length: 2 bytes (0x0012 = 18)
- Type: 1 byte (0xF0)
- ~Type: 1 byte (0x0F)
- BaudRate: 4 bytes
- DataBits: 1 byte
- StopBits: 1 byte
- Parity: 1 byte
- FlowCtrl: 1 byte
- CRC16: 2 bytes
Sourcepub fn set_baud_rate(baud_rate: u32) -> Self
pub fn set_baud_rate(baud_rate: u32) -> Self
Build set baud rate frame.
Sourcepub fn download_flash_image(
addr: u32,
len: u32,
erase_size: u32,
is_rom: bool,
) -> Self
pub fn download_flash_image( addr: u32, len: u32, erase_size: u32, is_rom: bool, ) -> Self
Build download flash image frame.
Frame structure (24 bytes total):
- Magic: 4 bytes
- Length: 2 bytes (0x0018 = 24)
- Type: 1 byte (0xD2)
- ~Type: 1 byte (0x2D)
- FileAddr: 4 bytes (flash address)
- FileLen: 4 bytes (data length)
- EraseSize: 4 bytes (size to erase, 0xFFFFFFFF for full)
- Formal: 1 byte (0x00 for normal)
- ~Formal: 1 byte (0xFF)
- CRC16: 2 bytes
Sourcepub fn download_factory_bin(addr: u32, len: u32, erase_size: u32) -> Self
pub fn download_factory_bin(addr: u32, len: u32, erase_size: u32) -> Self
Build download factory bin frame.
Sourcepub fn download_nv(
addr: u32,
len: u32,
erase_size: u32,
erase_all: bool,
) -> Self
pub fn download_nv( addr: u32, len: u32, erase_size: u32, erase_all: bool, ) -> Self
Build download NV frame.
Sourcepub fn download_otp_efuse(len: u32) -> Self
pub fn download_otp_efuse(len: u32) -> Self
Build download OTP/eFuse frame.
Sourcepub fn download_version(len: u32) -> Self
pub fn download_version(len: u32) -> Self
Build download version frame.
Sourcepub fn upload_data(addr: u32, len: u32) -> Self
pub fn upload_data(addr: u32, len: u32) -> Self
Build upload data frame.
Sourcepub fn read_otp_efuse(start_bit: u16, bit_width: u16) -> Self
pub fn read_otp_efuse(start_bit: u16, bit_width: u16) -> Self
Build read OTP/eFuse frame.
Sourcepub fn flash_lock(param: u16) -> Self
pub fn flash_lock(param: u16) -> Self
Build flash lock frame.
Sourcepub fn switch_dfu() -> Self
pub fn switch_dfu() -> Self
Build switch to DFU mode frame.
Sourcepub fn command_type(&self) -> CommandType
pub fn command_type(&self) -> CommandType
Get the command type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SebootFrame
impl RefUnwindSafe for SebootFrame
impl Send for SebootFrame
impl Sync for SebootFrame
impl Unpin for SebootFrame
impl UnsafeUnpin for SebootFrame
impl UnwindSafe for SebootFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more