Several webserver bugs fixed

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@391 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-11-20 20:32:33 +00:00
parent 4a1d3b4ffc
commit e240648389
5 changed files with 76 additions and 3 deletions

View File

@ -77,6 +77,8 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
{
int i;
dbg(" TCB=%p name=%s\n", tcb, tcb->argv[0]);
#if CONFIG_NFILE_DESCRIPTORS > 0
if (tcb->filelist)
{
dbg(" filelist refcount=%d\n",
@ -92,7 +94,9 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
}
}
}
#endif
#if CONFIG_NFILE_STREAMS > 0
if (tcb->streams)
{
dbg(" streamlist refcount=%d\n",
@ -109,6 +113,7 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
}
}
}
#endif
}
#endif

View File

@ -129,7 +129,9 @@ void up_initialize(void)
/* Register devices */
#if CONFIG_NFILE_DESCRIPTORS > 0
devnull_register(); /* Standard /dev/null */
#endif
/* Initialize the serial device driver */

View File

@ -129,8 +129,13 @@ extern void up_vectorfiq(void);
/* Defined in up_serial.c */
#if CONFIG_NFILE_DESCRIPTORS > 0
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
#else
# define up_earlyserialinit()
# define up_serialinit()
#endif
/* Defined in up_watchdog.c */

View File

@ -84,10 +84,10 @@
up_lowputc:
/* On entry, r0 holds the character to be printed */
#ifdef CONFIG_UART0_SERIAL_CONSOLE
ldr r2, =DM320_UART0_REGISTER_BASE /* r2=UART0 base */
#else
#ifdef CONFIG_UART1_SERIAL_CONSOLE
ldr r2, =DM320_UART1_REGISTER_BASE /* r2=UART1 base */
#else
ldr r2, =DM320_UART0_REGISTER_BASE /* r2=UART0 base */
#endif
/* Poll the TX fifo trigger level bit of the UART_SSR

View File

@ -38,20 +38,25 @@
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <unistd.h>
#include <semaphore.h>
#include <string.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/serial.h>
#include <arch/serial.h>
#include "up_arch.h"
#include "os_internal.h"
#include "up_internal.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
/************************************************************
* Definitions
************************************************************/
@ -723,3 +728,59 @@ int up_putc(int ch)
return ch;
}
#else /* CONFIG_NFILE_DESCRIPTORS > 0 */
/************************************************************
* Definitions
************************************************************/
# ifdef CONFIG_UART1_SERIAL_CONSOLE
# define DM320_REGISTER_BASE DM320_UART1_REGISTER_BASE
# else
# define DM320_REGISTER_BASE DM320_UART0_REGISTER_BASE
# endif
/************************************************************
* Private Functions
************************************************************/
static inline void up_waittxfifonotfull(void)
{
int tmp;
for (tmp = 1000 ; tmp > 0 ; tmp--)
{
if ((getreg16(DM320_REGISTER_BASE + UART_SR) & UART_SR_TFTI) != 0)
{
break;
}
}
}
/************************************************************
* Public Functions
************************************************************/
int up_putc(int ch)
{
up_waittxfifonotfull();
putreg16((uint16)ch, DM320_REGISTER_BASE + UART_DTRR);
/* Check for LF */
if (ch == '\n')
{
/* Add CR */
up_waittxfifonotfull();
putreg16((uint16)'\r', DM320_REGISTER_BASE + UART_DTRR);
}
up_waittxfifonotfull();
return ch;
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */