Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/periph_sdmmc: define a High-level SDIO/SD/MMC API and low-level SDMMC periperal driver interface #19539

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ rsource "mtd_sdcard/Kconfig"
rsource "nvram/Kconfig"
rsource "nvram_spi/Kconfig"
rsource "sdcard_spi/Kconfig"
rsource "sdmmc/Kconfig"
endmenu # Storage Device Drivers

endmenu # Drivers
80 changes: 80 additions & 0 deletions drivers/include/mtd_sdmmc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (C) 2017 HAW-Hamburg
* 2023 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @defgroup drivers_mtd_sdmmc mtd wrapper for sdmmc
* @ingroup drivers_storage
* @brief Driver for SD Memory Cards and MMCs/eMMCs using mtd interface
*
* @{
*
* @file
* @brief Interface definition for mtd_sdmmc driver
*
* @author Michel Rottleuthner <[email protected]>
* @author Gunar Schorcht <[email protected]>
*/

#ifndef MTD_SDMMC_H
#define MTD_SDMMC_H

#include <stdint.h>

#include "mtd.h"
#include "sdmmc/sdmmc.h"

#ifdef __cplusplus
extern "C"
{
#endif

/**
* @brief Device descriptor for a mtd_sdmmc device
*
* This is an extension of the @c mtd_dev_t struct
*/
typedef struct {
mtd_dev_t base; /**< inherit mtd_dev_t object */
sdmmc_dev_t *sdmmc; /**< SD/MMC device descriptor */
uint8_t sdmmc_idx; /**< SD/MMC peripheral index */
} mtd_sdmmc_t;

benpicco marked this conversation as resolved.
Show resolved Hide resolved
/**
* @defgroup drivers_mtd_sdmmc_config SD Memory Card driver compile configuration
* @ingroup config_drivers_storage
* @{
*/
/**
* @brief Enable SD Memory Card Erase
*
* SD Memory Cards and MMCs/eMMCs handle sector erase internally
* so it's possible to directly write to the card without erasing
* the sector first.
*
* @note An erase call will NOT touch the content if `CONFIG_MTD_SDMMC_ERASE`
* is not set, so enable this feature to ensure overriding the data.
*
* @pre This feature requires the `mtd_write_page` module.
*/
#ifdef DOXYGEN
#define CONFIG_MTD_SDMMC_ERASE
#endif
/** @} */

/**
* @brief sdcard device operations table for mtd
*/
extern const mtd_desc_t mtd_sdmmc_driver;

#ifdef __cplusplus
}
#endif

#endif /* MTD_SDMMC_H */
/** @} */
Loading