diff options
Diffstat (limited to 'nuttx/configs/pic32-starterkit/src/up_nsh.c')
-rw-r--r-- | nuttx/configs/pic32-starterkit/src/up_nsh.c | 33 |
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; } |