9
0
Fork 0

Add configurable application entry point

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5070 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-08-30 20:13:50 +00:00
parent 98d0ef6c36
commit 2848bbca14
254 changed files with 777 additions and 613 deletions

View File

@ -291,3 +291,7 @@
treads! treads!
* apps/nshlib/nsh.h: Both CONFIG_LIBC_STRERROR and CONFIG_NSH_STRERROR * apps/nshlib/nsh.h: Both CONFIG_LIBC_STRERROR and CONFIG_NSH_STRERROR
must be defined to use strerror() with NSH. must be defined to use strerror() with NSH.
* apps/examples/*/*_main.c, system/i2c/i2c_main.c, and others: Added
configuration variable CONFIG_USER_ENTRYPOINT that may be used to change
the default entry from user_start to some other symbol. Contributed by
Kate.

View File

@ -118,7 +118,7 @@ the NuttX configuration file:
CONFIG_BUILTIN_APP_START=<application name> CONFIG_BUILTIN_APP_START=<application name>
that application shall be invoked immediately after system starts that application shall be invoked immediately after system starts
*instead* of the normal, default "user_start" entry point. *instead* of the default "user_start" entry point.
Note that <application name> must be provided as: "hello", Note that <application name> must be provided as: "hello",
will call: will call:

View File

@ -57,14 +57,6 @@
* Pre-processor Definitions * 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 * 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]; struct adc_msg_s sample[CONFIG_EXAMPLES_ADC_GROUPSIZE];
size_t readsize; size_t readsize;
@ -244,11 +236,11 @@ int MAIN_NAME(int argc, char *argv[])
* this test. * this test.
*/ */
message(MAIN_STRING "Initializing external ADC device\n"); message("adc_main: Initializing external ADC device\n");
ret = adc_devinit(); ret = adc_devinit();
if (ret != OK) if (ret != OK)
{ {
message(MAIN_STRING "adc_devinit failed: %d\n", ret); message("adc_main: adc_devinit failed: %d\n", ret);
errval = 1; errval = 1;
goto errout; goto errout;
} }
@ -276,18 +268,18 @@ int MAIN_NAME(int argc, char *argv[])
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_ADC_NSAMPLES) #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 #endif
/* Open the ADC device for reading */ /* 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); g_adcstate.devpath);
fd = open(g_adcstate.devpath, O_RDONLY); fd = open(g_adcstate.devpath, O_RDONLY);
if (fd < 0) 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; errval = 2;
goto errout_with_dev; goto errout_with_dev;
} }
@ -322,17 +314,17 @@ int MAIN_NAME(int argc, char *argv[])
errval = errno; errval = errno;
if (errval != EINTR) if (errval != EINTR)
{ {
message(MAIN_STRING "read %s failed: %d\n", message("adc_main: read %s failed: %d\n",
g_adcstate.devpath, errval); g_adcstate.devpath, errval);
errval = 3; errval = 3;
goto errout_with_dev; goto errout_with_dev;
} }
message(MAIN_STRING "Interrupted read...\n"); message("adc_main: Interrupted read...\n");
} }
else if (nbytes == 0) 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 */ /* 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); int nsamples = nbytes / sizeof(struct adc_msg_s);
if (nsamples * sizeof(struct adc_msg_s) != nbytes) 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)); nbytes, sizeof(struct adc_msg_s));
} }
else else

View File

@ -130,16 +130,6 @@
#define NUM_BUTTONS (MAX_BUTTON - MIN_BUTTON + 1) #define NUM_BUTTONS (MAX_BUTTON - MIN_BUTTON + 1)
#define BUTTON_INDEX(b) ((b)-MIN_BUTTON) #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 * 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; uint8_t newset;
irqstate_t flags; irqstate_t flags;

View File

@ -76,14 +76,6 @@
# define MAX_ID (1 << 11) # define MAX_ID (1 << 11)
#endif #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 * 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 #ifndef CONFIG_EXAMPLES_CAN_READONLY
struct can_msg_s txmsg; struct can_msg_s txmsg;
@ -150,31 +142,31 @@ int MAIN_NAME(int argc, char *argv[])
{ {
nmsgs = strtol(argv[1], NULL, 10); 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) #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 #endif
/* Initialization of the CAN hardware is performed by logic external to /* Initialization of the CAN hardware is performed by logic external to
* this test. * this test.
*/ */
message(MAIN_STRING "Initializing external CAN device\n"); message("can_main: Initializing external CAN device\n");
ret = can_devinit(); ret = can_devinit();
if (ret != OK) if (ret != OK)
{ {
message(MAIN_STRING "can_devinit failed: %d\n", ret); message("can_main: can_devinit failed: %d\n", ret);
errval = 1; errval = 1;
goto errout; goto errout;
} }
/* Open the CAN device for reading */ /* 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); fd = open(CONFIG_EXAMPLES_CAN_DEVPATH, CAN_OFLAGS);
if (fd < 0) if (fd < 0)
{ {
message(MAIN_STRING "open %s failed: %d\n", message("can_main: open %s failed: %d\n",
CONFIG_EXAMPLES_CAN_DEVPATH, errno); CONFIG_EXAMPLES_CAN_DEVPATH, errno);
errval = 2; errval = 2;
goto errout_with_dev; goto errout_with_dev;

View File

@ -169,16 +169,6 @@
#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ #define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\
TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
/* Entry point **************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
# define MAIN_NAME conn_main
# define MAIN_NAME_STRING "conn"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
/* Debug ********************************************************************/ /* Debug ********************************************************************/
#ifdef CONFIG_CPP_HAVE_VARARGS #ifdef CONFIG_CPP_HAVE_VARARGS

View File

@ -662,7 +662,7 @@ void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev)
} }
/**************************************************************************** /****************************************************************************
* user_start/conn_main * conn_main
* *
* Description: * Description:
* This is the main program that configures the USB mass storage device * This is the main program that configures the USB mass storage device
@ -672,7 +672,7 @@ void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev)
* *
****************************************************************************/ ****************************************************************************/
int MAIN_NAME(int argc, char *argv[]) int conn_main(int argc, char *argv[])
{ {
int ret; int ret;
@ -688,7 +688,7 @@ int MAIN_NAME(int argc, char *argv[])
if (g_composite.cmphandle) if (g_composite.cmphandle)
{ {
message(MAIN_NAME_STRING ": ERROR: Already connected\n"); message("conn_main: ERROR: Already connected\n");
return 1; return 1;
} }
#endif #endif
@ -705,11 +705,11 @@ int MAIN_NAME(int argc, char *argv[])
/* Perform architecture-specific initialization */ /* Perform architecture-specific initialization */
message(MAIN_NAME_STRING ": Performing architecture-specific intialization\n"); message("conn_main: Performing architecture-specific intialization\n");
ret = composite_archinitialize(); ret = composite_archinitialize();
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": composite_archinitialize failed: %d\n", -ret); message("conn_main: composite_archinitialize failed: %d\n", -ret);
return 1; return 1;
} }
check_test_memory_usage("After composite_archinitialize()"); check_test_memory_usage("After composite_archinitialize()");
@ -719,7 +719,7 @@ int MAIN_NAME(int argc, char *argv[])
g_composite.cmphandle = composite_initialize(); g_composite.cmphandle = composite_initialize();
if (!g_composite.cmphandle) if (!g_composite.cmphandle)
{ {
message(MAIN_NAME_STRING ": composite_initialize failed\n"); message("conn_main: composite_initialize failed\n");
return 1; return 1;
} }
check_test_memory_usage("After composite_initialize()"); check_test_memory_usage("After composite_initialize()");
@ -774,7 +774,7 @@ int MAIN_NAME(int argc, char *argv[])
/* Dump trace data */ /* Dump trace data */
# ifdef CONFIG_USBDEV_TRACE # ifdef CONFIG_USBDEV_TRACE
message("\n" MAIN_NAME_STRING ": USB TRACE DATA:\n"); message("\n" "conn_main: USB TRACE DATA:\n");
ret = dumptrace(); ret = dumptrace();
if (ret < 0) if (ret < 0)
{ {
@ -782,18 +782,18 @@ int MAIN_NAME(int argc, char *argv[])
} }
check_test_memory_usage("After usbtrace_enumerate()"); check_test_memory_usage("After usbtrace_enumerate()");
# else # else
message(MAIN_NAME_STRING ": Still alive\n"); message("conn_main: Still alive\n");
# endif # endif
} }
#else #else
message(MAIN_NAME_STRING ": Connected\n"); message("conn_main: Connected\n");
check_test_memory_usage("After composite device connection"); check_test_memory_usage("After composite device connection");
#endif #endif
/* Dump debug memory usage */ /* Dump debug memory usage */
message(MAIN_NAME_STRING ": Exiting\n"); message("conn_main: Exiting\n");
#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) #if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS)
close(g_composite.infd); close(g_composite.infd);
close(g_composite.outfd); close(g_composite.outfd);

View File

@ -81,27 +81,15 @@
# error "You must define CONFIG_NET_BROADCAST" # error "You must define CONFIG_NET_BROADCAST"
#endif #endif
/* If CONFIG_NSH_BUILTIN_APPS is defined, then it is assumed that you want
* to execute the DHCPD daemon as an NSH built-in task.
*/
#ifdef CONFIG_NSH_BUILTIN_APPS
# define MAIN_NAME dhcpd_main
# define MAIN_NAME_STRING "dhcpd_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/dhcpd_main * Name: dhcpd_main
****************************************************************************/ ****************************************************************************/
int MAIN_NAME(int argc, char *argv[]) int dhcpd_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLE_DHCPD_NOMAC) #if defined(CONFIG_EXAMPLE_DHCPD_NOMAC)

View File

@ -107,16 +107,6 @@
# endif # endif
#endif #endif
/* Is this being built as an NSH built-in application? */
#ifdef CONFIG_NSH_BUILTIN_APPS
# define MAIN_NAME ftpd_start
# define MAIN_STRING "ftpd_start: "
#else
# define MAIN_NAME user_start
# define MAIN_STRING "user_start: "
#endif
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/

View File

