summaryrefslogtreecommitdiff
path: root/nuttx/configs/pic32-starterkit/src/up_nsh.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-03-07 22:50:43 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-03-07 22:50:43 +0000
commit64f3292a08e4d681e7f504ddbc1f2798f3780f0d (patch)
tree48e1bfc3c70cb04d8adcfcc5ff7e3f2b779e6b06 /nuttx/configs/pic32-starterkit/src/up_nsh.c
parentc1c23363041c3cd09a1fec50c16ca92c8c78a472 (diff)
downloadpx4-nuttx-64f3292a08e4d681e7f504ddbc1f2798f3780f0d.tar.gz
px4-nuttx-64f3292a08e4d681e7f504ddbc1f2798f3780f0d.tar.bz2
px4-nuttx-64f3292a08e4d681e7f504ddbc1f2798f3780f0d.zip
Add support for USB device testing on the PIC32 starter kit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4463 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/pic32-starterkit/src/up_nsh.c')
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_nsh.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/nuttx/configs/pic32-starterkit/src/up_nsh.c b/nuttx/configs/pic32-starterkit/src/up_nsh.c
index d66a651cd..db6dc922e 100644
--- a/nuttx/configs/pic32-starterkit/src/up_nsh.c
+++ b/nuttx/configs/pic32-starterkit/src/up_nsh.c
@@ -64,12 +64,12 @@
# define CONFIG_NSH_HAVEMMCSD 1
# define CONFIG_NSH_HAVEUSBHOST 1
# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 1
-# error "The Sure PIC32MX MMC/SD is on SPI2"
+# error "The PIC32 Starter Kit MMC/SD is on SPI2"
# undef CONFIG_NSH_MMCSDSPIPORTNO
# define CONFIG_NSH_MMCSDSPIPORTNO 2
# endif
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
-# error "The Sure PIC32MX MMC/SD is only one slot (0)"
+# error "The PIC32 Starter Kit has only one slot (0)"
# undef CONFIG_NSH_MMCSDSLOTNO
# define CONFIG_NSH_MMCSDSLOTNO 0
# endif
@@ -294,6 +294,28 @@ static int nsh_usbhostinitialize(void)
#endif
/****************************************************************************
+ * Name: nsh_usbdevinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBDEV
+static int nsh_usbdevinitialize(void)
+{
+ /* The PIC32 Starter Kit has no way to know when the USB is connected. So
+ * we will fake it and tell the USB driver that the USB is connected now.
+ */
+
+ pic32mx_usbattach();
+ return OK;
+}
+#else
+# define nsh_usbdevinitialize() (OK)
+#endif
+
+/****************************************************************************
* Public Functions
****************************************************************************/
@@ -318,5 +340,12 @@ int nsh_archinitialize(void)
ret = nsh_usbhostinitialize();
}
+
+ if (ret == OK)
+ {
+ /* Initialize USB device */
+
+ ret = nsh_usbdevinitialize();
+ }
return ret;
}