Skip to content

Commit 5d8f501

Browse files
committed
fixup: mmc: fix tuning new-types
Adds the `TuningMode` enum to represent tuning speed variants. Changes the previous `TuningMode` enum to `TuningWidth`. Changes variant names for consistency with other width types.
1 parent fc49578 commit 5d8f501

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

embedded-hal/src/mmc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub use reset::Reset;
1818

1919
use command::MmcCommand;
2020
use response::MmcResponse;
21-
use tuning::TuningMode;
21+
use tuning::{TuningMode, TuningWidth};
2222

2323
/// Common operations for DesignWare MMC controllers on JH7110 SoCs.
2424
pub trait MmcOps {
@@ -75,10 +75,10 @@ pub trait MmcOps {
7575
fn write_data(&mut self, data: &[u8]) -> Result<(), Self::Error>;
7676

7777
/// Requests the card to send a tuning block.
78-
fn send_tuning(&mut self, bus_width: BusWidth, mode: TuningMode) -> Result<(), Self::Error>;
78+
fn send_tuning(&mut self, mode: TuningMode, width: TuningWidth) -> Result<(), Self::Error>;
7979

8080
/// Executes MMC tuning.
81-
fn execute_tuning(&mut self, bus_width: BusWidth, mode: TuningMode) -> Result<(), Self::Error>;
81+
fn execute_tuning(&mut self, mode: TuningMode, width: TuningWidth) -> Result<(), Self::Error>;
8282

8383
/// Gets the interrupts status as a 32-bit bitfield.
8484
fn interrupt(&self) -> u32;

embedded-hal/src/mmc/tuning.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
//! Tuning data for SD/MMC peripherals.
22
3-
/// Represents the tuning mode for the SD/MMC device.
3+
/// Represents the tuning width for the SD/MMC device.
44
#[repr(u8)]
55
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6-
pub enum TuningMode {
6+
pub enum TuningWidth {
77
/// Represents a 4-bit tuning block.
8-
Block4bit = 0,
8+
Bits4 = 0,
99
/// Represents a 8-bit tuning block.
10-
Block8bit = 1,
10+
Bits8 = 1,
11+
}
12+
13+
/// Represents the tuning speed mode for the SD/MMC device.
14+
#[repr(u8)]
15+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
16+
pub enum TuningMode {
17+
/// Represents a standard tuning mode.
18+
Standard = 0,
19+
/// Represents a high-speed HS200 tuning mode.
20+
Hs200 = 1,
21+
/// Represents a high-speed HS400 tuning mode.
22+
Hs400 = 2,
1123
}
1224

1325
/// Represents the byte length of the 4-bit tuning block.

0 commit comments

Comments
 (0)