From 79c7065433ae27932ad8b781d38b8f7832b01581 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 30 Aug 2012 20:13:50 +0000 Subject: Add configurable application entry point git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5070 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/touchscreen/tc_main.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'apps/examples/touchscreen/tc_main.c') diff --git a/apps/examples/touchscreen/tc_main.c b/apps/examples/touchscreen/tc_main.c index 162025c79..76653bb8f 100644 --- a/apps/examples/touchscreen/tc_main.c +++ b/apps/examples/touchscreen/tc_main.c @@ -81,18 +81,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: user_start/nxhello_main + * Name: tc_main ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN -# define MAIN_NAME tc_main -# define MAIN_STRING "tc_main: " -#else -# define MAIN_NAME user_start -# define MAIN_STRING "user_start: " -#endif - -int MAIN_NAME(int argc, char *argv[]) +int tc_main(int argc, char *argv[]) { struct touch_sample_s sample; ssize_t nbytes; @@ -113,31 +105,31 @@ int MAIN_NAME(int argc, char *argv[]) { nsamples = strtol(argv[1], NULL, 10); } - message(MAIN_STRING "nsamples: %d\n", nsamples); + message("tc_main: nsamples: %d\n", nsamples); #elif defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) - message(MAIN_STRING "nsamples: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES); + message("tc_main: nsamples: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES); #endif /* Initialization of the touchscreen hardware is performed by logic * external to this test. */ - message(MAIN_STRING "Initializing external touchscreen device\n"); + message("tc_main: Initializing external touchscreen device\n"); ret = arch_tcinitialize(CONFIG_EXAMPLES_TOUCHSCREEN_MINOR); if (ret != OK) { - message(MAIN_STRING "arch_tcinitialize failed: %d\n", ret); + message("tc_main: arch_tcinitialize failed: %d\n", ret); errval = 1; goto errout; } /* Open the touchscreen device for reading */ - message(MAIN_STRING "Opening %s\n", CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH); + message("tc_main: Opening %s\n", CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH); fd = open(CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, O_RDONLY); if (fd < 0) { - message(MAIN_STRING "open %s failed: %d\n", + message("tc_main: open %s failed: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errno); errval = 2; goto errout_with_tc; @@ -174,17 +166,17 @@ int MAIN_NAME(int argc, char *argv[]) errval = errno; if (errval != EINTR) { - message(MAIN_STRING "read %s failed: %d\n", + message("tc_main: read %s failed: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); errval = 3; goto errout_with_dev; } - message(MAIN_STRING "Interrupted read...\n"); + message("tc_main: Interrupted read...\n"); } else if (nbytes != sizeof(struct touch_sample_s)) { - message(MAIN_STRING "Unexpected read size=%d, expected=%d, Ignoring\n", + message("tc_main: Unexpected read size=%d, expected=%d, Ignoring\n", nbytes, sizeof(struct touch_sample_s)); } -- cgit v1.2.3