Loading...
Searching...
No Matches
cpu_sdmmc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef PERIPH_CPU_SDMMC_H
20#define PERIPH_CPU_SDMMC_H
21
22#include <stdint.h>
23
24#include "periph/cpu_dma.h"
25#include "periph/cpu_gpio.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* Declare the types for SDIO/SDMMC only if the STM32 has SDIO/SDMMC peripheral */
32#if defined(SDMMC_POWER_PWRCTRL) || defined(SDIO_POWER_PWRCTRL)
33
34/* For F1, F2, F4 and L1 the SDMMC interface is called SDIO, define used
35 * symbols for source code compatibility */
36#if !defined(SDMMC1) && !DOXYGEN
37#define SDMMC_TypeDef SDIO_TypeDef
38#endif
39
43#define SDMMC_CPU_DMA_ALIGNMENT 4
44
48#define SDMMC_CPU_DMA_REQUIREMENTS __attribute__((aligned(SDMMC_CPU_DMA_ALIGNMENT)))
49
53typedef struct {
54 gpio_t pin;
55#ifndef CPU_FAM_STM32F1
56 gpio_af_t af;
57#endif
58} sdmmc_pin_t;
59
67typedef struct {
68 SDMMC_TypeDef *dev;
69 uint8_t bus;
70 uint32_t rcc_mask;
71 gpio_t cd;
72 int cd_active;
73 gpio_mode_t cd_mode;
74 sdmmc_pin_t clk;
75 sdmmc_pin_t cmd;
76 sdmmc_pin_t dat0;
77 sdmmc_pin_t dat1;
78 sdmmc_pin_t dat2;
79 sdmmc_pin_t dat3;
80#if IS_USED(MODULE_PERIPH_SDMMC_8BIT)
81 sdmmc_pin_t dat4;
82 sdmmc_pin_t dat5;
83 sdmmc_pin_t dat6;
84 sdmmc_pin_t dat7;
85#endif
86#if IS_USED(MODULE_PERIPH_DMA)
87 dma_t dma;
88 uint8_t dma_chan;
89#endif
90 uint8_t irqn;
92
93#endif /* defined(SDMMC_POWER_PWRCTRL) || defined(SDIO_POWER_PWRCTRL) */
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif /* PERIPH_CPU_SDMMC_H */
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:166
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:82
unsigned dma_t
DMA channel type.
SDMMC slot configuration.
Definition periph_cpu.h:704