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

drivers/sdcard_spi: remove auto-init

This commit is contained in:
Daniel Lockau 2020-07-09 08:49:20 +02:00
parent 40a7215680
commit 0d3dc120ef
12 changed files with 11 additions and 77 deletions

View File

@ -26,9 +26,8 @@
#if defined(MODULE_MTD_SDCARD) || defined(DOXYGEN)
/* this is provided by the sdcard_spi driver
* see sys/auto_init/storage/auto_init_sdcard_spi.c */
extern sdcard_spi_t sdcard_spi_devs[sizeof(sdcard_spi_params) /
sizeof(sdcard_spi_params[0])];
* see drivers/sdcard_spi/sdcard_spi.c */
extern sdcard_spi_t sdcard_spi_devs[ARRAY_SIZE(sdcard_spi_params)];
mtd_sdcard_t sensebox_sd_dev = {
.base = {
.driver = &mtd_sdcard_driver,

View File

@ -684,7 +684,6 @@ ifneq (,$(filter sdcard_spi,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_spi
FEATURES_OPTIONAL += periph_spi_reconfigure
DEFAULT_MODULE += auto_init_storage
USEMODULE += checksum
USEMODULE += xtimer
endif

View File

@ -43,6 +43,12 @@ static sd_rw_response_t _read_csd(sdcard_spi_t *card);
static sd_rw_response_t _read_data_packet(sdcard_spi_t *card, uint8_t token, uint8_t *data, int size);
static sd_rw_response_t _write_data_packet(sdcard_spi_t *card, uint8_t token, const uint8_t *data, int size);
/* number of used sd cards */
#define SDCARD_SPI_NUM ARRAY_SIZE(sdcard_spi_params)
/* Allocate memory for the device descriptors */
sdcard_spi_t sdcard_spi_devs[SDCARD_SPI_NUM];
/* CRC-7 (polynomial: x^7 + x^3 + 1) LSB of CRC-7 in a 8-bit variable is always 1*/
static uint8_t _crc_7(const uint8_t *data, int n);

View File

@ -34,7 +34,7 @@
#define SDCARD_SPI_NUM ARRAY_SIZE(sdcard_spi_params)
/* SD card devices are provided by auto_init_sdcard_spi */
/* SD card devices are provided by drivers/sdcard_spi/sdcard_spi.c */
extern sdcard_spi_t sdcard_spi_devs[SDCARD_SPI_NUM];
/* Configure MTD device for the first SD card */

View File

@ -258,7 +258,6 @@ NO_PSEUDOMODULES += auto_init_can
NO_PSEUDOMODULES += auto_init_loramac
NO_PSEUDOMODULES += auto_init_multimedia
NO_PSEUDOMODULES += auto_init_security
NO_PSEUDOMODULES += auto_init_storage
NO_PSEUDOMODULES += auto_init_usbus
# Packages may also add modules to PSEUDOMODULES in their `Makefile.include`.

View File

@ -6,10 +6,6 @@ ifneq (,$(filter saul_init,$(USEMODULE)))
DIRS += saul
endif
ifneq (,$(filter auto_init_storage,$(USEMODULE)))
DIRS += storage
endif
ifneq (,$(filter auto_init_can,$(USEMODULE)))
DIRS += can
endif

View File

@ -215,16 +215,6 @@ void auto_init(void)
auto_init_gnrc_rpl();
}
/* initialize storage devices */
if (IS_USED(MODULE_AUTO_INIT_STORAGE)) {
LOG_DEBUG("Auto init STORAGE.\n");
if (IS_USED(MODULE_SDCARD_SPI)) {
extern void auto_init_sdcard_spi(void);
auto_init_sdcard_spi();
}
}
if (IS_USED(MODULE_AUTO_INIT_CAN)) {
LOG_DEBUG("Auto init CAN.\n");

View File

@ -1,3 +0,0 @@
MODULE = auto_init_storage
include $(RIOTBASE)/Makefile.base

View File

@ -1,51 +0,0 @@
/*
* Copyright (C) 2017 Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
*
* 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.
*/
/**
* @ingroup sys_auto_init
* @{
*
* @file
* @brief Auto initialization for sd-cards connected over spi
*
* @author Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
*/
#include "log.h"
#include "sdcard_spi.h"
#include "sdcard_spi_params.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
/**
* @brief number of used sd cards
* @{
*/
#define SDCARD_SPI_NUM ARRAY_SIZE(sdcard_spi_params)
/** @} */
/**
* @brief Allocate memory for the device descriptors
* @{
*/
sdcard_spi_t sdcard_spi_devs[SDCARD_SPI_NUM];
/** @} */
void auto_init_sdcard_spi(void)
{
for (unsigned i = 0; i < SDCARD_SPI_NUM; i++) {
LOG_DEBUG("[auto_init_storage] initializing sdcard_spi #%u\n", i);
if (sdcard_spi_init(&sdcard_spi_devs[i], &sdcard_spi_params[i]) !=
SDCARD_SPI_OK) {
LOG_ERROR("[auto_init_storage] error initializing sdcard_spi #%u\n", i);
}
}
}
/** @} */

View File

@ -1,7 +1,6 @@
include ../Makefile.tests_common
USEMODULE += sdcard_spi
USEMODULE += auto_init_storage
USEMODULE += fmt
USEMODULE += shell

View File

@ -35,7 +35,7 @@
#define ASCII_UNPRINTABLE_REPLACEMENT "."
/* this is provided by the sdcard_spi driver
* see sys/auto_init/storage/auto_init_sdcard_spi.c */
* see drivers/sdcard_spi/sdcard_spi.c */
extern sdcard_spi_t sdcard_spi_devs[ARRAY_SIZE(sdcard_spi_params)];
sdcard_spi_t *card = &sdcard_spi_devs[0];

View File

@ -58,7 +58,7 @@ mtd_dev_t *fatfs_mtd_devs[1];
#include "mtd_sdcard.h"
#include "sdcard_spi_params.h"
#define SDCARD_SPI_NUM ARRAY_SIZE(sdcard_spi_params)
/* sdcard devs are provided by sys/auto_init/storage/auto_init_sdcard_spi.c */
/* sdcard devs are provided by drivers/sdcard_spi/sdcard_spi.c */
extern sdcard_spi_t sdcard_spi_devs[SDCARD_SPI_NUM];
mtd_sdcard_t mtd_sdcard_devs[SDCARD_SPI_NUM];
mtd_dev_t *fatfs_mtd_devs[SDCARD_SPI_NUM];