Struct atsamd_hal::nvm::Nvm
source · [−]pub struct Nvm { /* private fields */ }
Expand description
Non-volatile memory controller
Implementations
sourceimpl Nvm
impl Nvm
sourcepub unsafe fn bank_swap(&mut self) -> !
pub unsafe fn bank_swap(&mut self) -> !
Swap the flash banks. The processor will be reset, after which the inactive bank will become the active bank.
Safety
Ensure there is a working, memory safe program in place in the inactive bank before calling.
sourcepub fn power_reduction_mode(&mut self, prm: PRM_A)
pub fn power_reduction_mode(&mut self, prm: PRM_A)
Set the power reduction mode
sourcepub fn is_boot_protected(&self) -> bool
pub fn is_boot_protected(&self) -> bool
Check if the flash is boot protected
sourcepub fn first_bank(&self) -> PhysicalBank
pub fn first_bank(&self) -> PhysicalBank
Get first bank
sourcepub fn calibration_area(&self) -> CalibrationArea
pub fn calibration_area(&self) -> CalibrationArea
Read the calibration area
sourcepub fn temperatures_calibration_area(&self) -> TemperaturesCalibrationArea
pub fn temperatures_calibration_area(&self) -> TemperaturesCalibrationArea
Read the calibration area for temperatures
sourcepub fn boot_protection(&mut self, protect: bool) -> Result<()>
pub fn boot_protection(&mut self, protect: bool) -> Result<()>
Enable/disable boot protection on/off
Userpage’s NVM BOOT field defines a memory region that is supposed to be
protected. NVMCTRL.STATUS.BOOTPROT
is a readonly HW register populated
on reset with a value from a userpage. By default, 0
sourcepub unsafe fn write_from_slice(
&mut self,
destination_address: u32,
source_slice: &[u32]
) -> Result<()>
pub unsafe fn write_from_slice(
&mut self,
destination_address: u32,
source_slice: &[u32]
) -> Result<()>
sourcepub unsafe fn write(
&mut self,
destination_address: u32,
source_address: u32,
words: u32
) -> Result<()>
pub unsafe fn write(
&mut self,
destination_address: u32,
source_address: u32,
words: u32
) -> Result<()>
Write to flash memory
Safety
If either destination_address
or source_address
are not
word-aligned, an error is returned.
Writes to flash goes through the NVM controller
NVM controller sets the PROGE
/LOCKE
flag if an error occurs,
this is checked in manage_error_states
to propagate
the relevant error code
sourcepub unsafe fn erase(
&mut self,
address: u32,
length: u32,
granularity: EraseGranularity
) -> Result<()>
pub unsafe fn erase(
&mut self,
address: u32,
length: u32,
granularity: EraseGranularity
) -> Result<()>
Erase flash memory.
Unit of length
depends on a chosen erasing granularity.
Safety
Erasing flash goes through the NVM controller
NVM controller sets the PROGE
/LOCKE
flag if an error occurs,
this is checked in manage_error_states
to propagate
the relevant error code.
sourcepub fn smart_eeprom(&mut self) -> Result<'_>
pub fn smart_eeprom(&mut self) -> Result<'_>
Retrieve SmartEEPROM