drivers/sdcard_spi: remove auto-init
This commit is contained in:
parent
40a7215680
commit
0d3dc120ef
@ -26,9 +26,8 @@
|
|||||||
|
|
||||||
#if defined(MODULE_MTD_SDCARD) || defined(DOXYGEN)
|
#if defined(MODULE_MTD_SDCARD) || defined(DOXYGEN)
|
||||||
/* this is provided by the sdcard_spi driver
|
/* 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[sizeof(sdcard_spi_params) /
|
extern sdcard_spi_t sdcard_spi_devs[ARRAY_SIZE(sdcard_spi_params)];
|
||||||
sizeof(sdcard_spi_params[0])];
|
|
||||||
mtd_sdcard_t sensebox_sd_dev = {
|
mtd_sdcard_t sensebox_sd_dev = {
|
||||||
.base = {
|
.base = {
|
||||||
.driver = &mtd_sdcard_driver,
|
.driver = &mtd_sdcard_driver,
|
||||||
|
|||||||
@ -684,7 +684,6 @@ ifneq (,$(filter sdcard_spi,$(USEMODULE)))
|
|||||||
FEATURES_REQUIRED += periph_gpio
|
FEATURES_REQUIRED += periph_gpio
|
||||||
FEATURES_REQUIRED += periph_spi
|
FEATURES_REQUIRED += periph_spi
|
||||||
FEATURES_OPTIONAL += periph_spi_reconfigure
|
FEATURES_OPTIONAL += periph_spi_reconfigure
|
||||||
DEFAULT_MODULE += auto_init_storage
|
|
||||||
USEMODULE += checksum
|
USEMODULE += checksum
|
||||||
USEMODULE += xtimer
|
USEMODULE += xtimer
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -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 _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);
|
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*/
|
/* 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);
|
static uint8_t _crc_7(const uint8_t *data, int n);
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#define SDCARD_SPI_NUM ARRAY_SIZE(sdcard_spi_params)
|
#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];
|
extern sdcard_spi_t sdcard_spi_devs[SDCARD_SPI_NUM];
|
||||||
|
|
||||||
/* Configure MTD device for the first SD card */
|
/* Configure MTD device for the first SD card */
|
||||||
|
|||||||
@ -258,7 +258,6 @@ NO_PSEUDOMODULES += auto_init_can
|
|||||||
NO_PSEUDOMODULES += auto_init_loramac
|
NO_PSEUDOMODULES += auto_init_loramac
|
||||||
NO_PSEUDOMODULES += auto_init_multimedia
|
NO_PSEUDOMODULES += auto_init_multimedia
|
||||||
NO_PSEUDOMODULES += auto_init_security
|
NO_PSEUDOMODULES += auto_init_security
|
||||||
NO_PSEUDOMODULES += auto_init_storage
|
|
||||||
NO_PSEUDOMODULES += auto_init_usbus
|
NO_PSEUDOMODULES += auto_init_usbus
|
||||||
|
|
||||||
# Packages may also add modules to PSEUDOMODULES in their `Makefile.include`.
|
# Packages may also add modules to PSEUDOMODULES in their `Makefile.include`.
|
||||||
|
|||||||
@ -6,10 +6,6 @@ ifneq (,$(filter saul_init,$(USEMODULE)))
|
|||||||
DIRS += saul
|
DIRS += saul
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter auto_init_storage,$(USEMODULE)))
|
|
||||||
DIRS += storage
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq (,$(filter auto_init_can,$(USEMODULE)))
|
ifneq (,$(filter auto_init_can,$(USEMODULE)))
|
||||||
DIRS += can
|
DIRS += can
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -215,16 +215,6 @@ void auto_init(void)
|
|||||||
auto_init_gnrc_rpl();
|
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)) {
|
if (IS_USED(MODULE_AUTO_INIT_CAN)) {
|
||||||
LOG_DEBUG("Auto init CAN.\n");
|
LOG_DEBUG("Auto init CAN.\n");
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
MODULE = auto_init_storage
|
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
|
||||||
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/** @} */
|
|
||||||
@ -1,7 +1,6 @@
|
|||||||
include ../Makefile.tests_common
|
include ../Makefile.tests_common
|
||||||
|
|
||||||
USEMODULE += sdcard_spi
|
USEMODULE += sdcard_spi
|
||||||
USEMODULE += auto_init_storage
|
|
||||||
USEMODULE += fmt
|
USEMODULE += fmt
|
||||||
USEMODULE += shell
|
USEMODULE += shell
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#define ASCII_UNPRINTABLE_REPLACEMENT "."
|
#define ASCII_UNPRINTABLE_REPLACEMENT "."
|
||||||
|
|
||||||
/* this is provided by the sdcard_spi driver
|
/* 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)];
|
extern sdcard_spi_t sdcard_spi_devs[ARRAY_SIZE(sdcard_spi_params)];
|
||||||
sdcard_spi_t *card = &sdcard_spi_devs[0];
|
sdcard_spi_t *card = &sdcard_spi_devs[0];
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ mtd_dev_t *fatfs_mtd_devs[1];
|
|||||||
#include "mtd_sdcard.h"
|
#include "mtd_sdcard.h"
|
||||||
#include "sdcard_spi_params.h"
|
#include "sdcard_spi_params.h"
|
||||||
#define SDCARD_SPI_NUM ARRAY_SIZE(sdcard_spi_params)
|
#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];
|
extern sdcard_spi_t sdcard_spi_devs[SDCARD_SPI_NUM];
|
||||||
mtd_sdcard_t mtd_sdcard_devs[SDCARD_SPI_NUM];
|
mtd_sdcard_t mtd_sdcard_devs[SDCARD_SPI_NUM];
|
||||||
mtd_dev_t *fatfs_mtd_devs[SDCARD_SPI_NUM];
|
mtd_dev_t *fatfs_mtd_devs[SDCARD_SPI_NUM];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user