diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-03-06 20:21:57 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-03-06 20:21:57 +0000 |
commit | 2cb26d0787b41ae1dc7607ef11ac11047491d7dc (patch) | |
tree | 0bfa100d6337879837dd6abf9612a0a7f889129b /nuttx/configs/sure-pic32mx/src | |
parent | 829c1351e2be18265cd8ea8c481eec674192a6d5 (diff) | |
download | px4-nuttx-2cb26d0787b41ae1dc7607ef11ac11047491d7dc.tar.gz px4-nuttx-2cb26d0787b41ae1dc7607ef11ac11047491d7dc.tar.bz2 px4-nuttx-2cb26d0787b41ae1dc7607ef11ac11047491d7dc.zip |
Add support for use of a USB serial device to provide NSH console I/O. Verified on the Sure PIPIC32MX board
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4458 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/sure-pic32mx/src')
-rw-r--r-- | nuttx/configs/sure-pic32mx/src/Makefile | 2 | ||||
-rw-r--r-- | nuttx/configs/sure-pic32mx/src/up_nsh.c | 35 | ||||
-rw-r--r-- | nuttx/configs/sure-pic32mx/src/up_usbterm.c | 11 |
3 files changed, 41 insertions, 7 deletions
diff --git a/nuttx/configs/sure-pic32mx/src/Makefile b/nuttx/configs/sure-pic32mx/src/Makefile index 22f03d2bc..f934ae35a 100644 --- a/nuttx/configs/sure-pic32mx/src/Makefile +++ b/nuttx/configs/sure-pic32mx/src/Makefile @@ -1,7 +1,7 @@ ############################################################################ # configs/sure-pic32mx/src/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without diff --git a/nuttx/configs/sure-pic32mx/src/up_nsh.c b/nuttx/configs/sure-pic32mx/src/up_nsh.c index 9f2498ace..057b1467e 100644 --- a/nuttx/configs/sure-pic32mx/src/up_nsh.c +++ b/nuttx/configs/sure-pic32mx/src/up_nsh.c @@ -2,8 +2,8 @@ * config/sure-pic32mx/src/up_nsh.c * arch/arm/src/board/up_nsh.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -246,7 +246,7 @@ errout: * Name: nsh_usbhostinitialize * * Description: - * Initialize SPI-based microSD. + * Initialize USB Host * ****************************************************************************/ @@ -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 Sure board 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; } diff --git a/nuttx/configs/sure-pic32mx/src/up_usbterm.c b/nuttx/configs/sure-pic32mx/src/up_usbterm.c index a7394c20f..9ff333ce2 100644 --- a/nuttx/configs/sure-pic32mx/src/up_usbterm.c +++ b/nuttx/configs/sure-pic32mx/src/up_usbterm.c @@ -1,6 +1,6 @@ /************************************************************************************ - * configs/sure-pic32mx/src/up_usbdev.c - * arch/arm/src/board/up_usbdev.c + * configs/sure-pic32mx/src/up_usbterm.c + * arch/arm/src/board/up_usbterm.c * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -78,9 +78,14 @@ int usbterm_devinit(void) { /* The Sure board 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. + * + * If examples/usbterm is built as an NSH built-in application, then + * pic32mx_usbattach() will be called in nsh_archinitialize(). */ +#ifndef CONFIG_EXAMPLES_USBTERM_BUILTIN pic32mx_usbattach(); +#endif return OK; } @@ -89,7 +94,7 @@ int usbterm_devinit(void) * * Description: * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will - * call this user provided function as part of its termination sequeunce. + * call this user provided function as part of its termination sequence. * ****************************************************************************/ |