@ -217,10 +217,10 @@ int ftpd_daemon(int s_argc, char **s_argv)
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/ftpd_start * Name: ftpd_main
****************************************************************************/ ****************************************************************************/
int MAIN_NAME(int s_argc, char **s_argv) int ftpd_main(int s_argc, char **s_argv)
{ {
/* Check if we have already initialized the network */ /* Check if we have already initialized the network */

View File

@ -53,16 +53,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start/hello_main * hello_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_HELLO_BUILTIN int hello_main(int argc, char *argv[])
# define MAIN_NAME hello_main
#else
# define MAIN_NAME user_start
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
printf("Hello, World!!\n"); printf("Hello, World!!\n");
return 0; return 0;

View File

@ -124,24 +124,11 @@ static CHelloWorld g_HelloWorld;
// Public Functions // Public Functions
//*************************************************************************** //***************************************************************************
//***************************************************************************
// user_start
//***************************************************************************
/**************************************************************************** /****************************************************************************
* Name: user_start/nxhello_main * Name: helloxx_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_HELLOXX_BUILTIN int helloxx_main(int argc, char *argv[])
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[])
{ {
// If C++ initialization for static constructors is supported, then do // If C++ initialization for static constructors is supported, then do
// that first // that first
@ -153,7 +140,7 @@ int MAIN_NAME(int argc, char *argv[])
// Exercise an explictly instantiated C++ object // Exercise an explictly instantiated C++ object
CHelloWorld *pHelloWorld = new CHelloWorld; 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(); pHelloWorld->HelloWorld();
// Exercise an C++ object instantiated on the stack // Exercise an C++ object instantiated on the stack
@ -161,14 +148,14 @@ int MAIN_NAME(int argc, char *argv[])
#ifndef CONFIG_EXAMPLES_HELLOXX_NOSTACKCONST #ifndef CONFIG_EXAMPLES_HELLOXX_NOSTACKCONST
CHelloWorld HelloWorld; 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(); HelloWorld.HelloWorld();
#endif #endif
// Exercise an statically constructed C++ object // Exercise an statically constructed C++ object
#ifdef CONFIG_HAVE_CXXINITIALIZE #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(); g_HelloWorld.HelloWorld();
#endif #endif

View File

@ -141,10 +141,10 @@ static int hidkbd_waiter(int argc, char *argv[])
} }
/**************************************************************************** /****************************************************************************
* Name: user_start * Name: hidkbd_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int hidkbd_main(int argc, char *argv[])
{ {
char buffer[256]; char buffer[256];
pid_t pid; pid_t pid;
@ -154,22 +154,22 @@ int user_start(int argc, char *argv[])
/* First, register all of the USB host HID keyboard class driver */ /* First, register all of the USB host HID keyboard class driver */
printf("user_start: Register class drivers\n"); printf("hidkbd_main: Register class drivers\n");
ret = usbhost_kbdinit(); ret = usbhost_kbdinit();
if (ret != OK) if (ret != OK)
{ {
printf("user_start: Failed to register the KBD class\n"); printf("hidkbd_main: Failed to register the KBD class\n");
} }
/* Then get an instance of the USB host interface */ /* Then get an instance of the USB host interface */
printf("user_start: Initialize USB host keyboard driver\n"); printf("hidkbd_main: Initialize USB host keyboard driver\n");
g_drvr = usbhost_initialize(0); g_drvr = usbhost_initialize(0);
if (g_drvr) if (g_drvr)
{ {
/* Start a thread to handle device connection. */ /* Start a thread to handle device connection. */
printf("user_start: Start hidkbd_waiter\n"); printf("hidkbd_main: Start hidkbd_waiter\n");
#ifndef CONFIG_CUSTOM_STACK #ifndef CONFIG_CUSTOM_STACK
pid = task_create("usbhost", CONFIG_EXAMPLES_HIDKBD_DEFPRIO, pid = task_create("usbhost", CONFIG_EXAMPLES_HIDKBD_DEFPRIO,

View File

@ -78,10 +78,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * igmp_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int igmp_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLE_IGMP_NOMAC) #if defined(CONFIG_EXAMPLE_IGMP_NOMAC)

View File

@ -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 int lcdrw_main(int argc, char *argv[])
# define MAIN_NAME lcdrw_main
#else
# define MAIN_NAME user_start
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
struct lcdrw_instance_s inst; struct lcdrw_instance_s inst;
nxgl_coord_t row; nxgl_coord_t row;

View File

@ -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(); mm_showmallinfo();

View File

@ -104,14 +104,6 @@
# define CONFIG_EXAMPLES_MODBUS_REG_HOLDING_NREGS 130 # define CONFIG_EXAMPLES_MODBUS_REG_HOLDING_NREGS 130
#endif #endif
#ifdef CONFIG_NSH_BUILTIN_APPS
# define MAIN_NAME modbus_main
# define MAIN_NAME_STRING "modbus_main: "
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start: "
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -171,7 +163,7 @@ static inline int modbus_initialize(void)
if (g_modbus.threadstate != STOPPED) if (g_modbus.threadstate != STOPPED)
{ {
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: Bad state: %d\n", g_modbus.threadstate); "ERROR: Bad state: %d\n", g_modbus.threadstate);
return EINVAL; return EINVAL;
} }
@ -181,7 +173,7 @@ static inline int modbus_initialize(void)
status = pthread_mutex_init(&g_modbus.lock, NULL); status = pthread_mutex_init(&g_modbus.lock, NULL);
if (status != 0) if (status != 0)
{ {
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: pthread_mutex_init failed: %d\n", status); "ERROR: pthread_mutex_init failed: %d\n", status);
return status; return status;
} }
@ -201,7 +193,7 @@ static inline int modbus_initialize(void)
CONFIG_EXAMPLES_MODBUS_BAUD, CONFIG_EXAMPLES_MODBUS_PARITY); CONFIG_EXAMPLES_MODBUS_BAUD, CONFIG_EXAMPLES_MODBUS_PARITY);
if (mberr != MB_ENOERR) if (mberr != MB_ENOERR)
{ {
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: eMBInit failed: %d\n", mberr); "ERROR: eMBInit failed: %d\n", mberr);
goto errout_with_mutex; goto errout_with_mutex;
} }
@ -217,7 +209,7 @@ static inline int modbus_initialize(void)
mberr = eMBSetSlaveID(0x34, true, g_slaveid, 3); mberr = eMBSetSlaveID(0x34, true, g_slaveid, 3);
if (mberr != MB_ENOERR) if (mberr != MB_ENOERR)
{ {
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: eMBSetSlaveID failed: %d\n", mberr); "ERROR: eMBSetSlaveID failed: %d\n", mberr);
goto errout_with_modbus; goto errout_with_modbus;
} }
@ -227,7 +219,7 @@ static inline int modbus_initialize(void)
mberr = eMBEnable(); mberr = eMBEnable();
if (mberr == MB_ENOERR) if (mberr == MB_ENOERR)
{ {
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: eMBEnable failed: %d\n", mberr); "ERROR: eMBEnable failed: %d\n", mberr);
goto errout_with_modbus; goto errout_with_modbus;
} }
@ -270,7 +262,7 @@ static void *modbus_pollthread(void *pvarg)
ret = modbus_initialize(); ret = modbus_initialize();
if (ret != OK) if (ret != OK)
{ {
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: modbus_initialize failed: %d\n", ret); "ERROR: modbus_initialize failed: %d\n", ret);
return NULL; return NULL;
} }
@ -358,14 +350,14 @@ static void modbus_showusage(FAR const char *progname, int exitcode)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/modbus_main * Name: modbus_main
* *
* Description: * Description:
* This is the main entry point to the demo program * This is the main entry point to the demo program
* *
****************************************************************************/ ****************************************************************************/
int MAIN_NAME(int argc, char *argv[]) int modbus_main(int argc, char *argv[])
{ {
int option; int option;
int ret; int ret;
@ -389,7 +381,7 @@ int MAIN_NAME(int argc, char *argv[])
ret = modbus_create_pollthread(); ret = modbus_create_pollthread();
if (ret != OK) if (ret != OK)
{ {
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: modbus_create_pollthread failed: %d\n", ret); "ERROR: modbus_create_pollthread failed: %d\n", ret);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -400,19 +392,19 @@ int MAIN_NAME(int argc, char *argv[])
switch (g_modbus.threadstate) switch (g_modbus.threadstate)
{ {
case RUNNING: case RUNNING:
printf(MAIN_NAME_STRING "Protocol stack is running\n"); printf("modbus_main: Protocol stack is running\n");
break; break;
case STOPPED: case STOPPED:
printf(MAIN_NAME_STRING "Protocol stack is stopped\n"); printf("modbus_main: Protocol stack is stopped\n");
break; break;
case SHUTDOWN: case SHUTDOWN:
printf(MAIN_NAME_STRING "Protocol stack is shutting down\n"); printf("modbus_main: Protocol stack is shutting down\n");
break; break;
default: default:
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: Invalid thread state: %d\n", "ERROR: Invalid thread state: %d\n",
g_modbus.threadstate); g_modbus.threadstate);
break; break;
@ -429,7 +421,7 @@ int MAIN_NAME(int argc, char *argv[])
break; break;
default: default:
fprintf(stderr, MAIN_NAME_STRING fprintf(stderr, "modbus_main: "
"ERROR: Unrecognized option: '%c'\n", option); "ERROR: Unrecognized option: '%c'\n", option);
modbus_showusage(argv[0], EXIT_FAILURE); modbus_showusage(argv[0], EXIT_FAILURE);
break; break;

View File

@ -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; int ret;
@ -580,18 +580,18 @@ int user_start(int argc, char *argv[])
ret = create_ramdisk(); ret = create_ramdisk();
if (ret < 0) 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; return 1;
} }
#endif #endif
/* Mount the test file system (see arch/sim/src/up_deviceimage.c */ /* 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); g_filesystemtype, g_target, g_source);
ret = mount(g_source, g_target, g_filesystemtype, 0, NULL); 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) if (ret == 0)
{ {
@ -737,16 +737,16 @@ int user_start(int argc, char *argv[])
/* Unmount the file system */ /* 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); ret = umount(g_target);
if (ret != 0) 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++; g_nerrors++;
} }
printf("user_start: %d errors reported\n", g_nerrors); printf("mount_main: %d errors reported\n", g_nerrors);
} }
fflush(stdout); fflush(stdout);

View File

@ -53,18 +53,6 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
/* If CONFIG_NSH_BUILTIN_APPS is defined, then it is assumed that you want
* to execute the DHCPD daemon as an NSH built-in task.
*/
#ifdef CONFIG_NSH_BUILTIN_APPS
# define MAIN_NAME nettest_main
# define MAIN_NAME_STRING "nettest_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
@ -74,10 +62,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * nettest_main
****************************************************************************/ ****************************************************************************/
int MAIN_NAME(int argc, char *argv[]) int nettest_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;
#ifdef CONFIG_EXAMPLE_NETTEST_NOMAC #ifdef CONFIG_EXAMPLE_NETTEST_NOMAC

View File

@ -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 exitval = 0;
int ret; int ret;

View File

@ -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; return 0;
} }

View File

@ -614,18 +614,10 @@ static int nxeg_initialize(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/nx_main * Name: nx_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_NX_BUILTIN int nx_main(int argc, char *argv[])
# define MAIN_NAME nx_main
# define MAIN_NAME_STRING "nx_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
NXEGWINDOW hwnd1; NXEGWINDOW hwnd1;
NXEGWINDOW hwnd2; NXEGWINDOW hwnd2;
@ -637,10 +629,10 @@ int MAIN_NAME(int argc, char *argv[])
/* Initialize */ /* Initialize */
ret = nxeg_initialize(); ret = nxeg_initialize();
message(MAIN_NAME_STRING ": NX handle=%p\n", g_hnx); message("nx_main: NX handle=%p\n", g_hnx);
if (!g_hnx || ret < 0) if (!g_hnx || ret < 0)
{ {
message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); message("nx_main: Failed to get NX handle: %d\n", errno);
g_exitcode = NXEXIT_NXOPEN; g_exitcode = NXEXIT_NXOPEN;
goto errout; goto errout;
} }
@ -650,29 +642,29 @@ int MAIN_NAME(int argc, char *argv[])
g_fonthandle = nxf_getfonthandle(CONFIG_EXAMPLES_NX_FONTID); g_fonthandle = nxf_getfonthandle(CONFIG_EXAMPLES_NX_FONTID);
if (!g_fonthandle) if (!g_fonthandle)
{ {
message(MAIN_NAME_STRING ": Failed to get font handle: %d\n", errno); message("nx_main: Failed to get font handle: %d\n", errno);
g_exitcode = NXEXIT_FONTOPEN; g_exitcode = NXEXIT_FONTOPEN;
goto errout; goto errout;
} }
/* Set the background to the configured background color */ /* Set the background to the configured background color */
message(MAIN_NAME_STRING ": Set background color=%d\n", CONFIG_EXAMPLES_NX_BGCOLOR); message("nx_main: Set background color=%d\n", CONFIG_EXAMPLES_NX_BGCOLOR);
color = CONFIG_EXAMPLES_NX_BGCOLOR; color = CONFIG_EXAMPLES_NX_BGCOLOR;
ret = nx_setbgcolor(g_hnx, &color); ret = nx_setbgcolor(g_hnx, &color);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nx_main: nx_setbgcolor failed: %d\n", errno);
g_exitcode = NXEXIT_NXSETBGCOLOR; g_exitcode = NXEXIT_NXSETBGCOLOR;
goto errout_with_nx; goto errout_with_nx;
} }
/* Create window #1 */ /* Create window #1 */
message(MAIN_NAME_STRING ": Create window #1\n"); message("nx_main: Create window #1\n");
nxeg_initstate(&g_wstate[0], 1, CONFIG_EXAMPLES_NX_COLOR1); nxeg_initstate(&g_wstate[0], 1, CONFIG_EXAMPLES_NX_COLOR1);
hwnd1 = nxeg_openwindow(&g_nxcb, &g_wstate[0]); hwnd1 = nxeg_openwindow(&g_nxcb, &g_wstate[0]);
message(MAIN_NAME_STRING ": hwnd1=%p\n", hwnd1); message("nx_main: hwnd1=%p\n", hwnd1);
if (!hwnd1) if (!hwnd1)
{ {
goto errout_with_nx; goto errout_with_nx;
@ -684,14 +676,14 @@ int MAIN_NAME(int argc, char *argv[])
{ {
(void)sem_wait(&g_semevent); (void)sem_wait(&g_semevent);
} }
message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_xres, g_yres); message("nx_main: Screen resolution (%d,%d)\n", g_xres, g_yres);
/* Set the size of the window 1 */ /* Set the size of the window 1 */
size.w = g_xres / 2; size.w = g_xres / 2;
size.h = g_yres / 2; size.h = g_yres / 2;
message(MAIN_NAME_STRING ": Set window #1 size to (%d,%d)\n", size.w, size.h); message("nx_main: Set window #1 size to (%d,%d)\n", size.w, size.h);
ret = nxeg_setsize(hwnd1, &size); ret = nxeg_setsize(hwnd1, &size);
if (ret < 0) if (ret < 0)
{ {
@ -703,7 +695,7 @@ int MAIN_NAME(int argc, char *argv[])
* actually do them! * actually do them!
*/ */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
/* Set the position of window #1 */ /* Set the position of window #1 */
@ -711,7 +703,7 @@ int MAIN_NAME(int argc, char *argv[])
pt.x = g_xres / 8; pt.x = g_xres / 8;
pt.y = g_yres / 8; pt.y = g_yres / 8;
message(MAIN_NAME_STRING ": Set window #1 postion to (%d,%d)\n", pt.x, pt.y); message("nx_main: Set window #1 postion to (%d,%d)\n", pt.x, pt.y);
ret = nxeg_setposition(hwnd1, &pt); ret = nxeg_setposition(hwnd1, &pt);
if (ret < 0) if (ret < 0)
{ {
@ -720,13 +712,13 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
/* Open the toolbar */ /* Open the toolbar */
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS #ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
message(MAIN_NAME_STRING ": Add toolbar to window #1\n"); message("nx_main: Add toolbar to window #1\n");
ret = nxeq_opentoolbar(hwnd1, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[0]); ret = nxeq_opentoolbar(hwnd1, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[0]);
if (ret < 0) if (ret < 0)
{ {
@ -735,16 +727,16 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
#endif #endif
/* Create window #2 */ /* Create window #2 */
message(MAIN_NAME_STRING ": Create window #2\n"); message("nx_main: Create window #2\n");
nxeg_initstate(&g_wstate[1], 2, CONFIG_EXAMPLES_NX_COLOR2); nxeg_initstate(&g_wstate[1], 2, CONFIG_EXAMPLES_NX_COLOR2);
hwnd2 = nxeg_openwindow(&g_nxcb, &g_wstate[1]); hwnd2 = nxeg_openwindow(&g_nxcb, &g_wstate[1]);
message(MAIN_NAME_STRING ": hwnd2=%p\n", hwnd2); message("nx_main: hwnd2=%p\n", hwnd2);
if (!hwnd2) if (!hwnd2)
{ {
goto errout_with_hwnd1; goto errout_with_hwnd1;
@ -752,12 +744,12 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
/* Set the size of the window 2 == size of window 1*/ /* Set the size of the window 2 == size of window 1*/
message(MAIN_NAME_STRING ": Set hwnd2 size to (%d,%d)\n", size.w, size.h); message("nx_main: Set hwnd2 size to (%d,%d)\n", size.w, size.h);
ret = nxeg_setsize(hwnd2, &size); ret = nxeg_setsize(hwnd2, &size);
if (ret < 0) if (ret < 0)
{ {
@ -766,7 +758,7 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
/* Set the position of window #2 */ /* Set the position of window #2 */
@ -774,7 +766,7 @@ int MAIN_NAME(int argc, char *argv[])
pt.x = g_xres - size.w - pt.x; pt.x = g_xres - size.w - pt.x;
pt.y = g_yres - size.h - pt.y; pt.y = g_yres - size.h - pt.y;
message(MAIN_NAME_STRING ": Set hwnd2 postion to (%d,%d)\n", pt.x, pt.y); message("nx_main: Set hwnd2 postion to (%d,%d)\n", pt.x, pt.y);
ret = nxeg_setposition(hwnd2, &pt); ret = nxeg_setposition(hwnd2, &pt);
if (ret < 0) if (ret < 0)
{ {
@ -783,11 +775,11 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS #ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
message(MAIN_NAME_STRING ": Add toolbar to window #2\n"); message("nx_main: Add toolbar to window #2\n");
ret = nxeq_opentoolbar(hwnd2, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[1]); ret = nxeq_opentoolbar(hwnd2, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[1]);
if (ret < 0) if (ret < 0)
{ {
@ -796,30 +788,30 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
#endif #endif
/* Give keyboard input to the top window -- should be window #2 */ /* Give keyboard input to the top window -- should be window #2 */
#ifdef CONFIG_NX_KBD #ifdef CONFIG_NX_KBD
message(MAIN_NAME_STRING ": Send keyboard input: %s\n", g_kbdmsg1); message("nx_main: Send keyboard input: %s\n", g_kbdmsg1);
ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg1), g_kbdmsg1); ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg1), g_kbdmsg1);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_kbdin failed: %d\n", errno); message("nx_main: nx_kbdin failed: %d\n", errno);
goto errout_with_hwnd2; goto errout_with_hwnd2;
} }
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
#endif #endif
/* Lower window 2 */ /* Lower window 2 */
message(MAIN_NAME_STRING ": Lower window #2\n"); message("nx_main: Lower window #2\n");
ret = nxeg_lower(hwnd2); ret = nxeg_lower(hwnd2);
if (ret < 0) if (ret < 0)
{ {
@ -828,7 +820,7 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
/* Put mouse left-button clicks all over the screen and see who responds */ /* Put mouse left-button clicks all over the screen and see who responds */
@ -838,30 +830,30 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
#endif #endif
/* Give keyboard input to the top window -- should be window #1 */ /* Give keyboard input to the top window -- should be window #1 */
#ifdef CONFIG_NX_KBD #ifdef CONFIG_NX_KBD
message(MAIN_NAME_STRING ": Send keyboard input: %s\n", g_kbdmsg2); message("nx_main: Send keyboard input: %s\n", g_kbdmsg2);
ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg2), g_kbdmsg2); ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg2), g_kbdmsg2);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_kbdin failed: %d\n", errno); message("nx_main: nx_kbdin failed: %d\n", errno);
goto errout_with_hwnd2; goto errout_with_hwnd2;
} }
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(1); sleep(1);
#endif #endif
/* Raise window 2 */ /* Raise window 2 */
message(MAIN_NAME_STRING ": Raise window #2\n"); message("nx_main: Raise window #2\n");
ret = nxeg_raise(hwnd2); ret = nxeg_raise(hwnd2);
if (ret < 0) if (ret < 0)
{ {
@ -876,31 +868,31 @@ int MAIN_NAME(int argc, char *argv[])
/* Sleep a bit */ /* Sleep a bit */
message(MAIN_NAME_STRING ": Sleeping\n\n"); message("nx_main: Sleeping\n\n");
sleep(2); sleep(2);
/* Close the window 2 */ /* Close the window 2 */
errout_with_hwnd2: errout_with_hwnd2:
message(MAIN_NAME_STRING ": Close window #2\n"); message("nx_main: Close window #2\n");
(void)nxeg_closewindow(hwnd2, &g_wstate[1]); (void)nxeg_closewindow(hwnd2, &g_wstate[1]);
/* Close the window1 */ /* Close the window1 */
errout_with_hwnd1: errout_with_hwnd1:
message(MAIN_NAME_STRING ": Close window #1\n"); message("nx_main: Close window #1\n");
(void)nxeg_closewindow(hwnd1, &g_wstate[0]); (void)nxeg_closewindow(hwnd1, &g_wstate[0]);
errout_with_nx: errout_with_nx:
#ifdef CONFIG_NX_MULTIUSER #ifdef CONFIG_NX_MULTIUSER
/* Disconnect from the server */ /* Disconnect from the server */
message(MAIN_NAME_STRING ": Disconnect from the server\n"); message("nx_main: Disconnect from the server\n");
nx_disconnect(g_hnx); nx_disconnect(g_hnx);
#else #else
/* Close the server */ /* Close the server */
message(MAIN_NAME_STRING ": Close NX\n"); message("nx_main: Close NX\n");
nx_close(g_hnx); nx_close(g_hnx);
#endif #endif
errout: errout:

View File

@ -207,10 +207,10 @@ static int nxcon_task(int argc, char **argv)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start * Name: nxcon_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char **argv) int nxcon_main(int argc, char **argv)
{ {
nxgl_mxpixel_t color; nxgl_mxpixel_t color;
int fd; int fd;
@ -219,7 +219,7 @@ int user_start(int argc, char **argv)
/* General Initialization *************************************************/ /* General Initialization *************************************************/
/* Reset all global data */ /* Reset all global data */
message("user_start: Started\n"); message("nxcon_main: Started\n");
memset(&g_nxcon_vars, 0, sizeof(struct nxcon_state_s)); memset(&g_nxcon_vars, 0, sizeof(struct nxcon_state_s));
/* Call all C++ static constructors */ /* Call all C++ static constructors */
@ -231,7 +231,7 @@ int user_start(int argc, char **argv)
/* NSH Initialization *****************************************************/ /* NSH Initialization *****************************************************/
/* Initialize the NSH library */ /* Initialize the NSH library */
message("user_start: Initialize NSH\n"); message("nxcon_main: Initialize NSH\n");
nsh_initialize(); nsh_initialize();
/* If the Telnet console is selected as a front-end, then start the /* If the Telnet console is selected as a front-end, then start the
@ -252,37 +252,37 @@ int user_start(int argc, char **argv)
/* NX Initialization ******************************************************/ /* NX Initialization ******************************************************/
/* Initialize NX */ /* Initialize NX */
message("user_start: Initialize NX\n"); message("nxcon_main: Initialize NX\n");
ret = nxcon_initialize(); ret = nxcon_initialize();
message("user_start: NX handle=%p\n", g_nxcon_vars.hnx); message("nxcon_main: NX handle=%p\n", g_nxcon_vars.hnx);
if (!g_nxcon_vars.hnx || ret < 0) if (!g_nxcon_vars.hnx || ret < 0)
{ {
message("user_start: Failed to get NX handle: %d\n", errno); message("nxcon_main: Failed to get NX handle: %d\n", errno);
goto errout; goto errout;
} }
/* Set the background to the configured background color */ /* Set the background to the configured background color */
message("user_start: Set background color=%d\n", CONFIG_EXAMPLES_NXCON_BGCOLOR); message("nxcon_main: Set background color=%d\n", CONFIG_EXAMPLES_NXCON_BGCOLOR);
color = CONFIG_EXAMPLES_NXCON_BGCOLOR; color = CONFIG_EXAMPLES_NXCON_BGCOLOR;
ret = nx_setbgcolor(g_nxcon_vars.hnx, &color); ret = nx_setbgcolor(g_nxcon_vars.hnx, &color);
if (ret < 0) if (ret < 0)
{ {
message("user_start: nx_setbgcolor failed: %d\n", errno); message("nxcon_main: nx_setbgcolor failed: %d\n", errno);
goto errout_with_nx; goto errout_with_nx;
} }
/* Window Configuration ***************************************************/ /* Window Configuration ***************************************************/
/* Create a window */ /* Create a window */
message("user_start: Create window\n"); message("nxcon_main: Create window\n");
g_nxcon_vars.hwnd = nxtk_openwindow(g_nxcon_vars.hnx, &g_nxconcb, NULL); g_nxcon_vars.hwnd = nxtk_openwindow(g_nxcon_vars.hnx, &g_nxconcb, NULL);
if (!g_nxcon_vars.hwnd) if (!g_nxcon_vars.hwnd)
{ {
message("user_start: nxtk_openwindow failed: %d\n", errno); message("nxcon_main: nxtk_openwindow failed: %d\n", errno);
goto errout_with_nx; goto errout_with_nx;
} }
message("user_start: hwnd=%p\n", g_nxcon_vars.hwnd); message("nxcon_main: hwnd=%p\n", g_nxcon_vars.hwnd);
/* Wait until we have the screen resolution. We'll have this immediately /* Wait until we have the screen resolution. We'll have this immediately
* unless we are dealing with the NX server. * unless we are dealing with the NX server.
@ -292,7 +292,7 @@ int user_start(int argc, char **argv)
{ {
(void)sem_wait(&g_nxcon_vars.eventsem); (void)sem_wait(&g_nxcon_vars.eventsem);
} }
message("user_start: Screen resolution (%d,%d)\n", g_nxcon_vars.xres, g_nxcon_vars.yres); message("nxcon_main: Screen resolution (%d,%d)\n", g_nxcon_vars.xres, g_nxcon_vars.yres);
/* Determine the size and position of the window */ /* Determine the size and position of the window */
@ -304,35 +304,35 @@ int user_start(int argc, char **argv)
/* Set the window position */ /* Set the window position */
message("user_start: Set window position to (%d,%d)\n", message("nxcon_main: Set window position to (%d,%d)\n",
g_nxcon_vars.wpos.x, g_nxcon_vars.wpos.y); g_nxcon_vars.wpos.x, g_nxcon_vars.wpos.y);
ret = nxtk_setposition(g_nxcon_vars.hwnd, &g_nxcon_vars.wpos); ret = nxtk_setposition(g_nxcon_vars.hwnd, &g_nxcon_vars.wpos);
if (ret < 0) if (ret < 0)
{ {
message("user_start: nxtk_setposition failed: %d\n", errno); message("nxcon_main: nxtk_setposition failed: %d\n", errno);
goto errout_with_hwnd; goto errout_with_hwnd;
} }
/* Set the window size */ /* Set the window size */
message("user_start: Set window size to (%d,%d)\n", message("nxcon_main: Set window size to (%d,%d)\n",
g_nxcon_vars.wndo.wsize.w, g_nxcon_vars.wndo.wsize.h); g_nxcon_vars.wndo.wsize.w, g_nxcon_vars.wndo.wsize.h);
ret = nxtk_setsize(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo.wsize); ret = nxtk_setsize(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo.wsize);
if (ret < 0) if (ret < 0)
{ {
message("user_start: nxtk_setsize failed: %d\n", errno); message("nxcon_main: nxtk_setsize failed: %d\n", errno);
goto errout_with_hwnd; goto errout_with_hwnd;
} }
/* Open the toolbar */ /* Open the toolbar */
message("user_start: Add toolbar to window\n"); message("nxcon_main: Add toolbar to window\n");
ret = nxtk_opentoolbar(g_nxcon_vars.hwnd, CONFIG_EXAMPLES_NXCON_TOOLBAR_HEIGHT, &g_nxtoolcb, NULL); ret = nxtk_opentoolbar(g_nxcon_vars.hwnd, CONFIG_EXAMPLES_NXCON_TOOLBAR_HEIGHT, &g_nxtoolcb, NULL);
if (ret < 0) if (ret < 0)
{ {
message("user_start: nxtk_opentoolbar failed: %d\n", errno); message("nxcon_main: nxtk_opentoolbar failed: %d\n", errno);
goto errout_with_hwnd; goto errout_with_hwnd;
} }
@ -350,7 +350,7 @@ int user_start(int argc, char **argv)
g_nxcon_vars.hdrvr = nxtk_register(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo, CONFIG_EXAMPLES_NXCON_MINOR); g_nxcon_vars.hdrvr = nxtk_register(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo, CONFIG_EXAMPLES_NXCON_MINOR);
if (!g_nxcon_vars.hdrvr) if (!g_nxcon_vars.hdrvr)
{ {
message("user_start: nxtk_register failed: %d\n", errno); message("nxcon_main: nxtk_register failed: %d\n", errno);
goto errout_with_hwnd; goto errout_with_hwnd;
} }
@ -359,7 +359,7 @@ int user_start(int argc, char **argv)
fd = open(CONFIG_EXAMPLES_NXCON_DEVNAME, O_WRONLY); fd = open(CONFIG_EXAMPLES_NXCON_DEVNAME, O_WRONLY);
if (fd < 0) if (fd < 0)
{ {
message("user_start: open %s read-only failed: %d\n", message("nxcon_main: open %s read-only failed: %d\n",
CONFIG_EXAMPLES_NXCON_DEVNAME, errno); CONFIG_EXAMPLES_NXCON_DEVNAME, errno);
goto errout_with_driver; goto errout_with_driver;
} }
@ -369,7 +369,7 @@ int user_start(int argc, char **argv)
* Note that stdin is retained (file descriptor 0, probably the the serial console). * Note that stdin is retained (file descriptor 0, probably the the serial console).
*/ */
message("user_start: Starting the console task\n"); message("nxcon_main: Starting the console task\n");
msgflush(); msgflush();
(void)fflush(stdout); (void)fflush(stdout);

View File

@ -789,10 +789,10 @@ static int nxffs_directory(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start * Name: nxffs_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int nxffs_main(int argc, char *argv[])
{ {
FAR struct mtd_dev_s *mtd; FAR struct mtd_dev_s *mtd;
unsigned int i; unsigned int i;

View File

@ -145,10 +145,10 @@ static inline void testheader(FAR const char *progname)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start * Name: nxflat_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int nxflat_main(int argc, char *argv[])
{ {
struct binary_s bin; struct binary_s bin;
int ret; int ret;

View File

@ -203,18 +203,10 @@ static inline int nxhello_initialize(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/nxhello_main * Name: nxhello_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_NXHELLO_BUILTIN int nxhello_main(int argc, char *argv[])
# define MAIN_NAME nxhello_main
# define MAIN_NAME_STRING "nxhello_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
nxgl_mxpixel_t color; nxgl_mxpixel_t color;
int ret; int ret;
@ -222,10 +214,10 @@ int MAIN_NAME(int argc, char *argv[])
/* Initialize NX */ /* Initialize NX */
ret = nxhello_initialize(); ret = nxhello_initialize();
message(MAIN_NAME_STRING ": NX handle=%p\n", g_nxhello.hnx); message("nxhello_main: NX handle=%p\n", g_nxhello.hnx);
if (!g_nxhello.hnx || ret < 0) if (!g_nxhello.hnx || ret < 0)
{ {
message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); message("nxhello_main: Failed to get NX handle: %d\n", errno);
g_nxhello.code = NXEXIT_NXOPEN; g_nxhello.code = NXEXIT_NXOPEN;
goto errout; goto errout;
} }
@ -235,21 +227,21 @@ int MAIN_NAME(int argc, char *argv[])
g_nxhello.hfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXHELLO_FONTID); g_nxhello.hfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXHELLO_FONTID);
if (!g_nxhello.hfont) if (!g_nxhello.hfont)
{ {
message(MAIN_NAME_STRING ": Failed to get font handle: %d\n", errno); message("nxhello_main: Failed to get font handle: %d\n", errno);
g_nxhello.code = NXEXIT_FONTOPEN; g_nxhello.code = NXEXIT_FONTOPEN;
goto errout; goto errout;
} }
/* Set the background to the configured background color */ /* Set the background to the configured background color */
message(MAIN_NAME_STRING ": Set background color=%d\n", message("nxhello_main: Set background color=%d\n",
CONFIG_EXAMPLES_NXHELLO_BGCOLOR); CONFIG_EXAMPLES_NXHELLO_BGCOLOR);
color = CONFIG_EXAMPLES_NXHELLO_BGCOLOR; color = CONFIG_EXAMPLES_NXHELLO_BGCOLOR;
ret = nx_setbgcolor(g_nxhello.hnx, &color); ret = nx_setbgcolor(g_nxhello.hnx, &color);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nxhello_main: nx_setbgcolor failed: %d\n", errno);
g_nxhello.code = NXEXIT_NXSETBGCOLOR; g_nxhello.code = NXEXIT_NXSETBGCOLOR;
goto errout_with_nx; goto errout_with_nx;
} }
@ -259,7 +251,7 @@ int MAIN_NAME(int argc, char *argv[])
ret = nx_requestbkgd(g_nxhello.hnx, &g_nxhellocb, NULL); ret = nx_requestbkgd(g_nxhello.hnx, &g_nxhellocb, NULL);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nxhello_main: nx_setbgcolor failed: %d\n", errno);
g_nxhello.code = NXEXIT_NXREQUESTBKGD; g_nxhello.code = NXEXIT_NXREQUESTBKGD;
goto errout_with_nx; goto errout_with_nx;
} }
@ -272,7 +264,7 @@ int MAIN_NAME(int argc, char *argv[])
{ {
(void)sem_wait(&g_nxhello.sem); (void)sem_wait(&g_nxhello.sem);
} }
message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_nxhello.xres, g_nxhello.yres); message("nxhello_main: Screen resolution (%d,%d)\n", g_nxhello.xres, g_nxhello.yres);
/* Now, say hello and exit, sleeping a little before each. */ /* Now, say hello and exit, sleeping a little before each. */
@ -287,7 +279,7 @@ int MAIN_NAME(int argc, char *argv[])
/* Close NX */ /* Close NX */
errout_with_nx: errout_with_nx:
message(MAIN_NAME_STRING ": Close NX\n"); message("nxhello_main: Close NX\n");
nx_close(g_nxhello.hnx); nx_close(g_nxhello.hnx);
errout: errout:
return g_nxhello.code; return g_nxhello.code;

View File

@ -207,22 +207,14 @@ static inline int nximage_initialize(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/nximage_main * Name: nximage_main
* *
* Description: * Description:
* Main entry pointer. Configures the basic display resources. * Main entry pointer. Configures the basic display resources.
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_NXIMAGE_BUILTIN int nximage_main(int argc, char *argv[])
# define MAIN_NAME nximage_main
# define MAIN_NAME_STRING "nximage_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
nxgl_mxpixel_t color; nxgl_mxpixel_t color;
int ret; int ret;
@ -230,10 +222,10 @@ int MAIN_NAME(int argc, char *argv[])
/* Initialize NX */ /* Initialize NX */
ret = nximage_initialize(); ret = nximage_initialize();
message(MAIN_NAME_STRING ": NX handle=%p\n", g_nximage.hnx); message("nximage_main: NX handle=%p\n", g_nximage.hnx);
if (!g_nximage.hnx || ret < 0) if (!g_nximage.hnx || ret < 0)
{ {
message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); message("nximage_main: Failed to get NX handle: %d\n", errno);
g_nximage.code = NXEXIT_NXOPEN; g_nximage.code = NXEXIT_NXOPEN;
goto errout; goto errout;
} }
@ -241,12 +233,12 @@ int MAIN_NAME(int argc, char *argv[])
/* Set the background to the configured background color */ /* Set the background to the configured background color */
color = nximage_bgcolor(); color = nximage_bgcolor();
message(MAIN_NAME_STRING ": Set background color=%d\n", color); message("nximage_main: Set background color=%d\n", color);
ret = nx_setbgcolor(g_nximage.hnx, &color); ret = nx_setbgcolor(g_nximage.hnx, &color);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nximage_main: nx_setbgcolor failed: %d\n", errno);
g_nximage.code = NXEXIT_NXSETBGCOLOR; g_nximage.code = NXEXIT_NXSETBGCOLOR;
goto errout_with_nx; goto errout_with_nx;
} }
@ -256,7 +248,7 @@ int MAIN_NAME(int argc, char *argv[])
ret = nx_requestbkgd(g_nximage.hnx, &g_nximagecb, NULL); ret = nx_requestbkgd(g_nximage.hnx, &g_nximagecb, NULL);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nximage_main: nx_setbgcolor failed: %d\n", errno);
g_nximage.code = NXEXIT_NXREQUESTBKGD; g_nximage.code = NXEXIT_NXREQUESTBKGD;
goto errout_with_nx; goto errout_with_nx;
} }
@ -269,7 +261,7 @@ int MAIN_NAME(int argc, char *argv[])
{ {
(void)sem_wait(&g_nximage.sem); (void)sem_wait(&g_nximage.sem);
} }
message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_nximage.xres, g_nximage.yres); message("nximage_main: Screen resolution (%d,%d)\n", g_nximage.xres, g_nximage.yres);
/* Now, put up the NuttX logo. */ /* Now, put up the NuttX logo. */
@ -282,7 +274,7 @@ int MAIN_NAME(int argc, char *argv[])
/* Close NX */ /* Close NX */
errout_with_nx: errout_with_nx:
message(MAIN_NAME_STRING ": Close NX\n"); message("nximage_main: Close NX\n");
nx_close(g_nximage.hnx); nx_close(g_nximage.hnx);
errout: errout:
return g_nximage.code; return g_nximage.code;

View File

@ -199,18 +199,10 @@ static inline int nxlines_initialize(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/nxlines_main * Name: nxlines_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_NXLINES_BUILTIN int nxlines_main(int argc, char *argv[])
# define MAIN_NAME nxlines_main
# define MAIN_NAME_STRING "nxlines_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
nxgl_mxpixel_t color; nxgl_mxpixel_t color;
int ret; int ret;
@ -218,24 +210,24 @@ int MAIN_NAME(int argc, char *argv[])
/* Initialize NX */ /* Initialize NX */
ret = nxlines_initialize(); ret = nxlines_initialize();
message(MAIN_NAME_STRING ": NX handle=%p\n", g_nxlines.hnx); message("nxlines_main: NX handle=%p\n", g_nxlines.hnx);
if (!g_nxlines.hnx || ret < 0) if (!g_nxlines.hnx || ret < 0)
{ {
message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); message("nxlines_main: Failed to get NX handle: %d\n", errno);
g_nxlines.code = NXEXIT_NXOPEN; g_nxlines.code = NXEXIT_NXOPEN;
goto errout; goto errout;
} }
/* Set the background to the configured background color */ /* Set the background to the configured background color */
message(MAIN_NAME_STRING ": Set background color=%d\n", message("nxlines_main: Set background color=%d\n",
CONFIG_EXAMPLES_NXLINES_BGCOLOR); CONFIG_EXAMPLES_NXLINES_BGCOLOR);
color = CONFIG_EXAMPLES_NXLINES_BGCOLOR; color = CONFIG_EXAMPLES_NXLINES_BGCOLOR;
ret = nx_setbgcolor(g_nxlines.hnx, &color); ret = nx_setbgcolor(g_nxlines.hnx, &color);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nxlines_main: nx_setbgcolor failed: %d\n", errno);
g_nxlines.code = NXEXIT_NXSETBGCOLOR; g_nxlines.code = NXEXIT_NXSETBGCOLOR;
goto errout_with_nx; goto errout_with_nx;
} }
@ -245,7 +237,7 @@ int MAIN_NAME(int argc, char *argv[])
ret = nx_requestbkgd(g_nxlines.hnx, &g_nxlinescb, NULL); ret = nx_requestbkgd(g_nxlines.hnx, &g_nxlinescb, NULL);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nxlines_main: nx_setbgcolor failed: %d\n", errno);
g_nxlines.code = NXEXIT_NXREQUESTBKGD; g_nxlines.code = NXEXIT_NXREQUESTBKGD;
goto errout_with_nx; goto errout_with_nx;
} }
@ -258,7 +250,7 @@ int MAIN_NAME(int argc, char *argv[])
{ {
(void)sem_wait(&g_nxlines.sem); (void)sem_wait(&g_nxlines.sem);
} }
message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_nxlines.xres, g_nxlines.yres); message("nxlines_main: Screen resolution (%d,%d)\n", g_nxlines.xres, g_nxlines.yres);
/* Now, say perform the lines (these test does not return so the remaining /* Now, say perform the lines (these test does not return so the remaining
* logic is cosmetic). * logic is cosmetic).
@ -273,7 +265,7 @@ int MAIN_NAME(int argc, char *argv[])
/* Close NX */ /* Close NX */
errout_with_nx: errout_with_nx:
message(MAIN_NAME_STRING ": Close NX\n"); message("nxlines_main: Close NX\n");
nx_close(g_nxlines.hnx); nx_close(g_nxlines.hnx);
errout: errout:
return g_nxlines.code; return g_nxlines.code;

