sd_mmc.h
Go to the documentation of this file.
1 
33 /*
34  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
35  */
36 
37 #ifndef SD_MMC_H_INCLUDED
38 #define SD_MMC_H_INCLUDED
39 
40 #include "compiler.h"
41 #include "conf_sd_mmc.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
62 typedef uint8_t sd_mmc_err_t;
63 
66 #define SD_MMC_OK 0
67 #define SD_MMC_INIT_ONGOING 1
68 #define SD_MMC_ERR_NO_CARD 2
69 #define SD_MMC_ERR_UNUSABLE 3
70 #define SD_MMC_ERR_SLOT 4
71 #define SD_MMC_ERR_COMM 5
72 #define SD_MMC_ERR_PARAM 6
73 #define SD_MMC_ERR_WP 7
74 
76 typedef uint8_t card_type_t;
77 
80 #define CARD_TYPE_UNKNOWN (0)
81 #define CARD_TYPE_SD (1 << 0)
82 #define CARD_TYPE_MMC (1 << 1)
83 #define CARD_TYPE_SDIO (1 << 2)
84 #define CARD_TYPE_HC (1 << 3)
85 #define CARD_TYPE_SD_COMBO (CARD_TYPE_SD | CARD_TYPE_SDIO)
87 
89 typedef uint8_t card_version_t;
90 
93 #define CARD_VER_UNKNOWN (0)
94 #define CARD_VER_SD_1_0 (0x10)
95 #define CARD_VER_SD_1_10 (0x1A)
96 #define CARD_VER_SD_2_0 (0X20)
97 #define CARD_VER_SD_3_0 (0X30)
98 #define CARD_VER_MMC_1_2 (0x12)
99 #define CARD_VER_MMC_1_4 (0x14)
100 #define CARD_VER_MMC_2_2 (0x22)
101 #define CARD_VER_MMC_3 (0x30)
102 #define CARD_VER_MMC_4 (0x40)
103 
105 #define SD_MMC_BLOCK_SIZE 512
107 
111 void sd_mmc_init(void);
112 
117 uint8_t sd_mmc_nb_slot(void);
118 
128 sd_mmc_err_t sd_mmc_check(uint8_t slot);
129 
136 card_type_t sd_mmc_get_type(uint8_t slot);
137 
144 card_version_t sd_mmc_get_version(uint8_t slot);
145 
152 uint32_t sd_mmc_get_capacity(uint8_t slot);
153 
160 bool sd_mmc_is_write_protected(uint8_t slot);
161 
172 sd_mmc_err_t sd_mmc_init_read_blocks(uint8_t slot, uint32_t start,
173  uint16_t nb_block);
174 
184 sd_mmc_err_t sd_mmc_start_read_blocks(void *dest, uint16_t nb_block);
185 
196 sd_mmc_err_t sd_mmc_wait_end_of_read_blocks(bool abort);
197 
208 sd_mmc_err_t sd_mmc_init_write_blocks(uint8_t slot, uint32_t start,
209  uint16_t nb_block);
210 
220 sd_mmc_err_t sd_mmc_start_write_blocks(const void *src, uint16_t nb_block);
221 
232 sd_mmc_err_t sd_mmc_wait_end_of_write_blocks(bool abort);
233 
234 #ifdef SDIO_SUPPORT_ENABLE
235 
246 sd_mmc_err_t sdio_read_direct(uint8_t slot, uint8_t func_num, uint32_t addr,
247  uint8_t *dest);
259 sd_mmc_err_t sdio_write_direct(uint8_t slot, uint8_t func_num, uint32_t addr,
260  uint8_t data);
261 
276 sd_mmc_err_t sdio_read_extended(uint8_t slot, uint8_t func_num, uint32_t addr,
277  uint8_t inc_addr, uint8_t *dest, uint16_t size);
278 
293 sd_mmc_err_t sdio_write_extended(uint8_t slot, uint8_t func_num, uint32_t addr,
294  uint8_t inc_addr, uint8_t *src, uint16_t size);
295 #endif // SDIO_SUPPORT_ENABLE
296 
299 #ifdef __cplusplus
300 }
301 #endif
302 
303 #endif /* SD_MMC_H_INCLUDED */
bool sd_mmc_is_write_protected(uint8_t slot)
Get the card write protection status.
Definition: sd_mmc.c:1829
sd_mmc_err_t sd_mmc_wait_end_of_read_blocks(bool abort)
Wait the end of read blocks of data from the card.
Definition: sd_mmc.c:1905
sd_mmc_err_t sd_mmc_wait_end_of_write_blocks(bool abort)
Wait the end of write blocks of data.
Definition: sd_mmc.c:1991
uint8_t card_version_t
Type of card version.
Definition: sd_mmc.h:89
uint32_t sd_mmc_get_capacity(uint8_t slot)
Get the memory capacity.
Definition: sd_mmc.c:1820
uint8_t sd_mmc_nb_slot(void)
Return the number of slot available.
Definition: sd_mmc.c:1771
sd_mmc_err_t sd_mmc_init_write_blocks(uint8_t slot, uint32_t start, uint16_t nb_block)
Initialize the write blocks of data.
Definition: sd_mmc.c:1932
sd_mmc_err_t sd_mmc_start_write_blocks(const void *src, uint16_t nb_block)
Start the write blocks of data.
Definition: sd_mmc.c:1980
card_type_t sd_mmc_get_type(uint8_t slot)
Get the card type.
Definition: sd_mmc.c:1802
Commonly used includes, types and macros.
void sd_mmc_init(void)
Initialize the SD/MMC stack and low level driver required.
Definition: sd_mmc.c:1746
sd_mmc_err_t sd_mmc_check(uint8_t slot)
Performs a card checks.
Definition: sd_mmc.c:1776
sd_mmc_err_t sd_mmc_init_read_blocks(uint8_t slot, uint32_t start, uint16_t nb_block)
Initialize the read blocks of data from the card.
Definition: sd_mmc.c:1842
card_version_t sd_mmc_get_version(uint8_t slot)
Get the card version.
Definition: sd_mmc.c:1811
USBInterfaceDescriptor data
SD/MMC stack configuration file.
uint8_t card_type_t
Type of card type.
Definition: sd_mmc.h:76
sd_mmc_err_t sd_mmc_start_read_blocks(void *dest, uint16_t nb_block)
Start the read blocks of data from the card.
Definition: sd_mmc.c:1893
uint8_t sd_mmc_err_t
Type of return error code.
Definition: sd_mmc.h:62


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:58