26
26
****************************************************************************/
27
27
28
28
#include <nuttx/config.h>
29
+ #include <nuttx/sdio.h>
29
30
#include <stdint.h>
30
31
#include <debug.h>
31
32
59
60
* Public Types
60
61
****************************************************************************/
61
62
63
+ /* This structure is contains the unique state of the MMC/SD block driver */
64
+
65
+ struct mmcsd_state_s
66
+ {
67
+ FAR struct sdio_dev_s * dev ; /* The SDIO device bound to this instance */
68
+ uint8_t crefs ; /* Open references on the driver */
69
+ mutex_t lock ; /* Assures mutually exclusive access to the slot */
70
+
71
+ /* Status flags */
72
+
73
+ uint8_t probed :1 ; /* true: mmcsd_probe() discovered a card */
74
+ uint8_t widebus :1 ; /* true: Wide 4-bit bus selected */
75
+ uint8_t mediachanged :1 ; /* true: Media changed since last check */
76
+ uint8_t wrbusy :1 ; /* true: Last transfer was a write, card may be busy */
77
+ uint8_t wrprotect :1 ; /* true: Card is write protected (from CSD) */
78
+ uint8_t locked :1 ; /* true: Media is locked (from R1) */
79
+ uint8_t dsrimp :1 ; /* true: card supports CMD4/DSR setting (from CSD) */
80
+ #ifdef CONFIG_SDIO_DMA
81
+ uint8_t dma :1 ; /* true: hardware supports DMA */
82
+ #endif
83
+
84
+ uint8_t mode :2 ; /* (See MMCSDMODE_* definitions) */
85
+ uint8_t type :4 ; /* Card type (See MMCSD_CARDTYPE_* definitions) */
86
+ uint8_t buswidth :4 ; /* Bus widths supported (SD only) */
87
+ sdio_capset_t caps ; /* SDIO driver capabilities/limitations */
88
+ uint32_t cid [4 ]; /* CID register */
89
+ uint32_t csd [4 ]; /* CSD register */
90
+ uint16_t selblocklen ; /* The currently selected block length */
91
+ uint16_t rca ; /* Relative Card Address (RCS) register */
92
+
93
+ /* Memory card geometry (extracted from the CSD) */
94
+
95
+ uint8_t blockshift ; /* Log2 of blocksize */
96
+ uint16_t blocksize ; /* Read block length (== block size) */
97
+ uint32_t nblocks ; /* Number of blocks */
98
+ };
99
+
62
100
/****************************************************************************
63
101
* Public Functions Definitions
64
102
****************************************************************************/
@@ -72,6 +110,10 @@ extern "C"
72
110
#define EXTERN extern
73
111
#endif
74
112
113
+ #ifdef CONFIG_MMCSD_PROCFS
114
+ void mmcsd_initialize_procfs (void );
115
+ #endif
116
+
75
117
#ifdef CONFIG_MMCSD_DUMPALL
76
118
# define mmcsd_dumpbuffer (m ,b ,l ) finfodumpbuffer(m,b,l)
77
119
#else
0 commit comments