View File

@ -345,18 +345,10 @@ static int nxtext_initialize(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/nxtext_main * Name: nxtext_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_NXTEXT_BUILTIN int nxtext_main(int argc, char **argv)
# define MAIN_NAME nxtext_main
# define MAIN_NAME_STRING "nxtext_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
int MAIN_NAME(int argc, char **argv)
{ {
FAR struct nxtext_state_s *bgstate; FAR struct nxtext_state_s *bgstate;
NXWINDOW hwnd = NULL; NXWINDOW hwnd = NULL;
@ -368,10 +360,10 @@ int MAIN_NAME(int argc, char **argv)
/* Initialize NX */ /* Initialize NX */
ret = nxtext_initialize(); ret = nxtext_initialize();
message(MAIN_NAME_STRING ": NX handle=%p\n", g_hnx); message("nxtext_main: NX handle=%p\n", g_hnx);
if (!g_hnx || ret < 0) if (!g_hnx || ret < 0)
{ {
message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); message("nxtext_main: Failed to get NX handle: %d\n", errno);
g_exitcode = NXEXIT_NXOPEN; g_exitcode = NXEXIT_NXOPEN;
goto errout; goto errout;
} }
@ -381,7 +373,7 @@ int MAIN_NAME(int argc, char **argv)
g_bghfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_BGFONTID); g_bghfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_BGFONTID);
if (!g_bghfont) if (!g_bghfont)
{ {
message(MAIN_NAME_STRING ": Failed to get background font handle: %d\n", errno); message("nxtext_main: Failed to get background font handle: %d\n", errno);
g_exitcode = NXEXIT_FONTOPEN; g_exitcode = NXEXIT_FONTOPEN;
goto errout; goto errout;
} }
@ -389,19 +381,19 @@ int MAIN_NAME(int argc, char **argv)
g_puhfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_PUFONTID); g_puhfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_PUFONTID);
if (!g_puhfont) if (!g_puhfont)
{ {
message(MAIN_NAME_STRING ": Failed to get pop-up font handle: %d\n", errno); message("nxtext_main: Failed to get pop-up font handle: %d\n", errno);
g_exitcode = NXEXIT_FONTOPEN; g_exitcode = NXEXIT_FONTOPEN;
goto errout; goto errout;
} }
/* Set the background to the configured background color */ /* Set the background to the configured background color */
message(MAIN_NAME_STRING ": Set background color=%d\n", CONFIG_EXAMPLES_NXTEXT_BGCOLOR); message("nxtext_main: Set background color=%d\n", CONFIG_EXAMPLES_NXTEXT_BGCOLOR);
color = CONFIG_EXAMPLES_NXTEXT_BGCOLOR; color = CONFIG_EXAMPLES_NXTEXT_BGCOLOR;
ret = nx_setbgcolor(g_hnx, &color); ret = nx_setbgcolor(g_hnx, &color);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nxtext_main: nx_setbgcolor failed: %d\n", errno);
g_exitcode = NXEXIT_NXSETBGCOLOR; g_exitcode = NXEXIT_NXSETBGCOLOR;
goto errout_with_nx; goto errout_with_nx;
} }
@ -412,7 +404,7 @@ int MAIN_NAME(int argc, char **argv)
ret = nx_requestbkgd(g_hnx, &g_nxtextcb, bgstate); ret = nx_requestbkgd(g_hnx, &g_nxtextcb, bgstate);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); message("nxtext_main: nx_setbgcolor failed: %d\n", errno);
g_exitcode = NXEXIT_NXREQUESTBKGD; g_exitcode = NXEXIT_NXREQUESTBKGD;
goto errout_with_nx; goto errout_with_nx;
} }
@ -425,7 +417,7 @@ int MAIN_NAME(int argc, char **argv)
{ {
(void)sem_wait(&g_semevent); (void)sem_wait(&g_semevent);
} }
message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_xres, g_yres); message("nxtext_main: Screen resolution (%d,%d)\n", g_xres, g_yres);
/* Now loop, adding text to the background and periodically presenting /* Now loop, adding text to the background and periodically presenting
* a pop-up window. * a pop-up window.
@ -453,11 +445,11 @@ int MAIN_NAME(int argc, char **argv)
/* Give keyboard input to the top window (which should be the pop-up) */ /* Give keyboard input to the top window (which should be the pop-up) */
#ifdef CONFIG_NX_KBD #ifdef CONFIG_NX_KBD
message(MAIN_NAME_STRING ": Send keyboard input: %s\n", g_pumsg); message("nxtext_main: Send keyboard input: %s\n", g_pumsg);
ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_pumsg), g_pumsg); ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_pumsg), g_pumsg);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": nx_kbdin failed: %d\n", errno); message("nxtext_main: nx_kbdin failed: %d\n", errno);
goto errout_with_hwnd; goto errout_with_hwnd;
} }
#endif #endif
@ -466,7 +458,7 @@ int MAIN_NAME(int argc, char **argv)
{ {
/* Destroy the pop-up window and restart the sequence */ /* Destroy the pop-up window and restart the sequence */
message(MAIN_NAME_STRING ": Close pop-up\n"); message("nxtext_main: Close pop-up\n");
(void)nxpu_close(hwnd); (void)nxpu_close(hwnd);
popcnt = 0; popcnt = 0;
} }
@ -488,7 +480,7 @@ int MAIN_NAME(int argc, char **argv)
errout_with_hwnd: errout_with_hwnd:
if (popcnt >= 3) if (popcnt >= 3)
{ {
message(MAIN_NAME_STRING ": Close pop-up\n"); message("nxtext_main: Close pop-up\n");
(void)nxpu_close(hwnd); (void)nxpu_close(hwnd);
} }
@ -499,12 +491,12 @@ errout_with_nx:
#ifdef CONFIG_NX_MULTIUSER #ifdef CONFIG_NX_MULTIUSER
/* Disconnect from the server */ /* Disconnect from the server */
message(MAIN_NAME_STRING ": Disconnect from the server\n"); message("nxtext_main: Disconnect from the server\n");
nx_disconnect(g_hnx); nx_disconnect(g_hnx);
#else #else
/* Close the server */ /* Close the server */
message(MAIN_NAME_STRING ": Close NX\n"); message("nxtext_main: Close NX\n");
nx_close(g_hnx); nx_close(g_hnx);
#endif #endif
errout: errout:

