sdmmc_core/command/class/class0/cmd0/
arg.rs1use crate::lib_bitfield;
2use crate::result::{Error, Result};
3
4mod fast_boot;
5
6pub use fast_boot::*;
7
8lib_bitfield! {
9 pub Argument(u32): u32 {
11 raw_fast_boot_mode: 31, 0;
12 }
13}
14
15impl Argument {
16 pub const LEN: usize = 4;
18 pub const DEFAULT: u32 = 0;
20
21 pub const fn new() -> Self {
23 Self(Self::DEFAULT)
24 }
25
26 pub const fn fast_boot_mode(&self) -> Result<FastBootMode> {
28 FastBootMode::from_raw(self.raw_fast_boot_mode())
29 }
30
31 pub fn set_fast_boot_mode(&mut self, val: FastBootMode) {
33 self.set_raw_fast_boot_mode(val.into_raw())
34 }
35
36 pub const fn try_from_bits(val: u32) -> Result<Self> {
38 match Self(val) {
39 arg if arg.fast_boot_mode().is_err() => Err(Error::invalid_field_variant(
40 "cmd::arg::fast_boot_mode",
41 arg.raw_fast_boot_mode() as usize,
42 )),
43 arg => Ok(arg),
44 }
45 }
46}
47
48impl Default for Argument {
49 fn default() -> Self {
50 Self::new()
51 }
52}