feat: Block on rsa calls, remove Option<> results

This commit is contained in:
Sergio Gasquez 2025-01-08 11:27:48 +01:00
parent 8be4ff21a9
commit 8b0142d62e
5 changed files with 8 additions and 17 deletions

View File

@ -12,11 +12,8 @@ impl<Dm: crate::DriverMode> Rsa<'_, Dm> {
/// After the RSA Accelerator is released from reset, the memory blocks
/// needs to be initialized, only after that peripheral should be used.
/// This function would return without an error if the memory is initialized
pub fn ready(&mut self) -> Option<()> {
if self.rsa.clean().read().clean().bit_is_clear() {
return None;
}
Some(())
pub fn ready(&mut self) {
while !self.rsa.clean().read().clean().bit_is_clear() {}
}
/// Writes the multi-mode configuration to the RSA hardware.

View File

@ -12,11 +12,8 @@ impl<Dm: crate::DriverMode> Rsa<'_, Dm> {
/// After the RSA Accelerator is released from reset, the memory blocks
/// needs to be initialized, only after that peripheral should be used.
/// This function would return without an error if the memory is initialized
pub fn ready(&mut self) -> Option<()> {
if self.rsa.query_clean().read().query_clean().bit_is_clear() {
return None;
}
Some(())
pub fn ready(&mut self) {
while !self.rsa.query_clean().read().query_clean().bit_is_clear() {}
}
/// Enables/disables rsa interrupt.

View File

@ -13,11 +13,8 @@ impl<Dm: crate::DriverMode> Rsa<'_, Dm> {
/// needs to be initialized, only after that peripheral should be used.
/// This function would return without an error if the memory is
/// initialized.
pub fn ready(&mut self) -> Option<()> {
if self.rsa.clean().read().clean().bit_is_clear() {
return None;
}
Some(())
pub fn ready(&mut self) {
while !self.rsa.clean().read().clean().bit_is_clear() {}
}
/// Enables/disables rsa interrupt.

View File

@ -56,7 +56,7 @@ mod tests {
fn init() -> Context<'static> {
let peripherals = esp_hal::init(esp_hal::Config::default());
let mut rsa = Rsa::new(peripherals.RSA);
while rsa.ready().is_none() {}
rsa.ready();
Context { rsa }
}

View File

@ -56,7 +56,7 @@ mod tests {
fn init() -> Context<'static> {
let peripherals = esp_hal::init(esp_hal::Config::default());
let mut rsa = Rsa::new(peripherals.RSA).into_async();
while rsa.ready().is_none() {}
rsa.ready();
Context { rsa }
}