diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 8204a0fea..8468436d8 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -70,7 +70,7 @@ cortex-m-rt = ">=0.6.15,<0.8" cortex-m = "0.7.6" futures-util = { version = "0.3.30", default-features = false } rand_core = "0.6.3" -sdio-host = "0.5.0" +sdio-host = "0.6.0" critical-section = "1.1" #stm32-metapac = { version = "16" } stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-4a964af03b298de30ff9f84fcfa890bcab4ce609" } diff --git a/embassy-stm32/src/sdmmc/mod.rs b/embassy-stm32/src/sdmmc/mod.rs index 8f3c45f50..3cfae7ee1 100644 --- a/embassy-stm32/src/sdmmc/mod.rs +++ b/embassy-stm32/src/sdmmc/mod.rs @@ -10,7 +10,7 @@ use core::task::Poll; use embassy_hal_internal::drop::OnDrop; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; -use sdio_host::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatus, CID, CSD, OCR, SCR}; +use sdio_host::sd::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatus, CID, CSD, OCR, SCR, SD}; #[cfg(sdmmc_v1)] use crate::dma::ChannelAndRequest; @@ -162,13 +162,13 @@ pub struct Card { /// The type of this card pub card_type: CardCapacity, /// Operation Conditions Register - pub ocr: OCR, + pub ocr: OCR, /// Relative Card Address pub rca: u32, /// Card ID - pub cid: CID, + pub cid: CID, /// Card Specific Data - pub csd: CSD, + pub csd: CSD, /// SD CARD Configuration Register pub scr: SCR, /// SD Status @@ -765,7 +765,7 @@ impl<'d, T: Instance> Sdmmc<'d, T> { } /// Query the card status (CMD13, returns R1) - fn read_status(&self, card: &Card) -> Result { + fn read_status(&self, card: &Card) -> Result, Error> { let regs = T::regs(); let rca = card.rca; @@ -1089,7 +1089,7 @@ impl<'d, T: Instance> Sdmmc<'d, T> { Err(Error::Crc) => (), Err(err) => return Err(err), } - let ocr: OCR = regs.respr(0).read().cardstatus().into(); + let ocr: OCR = regs.respr(0).read().cardstatus().into(); if !ocr.is_busy() { // Power up done break ocr; @@ -1098,9 +1098,9 @@ impl<'d, T: Instance> Sdmmc<'d, T> { if ocr.high_capacity() { // Card is SDHC or SDXC or SDUC - card.card_type = CardCapacity::SDHC; + card.card_type = CardCapacity::HighCapacity; } else { - card.card_type = CardCapacity::SDSC; + card.card_type = CardCapacity::StandardCapacity; } card.ocr = ocr; @@ -1193,7 +1193,7 @@ impl<'d, T: Instance> Sdmmc<'d, T> { // Always read 1 block of 512 bytes // SDSC cards are byte addressed hence the blockaddress is in multiples of 512 bytes let address = match card_capacity { - CardCapacity::SDSC => block_idx * 512, + CardCapacity::StandardCapacity => block_idx * 512, _ => block_idx, }; Self::cmd(Cmd::set_block_length(512), false)?; // CMD16 @@ -1252,7 +1252,7 @@ impl<'d, T: Instance> Sdmmc<'d, T> { // Always read 1 block of 512 bytes // SDSC cards are byte addressed hence the blockaddress is in multiples of 512 bytes let address = match card.card_type { - CardCapacity::SDSC => block_idx * 512, + CardCapacity::StandardCapacity => block_idx * 512, _ => block_idx, }; Self::cmd(Cmd::set_block_length(512), false)?; // CMD16