View File

@ -409,7 +409,7 @@ static int user_main(int argc, char *argv[])
check_test_memory_usage(); check_test_memory_usage();
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */ #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 * user_main exits. These should not be identical, but should
* be similar enough that we can detect any serious OS memory * be similar enough that we can detect any serious OS memory
* leaks. * leaks.
@ -458,18 +458,10 @@ static void stdio_test(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start/ostest_main * ostest_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_OSTEST_BUILTIN int ostest_main(int argc, char *argv[])
# 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 result; int result;
@ -492,19 +484,19 @@ int MAIN_NAME(int argc, char *argv[])
/* Set up some environment variables */ /* Set up some environment variables */
#ifndef CONFIG_DISABLE_ENVIRON #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 */ 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 */ 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 */ 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 */ 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 */ 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 */ setenv(g_var3_name, g_bad_value2, FALSE); /* Variable3=GoodValue3 */
show_environment(true, true, true); show_environment(true, true, true);
#endif #endif
@ -518,13 +510,13 @@ int MAIN_NAME(int argc, char *argv[])
#endif #endif
if (result == ERROR) if (result == ERROR)
{ {
printf(MAIN_STRING "ERROR Failed to start user_main\n"); printf("ostest_main: ERROR Failed to start user_main\n");
} }
else 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; return 0;
} }

