pub struct AmlogicSoC { /* private fields */ }Expand description
The main interface for interacting with Amlogic-based hardware
This provides low-level access to the Amlogic SoC on the Superbird device, allowing for memory operations, partition management, and firmware flashing.
Implementations§
Source§impl AmlogicSoC
impl AmlogicSoC
Sourcepub fn init(callback: Option<Callback>) -> Result<Self>
pub fn init(callback: Option<Callback>) -> Result<Self>
Initialize a connection to an Amlogic SoC device
This will search for a connected device, put it in the correct mode if necessary, and establish a connection for flashing operations.
§Parameters
callback: Optional callback function to receive status updates
§Returns
Result<Self>: A connected AmlogicSoC instance or an error
Sourcepub fn write_large_memory(
&self,
memory_address: u32,
data: &[u8],
block_length: usize,
append_zeros: bool,
) -> Result<()>
pub fn write_large_memory( &self, memory_address: u32, data: &[u8], block_length: usize, append_zeros: bool, ) -> Result<()>
Write large blocks of data to device memory
This is used for writing firmware images and other large data blocks.
§Parameters
memory_address: The memory address to write todata: The data to writeblock_length: The size of each block to transferappend_zeros: Whether to pad data with zeros to match block_length
§Returns
Result<()>: Success or an error
Sourcepub fn write_large_memory_to_disk<R: Read, F: Fn(FlashProgress)>(
&self,
disk_address: u32,
reader: &mut R,
data_size: usize,
block_length: usize,
append_zeros: bool,
progress_callback: F,
) -> Result<()>
pub fn write_large_memory_to_disk<R: Read, F: Fn(FlashProgress)>( &self, disk_address: u32, reader: &mut R, data_size: usize, block_length: usize, append_zeros: bool, progress_callback: F, ) -> Result<()>
Write large blocks of data directly to a disk address with progress tracking
§Parameters
disk_address: The disk address to write toreader: A reader providing the data to writedata_size: The total size of data to writeblock_length: The size of each block to transferappend_zeros: Whether to pad data with zeros to match block_lengthprogress_callback: Function to call with progress updates
§Returns
Result<()>: Success or an error
pub fn write_amlc_data(&self, offset: u32, data: &[u8]) -> Result<()>
pub fn write_amlc_data_packet( &self, seq: u8, amlc_offset: u32, data: &[u8], ) -> Result<()>
pub fn get_boot_amlc(&self) -> Result<(u32, u32)>
Sourcepub fn validate_partition_size(
&self,
part_name: &str,
part_info: &PartitionInfo,
) -> Result<usize>
pub fn validate_partition_size( &self, part_name: &str, part_info: &PartitionInfo, ) -> Result<usize>
Sourcepub fn restore_partition<R: Read, F: Fn(FlashProgress)>(
&self,
part_name: &str,
part_size: usize,
reader: R,
file_size: usize,
progress_callback: F,
) -> Result<()>
pub fn restore_partition<R: Read, F: Fn(FlashProgress)>( &self, part_name: &str, part_size: usize, reader: R, file_size: usize, progress_callback: F, ) -> Result<()>
Restore a partition from a data source
§Parameters
part_name: The name of the partition to restorepart_size: The size of the partitionreader: A reader providing the partition datafile_size: The size of the data being readprogress_callback: Function to call with progress updates
§Returns
Result<()>: Success or an error
Sourcepub fn unbrick(&self) -> Result<()>
pub fn unbrick(&self) -> Result<()>
Execute the unbrick procedure
This writes the emergency unbrick image to the device.
§Returns
Result<()>: Success or an error
Sourcepub fn host_setup() -> Result<()>
pub fn host_setup() -> Result<()>
Set up the host environment for USB access
On Linux, this creates udev rules to allow access to the device.
§Returns
Result<()>: Success or an error
Trait Implementations§
Source§impl Clone for AmlogicSoC
impl Clone for AmlogicSoC
Source§fn clone(&self) -> AmlogicSoC
fn clone(&self) -> AmlogicSoC
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more