EFM32 Wonder Gecko Software Documentation  efm32wg-doc-5.1.2
microsd.h
Go to the documentation of this file.
1 /**************************************************************************/
17 #ifndef __MICROSD_H
18 #define __MICROSD_H
19 
20 #include "em_device.h"
21 #include "microsdconfig.h"
22 #include "em_gpio.h"
23 #include "integer.h"
24 
25 
26 /***************************************************************************/
31 /***************************************************************************/
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* Definitions for MMC/SDC command */
41 #define CMD0 (0)
42 #define CMD1 (1)
43 #define ACMD41 (41 | 0x80)
44 #define CMD8 (8)
45 #define CMD9 (9)
46 #define CMD10 (10)
47 #define CMD12 (12)
48 #define ACMD13 (13 | 0x80)
49 #define CMD16 (16)
50 #define CMD17 (17)
51 #define CMD18 (18)
52 #define CMD23 (23)
53 #define ACMD23 (23 | 0x80)
54 #define CMD24 (24)
55 #define CMD25 (25)
56 #define CMD41 (41)
57 #define CMD55 (55)
58 #define CMD58 (58)
61 void MICROSD_Init(void);
62 void MICROSD_Deinit(void);
63 
64 int MICROSD_Select(void);
65 void MICROSD_Deselect(void);
66 
67 void MICROSD_PowerOn(void);
68 void MICROSD_PowerOff(void);
69 
70 int MICROSD_BlockRx(uint8_t *buff, uint32_t btr);
71 int MICROSD_BlockTx(const uint8_t *buff, uint8_t token);
72 
73 uint8_t MICROSD_SendCmd(uint8_t cmd, DWORD arg);
74 uint8_t MICROSD_XferSpi(uint8_t data);
75 
76 void MICROSD_SpiClkFast(void);
77 void MICROSD_SpiClkSlow(void);
78 
79 bool MICROSD_TimeOutElapsed(void);
80 void MICROSD_TimeOutSet(uint32_t msec);
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
89 #endif
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
void MICROSD_SpiClkSlow(void)
Set SPI clock to a low frequency suitable for initial card initialization.
Definition: microsd.c:399
void MICROSD_PowerOn(void)
Turn on micro SD card power. DK doesn't support socket power control, only enable the SPI clock...
Definition: microsd.c:150
void MICROSD_Deinit(void)
Deinitialize SPI peripheral. Turn off the SPI peripheral and disable SPI GPIO pins.
Definition: microsd.c:91
void MICROSD_Deselect(void)
Deselect the micro SD card and release the SPI bus.
Definition: microsd.c:125
int MICROSD_Select(void)
Select the micro SD card and wait for the card to become ready.
Definition: microsd.c:135
bool MICROSD_TimeOutElapsed(void)
Check if timeout value set with MICROSD_TimeOutSet() has elapsed.
Definition: microsd.c:433
void MICROSD_SpiClkFast(void)
Set SPI clock to maximum frequency.
Definition: microsd.c:408
General Purpose IO (GPIO) peripheral API.
void MICROSD_TimeOutSet(uint32_t msec)
Set a timeout value. The timeout value will be decremented towards zero when SPI traffic to/from the ...
Definition: microsd.c:422
int MICROSD_BlockTx(const uint8_t *buff, uint8_t token)
Send a data block to micro SD card.
Definition: microsd.c:253
void MICROSD_PowerOff(void)
Turn off micro SD card power. DK doesn't support socket power control, only disable the SPI clock...
Definition: microsd.c:160
uint8_t MICROSD_SendCmd(uint8_t cmd, DWORD arg)
Send a command packet to micro SD card.
Definition: microsd.c:342
int MICROSD_BlockRx(uint8_t *buff, uint32_t btr)
Receive a data block from micro SD card.
Definition: microsd.c:178
uint8_t MICROSD_XferSpi(uint8_t data)
Do one SPI transfer.
Definition: microsd.c:112