View File

@ -99,10 +99,10 @@ static void prun(FAR struct pexec_s *st)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * pashello_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, FAR char *argv[]) int pashello_main(int argc, FAR char *argv[])
{ {
FAR struct pexec_s *st; FAR struct pexec_s *st;
@ -115,11 +115,11 @@ int user_start(int argc, FAR char *argv[])
st = pload("/dev/hello", CONFIG_PASHELLO_VARSTACKSIZE, CONFIG_PASHELLO_STRSTACKSIZE); st = pload("/dev/hello", CONFIG_PASHELLO_VARSTACKSIZE, CONFIG_PASHELLO_STRSTACKSIZE);
if (!st) if (!st)
{ {
fprintf(stderr, "user_start: ERROR: Could not load /dev/hello\n"); fprintf(stderr, "pashello_main: ERROR: Could not load /dev/hello\n");
exit(1); exit(1);
} }
printf("user_start: /dev/hello Loaded\n"); printf("pashello_main: /dev/hello Loaded\n");
printf("user_start: Interpreter started:\n"); printf("pashello_main: Interpreter started:\n");
/* And start program execution */ /* And start program execution */
@ -127,7 +127,7 @@ int user_start(int argc, FAR char *argv[])
/* Clean up resources used by the interpreter */ /* Clean up resources used by the interpreter */
printf("user_start: Interpreter terminated"); printf("pashello_main: Interpreter terminated");
pexec_release(st); pexec_release(st);
return 0; return 0;
} }

View File

@ -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 filedes[2];
int ret; int ret;
/* Test FIFO logic */ /* Test FIFO logic */
printf("\nuser_start: Performing FIFO test\n"); printf("\npipe_main: Performing FIFO test\n");
ret = mkfifo(FIFO_PATH1, 0666); ret = mkfifo(FIFO_PATH1, 0666);
if (ret < 0) 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; return 1;
} }
@ -96,7 +96,7 @@ int user_start(int argc, char *argv[])
filedes[1] = open(FIFO_PATH1, O_WRONLY); filedes[1] = open(FIFO_PATH1, O_WRONLY);
if (filedes[1] < 0) 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); FIFO_PATH1, errno);
return 2; return 2;
} }
@ -104,11 +104,11 @@ int user_start(int argc, char *argv[])
filedes[0] = open(FIFO_PATH1, O_RDONLY); filedes[0] = open(FIFO_PATH1, O_RDONLY);
if (filedes[0] < 0) 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); FIFO_PATH1, errno);
if (close(filedes[1]) != 0) 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; return 3;
} }
@ -118,28 +118,28 @@ int user_start(int argc, char *argv[])
ret = transfer_test(filedes[0], filedes[1]); ret = transfer_test(filedes[0], filedes[1]);
if (close(filedes[0]) != 0) 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) 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 */ /* unlink(FIFO_PATH1); fails */
if (ret != 0) 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; return 4;
} }
printf("user_start: FIFO test PASSED\n"); printf("pipe_main: FIFO test PASSED\n");
/* Test PIPE logic */ /* Test PIPE logic */
printf("\nuser_start: Performing pipe test\n"); printf("\npipe_main: Performing pipe test\n");
ret = pipe(filedes); ret = pipe(filedes);
if (ret < 0) 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; return 5;
} }
@ -148,41 +148,41 @@ int user_start(int argc, char *argv[])
ret = transfer_test(filedes[0], filedes[1]); ret = transfer_test(filedes[0], filedes[1]);
if (close(filedes[0]) != 0) 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) 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) 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; return 6;
} }
printf("user_start: PIPE test PASSED\n"); printf("pipe_main: PIPE test PASSED\n");
/* Perform the FIFO interlock test */ /* Perform the FIFO interlock test */
printf("\nuser_start: Performing pipe interlock test\n"); printf("\npipe_main: Performing pipe interlock test\n");
ret = interlock_test(); ret = interlock_test();
if (ret != 0) 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; return 7;
} }
printf("user_start: PIPE interlock test PASSED\n"); printf("pipe_main: PIPE interlock test PASSED\n");
/* Perform the pipe redirection test */ /* Perform the pipe redirection test */
printf("\nuser_start: Performing redirection test\n"); printf("\npipe_main: Performing redirection test\n");
ret = redirection_test(); ret = redirection_test();
if (ret != 0) 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; return 7;
} }
printf("user_start: PIPE redirection test PASSED\n"); printf("pipe_main: PIPE redirection test PASSED\n");
fflush(stdout); fflush(stdout);
return 0; return 0;

View File

@ -301,16 +301,16 @@ int redirection_test(void)
if (close(filedes[0]) != 0) 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) 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) 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; return 6;
} }

View File

@ -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]; char buffer[64];
ssize_t nbytes; ssize_t nbytes;
@ -94,20 +94,20 @@ int user_start(int argc, char *argv[])
/* Open FIFOs */ /* 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); ret = mkfifo(FIFO_PATH1, 0666);
if (ret < 0) if (ret < 0)
{ {
message("user_start: mkfifo failed: %d\n", errno); message("poll_main: mkfifo failed: %d\n", errno);
exitcode = 1; exitcode = 1;
goto errout; 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); ret = mkfifo(FIFO_PATH2, 0666);
if (ret < 0) if (ret < 0)
{ {
message("user_start: mkfifo failed: %d\n", errno); message("poll_main: mkfifo failed: %d\n", errno);
exitcode = 2; exitcode = 2;
goto errout; goto errout;
} }
@ -117,7 +117,7 @@ int user_start(int argc, char *argv[])
fd1 = open(FIFO_PATH1, O_WRONLY); fd1 = open(FIFO_PATH1, O_WRONLY);
if (fd1 < 0) 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); FIFO_PATH1, errno);
exitcode = 3; exitcode = 3;
goto errout; goto errout;
@ -126,7 +126,7 @@ int user_start(int argc, char *argv[])
fd2 = open(FIFO_PATH2, O_WRONLY); fd2 = open(FIFO_PATH2, O_WRONLY);
if (fd2 < 0) 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); FIFO_PATH2, errno);
exitcode = 4; exitcode = 4;
goto errout; goto errout;
@ -134,39 +134,39 @@ int user_start(int argc, char *argv[])
/* Start the listeners */ /* 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); ret = pthread_create(&tid1, NULL, poll_listener, NULL);
if (ret != 0) 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; exitcode = 5;
goto errout; 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); ret = pthread_create(&tid2, NULL, select_listener, NULL);
if (ret != 0) 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; exitcode = 6;
goto errout; goto errout;
} }
#ifdef HAVE_NETPOLL #ifdef HAVE_NETPOLL
#ifdef CONFIG_NET_TCPBACKLOG #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); ret = pthread_create(&tid3, NULL, net_listener, NULL);
#else #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); ret = pthread_create(&tid3, NULL, net_reader, NULL);
#endif #endif
if (ret != 0) 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 #endif
@ -182,7 +182,7 @@ int user_start(int argc, char *argv[])
nbytes = write(fd1, buffer, strlen(buffer)); nbytes = write(fd1, buffer, strlen(buffer));
if (nbytes < 0) 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; exitcode = 7;
goto errout; goto errout;
} }
@ -190,12 +190,12 @@ int user_start(int argc, char *argv[])
nbytes = write(fd2, buffer, strlen(buffer)); nbytes = write(fd2, buffer, strlen(buffer));
if (nbytes < 0) if (nbytes < 0)
{ {
message("user_start: Write fd2 failed: %d\n", errno); message("poll_main: Write fd2 failed: %d\n", errno);
exitcode = 8; exitcode = 8;
goto errout; goto errout;
} }
message("\nuser_start: Sent '%s' (%d bytes)\n", buffer, nbytes); message("\npoll_main: Sent '%s' (%d bytes)\n", buffer, nbytes);
msgflush(); msgflush();
/* Wait awhile. This delay should be long enough that the /* Wait awhile. This delay should be long enough that the

View File

@ -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[]) int pwm_main(int argc, char *argv[])

View File

@ -59,14 +59,6 @@
* Pre-processor Definitions * 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 * 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; int32_t position;
int fd; int fd;
@ -266,11 +258,11 @@ int MAIN_NAME(int argc, char *argv[])
* this test. * this test.
*/ */
message(MAIN_STRING "Initializing external encoder(s)\n"); message("qe_main: Initializing external encoder(s)\n");
ret = qe_devinit(); ret = qe_devinit();
if (ret != OK) if (ret != OK)
{ {
message(MAIN_STRING "qe_devinit failed: %d\n", ret); message("qe_main: qe_devinit failed: %d\n", ret);
exitval = EXIT_FAILURE; exitval = EXIT_FAILURE;
goto errout; goto errout;
} }
@ -289,13 +281,13 @@ int MAIN_NAME(int argc, char *argv[])
/* Open the encoder device for reading */ /* 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); g_qeexample.devpath);
fd = open(g_qeexample.devpath, O_RDONLY); fd = open(g_qeexample.devpath, O_RDONLY);
if (fd < 0) 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; exitval = EXIT_FAILURE;
goto errout_with_dev; goto errout_with_dev;
} }
@ -304,11 +296,11 @@ int MAIN_NAME(int argc, char *argv[])
if (g_qeexample.reset) if (g_qeexample.reset)
{ {
message(MAIN_STRING "Resetting the count...\n"); message("qe_main: Resetting the count...\n");
ret = ioctl(fd, QEIOC_RESET, 0); ret = ioctl(fd, QEIOC_RESET, 0);
if (ret < 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; exitval = EXIT_FAILURE;
goto errout_with_dev; goto errout_with_dev;
} }
@ -319,10 +311,10 @@ int MAIN_NAME(int argc, char *argv[])
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS) #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++) for (nloops = 0; nloops < g_qeexample.nloops; nloops++)
#elif defined(CONFIG_EXAMPLES_QENCODER_NSAMPLES) #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++) for (nloops = 0; nloops < CONFIG_EXAMPLES_QENCODER_NSAMPLES; nloops++)
#else #else
for (;;) for (;;)
@ -339,7 +331,7 @@ int MAIN_NAME(int argc, char *argv[])
ret = ioctl(fd, QEIOC_POSITION, (unsigned long)((uintptr_t)&position)); ret = ioctl(fd, QEIOC_POSITION, (unsigned long)((uintptr_t)&position));
if (ret < 0) 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; exitval = EXIT_FAILURE;
goto errout_with_dev; goto errout_with_dev;
} }
@ -348,7 +340,7 @@ int MAIN_NAME(int argc, char *argv[])
else else
{ {
message(MAIN_STRING "%3d. %d\n", nloops+1, position); message("qe_main: %3d. %d\n", nloops+1, position);
} }
/* Delay a little bit */ /* Delay a little bit */

