CARME-M4 BSP  V1.5
stm32f4_sdio_sd_lld.h
Go to the documentation of this file.
1 #ifndef __STM32F4_SDIO_SD_LLD_H__
2 #define __STM32F4_SDIO_SD_LLD_H__
3 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /* Includes ----------------------------------------------------------------*/
22 #include "stm32f4xx.h"
23 
24 #define SD_DETECT_USE 1
25 #if SD_DETECT_USE
26 #define SD_DETECT_PIN GPIO_Pin_11
27 #define SD_DETECT_GPIO_PORT GPIOI
28 #define SD_DETECT_GPIO_CLK RCC_AHB1Periph_GPIOI
29 #endif
30 
31 #define SDIO_FIFO_ADDRESS ((uint32_t)0x40012C80)
32 
35 #define SDIO_INIT_CLK_DIV ((uint8_t)0x76)
36 
39 #define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x0)
40 
41 #define SD_SDIO_DMA DMA2
42 #define SD_SDIO_DMA_CLK RCC_AHB1Periph_DMA2
43 
44 #define SD_SDIO_DMA_STREAM3 3
45 //#define SD_SDIO_DMA_STREAM6 6
47 #ifdef SD_SDIO_DMA_STREAM3
48 #define SD_SDIO_DMA_STREAM DMA2_Stream3
49 #define SD_SDIO_DMA_CHANNEL DMA_Channel_4
50 #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF3
51 #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF3
52 #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF3
53 #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF3
54 #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF3
55 #define SD_SDIO_DMA_IRQn DMA2_Stream3_IRQn
56 #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream3_IRQHandler
57 #elif defined SD_SDIO_DMA_STREAM6
58 #define SD_SDIO_DMA_STREAM DMA2_Stream6
59 #define SD_SDIO_DMA_CHANNEL DMA_Channel_4
60 #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF6
61 #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF6
62 #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF6
63 #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF6
64 #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF6
65 #define SD_SDIO_DMA_IRQn DMA2_Stream6_IRQn
66 #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream6_IRQHandler
67 #endif /* SD_SDIO_DMA_STREAM3 */
68 
69 void SD_LowLevel_DeInit(void);
70 void SD_LowLevel_Init(void);
71 void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize);
72 void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
90 #endif /* __STM32F4_SDIO_SD_LLD_H__ */
void SD_LowLevel_DeInit(void)
DeInitializes the SDIO interface. Disable SDIO Clock, Set Power State to OFF, DeInitializes the SDIO...
void SD_LowLevel_Init(void)
Initializes the SD Card and put it into StandBy State (Ready for data transfer).
void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize)
Configures the DMA2 Channel4 for SDIO Rx request.
void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize)
Configures the DMA2 Channel4 for SDIO Tx request.