diff options
author | px4dev <px4@purgatory.org> | 2012-09-02 12:17:16 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-09-02 12:17:16 -0700 |
commit | 6576edb47e9d0e032a89f01d9fb071871d53b553 (patch) | |
tree | 452c0de8053abec11bfc102a3480c666adb6282b /apps/examples | |
parent | 8aa41f7d34c6b6cddc59ba9d5ed1567044e66e46 (diff) | |
parent | 1349b00b418de388310c6658fd799a9049ddd38b (diff) | |
download | px4-firmware-6576edb47e9d0e032a89f01d9fb071871d53b553.tar.gz px4-firmware-6576edb47e9d0e032a89f01d9fb071871d53b553.tar.bz2 px4-firmware-6576edb47e9d0e032a89f01d9fb071871d53b553.zip |
Merge with trunk NuttX
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5079 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'apps/examples')
-rw-r--r-- | apps/examples/README.txt | 12 | ||||
-rw-r--r-- | apps/examples/adc/adc_main.c | 30 | ||||
-rw-r--r-- | apps/examples/buttons/main.c | 14 | ||||
-rw-r--r-- | apps/examples/can/can_main.c | 24 | ||||
-rw-r--r-- | apps/examples/hello/main.c | 10 | ||||
-rw-r--r-- | apps/examples/helloxx/main.cxx | 23 | ||||
-rw-r--r-- | apps/examples/lcdrw/lcdrw_main.c | 10 | ||||
-rw-r--r-- | apps/examples/mm/mm_main.c | 4 | ||||
-rw-r--r-- | apps/examples/mount/mount_main.c | 16 | ||||
-rw-r--r-- | apps/examples/nsh/nsh_main.c | 4 | ||||
-rw-r--r-- | apps/examples/null/null_main.c | 4 | ||||
-rw-r--r-- | apps/examples/ostest/main.c | 32 | ||||
-rw-r--r-- | apps/examples/pipe/pipe_main.c | 46 | ||||
-rw-r--r-- | apps/examples/pipe/redirect_test.c | 6 | ||||
-rw-r--r-- | apps/examples/poll/poll_main.c | 36 | ||||
-rw-r--r-- | apps/examples/pwm/pwm_main.c | 2 | ||||
-rw-r--r-- | apps/examples/qencoder/qe_main.c | 32 | ||||
-rw-r--r-- | apps/examples/romfs/romfs_main.c | 4 | ||||
-rw-r--r-- | apps/examples/serloop/main.c | 4 | ||||
-rw-r--r-- | apps/examples/watchdog/watchdog_main.c | 2 |
20 files changed, 126 insertions, 189 deletions
diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 7d068f979..52d7279da 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -1345,10 +1345,14 @@ examples/uip file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS += uiplib - CONFIGURED_APPS += dhcpc - CONFIGURED_APPS += resolv - CONFIGURED_APPS += webserver + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += dhcpc + CONFIGURED_APPS += resolv + CONFIGURED_APPS += webserver + + NOTE: This example does depend on the perl script at + nuttx/tools/mkfsdata.pl. You must have perl installed on your + development system at /usr/bin/perl. examples/usbserial ^^^^^^^^^^^^^^^^^^ diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c index b88032654..4797265db 100644 --- a/apps/examples/adc/adc_main.c +++ b/apps/examples/adc/adc_main.c @@ -57,14 +57,6 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef CONFIG_NSH_BUILTIN_APPS -# define MAIN_NAME adc_main -# define MAIN_STRING "adc_main: " -#else -# define MAIN_NAME user_start -# define MAIN_STRING "user_start: " -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -223,10 +215,10 @@ static void parse_args(FAR struct adc_state_s *adc, int argc, FAR char **argv) ****************************************************************************/ /**************************************************************************** - * Name: user_start/adc_main + * Name: adc_main ****************************************************************************/ -int MAIN_NAME(int argc, char *argv[]) +int adc_main(int argc, char *argv[]) { struct adc_msg_s sample[CONFIG_EXAMPLES_ADC_GROUPSIZE]; size_t readsize; @@ -244,11 +236,11 @@ int MAIN_NAME(int argc, char *argv[]) * this test. */ - message(MAIN_STRING "Initializing external ADC device\n"); + message("adc_main: Initializing external ADC device\n"); ret = adc_devinit(); if (ret != OK) { - message(MAIN_STRING "adc_devinit failed: %d\n", ret); + message("adc_main: adc_devinit failed: %d\n", ret); errval = 1; goto errout; } @@ -276,18 +268,18 @@ int MAIN_NAME(int argc, char *argv[]) */ #if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_ADC_NSAMPLES) - message(MAIN_STRING "g_adcstate.count: %d\n", g_adcstate.count); + message("adc_main: g_adcstate.count: %d\n", g_adcstate.count); #endif /* Open the ADC device for reading */ - message(MAIN_STRING "Hardware initialized. Opening the ADC device: %s\n", + message("adc_main: Hardware initialized. Opening the ADC device: %s\n", g_adcstate.devpath); fd = open(g_adcstate.devpath, O_RDONLY); if (fd < 0) { - message(MAIN_STRING "open %s failed: %d\n", g_adcstate.devpath, errno); + message("adc_main: open %s failed: %d\n", g_adcstate.devpath, errno); errval = 2; goto errout_with_dev; } @@ -322,17 +314,17 @@ int MAIN_NAME(int argc, char *argv[]) errval = errno; if (errval != EINTR) { - message(MAIN_STRING "read %s failed: %d\n", + message("adc_main: read %s failed: %d\n", g_adcstate.devpath, errval); errval = 3; goto errout_with_dev; } - message(MAIN_STRING "Interrupted read...\n"); + message("adc_main: Interrupted read...\n"); } else if (nbytes == 0) { - message(MAIN_STRING "No data read, Ignoring\n"); + message("adc_main: No data read, Ignoring\n"); } /* Print the sample data on successful return */ @@ -342,7 +334,7 @@ int MAIN_NAME(int argc, char *argv[]) int nsamples = nbytes / sizeof(struct adc_msg_s); if (nsamples * sizeof(struct adc_msg_s) != nbytes) { - message(MAIN_STRING "read size=%d is not a multiple of sample size=%d, Ignoring\n", + message("adc_main: read size=%d is not a multiple of sample size=%d, Ignoring\n", nbytes, sizeof(struct adc_msg_s)); } else diff --git a/apps/examples/buttons/main.c b/apps/examples/buttons/main.c index fe447ca6b..50124512c 100644 --- a/apps/examples/buttons/main.c +++ b/apps/examples/buttons/main.c @@ -130,16 +130,6 @@ #define NUM_BUTTONS (MAX_BUTTON - MIN_BUTTON + 1) #define BUTTON_INDEX(b) ((b)-MIN_BUTTON) -/* Is this being built as an NSH built-in application? */ - -#ifdef CONFIG_NSH_BUILTIN_APPS -# define MAIN_NAME buttons_main -# define MAIN_STRING "buttons_main: " -#else -# define MAIN_NAME user_start -# define MAIN_STRING "user_start: " -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -399,10 +389,10 @@ static int button7_handler(int irq, FAR void *context) ****************************************************************************/ /**************************************************************************** - * user_start/buttons_main + * buttons_main ****************************************************************************/ -int MAIN_NAME(int argc, char *argv[]) +int buttons_main(int argc, char *argv[]) { uint8_t newset; irqstate_t flags; diff --git a/apps/examples/can/can_main.c b/apps/examples/can/can_main.c index 0ea729e5e..d3ca24119 100644 --- a/apps/examples/can/can_main.c +++ b/apps/examples/can/can_main.c @@ -76,14 +76,6 @@ # define MAX_ID (1 << 11) #endif -#ifdef CONFIG_NSH_BUILTIN_APPS -# define MAIN_NAME can_main -# define MAIN_STRING "can_main: " -#else -# define MAIN_NAME user_start -# define MAIN_STRING "user_start: " -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -109,10 +101,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: user_start/can_main + * Name: can_main ****************************************************************************/ -int MAIN_NAME(int argc, char *argv[]) +int can_main(int argc, char *argv[]) { #ifndef CONFIG_EXAMPLES_CAN_READONLY struct can_msg_s txmsg; @@ -150,31 +142,31 @@ int MAIN_NAME(int argc, char *argv[]) { nmsgs = strtol(argv[1], NULL, 10); } - message(MAIN_STRING "nmsgs: %d\n", nmsgs); + message("can_main: nmsgs: %d\n", nmsgs); #elif defined(CONFIG_EXAMPLES_CAN_NMSGS) - message(MAIN_STRING "nmsgs: %d\n", CONFIG_EXAMPLES_CAN_NMSGS); + message("can_main: nmsgs: %d\n", CONFIG_EXAMPLES_CAN_NMSGS); #endif /* Initialization of the CAN hardware is performed by logic external to * this test. */ - message(MAIN_STRING "Initializing external CAN device\n"); + message("can_main: Initializing external CAN device\n"); ret = can_devinit(); if (ret != OK) { - message(MAIN_STRING "can_devinit failed: %d\n", ret); + message("can_main: can_devinit failed: %d\n", ret); errval = 1; goto errout; } /* Open the CAN device for reading */ - message(MAIN_STRING "Hardware initialized. Opening the CAN device\n"); + message("can_main: Hardware initialized. Opening the CAN device\n"); fd = open(CONFIG_EXAMPLES_CAN_DEVPATH, CAN_OFLAGS); if (fd < 0) { - message(MAIN_STRING "open %s failed: %d\n", + message("can_main: open %s failed: %d\n", CONFIG_EXAMPLES_CAN_DEVPATH, errno); errval = 2; goto errout_with_dev; diff --git a/apps/examples/hello/main.c b/apps/examples/hello/main.c index 7934dc34b..7e07cffd1 100644 --- a/apps/examples/hello/main.c +++ b/apps/examples/hello/main.c @@ -53,16 +53,10 @@ ****************************************************************************/ /**************************************************************************** - * user_start/hello_main + * hello_main ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_HELLO_BUILTIN -# define MAIN_NAME hello_main -#else -# define MAIN_NAME user_start -#endif - -int MAIN_NAME(int argc, char *argv[]) +int hello_main(int argc, char *argv[]) { printf("Hello, World!!\n"); return 0; diff --git a/apps/examples/helloxx/main.cxx b/apps/examples/helloxx/main.cxx index 8514fead2..fcec7c761 100644 --- a/apps/examples/helloxx/main.cxx +++ b/apps/examples/helloxx/main.cxx @@ -124,24 +124,11 @@ static CHelloWorld g_HelloWorld; // Public Functions //*************************************************************************** -//*************************************************************************** -// user_start -//*************************************************************************** - /**************************************************************************** - * Name: user_start/nxhello_main + * Name: helloxx_main ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_HELLOXX_BUILTIN -extern "C" int helloxx_main(int argc, char *argv[]); -# define MAIN_NAME helloxx_main -# define MAIN_STRING "helloxx_main: " -#else -# define MAIN_NAME user_start -# define MAIN_STRING "user_start: " -#endif - -int MAIN_NAME(int argc, char *argv[]) +int helloxx_main(int argc, char *argv[]) { // If C++ initialization for static constructors is supported, then do // that first @@ -153,7 +140,7 @@ int MAIN_NAME(int argc, char *argv[]) // Exercise an explictly instantiated C++ object CHelloWorld *pHelloWorld = new CHelloWorld; - printf(MAIN_STRING "Saying hello from the dynamically constructed instance\n"); + printf("helloxx_main: Saying hello from the dynamically constructed instance\n"); pHelloWorld->HelloWorld(); // Exercise an C++ object instantiated on the stack @@ -161,14 +148,14 @@ int MAIN_NAME(int argc, char *argv[]) #ifndef CONFIG_EXAMPLES_HELLOXX_NOSTACKCONST CHelloWorld HelloWorld; - printf(MAIN_STRING "Saying hello from the instance constructed on the stack\n"); + printf("helloxx_main: Saying hello from the instance constructed on the stack\n"); HelloWorld.HelloWorld(); #endif // Exercise an statically constructed C++ object #ifdef CONFIG_HAVE_CXXINITIALIZE - printf(MAIN_STRING "Saying hello from the statically constructed instance\n"); + printf("helloxx_main: Saying hello from the statically constructed instance\n"); g_HelloWorld.HelloWorld(); #endif diff --git a/apps/examples/lcdrw/lcdrw_main.c b/apps/examples/lcdrw/lcdrw_main.c index c366743f4..f39e1849d 100644 --- a/apps/examples/lcdrw/lcdrw_main.c +++ b/apps/examples/lcdrw/lcdrw_main.c @@ -152,16 +152,10 @@ static inline int lcdrw_initialize(FAR struct lcdrw_instance_s *inst) ****************************************************************************/ /**************************************************************************** - * Name: lcdrw_main/user_start + * Name: lcdrw_main ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_LCDRW_BUILTIN -# define MAIN_NAME lcdrw_main -#else -# define MAIN_NAME user_start -#endif - -int MAIN_NAME(int argc, char *argv[]) +int lcdrw_main(int argc, char *argv[]) { struct lcdrw_instance_s inst; nxgl_coord_t row; diff --git a/apps/examples/mm/mm_main.c b/apps/examples/mm/mm_main.c index 036c39047..5d45efdc5 100644 --- a/apps/examples/mm/mm_main.c +++ b/apps/examples/mm/mm_main.c @@ -267,10 +267,10 @@ static void do_frees(void **mem, const int *size, const int *seq, int n) ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: mm_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int mm_main(int argc, char *argv[]) { mm_showmallinfo(); diff --git a/apps/examples/mount/mount_main.c b/apps/examples/mount/mount_main.c index 00070b94c..5f881e40c 100644 --- a/apps/examples/mount/mount_main.c +++ b/apps/examples/mount/mount_main.c @@ -567,10 +567,10 @@ static void succeed_stat(const char *path) ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: mount_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int mount_main(int argc, char *argv[]) { int ret; @@ -580,18 +580,18 @@ int user_start(int argc, char *argv[]) ret = create_ramdisk(); if (ret < 0) { - printf("user_start: ERROR failed to create RAM disk\n"); + printf("mount_main: ERROR failed to create RAM disk\n"); return 1; } #endif /* Mount the test file system (see arch/sim/src/up_deviceimage.c */ - printf("user_start: mounting %s filesystem at target=%s with source=%s\n", + printf("mount_main: mounting %s filesystem at target=%s with source=%s\n", g_filesystemtype, g_target, g_source); ret = mount(g_source, g_target, g_filesystemtype, 0, NULL); - printf("user_start: mount() returned %d\n", ret); + printf("mount_main: mount() returned %d\n", ret); if (ret == 0) { @@ -737,16 +737,16 @@ int user_start(int argc, char *argv[]) /* Unmount the file system */ - printf("user_start: Try unmount(%s)\n", g_target); + printf("mount_main: Try unmount(%s)\n", g_target); ret = umount(g_target); if (ret != 0) { - printf("user_start: ERROR umount() failed, errno %d\n", errno); + printf("mount_main: ERROR umount() failed, errno %d\n", errno); g_nerrors++; } - printf("user_start: %d errors reported\n", g_nerrors); + printf("mount_main: %d errors reported\n", g_nerrors); } fflush(stdout); diff --git a/apps/examples/nsh/nsh_main.c b/apps/examples/nsh/nsh_main.c index c5b671ab1..97792cb2a 100644 --- a/apps/examples/nsh/nsh_main.c +++ b/apps/examples/nsh/nsh_main.c @@ -84,10 +84,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: nsh_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int nsh_main(int argc, char *argv[]) { int exitval = 0; int ret; diff --git a/apps/examples/null/null_main.c b/apps/examples/null/null_main.c index 10fc1bf1e..63a14fcac 100644 --- a/apps/examples/null/null_main.c +++ b/apps/examples/null/null_main.c @@ -58,10 +58,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: null_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int null_main(int argc, char *argv[]) { return 0; } diff --git a/apps/examples/ostest/main.c b/apps/examples/ostest/main.c index 7d63c0ff4..61a2af19a 100644 --- a/apps/examples/ostest/main.c +++ b/apps/examples/ostest/main.c @@ -409,7 +409,7 @@ static int user_main(int argc, char *argv[]) check_test_memory_usage(); #endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */ - /* Compare memory usage at time user_start started until + /* Compare memory usage at time ostest_main started until * user_main exits. These should not be identical, but should * be similar enough that we can detect any serious OS memory * leaks. @@ -458,18 +458,10 @@ static void stdio_test(void) ****************************************************************************/ /**************************************************************************** - * user_start/ostest_main + * ostest_main ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_OSTEST_BUILTIN -# define MAIN_NAME ostest_main -# define MAIN_STRING "ostest_main: " -#else -# define MAIN_NAME user_start -# define MAIN_STRING "user_start: " -#endif - -int MAIN_NAME(int argc, char *argv[]) +int ostest_main(int argc, char *argv[]) { int result; @@ -492,19 +484,19 @@ int MAIN_NAME(int argc, char *argv[]) /* Set up some environment variables */ #ifndef CONFIG_DISABLE_ENVIRON - printf(MAIN_STRING "putenv(%s)\n", g_putenv_value); + printf("ostest_main: putenv(%s)\n", g_putenv_value); putenv(g_putenv_value); /* Varaible1=BadValue3 */ - printf(MAIN_STRING "setenv(%s, %s, TRUE)\n", g_var1_name, g_var1_value); + printf("ostest_main: setenv(%s, %s, TRUE)\n", g_var1_name, g_var1_value); setenv(g_var1_name, g_var1_value, TRUE); /* Variable1=GoodValue1 */ - printf(MAIN_STRING "setenv(%s, %s, FALSE)\n", g_var2_name, g_bad_value1); + printf("ostest_main: setenv(%s, %s, FALSE)\n", g_var2_name, g_bad_value1); setenv(g_var2_name, g_bad_value1, FALSE); /* Variable2=BadValue1 */ - printf(MAIN_STRING "setenv(%s, %s, TRUE)\n", g_var2_name, g_var2_value); + printf("ostest_main: setenv(%s, %s, TRUE)\n", g_var2_name, g_var2_value); setenv(g_var2_name, g_var2_value, TRUE); /* Variable2=GoodValue2 */ - printf(MAIN_STRING "setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name); + printf("ostest_main: setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name); setenv(g_var3_name, g_var3_value, FALSE); /* Variable3=GoodValue3 */ - printf(MAIN_STRING "setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name); + printf("ostest_main: setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name); setenv(g_var3_name, g_bad_value2, FALSE); /* Variable3=GoodValue3 */ show_environment(true, true, true); #endif @@ -518,13 +510,13 @@ int MAIN_NAME(int argc, char *argv[]) #endif if (result == ERROR) { - printf(MAIN_STRING "ERROR Failed to start user_main\n"); + printf("ostest_main: ERROR Failed to start user_main\n"); } else { - printf(MAIN_STRING "Started user_main at PID=%d\n", result); + printf("ostest_main: Started user_main at PID=%d\n", result); } - printf(MAIN_STRING "Exitting\n"); + printf("ostest_main: Exitting\n"); return 0; } diff --git a/apps/examples/pipe/pipe_main.c b/apps/examples/pipe/pipe_main.c index 1f0f73032..406832a98 100644 --- a/apps/examples/pipe/pipe_main.c +++ b/apps/examples/pipe/pipe_main.c @@ -69,21 +69,21 @@ ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: pipe_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int pipe_main(int argc, char *argv[]) { int filedes[2]; int ret; /* Test FIFO logic */ - printf("\nuser_start: Performing FIFO test\n"); + printf("\npipe_main: Performing FIFO test\n"); ret = mkfifo(FIFO_PATH1, 0666); if (ret < 0) { - fprintf(stderr, "user_start: mkfifo failed with errno=%d\n", errno); + fprintf(stderr, "pipe_main: mkfifo failed with errno=%d\n", errno); return 1; } @@ -96,7 +96,7 @@ int user_start(int argc, char *argv[]) filedes[1] = open(FIFO_PATH1, O_WRONLY); if (filedes[1] < 0) { - fprintf(stderr, "user_start: Failed to open FIFO %s for writing, errno=%d\n", + fprintf(stderr, "pipe_main: Failed to open FIFO %s for writing, errno=%d\n", FIFO_PATH1, errno); return 2; } @@ -104,11 +104,11 @@ int user_start(int argc, char *argv[]) filedes[0] = open(FIFO_PATH1, O_RDONLY); if (filedes[0] < 0) { - fprintf(stderr, "user_start: Failed to open FIFO %s for reading, errno=%d\n", + fprintf(stderr, "pipe_main: Failed to open FIFO %s for reading, errno=%d\n", FIFO_PATH1, errno); if (close(filedes[1]) != 0) { - fprintf(stderr, "user_start: close failed: %d\n", errno); + fprintf(stderr, "pipe_main: close failed: %d\n", errno); } return 3; } @@ -118,28 +118,28 @@ int user_start(int argc, char *argv[]) ret = transfer_test(filedes[0], filedes[1]); if (close(filedes[0]) != 0) { - fprintf(stderr, "user_start: close failed: %d\n", errno); + fprintf(stderr, "pipe_main: close failed: %d\n", errno); } if (close(filedes[1]) != 0) { - fprintf(stderr, "user_start: close failed: %d\n", errno); + fprintf(stderr, "pipe_main: close failed: %d\n", errno); } /* unlink(FIFO_PATH1); fails */ if (ret != 0) { - fprintf(stderr, "user_start: FIFO test FAILED (%d)\n", ret); + fprintf(stderr, "pipe_main: FIFO test FAILED (%d)\n", ret); return 4; } - printf("user_start: FIFO test PASSED\n"); + printf("pipe_main: FIFO test PASSED\n"); /* Test PIPE logic */ - printf("\nuser_start: Performing pipe test\n"); + printf("\npipe_main: Performing pipe test\n"); ret = pipe(filedes); if (ret < 0) { - fprintf(stderr, "user_start: pipe failed with errno=%d\n", errno); + fprintf(stderr, "pipe_main: pipe failed with errno=%d\n", errno); return 5; } @@ -148,41 +148,41 @@ int user_start(int argc, char *argv[]) ret = transfer_test(filedes[0], filedes[1]); if (close(filedes[0]) != 0) { - fprintf(stderr, "user_start: close failed: %d\n", errno); + fprintf(stderr, "pipe_main: close failed: %d\n", errno); } if (close(filedes[1]) != 0) { - fprintf(stderr, "user_start: close failed: %d\n", errno); + fprintf(stderr, "pipe_main: close failed: %d\n", errno); } if (ret != 0) { - fprintf(stderr, "user_start: PIPE test FAILED (%d)\n", ret); + fprintf(stderr, "pipe_main: PIPE test FAILED (%d)\n", ret); return 6; } - printf("user_start: PIPE test PASSED\n"); + printf("pipe_main: PIPE test PASSED\n"); /* Perform the FIFO interlock test */ - printf("\nuser_start: Performing pipe interlock test\n"); + printf("\npipe_main: Performing pipe interlock test\n"); ret = interlock_test(); if (ret != 0) { - fprintf(stderr, "user_start: FIFO interlock test FAILED (%d)\n", ret); + fprintf(stderr, "pipe_main: FIFO interlock test FAILED (%d)\n", ret); return 7; } - printf("user_start: PIPE interlock test PASSED\n"); + printf("pipe_main: PIPE interlock test PASSED\n"); /* Perform the pipe redirection test */ - printf("\nuser_start: Performing redirection test\n"); + printf("\npipe_main: Performing redirection test\n"); ret = redirection_test(); if (ret != 0) { - fprintf(stderr, "user_start: FIFO redirection test FAILED (%d)\n", ret); + fprintf(stderr, "pipe_main: FIFO redirection test FAILED (%d)\n", ret); return 7; } - printf("user_start: PIPE redirection test PASSED\n"); + printf("pipe_main: PIPE redirection test PASSED\n"); fflush(stdout); return 0; diff --git a/apps/examples/pipe/redirect_test.c b/apps/examples/pipe/redirect_test.c index 45e86c356..db7c0b99a 100644 --- a/apps/examples/pipe/redirect_test.c +++ b/apps/examples/pipe/redirect_test.c @@ -301,16 +301,16 @@ int redirection_test(void) if (close(filedes[0]) != 0) { - fprintf(stderr, "user_start: close failed: %d\n", errno); + fprintf(stderr, "pipe_main: close failed: %d\n", errno); } if (close(filedes[1]) != 0) { - fprintf(stderr, "user_start: close failed: %d\n", errno); + fprintf(stderr, "pipe_main: close failed: %d\n", errno); } if (ret != 0) { - fprintf(stderr, "user_start: PIPE test FAILED (%d)\n", ret); + fprintf(stderr, "pipe_main: PIPE test FAILED (%d)\n", ret); return 6; } diff --git a/apps/examples/poll/poll_main.c b/apps/examples/poll/poll_main.c index 3db0150e7..9c3a096cb 100644 --- a/apps/examples/poll/poll_main.c +++ b/apps/examples/poll/poll_main.c @@ -74,10 +74,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: poll_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int poll_main(int argc, char *argv[]) { char buffer[64]; ssize_t nbytes; @@ -94,20 +94,20 @@ int user_start(int argc, char *argv[]) /* Open FIFOs */ - message("\nuser_start: Creating FIFO %s\n", FIFO_PATH1); + message("\npoll_main: Creating FIFO %s\n", FIFO_PATH1); ret = mkfifo(FIFO_PATH1, 0666); if (ret < 0) { - message("user_start: mkfifo failed: %d\n", errno); + message("poll_main: mkfifo failed: %d\n", errno); exitcode = 1; goto errout; } - message("\nuser_start: Creating FIFO %s\n", FIFO_PATH2); + message("\npoll_main: Creating FIFO %s\n", FIFO_PATH2); ret = mkfifo(FIFO_PATH2, 0666); if (ret < 0) { - message("user_start: mkfifo failed: %d\n", errno); + message("poll_main: mkfifo failed: %d\n", errno); exitcode = 2; goto errout; } @@ -117,7 +117,7 @@ int user_start(int argc, char *argv[]) fd1 = open(FIFO_PATH1, O_WRONLY); if (fd1 < 0) { - message("user_start: Failed to open FIFO %s for writing, errno=%d\n", + message("poll_main: Failed to open FIFO %s for writing, errno=%d\n", FIFO_PATH1, errno); exitcode = 3; goto errout; @@ -126,7 +126,7 @@ int user_start(int argc, char *argv[]) fd2 = open(FIFO_PATH2, O_WRONLY); if (fd2 < 0) { - message("user_start: Failed to open FIFO %s for writing, errno=%d\n", + message("poll_main: Failed to open FIFO %s for writing, errno=%d\n", FIFO_PATH2, errno); exitcode = 4; goto errout; @@ -134,39 +134,39 @@ int user_start(int argc, char *argv[]) /* Start the listeners */ - message("user_start: Starting poll_listener thread\n"); + message("poll_main: Starting poll_listener thread\n"); ret = pthread_create(&tid1, NULL, poll_listener, NULL); if (ret != 0) { - message("user_start: Failed to create poll_listener thread: %d\n", ret); + message("poll_main: Failed to create poll_listener thread: %d\n", ret); exitcode = 5; goto errout; } - message("user_start: Starting select_listener thread\n"); + message("poll_main: Starting select_listener thread\n"); ret = pthread_create(&tid2, NULL, select_listener, NULL); if (ret != 0) { - message("user_start: Failed to create select_listener thread: %d\n", ret); + message("poll_main: Failed to create select_listener thread: %d\n", ret); exitcode = 6; goto errout; } #ifdef HAVE_NETPOLL #ifdef CONFIG_NET_TCPBACKLOG - message("user_start: Starting net_listener thread\n"); + message("poll_main: Starting net_listener thread\n"); ret = pthread_create(&tid3, NULL, net_listener, NULL); #else - message("user_start: Starting net_reader thread\n"); + message("poll_main: Starting net_reader thread\n"); ret = pthread_create(&tid3, NULL, net_reader, NULL); #endif if (ret != 0) { - message("user_start: Failed to create net_listener thread: %d\n", ret); + message("poll_main: Failed to create net_listener thread: %d\n", ret); } #endif @@ -182,7 +182,7 @@ int user_start(int argc, char *argv[]) nbytes = write(fd1, buffer, strlen(buffer)); if (nbytes < 0) { - message("user_start: Write to fd1 failed: %d\n", errno); + message("poll_main: Write to fd1 failed: %d\n", errno); exitcode = 7; goto errout; } @@ -190,12 +190,12 @@ int user_start(int argc, char *argv[]) nbytes = write(fd2, buffer, strlen(buffer)); if (nbytes < 0) { - message("user_start: Write fd2 failed: %d\n", errno); + message("poll_main: Write fd2 failed: %d\n", errno); exitcode = 8; goto errout; } - message("\nuser_start: Sent '%s' (%d bytes)\n", buffer, nbytes); + message("\npoll_main: Sent '%s' (%d bytes)\n", buffer, nbytes); msgflush(); /* Wait awhile. This delay should be long enough that the diff --git a/apps/examples/pwm/pwm_main.c b/apps/examples/pwm/pwm_main.c index 64c5dfb2c..775bdba6b 100644 --- a/apps/examples/pwm/pwm_main.c +++ b/apps/examples/pwm/pwm_main.c @@ -269,7 +269,7 @@ static void parse_args(FAR struct pwm_state_s *pwm, int argc, FAR char **argv) ****************************************************************************/ /**************************************************************************** - * Name: user_start/pwm_main + * Name: pwm_main ****************************************************************************/ int pwm_main(int argc, char *argv[]) diff --git a/apps/examples/qencoder/qe_main.c b/apps/examples/qencoder/qe_main.c index c58a2b0ad..8c185ea1b 100644 --- a/apps/examples/qencoder/qe_main.c +++ b/apps/examples/qencoder/qe_main.c @@ -59,14 +59,6 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef CONFIG_NSH_BUILTIN_APPS -# define MAIN_NAME qe_main -# define MAIN_STRING "qe_main: " -#else -# define MAIN_NAME user_start -# define MAIN_STRING "user_start: " -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -245,10 +237,10 @@ static void parse_args(int argc, FAR char **argv) ****************************************************************************/ /**************************************************************************** - * Name: user_start/qe_main + * Name: qe_main ****************************************************************************/ -int MAIN_NAME(int argc, char *argv[]) +int qe_main(int argc, char *argv[]) { int32_t position; int fd; @@ -266,11 +258,11 @@ int MAIN_NAME(int argc, char *argv[]) * this test. */ - message(MAIN_STRING "Initializing external encoder(s)\n"); + message("qe_main: Initializing external encoder(s)\n"); ret = qe_devinit(); if (ret != OK) { - message(MAIN_STRING "qe_devinit failed: %d\n", ret); + message("qe_main: qe_devinit failed: %d\n", ret); exitval = EXIT_FAILURE; goto errout; } @@ -289,13 +281,13 @@ int MAIN_NAME(int argc, char *argv[]) /* Open the encoder device for reading */ - message(MAIN_STRING "Hardware initialized. Opening the encoder device: %s\n", + message("qe_main: Hardware initialized. Opening the encoder device: %s\n", g_qeexample.devpath); fd = open(g_qeexample.devpath, O_RDONLY); if (fd < 0) { - message(MAIN_STRING "open %s failed: %d\n", g_qeexample.devpath, errno); + message("qe_main: open %s failed: %d\n", g_qeexample.devpath, errno); exitval = EXIT_FAILURE; goto errout_with_dev; } @@ -304,11 +296,11 @@ int MAIN_NAME(int argc, char *argv[]) if (g_qeexample.reset) { - message(MAIN_STRING "Resetting the count...\n"); + message("qe_main: Resetting the count...\n"); ret = ioctl(fd, QEIOC_RESET, 0); if (ret < 0) { - message(MAIN_STRING "ioctl(QEIOC_RESET) failed: %d\n", errno); + message("qe_main: ioctl(QEIOC_RESET) failed: %d\n", errno); exitval = EXIT_FAILURE; goto errout_with_dev; } @@ -319,10 +311,10 @@ int MAIN_NAME(int argc, char *argv[]) */ #if defined(CONFIG_NSH_BUILTIN_APPS) - message(MAIN_STRING "Number of samples: %d\n", g_qeexample.nloops); + message("qe_main: Number of samples: %d\n", g_qeexample.nloops); for (nloops = 0; nloops < g_qeexample.nloops; nloops++) #elif defined(CONFIG_EXAMPLES_QENCODER_NSAMPLES) - message(MAIN_STRING "Number of samples: %d\n", CONFIG_EXAMPLES_QENCODER_NSAMPLES); + message("qe_main: Number of samples: %d\n", CONFIG_EXAMPLES_QENCODER_NSAMPLES); for (nloops = 0; nloops < CONFIG_EXAMPLES_QENCODER_NSAMPLES; nloops++) #else for (;;) @@ -339,7 +331,7 @@ int MAIN_NAME(int argc, char *argv[]) ret = ioctl(fd, QEIOC_POSITION, (unsigned long)((uintptr_t)&position)); if (ret < 0) { - message(MAIN_STRING "ioctl(QEIOC_POSITION) failed: %d\n", errno); + message("qe_main: ioctl(QEIOC_POSITION) failed: %d\n", errno); exitval = EXIT_FAILURE; goto errout_with_dev; } @@ -348,7 +340,7 @@ int MAIN_NAME(int argc, char *argv[]) else { - message(MAIN_STRING "%3d. %d\n", nloops+1, position); + message("qe_main: %3d. %d\n", nloops+1, position); } /* Delay a little bit */ diff --git a/apps/examples/romfs/romfs_main.c b/apps/examples/romfs/romfs_main.c index 32b3d2654..4870ff4f8 100644 --- a/apps/examples/romfs/romfs_main.c +++ b/apps/examples/romfs/romfs_main.c @@ -452,10 +452,10 @@ static void checkdirectories(struct node_s *entry) ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: romfs_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int romfs_main(int argc, char *argv[]) { int ret; diff --git a/apps/examples/serloop/main.c b/apps/examples/serloop/main.c index 3c635fe88..f0e3ac238 100644 --- a/apps/examples/serloop/main.c +++ b/apps/examples/serloop/main.c @@ -56,10 +56,10 @@ ****************************************************************************/ /**************************************************************************** - * user_start + * serloop_main ****************************************************************************/ -int user_start(int argc, char *argv[]) +int serloop_main(int argc, char *argv[]) { #ifdef CONFIG_EXAMPLES_SERLOOP_BUFIO int ch; diff --git a/apps/examples/watchdog/watchdog_main.c b/apps/examples/watchdog/watchdog_main.c index c1341e0fb..53099d21a 100644 --- a/apps/examples/watchdog/watchdog_main.c +++ b/apps/examples/watchdog/watchdog_main.c @@ -217,7 +217,7 @@ static void parse_args(FAR struct wdog_example_s *wdog, int argc, FAR char **arg ****************************************************************************/ /**************************************************************************** - * Name: user_start/wdog_main + * Name: wdog_main ****************************************************************************/ int wdog_main(int argc, char *argv[]) |