summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-19 14:34:17 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-19 14:34:17 +0000
commit202f234c3343a159ec01df2a1d9d00235391142d (patch)
treeabbdb2445c46e5084cad2b36bf4cd51779b7fa82 /nuttx/configs
parent9a9050f6ddd125fe7686091f3da2dd72c2991cd7 (diff)
downloadpx4-nuttx-202f234c3343a159ec01df2a1d9d00235391142d.tar.gz
px4-nuttx-202f234c3343a159ec01df2a1d9d00235391142d.tar.bz2
px4-nuttx-202f234c3343a159ec01df2a1d9d00235391142d.zip
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
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_nsh.c35
-rw-r--r--nuttx/configs/shenzhou/src/up_nsh.c33
2 files changed, 66 insertions, 2 deletions
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