diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-04-18 22:56:25 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-04-18 22:56:25 +0200 |
commit | b149b834c835190fbb3f7e1914346d5e0620036d (patch) | |
tree | 6c038e9a756d50c0f11c0748d13b3ee2f3b9f084 /src | |
parent | 5f2601836524055c3eb046535d53a38b0749ca52 (diff) | |
download | px4-firmware-b149b834c835190fbb3f7e1914346d5e0620036d.tar.gz px4-firmware-b149b834c835190fbb3f7e1914346d5e0620036d.tar.bz2 px4-firmware-b149b834c835190fbb3f7e1914346d5e0620036d.zip |
Initial attempt at getting SDIO to work
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/boards/px4fmuv2/px4fmu_init.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/drivers/boards/px4fmuv2/px4fmu_init.c b/src/drivers/boards/px4fmuv2/px4fmu_init.c index 1d99f15bf..2222e59a8 100644 --- a/src/drivers/boards/px4fmuv2/px4fmu_init.c +++ b/src/drivers/boards/px4fmuv2/px4fmu_init.c @@ -55,6 +55,7 @@ #include <nuttx/arch.h> #include <nuttx/spi.h> #include <nuttx/i2c.h> +#include <nuttx/sdio.h> #include <nuttx/mmcsd.h> #include <nuttx/analog/adc.h> @@ -128,6 +129,7 @@ __EXPORT void stm32_boardinitialize(void) static struct spi_dev_s *spi1; static struct spi_dev_s *spi2; +static struct sdio_dev_s *sdio; #include <math.h> @@ -225,5 +227,28 @@ __EXPORT int nsh_archinitialize(void) //message("[boot] Successfully bound SPI port 2 to the FRAM driver\n"); + #ifdef CONFIG_MMCSD + /* First, get an instance of the SDIO interface */ + + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!sdio) { + message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return -ENODEV; + } + + /* Now bind the SDIO interface to the MMC/SD driver */ + int ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); + if (ret != OK) { + message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + return ret; + } + + /* Then let's guess and say that there is a card in the slot. There is no card detect GPIO. */ + sdio_mediachange(sdio, true); + + message("[boot] Initialized SDIO\n"); + #endif + return OK; } |