From a563ce3647874aa19778b177c1d0cd05b903a040 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 12 Feb 2012 02:53:01 +0000 Subject: [PATCH] Fix some typos and compilation errors introduced in the last checkin git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4384 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/arch/arm/src/common/up_internal.h | 2 +- nuttx/arch/avr/src/at32uc3/at32uc3_config.h | 2 +- nuttx/arch/avr/src/at90usb/at90usb_config.h | 2 +- nuttx/arch/avr/src/atmega/atmega_config.h | 2 +- nuttx/arch/avr/src/common/up_initialize.c | 2 +- nuttx/arch/hc/src/common/up_internal.h | 2 +- nuttx/arch/mips/src/common/up_internal.h | 2 +- nuttx/arch/sh/src/common/up_internal.h | 2 +- nuttx/arch/x86/src/common/up_internal.h | 2 +- nuttx/configs/stm3240g-eval/README.txt | 23 +++++++++++++-- nuttx/configs/stm3240g-eval/nsh2/defconfig | 32 +++++++++++++++++++++ nuttx/drivers/ramlog.c | 18 ++++++++++++ nuttx/include/nuttx/ramlog.h | 19 ++++++++++-- 13 files changed, 95 insertions(+), 15 deletions(-) diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h index 8ade816c74..c1c7ed9a67 100644 --- a/nuttx/arch/arm/src/common/up_internal.h +++ b/nuttx/arch/arm/src/common/up_internal.h @@ -79,7 +79,7 @@ # define USE_SERIALDRIVER 1 # define USE_EARLYSERIALINIT 1 # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/avr/src/at32uc3/at32uc3_config.h b/nuttx/arch/avr/src/at32uc3/at32uc3_config.h index b425205316..543b4e752e 100644 --- a/nuttx/arch/avr/src/at32uc3/at32uc3_config.h +++ b/nuttx/arch/avr/src/at32uc3/at32uc3_config.h @@ -166,7 +166,7 @@ # undef USE_SERIALDRIVER # undef USE_EARLYSERIALINIT # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/avr/src/at90usb/at90usb_config.h b/nuttx/arch/avr/src/at90usb/at90usb_config.h index 41ad9957c3..644005d5be 100644 --- a/nuttx/arch/avr/src/at90usb/at90usb_config.h +++ b/nuttx/arch/avr/src/at90usb/at90usb_config.h @@ -85,7 +85,7 @@ # undef USE_SERIALDRIVER # undef USE_EARLYSERIALINIT # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/avr/src/atmega/atmega_config.h b/nuttx/arch/avr/src/atmega/atmega_config.h index a168a2e475..39ab53e4b1 100644 --- a/nuttx/arch/avr/src/atmega/atmega_config.h +++ b/nuttx/arch/avr/src/atmega/atmega_config.h @@ -90,7 +90,7 @@ # undef USE_SERIALDRIVER # undef USE_EARLYSERIALINIT # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/avr/src/common/up_initialize.c b/nuttx/arch/avr/src/common/up_initialize.c index 3bcbc0dc42..7f53ab8aec 100644 --- a/nuttx/arch/avr/src/common/up_initialize.c +++ b/nuttx/arch/avr/src/common/up_initialize.c @@ -76,7 +76,7 @@ # define USE_SERIALDRIVER 1 # define USE_EARLYSERIALINIT 1 # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/hc/src/common/up_internal.h b/nuttx/arch/hc/src/common/up_internal.h index 93572e4049..f4574bf204 100755 --- a/nuttx/arch/hc/src/common/up_internal.h +++ b/nuttx/arch/hc/src/common/up_internal.h @@ -79,7 +79,7 @@ # define USE_SERIALDRIVER 1 # define USE_EARLYSERIALINIT 1 # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/mips/src/common/up_internal.h b/nuttx/arch/mips/src/common/up_internal.h index d43580c657..bdc8bace15 100755 --- a/nuttx/arch/mips/src/common/up_internal.h +++ b/nuttx/arch/mips/src/common/up_internal.h @@ -79,7 +79,7 @@ # define USE_SERIALDRIVER 1 # define USE_EARLYSERIALINIT 1 # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/sh/src/common/up_internal.h b/nuttx/arch/sh/src/common/up_internal.h index 50aad14787..9d0517c8b6 100644 --- a/nuttx/arch/sh/src/common/up_internal.h +++ b/nuttx/arch/sh/src/common/up_internal.h @@ -83,7 +83,7 @@ # define USE_SERIALDRIVER 1 # define USE_EARLYSERIALINIT 1 # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/arch/x86/src/common/up_internal.h b/nuttx/arch/x86/src/common/up_internal.h index c840cf90b9..4fa98e0b3a 100644 --- a/nuttx/arch/x86/src/common/up_internal.h +++ b/nuttx/arch/x86/src/common/up_internal.h @@ -78,7 +78,7 @@ # define USE_SERIALDRIVER 1 # define USE_EARLYSERIALINIT 1 # endif -#endig +#endif /* Determine which device to use as the system loggin device */ diff --git a/nuttx/configs/stm3240g-eval/README.txt b/nuttx/configs/stm3240g-eval/README.txt index 727b46d087..ef26c00887 100755 --- a/nuttx/configs/stm3240g-eval/README.txt +++ b/nuttx/configs/stm3240g-eval/README.txt @@ -694,9 +694,26 @@ Where is one of the following: -CONFIG_STM32_SDIO=n : SDIO is enabled +CONFIG_STM32_SDIO=y - Logically, that is the only difference. There are, however, other configuration - differences as necessary to support this different device configuration. Just - the do the 'diff' if you are curious. + Logically, that is the only difference: This configuration has SDIO (and + the SD card) enabled and the serial console disabled. There is ONLY a + Telnet console!. + + There are some special settings to make life with only a Telnet + + CONFIG_SYSLOG=y - Enables the System Logging feature. + CONFIG_RAMLOG=y - Enable the RAM-based logging feature. + CONFIG_RAMLOG_CONSOLE=y - Use the RAM logger as the default console. + This means that any console output from non-Telnet threads will + go into the circular buffer in RAM. + CONFIG_RAMLOG_SYSLOG - This enables the RAM-based logger as the + system logger. This means that (1) in addition to the console + output from other tasks, ALL of the debug output will also to + to the circular buffer in RAM, and (2) NSH will now support a + command called 'dmesg' that can be used to dump the RAM log. + + There are a few other configuration differences as necessary to support + this different device configuration. Just the do the 'diff' if you are + curious. NOTES: 1. See the notes for the nsh configuration. Most also apply to the nsh2 diff --git a/nuttx/configs/stm3240g-eval/nsh2/defconfig b/nuttx/configs/stm3240g-eval/nsh2/defconfig index 804fc270e8..bdcf5c8885 100644 --- a/nuttx/configs/stm3240g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh2/defconfig @@ -526,6 +526,38 @@ CONFIG_SIG_SIGWORK=4 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n +# +# System Logging +# +# CONFIG_SYSLOG - Enables the System Logging feature. +# CONFIG_RAMLOG - Enables the RAM logging feature +# CONFIG_RAMLOG_CONSOLE - Use the RAM logging device as a system console. +# If this feature is enabled (along with CONFIG_DEV_CONSOLE), then all +# console output will be re-directed to a circular buffer in RAM. This +# is useful, for example, if the only console is a Telnet console. Then +# in that case, console output from non-Telnet threads will go to the +# circular buffer and can be viewed using the NSH 'dmesg' command. +# CONFIG_RAMLOG_SYSLOG - Use the RAM logging device for the syslogging +# interface. If this feature is enabled (along with CONFIG_SYSLOG), +# then all debug output (only) will be re-directed to the circular +# buffer in RAM. This RAM log can be view from NSH using the 'dmesg' +# command. +# CONFIG_RAMLOG_NPOLLWAITERS - The number of threads than can be waiting +# for this driver on poll(). Default: 4 +# +# If CONFIG_RAMLOG_CONSOLE or CONFIG_RAMLOG_SYSLOG is selected, then the +# following may also be provided: +# +# CONFIG_RAMLOG_CONSOLE_BUFSIZE - Size of the console RAM log. Default: 1024 +# + +CONFIG_SYSLOG=y +CONFIG_RAMLOG=y +CONFIG_RAMLOG_CONSOLE=y +CONFIG_RAMLOG_SYSLOG=y= +#CONFIG_RAMLOG_NPOLLWAITERS +#CONFIG_RAMLOG_CONSOLE_BUFSIZE + # # Settings for NXFLAT # diff --git a/nuttx/drivers/ramlog.c b/nuttx/drivers/ramlog.c index 53e57b1a0e..6c24b0f955 100644 --- a/nuttx/drivers/ramlog.c +++ b/nuttx/drivers/ramlog.c @@ -419,6 +419,14 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size ch = buffer[nwritten]; + /* Ignore carriage returns */ + +#ifdef CONFIG_RAMLOG_CRLF + if (ch == '\r') + { + continue; + } + /* Pre-pend a carriage before a linefeed */ if (ch == '\n') @@ -434,6 +442,7 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size break; } } +#endif /* Then output the character */ @@ -732,6 +741,14 @@ int ramlog_putc(int ch) FAR struct ramlog_dev_s *priv = &g_sysdev; int ret; + /* Ignore carriage returns */ + +#ifdef CONFIG_RAMLOG_CRLF + if (ch == '\r') + { + return ch; + } + /* Pre-pend a newline with a carriage return */ if (ch == '\n') @@ -747,6 +764,7 @@ int ramlog_putc(int ch) return ch; } } +#endif (void)ramlog_addchar(priv, ch); return ch; diff --git a/nuttx/include/nuttx/ramlog.h b/nuttx/include/nuttx/ramlog.h index 8f1a0c7022..eeef494ed0 100644 --- a/nuttx/include/nuttx/ramlog.h +++ b/nuttx/include/nuttx/ramlog.h @@ -104,7 +104,7 @@ /* The normal behavior of the RAM log when used as a SYSLOG is to return * end-of-file if there is no data in the RAM log (rather than blocking until - * data is available). That allows you to cat the SYSLOG with no ill + * data is available). That allows you to 'cat' the SYSLOG with no ill * consequences. */ @@ -113,6 +113,15 @@ # define CONFIG_RAMLOG_NONBLOCKING 1 #endif +/* When used as a console or syslogging device, the RAM log will pre-pend + * line-feeds with carriage returns. + */ + +#if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_RAMLOG_SYSLOG) +# undef CONFIG_RAMLOG_CRLF +# define CONFIG_RAMLOG_CRLF 1 +#endif + /**************************************************************************** * Public Data ****************************************************************************/ @@ -163,7 +172,7 @@ EXTERN int ramlog_register(FAR const char *devpath, FAR char *buffer, ****************************************************************************/ #ifdef CONFIG_RAMLOG_CONSOLE -EXTERN int ramlog_consoleinit(void) +EXTERN int ramlog_consoleinit(void); #endif /**************************************************************************** @@ -178,8 +187,12 @@ EXTERN int ramlog_consoleinit(void) * ****************************************************************************/ -#if !defined(CONFIG_RAMLOG_CONSOLE) && defined(CONFIG_RAMLOG_SYSLOG) +#ifdef CONFIG_RAMLOG_SYSLOG +#ifndef CONFIG_RAMLOG_CONSOLE EXTERN int ramlog_sysloginit(void); +#else +# define ramlog_sysloginit() +#endif #endif /****************************************************************************