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
9#pragma once
10
20
21#include <stdint.h>
22
23#include "periph/cpu_dma.h"
24#include "periph/cpu_gpio.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/* Declare the types for SDIO/SDMMC only if the STM32 has SDIO/SDMMC peripheral */
31#if defined(SDMMC_POWER_PWRCTRL) || defined(SDIO_POWER_PWRCTRL)
32
33/* For F1, F2, F4 and L1 the SDMMC interface is called SDIO, define used
34 * symbols for source code compatibility */
35#if !defined(SDMMC1) && !DOXYGEN
36#define SDMMC_TypeDef SDIO_TypeDef
37#endif
38
42#define SDMMC_CPU_DMA_ALIGNMENT 4
43
47#define SDMMC_CPU_DMA_REQUIREMENTS __attribute__((aligned(SDMMC_CPU_DMA_ALIGNMENT)))
48
52typedef struct {
53 gpio_t pin;
54#ifndef CPU_FAM_STM32F1
55 gpio_af_t af;
56#endif
57} sdmmc_pin_t;
58
66typedef struct {
67 SDMMC_TypeDef *dev;
68 uint8_t bus;
69 uint32_t rcc_mask;
70 gpio_t cd;
71 int cd_active;
72 gpio_mode_t cd_mode;
73 sdmmc_pin_t clk;
74 sdmmc_pin_t cmd;
75 sdmmc_pin_t dat0;
76 sdmmc_pin_t dat1;
77 sdmmc_pin_t dat2;
78 sdmmc_pin_t dat3;
79#if IS_USED(MODULE_PERIPH_SDMMC_8BIT)
80 sdmmc_pin_t dat4;
81 sdmmc_pin_t dat5;
82 sdmmc_pin_t dat6;
83 sdmmc_pin_t dat7;
84#endif
85#if IS_USED(MODULE_PERIPH_DMA)
86 dma_t dma;
87 uint8_t dma_chan;
88#endif
89 uint8_t irqn;
91
92#endif /* defined(SDMMC_POWER_PWRCTRL) || defined(SDIO_POWER_PWRCTRL) */
93
94#ifdef __cplusplus
95}
96#endif
97
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:165
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:91
unsigned dma_t
DMA channel type.
SDMMC slot configuration.
Definition periph_cpu.h:704