1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/mtd_sdard : Add MACRO and CONFIG_

Replace MTD_SDCARD_SKIP_ERASE with MTD_SDCARD_ERASE
Add CONFIG_ Prefix to MTD_SDCARD_ERASE
Model CONFIG_MTD_SDCARD_ERASE as bool
This commit is contained in:
Akshai M 2020-04-23 20:09:50 +05:30
parent 3c03394e1e
commit 854145c884
2 changed files with 15 additions and 12 deletions

View File

@ -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
/** @} */

View File

@ -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)