From 4c0502234f156d9d21bd7c6d20d1002908ef65ed Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 22 Apr 2014 08:41:15 -0600 Subject: examples/serialrx added by Bob Doison --- apps/ChangeLog.txt | 4 ++-- apps/examples/Kconfig | 1 + apps/examples/Make.defs | 4 ++++ apps/examples/Makefile | 9 +++++---- apps/examples/README.txt | 9 ++++++++- apps/examples/serialrx/Kconfig | 2 +- apps/examples/serialrx/Makefile | 1 - apps/examples/serialrx/send.py | 1 - apps/examples/serialrx/serialrx_main.c | 12 ++++++------ 9 files changed, 27 insertions(+), 16 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index f8d611761..3cf4d91c7 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -892,5 +892,5 @@ (2014-4-21). * apps/nshlib: malloc/free IOBUFFER for 'cat' and 'hexdump' commands instead of using the stack. From Bob Doiron (2014-4-21). - * apps/examples/cpuhog and serialblaster: Stress test examples added - by Bob Doiron (2014-4-22). + * apps/examples/cpuhog, serialblaster, and serialrx: Stress test + examples added by Bob Doiron (2014-4-22). diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig index 4e3db375d..968ef8fd4 100644 --- a/apps/examples/Kconfig +++ b/apps/examples/Kconfig @@ -51,6 +51,7 @@ source "$APPSDIR/examples/rgmp/Kconfig" source "$APPSDIR/examples/romfs/Kconfig" source "$APPSDIR/examples/sendmail/Kconfig" source "$APPSDIR/examples/serialblaster/Kconfig" +source "$APPSDIR/examples/serialrx/Kconfig" source "$APPSDIR/examples/serloop/Kconfig" source "$APPSDIR/examples/slcd/Kconfig" source "$APPSDIR/examples/flash_test/Kconfig" diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs index ed1375717..e5dfbb355 100644 --- a/apps/examples/Make.defs +++ b/apps/examples/Make.defs @@ -230,6 +230,10 @@ ifeq ($(CONFIG_EXAMPLES_SERIALBLASTER),y) CONFIGURED_APPS += examples/serialblaster endif +ifeq ($(CONFIG_EXAMPLES_SERIALRX),y) +CONFIGURED_APPS += examples/serialrx +endif + ifeq ($(CONFIG_EXAMPLES_SERLOOP),y) CONFIGURED_APPS += examples/serloop endif diff --git a/apps/examples/Makefile b/apps/examples/Makefile index f59667a81..83153157b 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -42,8 +42,8 @@ SUBDIRS += flash_test ftpc ftpd hello helloxx hidkbd igmp i2schar json SUBDIRS += keypadtest lcdrw mm modbus mount mtdpart nettest nrf24l01_term SUBDIRS += nsh null nx nxconsole nxffs nxflat nxhello nximage nxlines SUBDIRS += nxtext ostest pashello pipe poll posix_spawn pwm qencoder random -SUBDIRS += relays rgmp romfs sendmail serialblaster serloop slcd smart -SUBDIRS += smart_test tcpecho telnetd thttpd tiff touchscreen udp uip +SUBDIRS += relays rgmp romfs sendmail serialblaster serloop serialrx slcd +SUBDIRS += smart smart_test tcpecho telnetd thttpd tiff touchscreen udp uip SUBDIRS += usbserial usbterm watchdog wget wgetjson xmlrpc @@ -57,8 +57,9 @@ ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) CNTXTDIRS += adc can cc3000 cpuhog cxxtest dhcpd discover flash_test ftpd CNTXTDIRS += hello helloxx i2schar json keypadtestmodbus lcdrw mtdpart CNTXTDIRS += nettest nx nxhello nximage nxlines nxtext nrf24l01_term -CNTXTDIRS += ostest random relays qencoder serialblasterslcd smart_test -CNTXTDIRS += tcpecho telnetd tiff touchscreen usbterm watchdog wgetjson +CNTXTDIRS += ostest random relays qencoder serialblasterslcd serialrx +CNTXTDIRS += smart_test tcpecho telnetd tiff touchscreen usbterm watchdog +CNTXTDIRS += wgetjson endif all: nothing diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 3af7ccdad..137802220 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -1452,7 +1452,14 @@ examples/sendmail examples/serialblaster ^^^^^^^^^^^^^^^^^^^^^^ - Sends a repeating pattern (the alphabet) out a serial por continuously. + Sends a repeating pattern (the alphabet) out a serial port continuously. + This may be useful if you are trying run down other problems that you + think might only occur when the serial port usage is high. + +examples/serialrx +^^^^^^^^^^^^^^^^^ + + Constant receives serial data. This is the complement to serialblaster. This may be useful if you are trying run down other problems that you think might only occur when the serial port usage is high. diff --git a/apps/examples/serialrx/Kconfig b/apps/examples/serialrx/Kconfig index c88591b14..ddced0ee5 100644 --- a/apps/examples/serialrx/Kconfig +++ b/apps/examples/serialrx/Kconfig @@ -7,7 +7,7 @@ config EXAMPLES_SERIALRX bool "Serial Rx example" default n ---help--- - Enable the serial rx example + Enable the serial RX example if EXAMPLES_SERIALRX endif diff --git a/apps/examples/serialrx/Makefile b/apps/examples/serialrx/Makefile index 66617d456..d99fd44a5 100644 --- a/apps/examples/serialrx/Makefile +++ b/apps/examples/serialrx/Makefile @@ -107,4 +107,3 @@ distclean: clean $(call DELFILE, .depend) -include Make.dep - diff --git a/apps/examples/serialrx/send.py b/apps/examples/serialrx/send.py index 54f07b621..366bd9da0 100644 --- a/apps/examples/serialrx/send.py +++ b/apps/examples/serialrx/send.py @@ -18,4 +18,3 @@ while(True): #sleep(0.050) sys.stdout.write(".") sys.stdout.flush() - diff --git a/apps/examples/serialrx/serialrx_main.c b/apps/examples/serialrx/serialrx_main.c index bd4207695..4ff672098 100644 --- a/apps/examples/serialrx/serialrx_main.c +++ b/apps/examples/serialrx/serialrx_main.c @@ -51,10 +51,15 @@ * Pre-processor Definitions ****************************************************************************/ +#undef BUFFERED_IO +#define CHUNK 960 + /**************************************************************************** * Private Data ****************************************************************************/ +static int count = 0; + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -63,12 +68,9 @@ * serloop_main ****************************************************************************/ -//#define BUFFERED_IO -#define CHUNK 960 -static int count = 0; int serialrx_main(int argc, char *argv[]) { - FAR char *buf = (char *)malloc(CHUNK*3); + FAR char *buf = (FAR char *)malloc(CHUNK*3); FAR FILE *f; printf("Reading from %s\n", argv[1]); f = fopen(argv[1], "r"); @@ -89,7 +91,5 @@ int serialrx_main(int argc, char *argv[]) } free(buf); - return 0; } - -- cgit v1.2.3