Several fixes to the PIC32 USB device OUT path logic

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4451 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-03-04 17:38:00 +00:00
parent 03c2be3856
commit 40f49928b0
4 changed files with 228 additions and 137 deletions
+2
View File
@@ -132,6 +132,8 @@ struct usbterm_globals_s
FILE *instream; /* Stream for incoming USB data */
FILE *outstream; /* Stream for outgoing USB data */
pthread_t listener; /* USB terminal listener thread */
bool peer; /* True: A peer is connected to the serial port on
* the remote host */
/* Buffers for incoming and outgoing data */
+27 -5
View File
@@ -127,15 +127,27 @@ FAR void *usbterm_listener(FAR void *parameter)
message("usbterm_listener: Waiting for remote input\n");
for (;;)
{
/* Display the prompt string on the remote USB serial connection */
/* Display the prompt string on the remote USB serial connection -- only
* if we know that there is someone listening at the other end. The
* remote side must initiate the the conversation.
*/
fputs("\rusbterm> ", g_usbterm.outstream);
fflush(g_usbterm.outstream);
if (g_usbterm.peer)
{
fputs("\rusbterm> ", g_usbterm.outstream);
fflush(g_usbterm.outstream);
}
/* Get the next line of input from the remote USB serial connection */
if (fgets(g_usbterm.inbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, g_usbterm.instream))
{
/* If we receive anything, then we can be assured that there is someone
* with the serial driver open on the remote host.
*/
g_usbterm.peer = true;
/* Echo the line on the local stdout */
fputs(g_usbterm.inbuffer, stdout);
@@ -181,6 +193,10 @@ int MAIN_NAME(int argc, char *argv[])
pthread_attr_t attr;
int ret;
/* Initialize global data */
memset(&g_usbterm, 0, sizeof(struct usbterm_globals_s));
/* Initialization of the USB hardware may be performed by logic external to
* this test.
*/
@@ -324,9 +340,11 @@ int MAIN_NAME(int argc, char *argv[])
return 1;
}
#endif
else
/* Is there anyone listening on the other end? */
else if (g_usbterm.peer)
{
/* Send the line of input via USB */
/* Yes.. Send the line of input via USB */
fputs(g_usbterm.outbuffer, g_usbterm.outstream);
@@ -335,6 +353,10 @@ int MAIN_NAME(int argc, char *argv[])
fputs("\rusbterm> ", g_usbterm.outstream);
fflush(g_usbterm.outstream);
}
else
{
printf("Still waiting for remote peer. Please try again later.\n", ret);
}
/* If USB tracing is enabled, then dump all collected trace data to stdout */
+5 -4
View File
@@ -152,10 +152,11 @@
to support a rich, multi-threaded development environment for deeply embedded
processors.
</p>
NON-GOALS: (1) It is not a goal to provide the rich level of OS
features like those provided with Linux.
Small footprint is more important than features.
Standard compliance is more important than small footprint.
NON-GOALS: (1) It is not a goal to provide the level of OS features like those provided by Linux.
In order to work with smaller MCUs, small footprint must be more important than an extensive feature set.
But standard compliance is more important than small footprint.
Surely a smaller RTOS could be produced by ignoring standards.
Think of NuttX is a tiny Linux work-alike with a much reduced feature set.
(2) There is no MMU-based support for processes.
At present, NuttX assumes a flat address space.
</p>
File diff suppressed because it is too large Load Diff