diff --git a/arch/arm/src/common/up_exit.c b/arch/arm/src/common/up_exit.c index 94a4670063a..3dac42595ba 100644 --- a/arch/arm/src/common/up_exit.c +++ b/arch/arm/src/common/up_exit.c @@ -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 diff --git a/arch/arm/src/common/up_initialize.c b/arch/arm/src/common/up_initialize.c index b8ed24f08ae..0f70fcca5cd 100644 --- a/arch/arm/src/common/up_initialize.c +++ b/arch/arm/src/common/up_initialize.c @@ -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 */ diff --git a/arch/arm/src/common/up_internal.h b/arch/arm/src/common/up_internal.h index 2d789a802c8..a32c5324db8 100644 --- a/arch/arm/src/common/up_internal.h +++ b/arch/arm/src/common/up_internal.h @@ -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 */ diff --git a/arch/arm/src/dm320/dm320_lowputc.S b/arch/arm/src/dm320/dm320_lowputc.S index c27918262b3..5566b3f5849 100644 --- a/arch/arm/src/dm320/dm320_lowputc.S +++ b/arch/arm/src/dm320/dm320_lowputc.S @@ -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 diff --git a/arch/arm/src/dm320/dm320_serial.c b/arch/arm/src/dm320/dm320_serial.c index 8051393cf3d..c74264b8d7e 100644 --- a/arch/arm/src/dm320/dm320_serial.c +++ b/arch/arm/src/dm320/dm320_serial.c @@ -38,20 +38,25 @@ ************************************************************/ #include + #include #include #include #include #include #include + #include #include #include #include + #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 */ + +