Skip to content

Commit b87c5c1

Browse files
authored
Merge pull request #90 from Neotron-Compute/update-embedded-sdmmc
Update embedded-sdmmc to 0.6.0
2 parents 4ff8474 + 465bc07 commit b87c5c1

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ shared-bus = "0.2"
5757
# Gets us compare-swap atomic operations
5858
atomic-polyfill = "1.0.2"
5959
# SD Card driver
60-
embedded-sdmmc = { version = "0.5", default-features = false, features = [
60+
embedded-sdmmc = { version = "0.6", default-features = false, features = [
6161
"defmt-log"
6262
] }
6363
# CODEC register control

src/main.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,10 @@ impl Hardware {
15551555
let spi = sdcard::FakeSpi(self, true);
15561556
let cs = sdcard::FakeCs();
15571557
let delayer = sdcard::FakeDelayer();
1558-
let options = embedded_sdmmc::sdcard::AcquireOpts { use_crc: true };
1558+
let options = embedded_sdmmc::sdcard::AcquireOpts {
1559+
use_crc: true,
1560+
acquire_retries: 5,
1561+
};
15591562
let sdcard = embedded_sdmmc::SdCard::new_with_options(spi, cs, delayer, options);
15601563
// Talk to the card to trigger a scan if its type
15611564
let num_blocks = sdcard.num_blocks();
@@ -2359,12 +2362,13 @@ pub extern "C" fn block_write(
23592362

23602363
/// Read one or more sectors to a block device.
23612364
///
2362-
/// The function will block until all data is read. The array pointed
2363-
/// to by `data` must be `num_blocks * block_size` in length, where
2364-
/// `block_size` is given by `block_dev_get_info`.
2365+
/// The function will block until all data is read. The array pointed to by
2366+
/// `data` must be `num_blocks * block_size` in length, where `block_size` is
2367+
/// given by `block_dev_get_info`.
23652368
///
2366-
/// There are no requirements on the alignment of `data` but if it is
2367-
/// aligned, the BIOS may be able to use a higher-performance code path.
2369+
/// The API docs say there are no requirements on the alignment of `data` but we
2370+
/// unsafely transmute it into a `[embedded_sdmmc::Block]` so it should match
2371+
/// whatever that needs.
23682372
pub extern "C" fn block_read(
23692373
device: u8,
23702374
block: common::block_dev::BlockIdx,
@@ -2391,7 +2395,10 @@ pub extern "C" fn block_read(
23912395
let spi = sdcard::FakeSpi(hw, false);
23922396
let cs = sdcard::FakeCs();
23932397
let delayer = sdcard::FakeDelayer();
2394-
let options = embedded_sdmmc::sdcard::AcquireOpts { use_crc: true };
2398+
let options = embedded_sdmmc::sdcard::AcquireOpts {
2399+
use_crc: true,
2400+
acquire_retries: 5,
2401+
};
23952402
let sdcard = embedded_sdmmc::SdCard::new_with_options(spi, cs, delayer, options);
23962403
unsafe {
23972404
sdcard.mark_card_as_init(info.card_type);

0 commit comments

Comments
 (0)