Merge pull request #8491 from hydra/bf-h7-sd-fixes
H7 SDIO/SDCARD fixes/cleanups.
This commit is contained in:
commit
8a8e8e7cb9
|
@ -60,7 +60,7 @@ typedef struct dmaTimerMapping_s {
|
||||||
#define REQMAP(periph, device) { DMA_PERIPH_ ## periph, periph ## DEV_ ## device, DMA_REQUEST_ ## periph ## device }
|
#define REQMAP(periph, device) { DMA_PERIPH_ ## periph, periph ## DEV_ ## device, DMA_REQUEST_ ## periph ## device }
|
||||||
#define REQMAP_DIR(periph, device, dir) { DMA_PERIPH_ ## periph ## _ ## dir, periph ## DEV_ ## device, DMA_REQUEST_ ## periph ## device ## _ ## dir }
|
#define REQMAP_DIR(periph, device, dir) { DMA_PERIPH_ ## periph ## _ ## dir, periph ## DEV_ ## device, DMA_REQUEST_ ## periph ## device ## _ ## dir }
|
||||||
|
|
||||||
// Resolve UART/UART mess
|
// Resolve UART/USART mess
|
||||||
#define DMA_REQUEST_UART1_RX DMA_REQUEST_USART1_RX
|
#define DMA_REQUEST_UART1_RX DMA_REQUEST_USART1_RX
|
||||||
#define DMA_REQUEST_UART1_TX DMA_REQUEST_USART1_TX
|
#define DMA_REQUEST_UART1_TX DMA_REQUEST_USART1_TX
|
||||||
#define DMA_REQUEST_UART2_RX DMA_REQUEST_USART2_RX
|
#define DMA_REQUEST_UART2_RX DMA_REQUEST_USART2_RX
|
||||||
|
@ -92,10 +92,6 @@ static const dmaPeripheralMapping_t dmaPeripheralMapping[] = {
|
||||||
REQMAP(ADC, 3),
|
REQMAP(ADC, 3),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SDCARD_SDIO
|
|
||||||
REQMAP_SGL(SDIO),
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_UART
|
#ifdef USE_UART
|
||||||
REQMAP_DIR(UART, 1, TX),
|
REQMAP_DIR(UART, 1, TX),
|
||||||
REQMAP_DIR(UART, 1, RX),
|
REQMAP_DIR(UART, 1, RX),
|
||||||
|
|
|
@ -202,6 +202,7 @@ static void sdcardSdio_init(const sdcardConfig_t *config, const spiPinConfig_t *
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_DMA_SPEC
|
#ifdef USE_DMA_SPEC
|
||||||
|
#if !defined(STM32H7) // H7 uses IDMA
|
||||||
const dmaChannelSpec_t *dmaChannelSpec = dmaGetChannelSpecByPeripheral(DMA_PERIPH_SDIO, 0, sdioConfig()->dmaopt);
|
const dmaChannelSpec_t *dmaChannelSpec = dmaGetChannelSpecByPeripheral(DMA_PERIPH_SDIO, 0, sdioConfig()->dmaopt);
|
||||||
|
|
||||||
if (!dmaChannelSpec) {
|
if (!dmaChannelSpec) {
|
||||||
|
@ -215,6 +216,7 @@ static void sdcardSdio_init(const sdcardConfig_t *config, const spiPinConfig_t *
|
||||||
sdcard.state = SDCARD_STATE_NOT_PRESENT;
|
sdcard.state = SDCARD_STATE_NOT_PRESENT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (config->cardDetectTag) {
|
if (config->cardDetectTag) {
|
||||||
sdcard.cardDetectPin = IOGetByTag(config->cardDetectTag);
|
sdcard.cardDetectPin = IOGetByTag(config->cardDetectTag);
|
||||||
|
@ -230,7 +232,11 @@ static void sdcardSdio_init(const sdcardConfig_t *config, const spiPinConfig_t *
|
||||||
sdcard.useCache = 0;
|
sdcard.useCache = 0;
|
||||||
}
|
}
|
||||||
#ifdef USE_DMA_SPEC
|
#ifdef USE_DMA_SPEC
|
||||||
|
#if defined(STM32H7) // H7 uses IDMA
|
||||||
|
SD_Initialize_LL(0);
|
||||||
|
#else
|
||||||
SD_Initialize_LL(dmaChannelSpec->ref);
|
SD_Initialize_LL(dmaChannelSpec->ref);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
SD_Initialize_LL(SDCARD_SDIO_DMA_OPT);
|
SD_Initialize_LL(SDCARD_SDIO_DMA_OPT);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#ifdef USE_SDCARD
|
||||||
|
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
#include "drivers/dma.h"
|
#include "drivers/dma.h"
|
||||||
#include "drivers/dma_reqmap.h"
|
#include "drivers/dma_reqmap.h"
|
||||||
|
@ -308,3 +310,4 @@ static int8_t STORAGE_GetMaxLun (void)
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|
||||||
|
#endif // USE_SDCARD
|
||||||
|
|
Loading…
Reference in New Issue