1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! # Phytium MCI Driver
//!
//! This is a `no_std` Rust driver for the Phytium Memory Card Interface (MCI) controller.
//! It provides support for SD/MMC card operations including initialization, data transfer,
//! and card management.
//!
//! ## Architecture
//!
//! The driver is organized into several modules:
//!
//! - **mci**: Core MCI controller functionality including register access, command handling,
//! and data transfer (DMA/PIO modes)
//! - **mci_host**: Host controller abstraction layer providing card detection, command
//! execution, and SD/MMC card operations
//! - **iopad**: I/O pad configuration for signal timing and electrical characteristics
//! - **osa**: Operating System Abstraction layer providing memory pool management
//!
//! ## Features
//!
//! - DMA and PIO transfer modes
//! - SD and eMMC card support
//! - Configurable bus width (1/4/8 bit)
//! - Variable clock frequency support
//! - Card detection and hot-plug support
//! - Voltage switching (3.3V/1.8V)
//!
//! ## Usage
//!
//! The driver requires the user to implement the [`Kernel`] trait and use the
//! [`set_impl!`] macro to provide sleep functionality.
//!
//! ```rust
//! use phytium_mci::{Kernel, set_impl};
//!
//! struct MyKernel;
//!
//! impl Kernel for MyKernel {
//! fn sleep(duration: core::time::Duration) {
//! // Implement sleep functionality
//! }
//! }
//!
//! set_impl!(MyKernel);
//! ```
extern crate alloc;
use Duration;
pub use *;
pub use *;
// pub use dma_api::{set_impl as set_dma_impl, Direction as DmaDirection, Impl as DmaImpl};
/// Trait that must be implemented by the user to provide kernel functionality.
///
/// This trait abstracts the underlying kernel/OS operations required by the driver.
/// Currently, only a sleep function is required for timing operations.
pub
/// Macro to set the kernel implementation for the driver.
///
/// This macro generates the internal function that bridges the driver's sleep
/// calls to the user-provided [`Kernel`] implementation.
///
/// # Example
///
/// ```rust
/// use phytium_mci::set_impl;
///
/// struct MyKernel;
/// impl phytium_mci::Kernel for MyKernel {
/// fn sleep(duration: core::time::Duration) {
/// // implementation
/// }
/// }
///
/// set_impl!(MyKernel);
/// ```