View File

@ -54,10 +54,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * rgmp_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int rgmp_main(int argc, char *argv[])
{ {
// TODO: add your code here // TODO: add your code here

View File

@ -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; int ret;

View File

@ -99,10 +99,10 @@ static const char g_msg_body[] = CONFIG_EXAMPLE_SENDMAIL_BODY "\r\n";
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * sendmail_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int sendmail_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLE_SENDMAIL_NOMAC) #if defined(CONFIG_EXAMPLE_SENDMAIL_NOMAC)

View File

@ -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 #ifdef CONFIG_EXAMPLES_SERLOOP_BUFIO
int ch; int ch;

View File

@ -222,14 +222,14 @@ static void shell_netinit(void)
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
int MAIN_NAME(int argc, char *argv[]) int shell_main(int argc, char *argv[])
{ {
struct telnetd_config_s config; struct telnetd_config_s config;
int ret; int ret;
/* Configure the network */ /* Configure the network */
printf(MAIN_STRING "Initializing the network\n"); printf("shell_main: Initializing the network\n");
shell_netinit(); shell_netinit();
/* Configure the telnet daemon */ /* Configure the telnet daemon */
@ -243,13 +243,13 @@ int MAIN_NAME(int argc, char *argv[])
/* Start the telnet daemon */ /* Start the telnet daemon */
printf(MAIN_STRING "Starting the Telnet daemon\n"); printf("shell_main: Starting the Telnet daemon\n");
ret = telnetd_start(&config); ret = telnetd_start(&config);
if (ret < 0) if (ret < 0)
{ {
printf("Failed to tart the Telnet daemon\n"); printf("Failed to tart the Telnet daemon\n");
} }
printf(MAIN_STRING "Exiting\n"); printf("shell_main: Exiting\n");
return 0; return 0;
} }

View File

@ -81,16 +81,6 @@
# define CONFIG_EXAMPLE_TELNETD_NETMASK 0xffffff00 # define CONFIG_EXAMPLE_TELNETD_NETMASK 0xffffff00
#endif #endif
/* Is this being built as an NSH built-in application? */
#ifdef CONFIG_NSH_BUILTIN_APPS
# define MAIN_NAME shell_main
# define MAIN_STRING "shell_main: "
#else
# define MAIN_NAME user_start
# define MAIN_STRING "user_start: "
#endif
/* Other definitions ********************************************************/ /* Other definitions ********************************************************/
#define SHELL_PROMPT "uIP 1.0> " #define SHELL_PROMPT "uIP 1.0> "

View File

@ -166,10 +166,10 @@ int g_thttpdnsymbols;
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * thttp_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int thttp_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;
#ifdef CONFIG_EXAMPLE_THTTPD_NOMAC #ifdef CONFIG_EXAMPLE_THTTPD_NOMAC

View File

@ -98,20 +98,14 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: tiff_main/user_start * Name: tiff_main
* *
* Description: * Description:
* TIFF unit test. * TIFF unit test.
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_TIFF_BUILTIN int tiff_main(int argc, char *argv[])
# define MAIN_NAME tiff_main
#else
# define MAIN_NAME user_start
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
struct tiff_info_s info; struct tiff_info_s info;
uint8_t strip[3*256]; uint8_t strip[3*256];

View File

@ -81,18 +81,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: user_start/nxhello_main * Name: tc_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN int tc_main(int argc, char *argv[])
# 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[])
{ {
struct touch_sample_s sample; struct touch_sample_s sample;
ssize_t nbytes; ssize_t nbytes;
@ -113,31 +105,31 @@ int MAIN_NAME(int argc, char *argv[])
{ {
nsamples = strtol(argv[1], NULL, 10); 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) #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 #endif
/* Initialization of the touchscreen hardware is performed by logic /* Initialization of the touchscreen hardware is performed by logic
* external to this test. * 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); ret = arch_tcinitialize(CONFIG_EXAMPLES_TOUCHSCREEN_MINOR);
if (ret != OK) if (ret != OK)
{ {
message(MAIN_STRING "arch_tcinitialize failed: %d\n", ret); message("tc_main: arch_tcinitialize failed: %d\n", ret);
errval = 1; errval = 1;
goto errout; goto errout;
} }
/* Open the touchscreen device for reading */ /* 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); fd = open(CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, O_RDONLY);
if (fd < 0) if (fd < 0)
{ {
message(MAIN_STRING "open %s failed: %d\n", message("tc_main: open %s failed: %d\n",
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errno); CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errno);
errval = 2; errval = 2;
goto errout_with_tc; goto errout_with_tc;
@ -174,17 +166,17 @@ int MAIN_NAME(int argc, char *argv[])
errval = errno; errval = errno;
if (errval != EINTR) if (errval != EINTR)
{ {
message(MAIN_STRING "read %s failed: %d\n", message("tc_main: read %s failed: %d\n",
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval);
errval = 3; errval = 3;
goto errout_with_dev; goto errout_with_dev;
} }
message(MAIN_STRING "Interrupted read...\n"); message("tc_main: Interrupted read...\n");
} }
else if (nbytes != sizeof(struct touch_sample_s)) 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)); nbytes, sizeof(struct touch_sample_s));
} }

View File

@ -59,10 +59,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * udp_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int udp_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;

View File

@ -105,10 +105,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * uip_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int uip_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_NOMAC) #if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_NOMAC)

View File

@ -198,10 +198,10 @@ static void dumptrace(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * usbserial_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int usbserial_main(int argc, char *argv[])
{ {
#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY #ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY
int infd; int infd;
@ -220,7 +220,7 @@ int user_start(int argc, char *argv[])
/* Initialize the USB serial driver */ /* Initialize the USB serial driver */
message("user_start: Registering USB serial driver\n"); message("usbserial_main: Registering USB serial driver\n");
#ifdef CONFIG_CDCACM #ifdef CONFIG_CDCACM
ret = cdcacm_initialize(0, NULL); ret = cdcacm_initialize(0, NULL);
#else #else
@ -228,10 +228,10 @@ int user_start(int argc, char *argv[])
#endif #endif
if (ret < 0) if (ret < 0)
{ {
message("user_start: ERROR: Failed to create the USB serial device: %d\n", -ret); message("usbserial_main: ERROR: Failed to create the USB serial device: %d\n", -ret);
return 1; return 1;
} }
message("user_start: Successfully registered the serial driver\n"); message("usbserial_main: Successfully registered the serial driver\n");
#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 #if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0
/* If USB tracing is enabled and tracing of initial USB events is specified, /* If USB tracing is enabled and tracing of initial USB events is specified,
@ -251,25 +251,25 @@ int user_start(int argc, char *argv[])
#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY #ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY
do do
{ {
message("user_start: Opening USB serial driver\n"); message("usbserial_main: Opening USB serial driver\n");
outfd = open(USBSER_DEVNAME, O_WRONLY); outfd = open(USBSER_DEVNAME, O_WRONLY);
if (outfd < 0) if (outfd < 0)
{ {
int errcode = errno; int errcode = errno;
message("user_start: ERROR: Failed to open " USBSER_DEVNAME " for writing: %d\n", errcode); message("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for writing: %d\n", errcode);
/* ENOTCONN means that the USB device is not yet connected */ /* ENOTCONN means that the USB device is not yet connected */
if (errcode == ENOTCONN) if (errcode == ENOTCONN)
{ {
message("user_start: Not connected. Wait and try again.\n"); message("usbserial_main: Not connected. Wait and try again.\n");
sleep(5); sleep(5);
} }
else else
{ {
/* Give up on other errors */ /* Give up on other errors */
message("user_start: Aborting\n"); message("usbserial_main: Aborting\n");
return 2; return 2;
} }
} }
@ -288,7 +288,7 @@ int user_start(int argc, char *argv[])
infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK); infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK);
if (infd < 0) if (infd < 0)
{ {
message("user_start: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno); message("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno);
close(outfd); close(outfd);
return 3; return 3;
} }
@ -299,20 +299,20 @@ int user_start(int argc, char *argv[])
if (infd < 0) if (infd < 0)
{ {
int errcode = errno; int errcode = errno;
message("user_start: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno); message("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno);
/* ENOTCONN means that the USB device is not yet connected */ /* ENOTCONN means that the USB device is not yet connected */
if (errcode == ENOTCONN) if (errcode == ENOTCONN)
{ {
message("user_start: Not connected. Wait and try again.\n"); message("usbserial_main: Not connected. Wait and try again.\n");
sleep(5); sleep(5);
} }
else else
{ {
/* Give up on other errors */ /* Give up on other errors */
message("user_start: Aborting\n"); message("usbserial_main: Aborting\n");
return 3; return 3;
} }
} }
@ -325,7 +325,7 @@ int user_start(int argc, char *argv[])
#endif #endif
#endif #endif
message("user_start: Successfully opened the serial driver\n"); message("usbserial_main: Successfully opened the serial driver\n");
/* Send messages and get responses -- forever */ /* Send messages and get responses -- forever */
@ -337,21 +337,21 @@ int user_start(int argc, char *argv[])
#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) #if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL)
if (count < 8) if (count < 8)
{ {
message("user_start: Saying hello\n"); message("usbserial_main: Saying hello\n");
nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg)); nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg));
count++; count++;
} }
else else
{ {
message("user_start: Reciting QEI's speech of 1588\n"); message("usbserial_main: Reciting QEI's speech of 1588\n");
nbytes = write(outfd, g_longmsg, sizeof(g_longmsg)); nbytes = write(outfd, g_longmsg, sizeof(g_longmsg));
count = 0; count = 0;
} }
#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) #elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL)
message("user_start: Reciting QEI's speech of 1588\n"); message("usbserial_main: Reciting QEI's speech of 1588\n");
nbytes = write(outfd, g_longmsg, sizeof(g_longmsg)); nbytes = write(outfd, g_longmsg, sizeof(g_longmsg));
#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */ #else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */
message("user_start: Saying hello\n"); message("usbserial_main: Saying hello\n");
nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg)); nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg));
#endif #endif
@ -359,14 +359,14 @@ int user_start(int argc, char *argv[])
if (nbytes < 0) if (nbytes < 0)
{ {
message("user_start: ERROR: write failed: %d\n", errno); message("usbserial_main: ERROR: write failed: %d\n", errno);
#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY #ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY
close(infd); close(infd);
#endif #endif
close(outfd); close(outfd);
return 4; return 4;
} }
message("user_start: %d bytes sent\n", nbytes); message("usbserial_main: %d bytes sent\n", nbytes);
#endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */ #endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */
/* Test OUT (host-to-device) messages */ /* Test OUT (host-to-device) messages */
@ -374,7 +374,7 @@ int user_start(int argc, char *argv[])
#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY #ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY
/* Poll for incoming messages */ /* Poll for incoming messages */
message("user_start: Polling for OUT messages\n"); message("usbserial_main: Polling for OUT messages\n");
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
memset(g_iobuffer, 'X', IOBUFFER_SIZE); memset(g_iobuffer, 'X', IOBUFFER_SIZE);
@ -384,7 +384,7 @@ int user_start(int argc, char *argv[])
int errorcode = errno; int errorcode = errno;
if (errorcode != EAGAIN) if (errorcode != EAGAIN)
{ {
message("user_start: ERROR: read failed: %d\n", errno); message("usbserial_main: ERROR: read failed: %d\n", errno);
close(infd); close(infd);
#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY #ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY
close(outfd); close(outfd);
@ -394,12 +394,12 @@ int user_start(int argc, char *argv[])
} }
else else
{ {
message("user_start: Received %d bytes:\n", nbytes); message("usbserial_main: Received %d bytes:\n", nbytes);
if (nbytes > 0) if (nbytes > 0)
{ {
for (j = 0; j < nbytes; j += 16) for (j = 0; j < nbytes; j += 16)
{ {
message("user_start: %03x: ", j); message("usbserial_main: %03x: ", j);
for (k = 0; k < 16; k++) for (k = 0; k < 16; k++)
{ {
if (k == 8) if (k == 8)
@ -445,7 +445,7 @@ int user_start(int argc, char *argv[])
sleep(1); sleep(1);
} }
#else /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ #else /* CONFIG_EXAMPLES_USBSERIAL_INONLY */
message("user_start: Waiting\n"); message("usbserial_main: Waiting\n");
sleep(5); sleep(5);
#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ #endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */

View File

@ -379,7 +379,7 @@ static int usbmsc_enumerate(struct usbtrace_s *trace, void *arg)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start/msconn_main * msconn_main
* *
* Description: * Description:
* This is the main program that configures the USB mass storage device * This is the main program that configures the USB mass storage device
@ -389,15 +389,7 @@ static int usbmsc_enumerate(struct usbtrace_s *trace, void *arg)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_USBMSC_BUILTIN int msconn_main(int argc, char *argv[])
# define MAIN_NAME msconn_main
# define MAIN_NAME_STRING "msconn"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
FAR void *handle; FAR void *handle;
int ret; int ret;
@ -414,7 +406,7 @@ int MAIN_NAME(int argc, char *argv[])
if (g_usbmsc.mshandle) if (g_usbmsc.mshandle)
{ {
message(MAIN_NAME_STRING ": ERROR: Already connected\n"); message("msconn_main: ERROR: Already connected\n");
return 1; return 1;
} }
#endif #endif
@ -436,33 +428,33 @@ int MAIN_NAME(int argc, char *argv[])
/* Register block drivers (architecture-specific) */ /* Register block drivers (architecture-specific) */
message(MAIN_NAME_STRING ": Creating block drivers\n"); message("msconn_main: Creating block drivers\n");
ret = usbmsc_archinitialize(); ret = usbmsc_archinitialize();
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": usbmsc_archinitialize failed: %d\n", -ret); message("msconn_main: usbmsc_archinitialize failed: %d\n", -ret);
return 2; return 2;
} }
check_test_memory_usage("After usbmsc_archinitialize()"); check_test_memory_usage("After usbmsc_archinitialize()");
/* Then exports the LUN(s) */ /* Then exports the LUN(s) */
message(MAIN_NAME_STRING ": Configuring with NLUNS=%d\n", CONFIG_EXAMPLES_USBMSC_NLUNS); message("msconn_main: Configuring with NLUNS=%d\n", CONFIG_EXAMPLES_USBMSC_NLUNS);
ret = usbmsc_configure(CONFIG_EXAMPLES_USBMSC_NLUNS, &handle); ret = usbmsc_configure(CONFIG_EXAMPLES_USBMSC_NLUNS, &handle);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": usbmsc_configure failed: %d\n", -ret); message("msconn_main: usbmsc_configure failed: %d\n", -ret);
usbmsc_uninitialize(handle); usbmsc_uninitialize(handle);
return 3; return 3;
} }
message(MAIN_NAME_STRING ": handle=%p\n", handle); message("msconn_main: handle=%p\n", handle);
check_test_memory_usage("After usbmsc_configure()"); check_test_memory_usage("After usbmsc_configure()");
message(MAIN_NAME_STRING ": Bind LUN=0 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH1); message("msconn_main: Bind LUN=0 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH1);
ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH1, 0, 0, 0, false); ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH1, 0, 0, 0, false);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": usbmsc_bindlun failed for LUN 1 using %s: %d\n", message("msconn_main: usbmsc_bindlun failed for LUN 1 using %s: %d\n",
CONFIG_EXAMPLES_USBMSC_DEVPATH1, -ret); CONFIG_EXAMPLES_USBMSC_DEVPATH1, -ret);
usbmsc_uninitialize(handle); usbmsc_uninitialize(handle);
return 4; return 4;
@ -471,11 +463,11 @@ int MAIN_NAME(int argc, char *argv[])
#if CONFIG_EXAMPLES_USBMSC_NLUNS > 1 #if CONFIG_EXAMPLES_USBMSC_NLUNS > 1
message(MAIN_NAME_STRING ": Bind LUN=1 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH2); message("msconn_main: Bind LUN=1 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH2);
ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH2, 1, 0, 0, false); ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH2, 1, 0, 0, false);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": usbmsc_bindlun failed for LUN 2 using %s: %d\n", message("msconn_main: usbmsc_bindlun failed for LUN 2 using %s: %d\n",
CONFIG_EXAMPLES_USBMSC_DEVPATH2, -ret); CONFIG_EXAMPLES_USBMSC_DEVPATH2, -ret);
usbmsc_uninitialize(handle); usbmsc_uninitialize(handle);
return 5; return 5;
@ -484,11 +476,11 @@ int MAIN_NAME(int argc, char *argv[])
#if CONFIG_EXAMPLES_USBMSC_NLUNS > 2 #if CONFIG_EXAMPLES_USBMSC_NLUNS > 2
message(MAIN_NAME_STRING ": Bind LUN=2 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH3); message("msconn_main: Bind LUN=2 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH3);
ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH3, 2, 0, 0, false); ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH3, 2, 0, 0, false);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": usbmsc_bindlun failed for LUN 3 using %s: %d\n", message("msconn_main: usbmsc_bindlun failed for LUN 3 using %s: %d\n",
CONFIG_EXAMPLES_USBMSC_DEVPATH3, -ret); CONFIG_EXAMPLES_USBMSC_DEVPATH3, -ret);
usbmsc_uninitialize(handle); usbmsc_uninitialize(handle);
return 6; return 6;
@ -501,7 +493,7 @@ int MAIN_NAME(int argc, char *argv[])
ret = usbmsc_exportluns(handle); ret = usbmsc_exportluns(handle);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": usbmsc_exportluns failed: %d\n", -ret); message("msconn_main: usbmsc_exportluns failed: %d\n", -ret);
usbmsc_uninitialize(handle); usbmsc_uninitialize(handle);
return 7; return 7;
} }
@ -522,17 +514,17 @@ int MAIN_NAME(int argc, char *argv[])
sleep(5); sleep(5);
# ifdef CONFIG_USBDEV_TRACE # ifdef CONFIG_USBDEV_TRACE
message("\nuser_start: USB TRACE DATA:\n"); message("\nmsconn_main: USB TRACE DATA:\n");
ret = usbtrace_enumerate(usbmsc_enumerate, NULL); ret = usbtrace_enumerate(usbmsc_enumerate, NULL);
if (ret < 0) if (ret < 0)
{ {
message(MAIN_NAME_STRING ": usbtrace_enumerate failed: %d\n", -ret); message("msconn_main: usbtrace_enumerate failed: %d\n", -ret);
usbmsc_uninitialize(handle); usbmsc_uninitialize(handle);
return 8; return 8;
} }
check_test_memory_usage("After usbtrace_enumerate()"); check_test_memory_usage("After usbtrace_enumerate()");
# else # else
message(MAIN_NAME_STRING ": Still alive\n"); message("msconn_main: Still alive\n");
# endif # endif
} }
#elif defined(CONFIG_EXAMPLES_USBMSC_BUILTIN) #elif defined(CONFIG_EXAMPLES_USBMSC_BUILTIN)
@ -541,7 +533,7 @@ int MAIN_NAME(int argc, char *argv[])
* command. * command.
*/ */
message(MAIN_NAME_STRING ": Connected\n"); message("msconn_main: Connected\n");
g_usbmsc.mshandle = handle; g_usbmsc.mshandle = handle;
check_test_memory_usage("After MS connection"); check_test_memory_usage("After MS connection");
@ -549,7 +541,7 @@ int MAIN_NAME(int argc, char *argv[])
/* Just exit */ /* Just exit */
message(MAIN_NAME_STRING ": Exiting\n"); message("msconn_main: Exiting\n");
/* Dump debug memory usage */ /* Dump debug memory usage */

