Struct ti_sbl::Device [−][src]
pub struct Device<P> { /* fields omitted */ }
A TI connected device supporting the Serial Bootloader Interface (SBL).
Implementations
impl<P> Device<P> where
P: SerialPort,
[src]
impl<P> Device<P> where
P: SerialPort,
[src]pub fn new(port: P, family: Family) -> Result<Self>
[src]
Create a new Device
from an already opened port.
This will synchronize the baudrate with the device.
Note
This functions expects the device to be already in bootloader mode,
to enter bootloader please reset the device into this mode or use
invoke_bootloader
function to enter the bootloader on the device
(on supported boards).
pub fn family(&self) -> Family
[src]
Returns the Family
of the device.
pub fn ping(&mut self) -> Result<bool>
[src]
Ping the bootloader.
pub fn download(
&mut self,
program_address: u32,
program_size: u32
) -> Result<()>
[src]
&mut self,
program_address: u32,
program_size: u32
) -> Result<()>
Prepares flash programming.
Notes
This command must be followed by a Device::get_status
command
to verify it worked.
pub fn get_status(&mut self) -> Result<u8>
[src]
Get the status of the last issued command.
pub fn send_data<D>(&mut self, data: &D) -> Result<bool> where
D: AsRef<[u8]>,
[src]
D: AsRef<[u8]>,
Send data to be written into the flash memory.
The return value represents if the command was acknowledged or not, if not acknowledged the write address is not incrmeneted by the device which allows for retransmissions of the previous data.
Note
This only does work after a Device::download
command
has been issued.
After issuing this command, Device::get_status
command
should be used to check for errors.
Panics
This function will panic if the data
length in bytes is
higher than constants::MAX_BYTES_PER_TRANSFER
.
pub fn get_chip_id(&mut self) -> Result<u32>
[src]
Read chip ID.
pub fn erase(&mut self, address: u32, byte_count: u32) -> Result<()>
[src]
Erase. Only supported on Family::CC2538
.
pub fn sector_erase(&mut self, address: u32) -> Result<()>
[src]
Sector erase. Only supported on Family::CC26X0
and Family::CC26X2
.
The size of each sector is specified at Family::sector_size
.
Parameters
address
: The start address of the sector.
Panics
- This function panics if the family doesn’t support this command.
- This function panics if the
address
isn’t the start of a sector.
See util::erase_flash_range
for an easier to use wrapper of this
function.
pub fn set_xosc(&mut self) -> Result<()>
[src]
Switch to XOSC. Only supported on Family::CC2538
.
Panics
This function panics if the family doesn’t support this command.
pub fn memory_read_32(&mut self, address: u32, data: &mut [u8]) -> Result<()>
[src]
Read memory using 32-bit access type.
Parameters
address
: the memory address to read. Must be aligned to 32-bits.data
: where the data will be stored. Can’t be higher than63 * 4
bytes. The number of bytes MUST be exactly divisible by 4.
Panics
- This function will panic if the length of the
data
slice is higher than63 * 4
bytes, this is the maximum number of accesses that can be done using this mode. - This function will panic if the
address
is not aligned to 32-bits.
Trait Implementations
Auto Trait Implementations
impl<P> RefUnwindSafe for Device<P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
impl<P> Send for Device<P> where
P: Send,
P: Send,
impl<P> Sync for Device<P> where
P: Sync,
P: Sync,
impl<P> Unpin for Device<P> where
P: Unpin,
P: Unpin,
impl<P> UnwindSafe for Device<P> where
P: UnwindSafe,
P: UnwindSafe,