update sdio-host to 0.6

This commit is contained in:
Anton Lazarev 2025-03-24 10:49:47 -07:00
parent a44abaf7e4
commit 280d21a6b4
No known key found for this signature in database
GPG Key ID: FBD20243E0CD9104
2 changed files with 11 additions and 11 deletions

View File

@ -70,7 +70,7 @@ cortex-m-rt = ">=0.6.15,<0.8"
cortex-m = "0.7.6" cortex-m = "0.7.6"
futures-util = { version = "0.3.30", default-features = false } futures-util = { version = "0.3.30", default-features = false }
rand_core = "0.6.3" rand_core = "0.6.3"
sdio-host = "0.5.0" sdio-host = "0.6.0"
critical-section = "1.1" critical-section = "1.1"
#stm32-metapac = { version = "16" } #stm32-metapac = { version = "16" }
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-4a964af03b298de30ff9f84fcfa890bcab4ce609" } stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-4a964af03b298de30ff9f84fcfa890bcab4ce609" }

View File

@ -10,7 +10,7 @@ use core::task::Poll;
use embassy_hal_internal::drop::OnDrop; use embassy_hal_internal::drop::OnDrop;
use embassy_hal_internal::{Peri, PeripheralType}; use embassy_hal_internal::{Peri, PeripheralType};
use embassy_sync::waitqueue::AtomicWaker; 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)] #[cfg(sdmmc_v1)]
use crate::dma::ChannelAndRequest; use crate::dma::ChannelAndRequest;
@ -162,13 +162,13 @@ pub struct Card {
/// The type of this card /// The type of this card
pub card_type: CardCapacity, pub card_type: CardCapacity,
/// Operation Conditions Register /// Operation Conditions Register
pub ocr: OCR, pub ocr: OCR<SD>,
/// Relative Card Address /// Relative Card Address
pub rca: u32, pub rca: u32,
/// Card ID /// Card ID
pub cid: CID, pub cid: CID<SD>,
/// Card Specific Data /// Card Specific Data
pub csd: CSD, pub csd: CSD<SD>,
/// SD CARD Configuration Register /// SD CARD Configuration Register
pub scr: SCR, pub scr: SCR,
/// SD Status /// SD Status
@ -765,7 +765,7 @@ impl<'d, T: Instance> Sdmmc<'d, T> {
} }
/// Query the card status (CMD13, returns R1) /// Query the card status (CMD13, returns R1)
fn read_status(&self, card: &Card) -> Result<CardStatus, Error> { fn read_status(&self, card: &Card) -> Result<CardStatus<SD>, Error> {
let regs = T::regs(); let regs = T::regs();
let rca = card.rca; let rca = card.rca;
@ -1089,7 +1089,7 @@ impl<'d, T: Instance> Sdmmc<'d, T> {
Err(Error::Crc) => (), Err(Error::Crc) => (),
Err(err) => return Err(err), Err(err) => return Err(err),
} }
let ocr: OCR = regs.respr(0).read().cardstatus().into(); let ocr: OCR<SD> = regs.respr(0).read().cardstatus().into();
if !ocr.is_busy() { if !ocr.is_busy() {
// Power up done // Power up done
break ocr; break ocr;
@ -1098,9 +1098,9 @@ impl<'d, T: Instance> Sdmmc<'d, T> {
if ocr.high_capacity() { if ocr.high_capacity() {
// Card is SDHC or SDXC or SDUC // Card is SDHC or SDXC or SDUC
card.card_type = CardCapacity::SDHC; card.card_type = CardCapacity::HighCapacity;
} else { } else {
card.card_type = CardCapacity::SDSC; card.card_type = CardCapacity::StandardCapacity;
} }
card.ocr = ocr; card.ocr = ocr;
@ -1193,7 +1193,7 @@ impl<'d, T: Instance> Sdmmc<'d, T> {
// Always read 1 block of 512 bytes // Always read 1 block of 512 bytes
// SDSC cards are byte addressed hence the blockaddress is in multiples of 512 bytes // SDSC cards are byte addressed hence the blockaddress is in multiples of 512 bytes
let address = match card_capacity { let address = match card_capacity {
CardCapacity::SDSC => block_idx * 512, CardCapacity::StandardCapacity => block_idx * 512,
_ => block_idx, _ => block_idx,
}; };
Self::cmd(Cmd::set_block_length(512), false)?; // CMD16 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 // Always read 1 block of 512 bytes
// SDSC cards are byte addressed hence the blockaddress is in multiples of 512 bytes // SDSC cards are byte addressed hence the blockaddress is in multiples of 512 bytes
let address = match card.card_type { let address = match card.card_type {
CardCapacity::SDSC => block_idx * 512, CardCapacity::StandardCapacity => block_idx * 512,
_ => block_idx, _ => block_idx,
}; };
Self::cmd(Cmd::set_block_length(512), false)?; // CMD16 Self::cmd(Cmd::set_block_length(512), false)?; // CMD16