View File

@ -177,22 +177,14 @@ FAR void *usbterm_listener(FAR void *parameter)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: term_main/user_start * Name: usbterm_main
* *
* Description: * Description:
* Main entry point for the USB serial terminal example. * Main entry point for the USB serial terminal example.
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_USBTERM_BUILTIN int usbterm_main(int argc, char *argv[])
# define MAIN_NAME usbterm_main
# define MAIN_STRING "usbterm_main: "
#else
# define MAIN_NAME user_start
# define MAIN_STRING "user_start: "
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
pthread_attr_t attr; pthread_attr_t attr;
int ret; int ret;
@ -206,18 +198,18 @@ int MAIN_NAME(int argc, char *argv[])
*/ */
#ifdef CONFIG_EXAMPLES_USBTERM_DEVINIT #ifdef CONFIG_EXAMPLES_USBTERM_DEVINIT
message(MAIN_STRING "Performing external device initialization\n"); message("usbterm_main: Performing external device initialization\n");
ret = usbterm_devinit(); ret = usbterm_devinit();
if (ret != OK) if (ret != OK)
{ {
message(MAIN_STRING "usbterm_devinit failed: %d\n", ret); message("usbterm_main: usbterm_devinit failed: %d\n", ret);
goto errout; goto errout;
} }
#endif #endif
/* Initialize the USB serial driver */ /* Initialize the USB serial driver */
message(MAIN_STRING "Registering USB serial driver\n"); message("usbterm_main: Registering USB serial driver\n");
#ifdef CONFIG_CDCACM #ifdef CONFIG_CDCACM
ret = cdcacm_initialize(0, NULL); ret = cdcacm_initialize(0, NULL);
#else #else
@ -225,10 +217,10 @@ int MAIN_NAME(int argc, char *argv[])
#endif #endif
if (ret < 0) if (ret < 0)
{ {
message(MAIN_STRING "ERROR: Failed to create the USB serial device: %d\n", -ret); message("usbterm_main: ERROR: Failed to create the USB serial device: %d\n", -ret);
goto errout_with_devinit; goto errout_with_devinit;
} }
message(MAIN_STRING "Successfully registered the serial driver\n"); message("usbterm_main: Successfully registered the serial driver\n");
#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 #if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0
/* If USB tracing is enabled and tracing of initial USB events is specified, /* If USB tracing is enabled and tracing of initial USB events is specified,
@ -247,20 +239,20 @@ int MAIN_NAME(int argc, char *argv[])
do do
{ {
message(MAIN_STRING "Opening USB serial driver\n"); message("usbterm_main: Opening USB serial driver\n");
g_usbterm.outstream = fopen(USBTERM_DEVNAME, "w"); g_usbterm.outstream = fopen(USBTERM_DEVNAME, "w");
if (g_usbterm.outstream == NULL) if (g_usbterm.outstream == NULL)
{ {
int errcode = errno; int errcode = errno;
message(MAIN_STRING "ERROR: Failed to open " USBTERM_DEVNAME " for writing: %d\n", message("usbterm_main: ERROR: Failed to open " USBTERM_DEVNAME " for writing: %d\n",
errcode); errcode);
/* ENOTCONN means that the USB device is not yet connected */ /* ENOTCONN means that the USB device is not yet connected */
if (errcode == ENOTCONN) if (errcode == ENOTCONN)
{ {
message(MAIN_STRING " Not connected. Wait and try again.\n"); message("usbterm_main: Not connected. Wait and try again.\n");
sleep(5); sleep(5);
} }
else else
@ -284,20 +276,20 @@ int MAIN_NAME(int argc, char *argv[])
g_usbterm.instream = fopen(USBTERM_DEVNAME, "r"); g_usbterm.instream = fopen(USBTERM_DEVNAME, "r");
if (g_usbterm.instream == NULL) if (g_usbterm.instream == NULL)
{ {
message(MAIN_STRING "ERROR: Failed to open " USBTERM_DEVNAME " for reading: %d\n", errno); message("usbterm_main: ERROR: Failed to open " USBTERM_DEVNAME " for reading: %d\n", errno);
goto errout_with_outstream; goto errout_with_outstream;
} }
message(MAIN_STRING "Successfully opened the serial driver\n"); message("usbterm_main: Successfully opened the serial driver\n");
/* Start the USB term listener thread */ /* Start the USB term listener thread */
message(MAIN_STRING "Starting the listener thread\n"); message("usbterm_main: Starting the listener thread\n");
ret = pthread_attr_init(&attr); ret = pthread_attr_init(&attr);
if (ret != OK) if (ret != OK)
{ {
message(MAIN_STRING "pthread_attr_init failed: %d\n", ret); message("usbterm_main: pthread_attr_init failed: %d\n", ret);
goto errout_with_streams; goto errout_with_streams;
} }
@ -305,13 +297,13 @@ int MAIN_NAME(int argc, char *argv[])
usbterm_listener, (pthread_addr_t)0); usbterm_listener, (pthread_addr_t)0);
if (ret != 0) if (ret != 0)
{ {
message(MAIN_STRING "Error in thread creation: %d\n", ret); message("usbterm_main: Error in thread creation: %d\n", ret);
goto errout_with_streams; goto errout_with_streams;
} }
/* Send messages and get responses -- forever */ /* Send messages and get responses -- forever */
message(MAIN_STRING "Waiting for local input\n"); message("usbterm_main: Waiting for local input\n");
for (;;) for (;;)
{ {
/* Display the prompt string on stdout */ /* Display the prompt string on stdout */
@ -378,7 +370,7 @@ errout_with_devinit:
usbterm_devuninit(); usbterm_devuninit();
errout: errout:
#endif #endif
message(MAIN_STRING " Aborting\n"); message("usbterm_main: Aborting\n");
return 1; return 1;
} }

