From 202f234c3343a159ec01df2a1d9d00235391142d Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 19 Sep 2012 14:34:17 +0000 Subject: Add support so that the W25 FLASH can be used with both the Shenzhou and Fire-stm32v2 boards git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5166 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/configs/fire-stm32v2/src/up_nsh.c | 35 ++++++++++++++++++++++++++++++++- nuttx/configs/shenzhou/src/up_nsh.c | 33 ++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) (limited to 'nuttx/configs') diff --git a/nuttx/configs/fire-stm32v2/src/up_nsh.c b/nuttx/configs/fire-stm32v2/src/up_nsh.c index f728a227a..ba93d714f 100644 --- a/nuttx/configs/fire-stm32v2/src/up_nsh.c +++ b/nuttx/configs/fire-stm32v2/src/up_nsh.c @@ -57,6 +57,7 @@ #define HAVE_MMCSD 1 #define HAVE_USBDEV 1 +#define HAVE_W25 1 /* Configuration ************************************************************/ /* SPI1 connects to the SD CARD (and to the SPI FLASH) */ @@ -96,6 +97,24 @@ # endif #endif +/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ + +#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) +# undef HAVE_W25 +#endif + +/* Can't support W25 features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef HAVE_W25 +#endif + +/* Default W25 minor number */ + +#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) +# define CONFIG_NSH_W25MINOR 0 +#endif + /* Can't support USB host or device features if the USB peripheral or the USB * device infrastructure is not enabled */ @@ -134,11 +153,25 @@ int nsh_archinitialize(void) { -#ifdef HAVE_MMCSD +#if defined(HAVE_MMCSD) || defined(HAVE_W25) int ret; +#endif + + /* Initialize and register the W25 FLASH file system. */ + +#ifdef HAVE_W25 + ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); + if (ret < 0) + { + message("nsh_archinitialize: Failed to initialize W25 minor %d: %d\n", + CONFIG_NSH_W25MINOR, ret); + return ret; + } +#endif /* Initialize the SDIO-based MMC/SD slot */ +#ifdef HAVE_MMCSD ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR); if (ret < 0) { diff --git a/nuttx/configs/shenzhou/src/up_nsh.c b/nuttx/configs/shenzhou/src/up_nsh.c index 1324ae0b9..e6126ba4d 100644 --- a/nuttx/configs/shenzhou/src/up_nsh.c +++ b/nuttx/configs/shenzhou/src/up_nsh.c @@ -58,6 +58,7 @@ #define HAVE_MMCSD 1 #define HAVE_USBDEV 1 #define HAVE_USBHOST 1 +#define HAVE_W25 1 /* Configuration ************************************************************/ /* SPI1 connects to the SD CARD (and to the SPI FLASH) */ @@ -107,6 +108,24 @@ # endif #endif +/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ + +#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) +# undef HAVE_W25 +#endif + +/* Can't support W25 features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef HAVE_W25 +#endif + +/* Default W25 minor number */ + +#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) +# define CONFIG_NSH_W25MINOR 0 +#endif + /* Can't support USB host or device features if USB OTG FS is not enabled */ #ifndef CONFIG_STM32_OTGFS @@ -156,10 +175,22 @@ int nsh_archinitialize(void) { -#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) +#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) || defined(HAVE_W25) int ret; #endif + /* Initialize and register the W25 FLASH file system. */ + +#ifdef HAVE_W25 + ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); + if (ret < 0) + { + message("nsh_archinitialize: Failed to initialize W25 minor %d: %d\n", + CONFIG_NSH_W25MINOR, ret); + return ret; + } +#endif + /* Initialize the SPI-based MMC/SD slot */ #ifdef HAVE_MMCSD -- cgit v1.2.3