ChibiOS/HAL  6.1.0
hal_mmcsd.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 /**
18  * @file hal_mmcsd.h
19  * @brief MMC/SD cards common header.
20  * @details This header defines an abstract interface useful to access MMC/SD
21  * I/O block devices in a standardized way.
22  *
23  * @addtogroup MMCSD
24  * @{
25  */
26 
27 #ifndef HAL_MMCSD_H
28 #define HAL_MMCSD_H
29 
30 #if (HAL_USE_MMC_SPI == TRUE) || (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)
31 
32 /*===========================================================================*/
33 /* Driver constants. */
34 /*===========================================================================*/
35 
36 /**
37  * @brief Fixed block size for MMC/SD block devices.
38  */
39 #define MMCSD_BLOCK_SIZE 512U
40 
41 /**
42  * @brief Mask of error bits in R1 responses.
43  */
44 #define MMCSD_R1_ERROR_MASK 0xFDFFE008U
45 
46 /**
47  * @brief Fixed pattern for CMD8.
48  */
49 #define MMCSD_CMD8_PATTERN 0x000001AAU
50 
51 /**
52  * @name SD/MMC status conditions
53  * @{
54  */
55 #define MMCSD_STS_IDLE 0U
56 #define MMCSD_STS_READY 1U
57 #define MMCSD_STS_IDENT 2U
58 #define MMCSD_STS_STBY 3U
59 #define MMCSD_STS_TRAN 4U
60 #define MMCSD_STS_DATA 5U
61 #define MMCSD_STS_RCV 6U
62 #define MMCSD_STS_PRG 7U
63 #define MMCSD_STS_DIS 8U
64 /** @} */
65 
66 /**
67  * @name SD/MMC commands
68  * @{
69  */
70 #define MMCSD_CMD_GO_IDLE_STATE 0U
71 #define MMCSD_CMD_INIT 1U
72 #define MMCSD_CMD_ALL_SEND_CID 2U
73 #define MMCSD_CMD_SEND_RELATIVE_ADDR 3U
74 #define MMCSD_CMD_SET_BUS_WIDTH 6U
75 #define MMCSD_CMD_SWITCH MMCSD_CMD_SET_BUS_WIDTH
76 #define MMCSD_CMD_SEL_DESEL_CARD 7U
77 #define MMCSD_CMD_SEND_IF_COND 8U
78 #define MMCSD_CMD_SEND_EXT_CSD MMCSD_CMD_SEND_IF_COND
79 #define MMCSD_CMD_SEND_CSD 9U
80 #define MMCSD_CMD_SEND_CID 10U
81 #define MMCSD_CMD_STOP_TRANSMISSION 12U
82 #define MMCSD_CMD_SEND_STATUS 13U
83 #define MMCSD_CMD_SET_BLOCKLEN 16U
84 #define MMCSD_CMD_READ_SINGLE_BLOCK 17U
85 #define MMCSD_CMD_READ_MULTIPLE_BLOCK 18U
86 #define MMCSD_CMD_SET_BLOCK_COUNT 23U
87 #define MMCSD_CMD_WRITE_BLOCK 24U
88 #define MMCSD_CMD_WRITE_MULTIPLE_BLOCK 25U
89 #define MMCSD_CMD_ERASE_RW_BLK_START 32U
90 #define MMCSD_CMD_ERASE_RW_BLK_END 33U
91 #define MMCSD_CMD_ERASE 38U
92 #define MMCSD_CMD_APP_OP_COND 41U
93 #define MMCSD_CMD_LOCK_UNLOCK 42U
94 #define MMCSD_CMD_APP_CMD 55U
95 #define MMCSD_CMD_READ_OCR 58U
96 /** @} */
97 
98 /**
99  * @name CSD record offsets
100  */
101 /**
102  * @brief Slice position of values in CSD register.
103  */
104 /* CSD for MMC */
105 #define MMCSD_CSD_MMC_CSD_STRUCTURE_SLICE 127U,126U
106 #define MMCSD_CSD_MMC_SPEC_VERS_SLICE 125U,122U
107 #define MMCSD_CSD_MMC_TAAC_SLICE 119U,112U
108 #define MMCSD_CSD_MMC_NSAC_SLICE 111U,104U
109 #define MMCSD_CSD_MMC_TRAN_SPEED_SLICE 103U,96U
110 #define MMCSD_CSD_MMC_CCC_SLICE 95U,84U
111 #define MMCSD_CSD_MMC_READ_BL_LEN_SLICE 83U,80U
112 #define MMCSD_CSD_MMC_READ_BL_PARTIAL_SLICE 79U,79U
113 #define MMCSD_CSD_MMC_WRITE_BLK_MISALIGN_SLICE 78U,78U
114 #define MMCSD_CSD_MMC_READ_BLK_MISALIGN_SLICE 77U,77U
115 #define MMCSD_CSD_MMC_DSR_IMP_SLICE 76U,76U
116 #define MMCSD_CSD_MMC_C_SIZE_SLICE 73U,62U
117 #define MMCSD_CSD_MMC_VDD_R_CURR_MIN_SLICE 61U,59U
118 #define MMCSD_CSD_MMC_VDD_R_CURR_MAX_SLICE 58U,56U
119 #define MMCSD_CSD_MMC_VDD_W_CURR_MIN_SLICE 55U,53U
120 #define MMCSD_CSD_MMC_VDD_W_CURR_MAX_SLICE 52U,50U
121 #define MMCSD_CSD_MMC_C_SIZE_MULT_SLICE 49U,47U
122 #define MMCSD_CSD_MMC_ERASE_GRP_SIZE_SLICE 46U,42U
123 #define MMCSD_CSD_MMC_ERASE_GRP_MULT_SLICE 41U,37U
124 #define MMCSD_CSD_MMC_WP_GRP_SIZE_SLICE 36U,32U
125 #define MMCSD_CSD_MMC_WP_GRP_ENABLE_SLICE 31U,31U
126 #define MMCSD_CSD_MMC_DEFAULT_ECC_SLICE 30U,29U
127 #define MMCSD_CSD_MMC_R2W_FACTOR_SLICE 28U,26U
128 #define MMCSD_CSD_MMC_WRITE_BL_LEN_SLICE 25U,22U
129 #define MMCSD_CSD_MMC_WRITE_BL_PARTIAL_SLICE 21U,21U
130 #define MMCSD_CSD_MMC_CONTENT_PROT_APP_SLICE 16U,16U
131 #define MMCSD_CSD_MMC_FILE_FORMAT_GRP_SLICE 15U,15U
132 #define MMCSD_CSD_MMC_COPY_SLICE 14U,14U
133 #define MMCSD_CSD_MMC_PERM_WRITE_PROTECT_SLICE 13U,13U
134 #define MMCSD_CSD_MMC_TMP_WRITE_PROTECT_SLICE 12U,12U
135 #define MMCSD_CSD_MMC_FILE_FORMAT_SLICE 11U,10U
136 #define MMCSD_CSD_MMC_ECC_SLICE 9U,8U
137 #define MMCSD_CSD_MMC_CRC_SLICE 7U,1U
138 
139 /* CSD version 2.0 */
140 #define MMCSD_CSD_20_CRC_SLICE 7U,1U
141 #define MMCSD_CSD_20_FILE_FORMAT_SLICE 11U,10U
142 #define MMCSD_CSD_20_TMP_WRITE_PROTECT_SLICE 12U,12U
143 #define MMCSD_CSD_20_PERM_WRITE_PROTECT_SLICE 13U,13U
144 #define MMCSD_CSD_20_COPY_SLICE 14U,14U
145 #define MMCSD_CSD_20_FILE_FORMAT_GRP_SLICE 15U,15U
146 #define MMCSD_CSD_20_WRITE_BL_PARTIAL_SLICE 21U,21U
147 #define MMCSD_CSD_20_WRITE_BL_LEN_SLICE 25U,12U
148 #define MMCSD_CSD_20_R2W_FACTOR_SLICE 28U,26U
149 #define MMCSD_CSD_20_WP_GRP_ENABLE_SLICE 31U,31U
150 #define MMCSD_CSD_20_WP_GRP_SIZE_SLICE 38U,32U
151 #define MMCSD_CSD_20_ERASE_SECTOR_SIZE_SLICE 45U,39U
152 #define MMCSD_CSD_20_ERASE_BLK_EN_SLICE 46U,46U
153 #define MMCSD_CSD_20_C_SIZE_SLICE 69U,48U
154 #define MMCSD_CSD_20_DSR_IMP_SLICE 76U,76U
155 #define MMCSD_CSD_20_READ_BLK_MISALIGN_SLICE 77U,77U
156 #define MMCSD_CSD_20_WRITE_BLK_MISALIGN_SLICE 78U,78U
157 #define MMCSD_CSD_20_READ_BL_PARTIAL_SLICE 79U,79U
158 #define MMCSD_CSD_20_READ_BL_LEN_SLICE 83U,80U
159 #define MMCSD_CSD_20_CCC_SLICE 95U,84U
160 #define MMCSD_CSD_20_TRANS_SPEED_SLICE 103U,96U
161 #define MMCSD_CSD_20_NSAC_SLICE 111U,104U
162 #define MMCSD_CSD_20_TAAC_SLICE 119U,112U
163 #define MMCSD_CSD_20_CSD_STRUCTURE_SLICE 127U,126U
164 
165 /* CSD version 1.0 */
166 #define MMCSD_CSD_10_CRC_SLICE MMCSD_CSD_20_CRC_SLICE
167 #define MMCSD_CSD_10_FILE_FORMAT_SLICE MMCSD_CSD_20_FILE_FORMAT_SLICE
168 #define MMCSD_CSD_10_TMP_WRITE_PROTECT_SLICE MMCSD_CSD_20_TMP_WRITE_PROTECT_SLICE
169 #define MMCSD_CSD_10_PERM_WRITE_PROTECT_SLICE MMCSD_CSD_20_PERM_WRITE_PROTECT_SLICE
170 #define MMCSD_CSD_10_COPY_SLICE MMCSD_CSD_20_COPY_SLICE
171 #define MMCSD_CSD_10_FILE_FORMAT_GRP_SLICE MMCSD_CSD_20_FILE_FORMAT_GRP_SLICE
172 #define MMCSD_CSD_10_WRITE_BL_PARTIAL_SLICE MMCSD_CSD_20_WRITE_BL_PARTIAL_SLICE
173 #define MMCSD_CSD_10_WRITE_BL_LEN_SLICE MMCSD_CSD_20_WRITE_BL_LEN_SLICE
174 #define MMCSD_CSD_10_R2W_FACTOR_SLICE MMCSD_CSD_20_R2W_FACTOR_SLICE
175 #define MMCSD_CSD_10_WP_GRP_ENABLE_SLICE MMCSD_CSD_20_WP_GRP_ENABLE_SLICE
176 #define MMCSD_CSD_10_WP_GRP_SIZE_SLICE MMCSD_CSD_20_WP_GRP_SIZE_SLICE
177 #define MMCSD_CSD_10_ERASE_SECTOR_SIZE_SLICE MMCSD_CSD_20_ERASE_SECTOR_SIZE_SLICE
178 #define MMCSD_CSD_10_ERASE_BLK_EN_SLICE MMCSD_CSD_20_ERASE_BLK_EN_SLICE
179 #define MMCSD_CSD_10_C_SIZE_MULT_SLICE 49U,47U
180 #define MMCSD_CSD_10_VDD_W_CURR_MAX_SLICE 52U,50U
181 #define MMCSD_CSD_10_VDD_W_CURR_MIN_SLICE 55U,53U
182 #define MMCSD_CSD_10_VDD_R_CURR_MAX_SLICE 58U,56U
183 #define MMCSD_CSD_10_VDD_R_CURR_MIX_SLICE 61U,59U
184 #define MMCSD_CSD_10_C_SIZE_SLICE 73U,62U
185 #define MMCSD_CSD_10_DSR_IMP_SLICE MMCSD_CSD_20_DSR_IMP_SLICE
186 #define MMCSD_CSD_10_READ_BLK_MISALIGN_SLICE MMCSD_CSD_20_READ_BLK_MISALIGN_SLICE
187 #define MMCSD_CSD_10_WRITE_BLK_MISALIGN_SLICE MMCSD_CSD_20_WRITE_BLK_MISALIGN_SLICE
188 #define MMCSD_CSD_10_READ_BL_PARTIAL_SLICE MMCSD_CSD_20_READ_BL_PARTIAL_SLICE
189 #define MMCSD_CSD_10_READ_BL_LEN_SLICE 83U,80U
190 #define MMCSD_CSD_10_CCC_SLICE MMCSD_CSD_20_CCC_SLICE
191 #define MMCSD_CSD_10_TRANS_SPEED_SLICE MMCSD_CSD_20_TRANS_SPEED_SLICE
192 #define MMCSD_CSD_10_NSAC_SLICE MMCSD_CSD_20_NSAC_SLICE
193 #define MMCSD_CSD_10_TAAC_SLICE MMCSD_CSD_20_TAAC_SLICE
194 #define MMCSD_CSD_10_CSD_STRUCTURE_SLICE MMCSD_CSD_20_CSD_STRUCTURE_SLICE
195 /** @} */
196 
197 /**
198  * @name CID record offsets
199  */
200 /**
201  * @brief Slice position of values in CID register.
202  */
203 /* CID for SDC */
204 #define MMCSD_CID_SDC_CRC_SLICE 7U,1U
205 #define MMCSD_CID_SDC_MDT_M_SLICE 11U,8U
206 #define MMCSD_CID_SDC_MDT_Y_SLICE 19U,12U
207 #define MMCSD_CID_SDC_PSN_SLICE 55U,24U
208 #define MMCSD_CID_SDC_PRV_M_SLICE 59U,56U
209 #define MMCSD_CID_SDC_PRV_N_SLICE 63U,60U
210 #define MMCSD_CID_SDC_PNM0_SLICE 71U,64U
211 #define MMCSD_CID_SDC_PNM1_SLICE 79U,72U
212 #define MMCSD_CID_SDC_PNM2_SLICE 87U,80U
213 #define MMCSD_CID_SDC_PNM3_SLICE 95U,88U
214 #define MMCSD_CID_SDC_PNM4_SLICE 103U,96U
215 #define MMCSD_CID_SDC_OID_SLICE 119U,104U
216 #define MMCSD_CID_SDC_MID_SLICE 127U,120U
217 
218 /* CID for MMC */
219 #define MMCSD_CID_MMC_CRC_SLICE 7U,1U
220 #define MMCSD_CID_MMC_MDT_Y_SLICE 11U,8U
221 #define MMCSD_CID_MMC_MDT_M_SLICE 15U,12U
222 #define MMCSD_CID_MMC_PSN_SLICE 47U,16U
223 #define MMCSD_CID_MMC_PRV_M_SLICE 51U,48U
224 #define MMCSD_CID_MMC_PRV_N_SLICE 55U,52U
225 #define MMCSD_CID_MMC_PNM0_SLICE 63U,56U
226 #define MMCSD_CID_MMC_PNM1_SLICE 71U,64U
227 #define MMCSD_CID_MMC_PNM2_SLICE 79U,72U
228 #define MMCSD_CID_MMC_PNM3_SLICE 87U,80U
229 #define MMCSD_CID_MMC_PNM4_SLICE 95U,88U
230 #define MMCSD_CID_MMC_PNM5_SLICE 103U,96U
231 #define MMCSD_CID_MMC_OID_SLICE 119U,104U
232 #define MMCSD_CID_MMC_MID_SLICE 127U,120U
233 /** @} */
234 
235 /*===========================================================================*/
236 /* Driver pre-compile time settings. */
237 /*===========================================================================*/
238 
239 /*===========================================================================*/
240 /* Derived constants and error checks. */
241 /*===========================================================================*/
242 
243 /*===========================================================================*/
244 /* Driver data structures and types. */
245 /*===========================================================================*/
246 
247 /**
248  * @brief @p MMCSDBlockDevice specific methods.
249  */
250 #define _mmcsd_block_device_methods \
251  _base_block_device_methods
252 
253 /**
254  * @brief @p MMCSDBlockDevice specific data.
255  * @note It is empty because @p MMCSDBlockDevice is only an interface
256  * without implementation.
257  */
258 #define _mmcsd_block_device_data \
259  _base_block_device_data \
260  /* Card CID.*/ \
261  uint32_t cid[4]; \
262  /* Card CSD.*/ \
263  uint32_t csd[4]; \
264  /* Total number of blocks in card.*/ \
265  uint32_t capacity;
266 
267 /**
268  * @extends BaseBlockDeviceVMT
269  *
270  * @brief @p MMCSDBlockDevice virtual methods table.
271  */
274 };
275 
276 /**
277  * @extends BaseBlockDevice
278  *
279  * @brief MCC/SD block device class.
280  * @details This class represents a, block-accessible, MMC/SD device.
281  */
282 typedef struct {
283  /** @brief Virtual Methods Table.*/
284  const struct MMCSDBlockDeviceVMT *vmt;
287 
288 /**
289  * @brief Unpacked CID register from SDC.
290  */
291 typedef struct {
292  uint8_t mid;
293  uint16_t oid;
294  char pnm[5];
295  uint8_t prv_n;
296  uint8_t prv_m;
297  uint32_t psn;
298  uint8_t mdt_m;
299  uint16_t mdt_y;
300  uint8_t crc;
302 
303 /**
304  * @brief Unpacked CID register from MMC.
305  */
306 typedef struct {
307  uint8_t mid;
308  uint16_t oid;
309  char pnm[6];
310  uint8_t prv_n;
311  uint8_t prv_m;
312  uint32_t psn;
313  uint8_t mdt_m;
314  uint16_t mdt_y;
315  uint8_t crc;
317 
318 /**
319  * @brief Unpacked CSD v1.0 register from SDC.
320  */
321 typedef struct {
322  uint8_t csd_structure;
323  uint8_t taac;
324  uint8_t nsac;
325  uint8_t tran_speed;
326  uint16_t ccc;
327  uint8_t read_bl_len;
328  uint8_t read_bl_partial;
329  uint8_t write_blk_misalign;
330  uint8_t read_blk_misalign;
331  uint8_t dsr_imp;
332  uint16_t c_size;
333  uint8_t vdd_r_curr_min;
334  uint8_t vdd_r_curr_max;
335  uint8_t vdd_w_curr_min;
336  uint8_t vdd_w_curr_max;
337  uint8_t c_size_mult;
338  uint8_t erase_blk_en;
339  uint8_t erase_sector_size;
340  uint8_t wp_grp_size;
341  uint8_t wp_grp_enable;
342  uint8_t r2w_factor;
343  uint8_t write_bl_len;
344  uint8_t write_bl_partial;
345  uint8_t file_format_grp;
346  uint8_t copy;
347  uint8_t perm_write_protect;
348  uint8_t tmp_write_protect;
349  uint8_t file_format;
350  uint8_t crc;
352 
353 /**
354  * @brief Unpacked CSD v2.0 register from SDC.
355  */
356 typedef struct {
357  uint8_t csd_structure;
358  uint8_t taac;
359  uint8_t nsac;
360  uint8_t tran_speed;
361  uint16_t ccc;
362  uint8_t read_bl_len;
363  uint8_t read_bl_partial;
364  uint8_t write_blk_misalign;
365  uint8_t read_blk_misalign;
366  uint8_t dsr_imp;
367  uint32_t c_size;
368  uint8_t erase_blk_en;
369  uint8_t erase_sector_size;
370  uint8_t wp_grp_size;
371  uint8_t wp_grp_enable;
372  uint8_t r2w_factor;
373  uint8_t write_bl_len;
374  uint8_t write_bl_partial;
375  uint8_t file_format_grp;
376  uint8_t copy;
377  uint8_t perm_write_protect;
378  uint8_t tmp_write_protect;
379  uint8_t file_format;
380  uint8_t crc;
382 
383 /**
384  * @brief Unpacked CSD register from MMC.
385  */
386 typedef struct {
387  uint8_t csd_structure;
388  uint8_t spec_vers;
389  uint8_t taac;
390  uint8_t nsac;
391  uint8_t tran_speed;
392  uint16_t ccc;
393  uint8_t read_bl_len;
394  uint8_t read_bl_partial;
395  uint8_t write_blk_misalign;
396  uint8_t read_blk_misalign;
397  uint8_t dsr_imp;
398  uint16_t c_size;
399  uint8_t vdd_r_curr_min;
400  uint8_t vdd_r_curr_max;
401  uint8_t vdd_w_curr_min;
402  uint8_t vdd_w_curr_max;
403  uint8_t c_size_mult;
404  uint8_t erase_grp_size;
405  uint8_t erase_grp_mult;
406  uint8_t wp_grp_size;
407  uint8_t wp_grp_enable;
408  uint8_t default_ecc;
409  uint8_t r2w_factor;
410  uint8_t write_bl_len;
411  uint8_t write_bl_partial;
412  uint8_t content_prot_app;
413  uint8_t file_format_grp;
414  uint8_t copy;
415  uint8_t perm_write_protect;
416  uint8_t tmp_write_protect;
417  uint8_t file_format;
418  uint8_t ecc;
419  uint8_t crc;
421 
422 /*===========================================================================*/
423 /* Driver macros. */
424 /*===========================================================================*/
425 
426 /**
427  * @name R1 response utilities
428  * @{
429  */
430 /**
431  * @brief Evaluates to @p true if the R1 response contains error flags.
432  *
433  * @param[in] r1 the r1 response
434  */
435 #define MMCSD_R1_ERROR(r1) (((r1) & MMCSD_R1_ERROR_MASK) != 0U)
436 
437 /**
438  * @brief Returns the status field of an R1 response.
439  *
440  * @param[in] r1 the r1 response
441  */
442 #define MMCSD_R1_STS(r1) (((r1) >> 9U) & 15U)
443 
444 /**
445  * @brief Evaluates to @p true if the R1 response indicates a locked card.
446  *
447  * @param[in] r1 the r1 response
448  */
449 #define MMCSD_R1_IS_CARD_LOCKED(r1) ((((r1) >> 21U) & 1U) != 0U)
450 /** @} */
451 
452 /**
453  * @name Macro Functions
454  * @{
455  */
456 /**
457  * @brief Returns the card capacity in blocks.
458  *
459  * @param[in] ip pointer to a @p MMCSDBlockDevice or derived class
460  *
461  * @return The card capacity.
462  *
463  * @api
464  */
465 #define mmcsdGetCardCapacity(ip) ((ip)->capacity)
466 /** @} */
467 
468 /*===========================================================================*/
469 /* External declarations. */
470 /*===========================================================================*/
471 
472 #ifdef __cplusplus
473 extern "C" {
474 #endif
475  uint32_t _mmcsd_get_slice(const uint32_t *data,
476  uint32_t end,
477  uint32_t start);
478  uint32_t _mmcsd_get_capacity(const uint32_t *csd);
479  uint32_t _mmcsd_get_capacity_ext(const uint8_t *ext_csd);
480  void _mmcsd_unpack_sdc_cid(const MMCSDBlockDevice *sdcp,
481  unpacked_sdc_cid_t *cidsdc);
482  void _mmcsd_unpack_mmc_cid(const MMCSDBlockDevice *sdcp,
483  unpacked_mmc_cid_t *cidmmc);
484  void _mmcsd_unpack_csd_mmc(const MMCSDBlockDevice *sdcp,
485  unpacked_mmc_csd_t *csdmmc);
486  void _mmcsd_unpack_csd_v10(const MMCSDBlockDevice *sdcp,
487  unpacked_sdc_csd_10_t *csd10);
488  void _mmcsd_unpack_csd_v20(const MMCSDBlockDevice *sdcp,
489  unpacked_sdc_csd_20_t *csd20);
490 #ifdef __cplusplus
491 }
492 #endif
493 
494 #endif /* HAL_USE_MMC_SPI == TRUE || HAL_USE_MMC_SDC == TRUE */
495 
496 #endif /* HAL_MMCSD_H */
497 
498 /** @} */
MCC/SD block device class.
Definition: hal_mmcsd.h:282
uint32_t _mmcsd_get_capacity_ext(const uint8_t *ext_csd)
Extract MMC card capacity from EXT_CSD.
Definition: hal_mmcsd.c:125
#define _mmcsd_block_device_data
MMCSDBlockDevice specific data.
Definition: hal_mmcsd.h:258
void _mmcsd_unpack_csd_mmc(const MMCSDBlockDevice *sdcp, unpacked_mmc_csd_t *csdmmc)
Unpacks MMC CSD array in structure.
Definition: hal_mmcsd.c:206
Unpacked CSD v1.0 register from SDC.
Definition: hal_mmcsd.h:321
Unpacked CSD register from MMC.
Definition: hal_mmcsd.h:386
void _mmcsd_unpack_csd_v20(const MMCSDBlockDevice *sdcp, unpacked_sdc_csd_20_t *csd20)
Unpacks SDC CSD v2.0 array in structure.
Definition: hal_mmcsd.c:296
Unpacked CID register from MMC.
Definition: hal_mmcsd.h:306
MMCSDBlockDevice virtual methods table.
Definition: hal_mmcsd.h:272
const struct MMCSDBlockDeviceVMT * vmt
Virtual Methods Table.
Definition: hal_mmcsd.h:284
void _mmcsd_unpack_sdc_cid(const MMCSDBlockDevice *sdcp, unpacked_sdc_cid_t *cidsdc)
Unpacks SDC CID array in structure.
Definition: hal_mmcsd.c:143
#define _base_block_device_methods
BaseBlockDevice specific methods.
Definition: hal_ioblock.h:63
uint32_t _mmcsd_get_slice(const uint32_t *data, uint32_t end, uint32_t start)
Gets a bit field from a words array.
Definition: hal_mmcsd.c:61
Unpacked CID register from SDC.
Definition: hal_mmcsd.h:291
void _mmcsd_unpack_csd_v10(const MMCSDBlockDevice *sdcp, unpacked_sdc_csd_10_t *csd10)
Unpacks SDC CSD v1.0 array in structure.
Definition: hal_mmcsd.c:254
void _mmcsd_unpack_mmc_cid(const MMCSDBlockDevice *sdcp, unpacked_mmc_cid_t *cidmmc)
Unpacks MMC CID array in structure.
Definition: hal_mmcsd.c:174
Unpacked CSD v2.0 register from SDC.
Definition: hal_mmcsd.h:356
uint32_t _mmcsd_get_capacity(const uint32_t *csd)
Extract card capacity from a CSD.
Definition: hal_mmcsd.c:93