View File

@ -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[]) int wdog_main(int argc, char *argv[])

View File

@ -106,10 +106,10 @@ static void callback(FAR char **buffer, int offset, int datend,
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* user_start * wget_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int wget_main(int argc, char *argv[])
{ {
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLE_WGET_NOMAC) #if defined(CONFIG_EXAMPLE_WGET_NOMAC)

View File

@ -258,32 +258,32 @@ static int wlan_waiter(int argc, char *argv[])
} }
/**************************************************************************** /****************************************************************************
* Name: user_start * Name: wlan_main
****************************************************************************/ ****************************************************************************/
int user_start(int argc, char *argv[]) int wlan_main(int argc, char *argv[])
{ {
pid_t pid; pid_t pid;
int ret; int ret;
/* First, register all of the USB host Wireless LAN drivers */ /* First, register all of the USB host Wireless LAN drivers */
printf("user_start: Register drivers\n"); printf("wlan_main: Register drivers\n");
ret = usbhost_wlaninit(); ret = usbhost_wlaninit();
if (ret != OK) if (ret != OK)
{ {
printf("user_start: Failed to register the WLAN driver\n"); printf("wlan_main: Failed to register the WLAN driver\n");
} }
/* Then get an instance of the USB host interface */ /* Then get an instance of the USB host interface */
printf("user_start: Initialize USB host WLAN driver\n"); printf("wlan_main: Initialize USB host WLAN driver\n");
g_drvr = usbhost_initialize(0); g_drvr = usbhost_initialize(0);
if (g_drvr) if (g_drvr)
{ {
/* Start a thread to handle device connection. */ /* Start a thread to handle device connection. */
printf("user_start: Start wlan_waiter\n"); printf("wlan_main: Start wlan_waiter\n");
#ifndef CONFIG_CUSTOM_STACK #ifndef CONFIG_CUSTOM_STACK
pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO, pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO,

View File

@ -58,7 +58,7 @@ pcode
Pascal P-Code at runtime. To use this example, place the following in Pascal P-Code at runtime. To use this example, place the following in
your appconfig file" your appconfig file"
# Path to example in apps/examples containing the user_start entry point # Path to example in apps/examples containing the passhello_main entry point
CONFIGURED_APPS += examples/pashello CONFIGURED_APPS += examples/pashello

View File

@ -351,15 +351,7 @@ static void i2c_teardown(FAR struct i2ctool_s *i2ctool)
* Name: i2c_main * Name: i2c_main
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_I2CTOOL_BUILTIN int i2c_main(int argc, char *argv[])
# define MAIN_NAME i2c_main
# define MAIN_NAME_STRING "i2c_main"
#else
# define MAIN_NAME user_start
# define MAIN_NAME_STRING "user_start"
#endif
int MAIN_NAME(int argc, char *argv[])
{ {
/* Verify settings */ /* Verify settings */

View File

@ -3221,3 +3221,7 @@
common configurations and in configs/*/README.txt for board and MCU_ common configurations and in configs/*/README.txt for board and MCU_
specific configurations. specific configurations.
* configs/stm3240g-eval: Add USB host support. * configs/stm3240g-eval: Add USB host support.
* sched/os_bring.c, configs/*/defconfig, tools/mkconfig.c, and others: Added
configuration variable CONFIG_USER_ENTRYPOINT that may be used to change
the default entry from user_start to some other symbol. Contributed by
Kate.

View File

@ -3066,7 +3066,7 @@ Builtin Apps:
<p> <p>
<code><b>apps/examples/hello</code></b>. <code><b>apps/examples/hello</code></b>.
The main routine for apps/examples/hello can be found in <code>apps/examples/hello/main.c</code>. The main routine for apps/examples/hello can be found in <code>apps/examples/hello/main.c</code>.
When <code>CONFIG_EXAMPLES_HELLO_BUILTIN</code> is defined, this main routine simplifies to: The main routine is:
</p> </p>
<ul><pre> <ul><pre>
int hello_main(int argc, char *argv[]) int hello_main(int argc, char *argv[])
@ -3165,10 +3165,8 @@ STACKSIZE = 2048
</p> </p>
<ul><pre> <ul><pre>
.context: .context:
ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y)
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
@touch $@ @touch $@
endif
</pre></ul> </pre></ul>
</ol> </ol>
@ -3189,7 +3187,7 @@ endif
CONFIG_BUILTIN_APP_START=&lt;application name&gt; CONFIG_BUILTIN_APP_START=&lt;application name&gt;
</pre></ul> </pre></ul>
<p> <p>
that application will be invoked immediately after system starts instead of the normal, default <code>user_start()</code> entry point. that application will be invoked immediately after system starts instead of the default <code>CONFIG_USER_ENTRYPOINT</code>() entry point.
Note that <code>&lt;application name&gt;</code> must be provided just as it would have been on the NSH command line. Note that <code>&lt;application name&gt;</code> must be provided just as it would have been on the NSH command line.
For example, <code>hello</code> would result in <code>hello_main()</code> being started at power-up. For example, <code>hello</code> would result in <code>hello_main()</code> being started at power-up.
</p> </p>
@ -3276,8 +3274,8 @@ CONFIGURED_APPS += examples/hello
<p> <p>
You replace the sample code at <code>apps/examples/nsh/nsh_main.c</code> with whatever start-up logic that you want. You replace the sample code at <code>apps/examples/nsh/nsh_main.c</code> with whatever start-up logic that you want.
NSH is a library at <code>apps/nshlib</code>. NSH is a library at <code>apps/nshlib</code>.
<code>apps.examplex/nsh</code> is just a tiny, example start-up function (<code>user_start()</code>) that that runs immediately and illustrates how to start NSH <code>apps.examplex/nsh</code> is just a tiny, example start-up function (<code>CONFIG_USER_ENTRYPOINT</code>()) that that runs immediately and illustrates how to start NSH
If you want something else to run immediately then you can write your write your own custom <code>user_start()</code> function and then start other tasks from your custom <code>user_start()</code>. If you want something else to run immediately then you can write your write your own custom <code>CONFIG_USER_ENTRYPOINT</code>() function and then start other tasks from your custom <code>CONFIG_USER_ENTRYPOINT</code>().
</p> </p>
<li> <li>
<p> <p>

View File

@ -4085,6 +4085,14 @@ build
<code>CONFIG_SCHED_ONEXIT_MAX</code>: By default if <code>CONFIG_SCHED_ONEXIT</code> is selected, only a single <code>on_exit()</code> function is supported. <code>CONFIG_SCHED_ONEXIT_MAX</code>: By default if <code>CONFIG_SCHED_ONEXIT</code> is selected, only a single <code>on_exit()</code> function is supported.
That number can be increased by defined this setting to the number that you require. That number can be increased by defined this setting to the number that you require.
</li> </li>
<li>
<code>CONFIG_USER_ENTRYPOINT</code>: The name of the entry point for user
applications.
For the example applications this is of the form <code>app_main</code>
where <code>app</code> is the application name.
If not defined, <code>CONFIG_USER_ENTRYPOINT</code> defaults to
<code>user_start</code>.
</li>
</ul> </ul>
<p> <p>
@ -5792,13 +5800,14 @@ build
<li> <li>
<code>CONFIG_IDLETHREAD_STACKSIZE</code>: The size of the initial stack. <code>CONFIG_IDLETHREAD_STACKSIZE</code>: The size of the initial stack.
This is the thread that (1) performs the initial boot of the system up This is the thread that (1) performs the initial boot of the system up
to the point where user_start() is spawned, and (2) there after is the to the point where <code>CONFIG_USER_ENTRYPOINT</code>() is spawned,
IDLE thread that executes only when there is no other thread ready to and (2) there after is the IDLE thread that executes only when there
run. is no other thread ready to run.
</li> </li>
<li> <li>
<code>CONFIG_USERMAIN_STACKSIZE</code>: The size of the stack to allocate <code>CONFIG_USERMAIN_STACKSIZE</code>: The size of the stack to allocate
for the main user thread that begins at the user_start() entry point. for the main user thread that begins at the <code>CONFIG_USER_ENTRYPOINT</code>()
entry point.
</li> </li>
<li> <li>
<code>CONFIG_PTHREAD_STACK_MIN</code>: Minimum pthread stack size <code>CONFIG_PTHREAD_STACK_MIN</code>: Minimum pthread stack size

View File

@ -150,7 +150,7 @@
</tr> </tr>
<tr> <tr>
<td align="center">&nbsp;</td> <td align="center">&nbsp;</td>
<td align="left"><code>user_start: Registering USB serial driver</code></td> <td align="left"><code>usbserial_main: Registering USB serial driver</code></td>
</tr> </tr>
<tr> <tr>
<td align="center">&nbsp;</td> <td align="center">&nbsp;</td>
@ -158,7 +158,7 @@
</tr> </tr>
<tr> <tr>
<td align="center">&nbsp;</td> <td align="center">&nbsp;</td>
<td align="left"><code>user_start: Successfully registered the serial driver</code></td> <td align="left"><code>usbserial_main: Successfully registered the serial driver</code></td>
</tr> </tr>
<tr> <tr>
<td align="center">1</td> <td align="center">1</td>
@ -170,11 +170,11 @@
</tr> </tr>
<tr> <tr>
<td align="center">&nbsp;</td> <td align="center">&nbsp;</td>
<td align="left"><code>user_start: ERROR: Failed to open /dev/ttyUSB0 for reading: 107</code></td> <td align="left"><code>usbserial_main: ERROR: Failed to open /dev/ttyUSB0 for reading: 107</code></td>
</tr> </tr>
<tr> <tr>
<td align="center">&nbsp;</td> <td align="center">&nbsp;</td>
<td align="left"><code>user_start: Not connected. Wait and try again.</code></td> <td align="left"><code>usbserial_main: Not connected. Wait and try again.</code></td>
</tr> </tr>
<tr> <tr>
<td align="center">3</td> <td align="center">3</td>

View File

@ -268,6 +268,7 @@ defconfig -- This is a configuration file similar to the Linux
by default) by default)
CONFIG_DEBUG_GRAPHICS - enable NX graphics debug output CONFIG_DEBUG_GRAPHICS - enable NX graphics debug output
(disabled by default) (disabled by default)
CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
time console output time console output
CONFIG_MM_REGIONS - If the architecture includes multiple CONFIG_MM_REGIONS - If the architecture includes multiple
@ -375,6 +376,10 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_SCHED_ONEXIT_MAX - By default if CONFIG_SCHED_ONEXIT is selected, CONFIG_SCHED_ONEXIT_MAX - By default if CONFIG_SCHED_ONEXIT is selected,
only a single on_exit() function is supported. That number can be only a single on_exit() function is supported. That number can be
increased by defined this setting to the number that you require. increased by defined this setting to the number that you require.
CONFIG_USER_ENTRYPOINT - The name of the entry point for user
applications. For the example applications this is of the form 'app_main'
where 'app' is the application name. If not defined, CONFIG_USER_ENTRYPOINT
defaults to user_start.
System Logging: System Logging:
CONFIG_SYSLOG enables general system logging support. CONFIG_SYSLOG enables general system logging support.

View File

@ -115,6 +115,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="hello_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -141,6 +141,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -141,6 +141,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -91,6 +91,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="uip_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -91,6 +91,7 @@ CONFIG_NET_C5471_BASET10=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nettest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -91,6 +91,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -91,6 +91,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -93,6 +93,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -96,6 +96,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -96,6 +96,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_GRAPHICS=n CONFIG_DEBUG_GRAPHICS=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n

View File

@ -115,6 +115,7 @@ CONFIG_PASS1_OBJECT=
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -113,6 +113,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -113,6 +113,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -126,6 +126,7 @@ CONFIG_PASS1_OBJECT=locked.r
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -113,6 +113,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="usbserial_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_FS=n CONFIG_DEBUG_FS=n

View File

@ -113,6 +113,8 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="msconn_main"
#CONFIG_USER_ENTRYPOINT="msdis_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_FS=n CONFIG_DEBUG_FS=n

View File

@ -113,6 +113,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -120,6 +120,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="uip_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -120,6 +120,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nettest_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -120,6 +120,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -120,6 +120,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nxflat_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -120,6 +120,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -120,6 +120,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="thttp_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -137,6 +137,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -137,6 +137,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -99,6 +99,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -102,6 +102,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="dhcpd_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -102,6 +102,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="uip_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -102,6 +102,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nettest_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -102,6 +102,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -101,6 +101,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -102,6 +102,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="poll_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -175,6 +175,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="buttons_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -173,6 +173,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

View File

@ -180,6 +180,7 @@ CONFIG_RTC=y
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DEBUG=y CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=y CONFIG_DEBUG_VERBOSE=y
CONFIG_DEBUG_GRAPHICS=y CONFIG_DEBUG_GRAPHICS=y

View File

@ -173,6 +173,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nx_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_GRAPHICS=n CONFIG_DEBUG_GRAPHICS=n

View File

@ -177,6 +177,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="nxlines_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_GRAPHICS=n CONFIG_DEBUG_GRAPHICS=n

View File

@ -175,6 +175,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="usbserial_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_USB=n CONFIG_DEBUG_USB=n

View File

@ -174,6 +174,8 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="msconn_main"
#CONFIG_USER_ENTRYPOINT="msdis_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_FS=n CONFIG_DEBUG_FS=n

View File

@ -185,6 +185,7 @@ CONFIG_HAVE_LIBM=n
# #
# General OS setup # General OS setup
# #
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_DEBUG=n CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_SYMBOLS=n

Some files were not shown because too many files have changed in this diff Show More