summaryrefslogtreecommitdiff
path: root/apps/examples/can
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-30 20:13:50 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-30 20:13:50 +0000
commit79c7065433ae27932ad8b781d38b8f7832b01581 (patch)
treef770414832eeecb35adb70404b31d147afad7235 /apps/examples/can
parentf9d19788072090be80b71ab0d0de14507a6e739b (diff)
downloadnuttx-79c7065433ae27932ad8b781d38b8f7832b01581.tar.gz
nuttx-79c7065433ae27932ad8b781d38b8f7832b01581.tar.bz2
nuttx-79c7065433ae27932ad8b781d38b8f7832b01581.zip
Add configurable application entry point
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5070 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/can')
-rw-r--r--apps/examples/can/can_main.c24
1 files changed, 8 insertions, 16 deletions
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;