Skip to main content

embedded_hal_sdmmc/
tuning.rs

1//! Tuning data for SD/MMC peripherals.
2
3/// Represents the tuning width for the SD/MMC device.
4#[repr(u8)]
5#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6pub enum TuningWidth {
7    /// Represents a 4-bit tuning block.
8    Bits4 = 0,
9    /// Represents a 8-bit tuning block.
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)]
16pub 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,
23}
24
25/// Represents the byte length of the 4-bit tuning block.
26pub const TUNING_BLOCK_4BIT_LEN: usize = 64;
27/// Represents the byte length of the 8-bit tuning block.
28pub const TUNING_BLOCK_8BIT_LEN: usize = 128;
29
30/// Represents the tuning pattern used for 4-bit SD/MMC cards.
31pub const TUNING_BLOCK_PATTERN_4BIT: [u8; TUNING_BLOCK_4BIT_LEN] = [
32    0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc, 0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef,
33    0xff, 0xdf, 0xff, 0xdd, 0xff, 0xfb, 0xff, 0xfb, 0xbf, 0xff, 0x7f, 0xff, 0x77, 0xf7, 0xbd, 0xef,
34    0xff, 0xf0, 0xff, 0xf0, 0x0f, 0xfc, 0xcc, 0x3c, 0xcc, 0x33, 0xcc, 0xcf, 0xff, 0xef, 0xff, 0xee,
35    0xff, 0xfd, 0xff, 0xfd, 0xdf, 0xff, 0xbf, 0xff, 0xbb, 0xff, 0xf7, 0xff, 0xf7, 0x7f, 0x7b, 0xde,
36];
37
38/// Represents the tuning pattern used for 8-bit SD/MMC cards.
39pub const TUNING_BLOCK_PATTERN_8BIT: [u8; TUNING_BLOCK_8BIT_LEN] = [
40    0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, 0xcc,
41    0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff,
42    0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb,
43    0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, 0xff,
44    0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc,
45    0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee,
46    0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff,
47    0xbb, 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
48];