Merge pull request #13932 from akshaim/Kconfig_mtd_sdcard_1
drivers/mtd_sdcard : Expose Configurations to Kconfig
This commit is contained in:
commit
1fe30c1aca
@ -12,6 +12,8 @@ endmenu # Actuator Device Drivers
|
||||
|
||||
rsource "Kconfig.net"
|
||||
|
||||
rsource "periph_common/Kconfig"
|
||||
|
||||
menu "Sensor Device Drivers"
|
||||
rsource "ads101x/Kconfig"
|
||||
rsource "bmx055/Kconfig"
|
||||
@ -23,6 +25,8 @@ rsource "opt3001/Kconfig"
|
||||
rsource "sps30/Kconfig"
|
||||
endmenu # Sensor Device Drivers
|
||||
|
||||
rsource "periph_common/Kconfig"
|
||||
menu "Storage Device Drivers"
|
||||
rsource "mtd_sdcard/Kconfig"
|
||||
endmenu # Storage Device Drivers
|
||||
|
||||
endmenu # Drivers
|
||||
|
||||
@ -49,15 +49,16 @@ typedef struct {
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Enable Skip SDCard Erase
|
||||
* @brief Enable SDCard Erase
|
||||
* @note SDCards handle sector erase internally so it's
|
||||
* possible to directly write to the card without erasing
|
||||
* the sector first.
|
||||
* Attention: an erase call will therefore NOT touch the content,
|
||||
* so disable this feature to ensure overriding the data.
|
||||
* possible to directly write to the card without erasing
|
||||
* the sector first.
|
||||
* Attention: an erase call will therefore NOT touch the content,
|
||||
* so enable this feature to ensure overriding the data.
|
||||
* This feature is currently not supported.
|
||||
*/
|
||||
#ifndef MTD_SDCARD_SKIP_ERASE
|
||||
#define MTD_SDCARD_SKIP_ERASE (1)
|
||||
#ifdef DOXYGEN
|
||||
#define CONFIG_MTD_SDCARD_ERASE
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
|
||||
23
drivers/mtd_sdcard/Kconfig
Normal file
23
drivers/mtd_sdcard/Kconfig
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2020 Freie Universitaet Berlin
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
menuconfig KCONFIG_MODULE_MTD_SDCARD
|
||||
bool "Configure MTD_SDCARD driver"
|
||||
depends on MODULE_MTD_SDCARD
|
||||
help
|
||||
Configure the MTD_SDCARD driver using Kconfig.
|
||||
|
||||
if KCONFIG_MODULE_MTD_SDCARD
|
||||
|
||||
config MTD_SDCARD_ERASE
|
||||
bool "Enable SD card erase"
|
||||
help
|
||||
Enable this to erase sector before a data write operation.
|
||||
SDCards handle sector erase internally so it's
|
||||
possible to directly write to the card without erasing
|
||||
the sector first hence this feature is disabled by default.
|
||||
|
||||
endif # KCONFIG_MODULE_MTD_SDCARD
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mtd_sdcard.h"
|
||||
#include "sdcard_spi.h"
|
||||
#include "sdcard_spi_internal.h"
|
||||
#include "kernel_defines.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
@ -103,11 +104,12 @@ static int mtd_sdcard_erase(mtd_dev_t *dev,
|
||||
(void)addr;
|
||||
(void)size;
|
||||
|
||||
#if MTD_SDCARD_SKIP_ERASE == 1
|
||||
return 0;
|
||||
#else
|
||||
return -ENOTSUP; /* explicit erase currently not supported */
|
||||
#endif
|
||||
if (!IS_ACTIVE(CONFIG_MTD_SDCARD_ERASE)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return -ENOTSUP; /* explicit erase currently not supported */
|
||||
}
|
||||
}
|
||||
|
||||
static int mtd_sdcard_power(mtd_dev_t *dev, enum mtd_power_state power)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user