embedded_error/
mci.rs

1use crate::ImplError;
2
3/// An MCI specific error
4///
5/// This error type contains errors specific to MCI (MultiMedia Card Interface) peripherals. Also it
6/// has an `Impl` kind to pass through implementation specific errors occurring while trying to use
7/// an MCI peripheral.
8#[derive(Debug, Clone)]
9#[non_exhaustive]
10pub enum MciError {
11    /// Data Error, can be a CRC problem, timeout or end bit problem
12    DataError(CommandOrDataError),
13    /// Commands are inhibited from being processed at the moment
14    CommandInhibited,
15    /// There was a problem sending the command
16    CommandError(CommandOrDataError),
17    /// ADMA error
18    Adma,
19    /// Function group trying to be accessed is busy
20    GroupBusy,
21    /// When trying to do get the CIA register could not find the correct tuple in the response
22    CiaCouldNotFindTuple,
23    /// Supplied data size is either 0 or more than 512 bytes
24    IncorrectDataSize,
25    /// Could not select and/or setup the card at the slot
26    CouldNotSelectDevice,
27    /// No card inserted
28    NoCard,
29    /// Card is unusable
30    UnusableCard,
31    /// Read error
32    ReadError,
33    /// Card is write protected
34    WriteProtected,
35    /// Write error
36    WriteError,
37    /// Error reading a pin's value
38    PinLevelReadError,
39    /// Setup error
40    Setup(SetupError),
41    /// Implementation specific error (shared across all peripheral specific error kinds)
42    Impl(ImplError),
43}
44
45/// Enumeration used when setting up the device especially when installing MMC
46#[derive(Debug, Clone)]
47#[non_exhaustive]
48pub enum SetupError {
49    /// Could not set bus width
50    CouldNotSetBusWidth,
51    /// Could not set to high speed
52    CouldNotSetToHighSpeed,
53    /// Could not check if it is a high speed device
54    CouldNotCheckIfIsHighSpeed,
55}
56
57/// When sending a command (or receiving its response) something can go wrong
58#[derive(Debug, Clone)]
59#[non_exhaustive]
60pub enum CommandOrDataError {
61    /// Timeout occurred
62    Timeout,
63    /// CRC check failed
64    Crc,
65    /// End bit error
66    EndBit,
67    /// Command index fault
68    Index,
69}