Loading...
Searching...
No Matches
cpu_sdmmc.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include <stdint.h>
19
20#include "periph/cpu_dma.h"
21#include "periph/cpu_gpio.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Declare the types for SDIO/SDMMC only if the STM32 has SDIO/SDMMC peripheral */
28#if defined(SDMMC_POWER_PWRCTRL) || defined(SDIO_POWER_PWRCTRL)
29
30/* For F1, F2, F4 and L1 the SDMMC interface is called SDIO, define used
31 * symbols for source code compatibility */
32#if !defined(SDMMC1) && !DOXYGEN
33#define SDMMC_TypeDef SDIO_TypeDef
34#endif
35
39#define SDMMC_CPU_DMA_ALIGNMENT 4
40
44#define SDMMC_CPU_DMA_REQUIREMENTS __attribute__((aligned(SDMMC_CPU_DMA_ALIGNMENT)))
45
49typedef struct {
50 gpio_t pin;
51#ifndef CPU_FAM_STM32F1
52 gpio_af_t af;
53#endif
54} sdmmc_pin_t;
55
63typedef struct {
64 SDMMC_TypeDef *dev;
65 uint8_t bus;
66 uint32_t rcc_mask;
67 gpio_t cd;
68 int cd_active;
69 gpio_mode_t cd_mode;
70 sdmmc_pin_t clk;
71 sdmmc_pin_t cmd;
72 sdmmc_pin_t dat0;
73 sdmmc_pin_t dat1;
74 sdmmc_pin_t dat2;
75 sdmmc_pin_t dat3;
76#if IS_USED(MODULE_PERIPH_SDMMC_8BIT)
77 sdmmc_pin_t dat4;
78 sdmmc_pin_t dat5;
79 sdmmc_pin_t dat6;
80 sdmmc_pin_t dat7;
81#endif
82#if IS_USED(MODULE_PERIPH_DMA)
83 dma_t dma;
84 uint8_t dma_chan;
85#endif
86 uint8_t irqn;
88
89#endif /* defined(SDMMC_POWER_PWRCTRL) || defined(SDIO_POWER_PWRCTRL) */
90
91#ifdef __cplusplus
92}
93#endif
94
DMA CPU specific definitions for the STM32 family.
GPIO CPU definitions for the STM32 family.
gpio_af_t
Override alternative GPIO mode options.
Definition periph_cpu.h:162
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:88
unsigned dma_t
DMA channel type.
SDMMC slot configuration.
Definition periph_cpu.h:701