apps.: Remove the inappropriate NSH_BUILTIN_APPS coupling

1. Check NSH_NETINIT for self network initialization
2. Check NSH_ARCHINIT for sel arch specific initialization
3. Always show help regardless of NSH_BUILTIN_APPS
4. Loop forever regardless of NSH_BUILTIN_APPS, user could:
  a.change the default behavior by the command line argument
  b.or ctrl+c to break out the loop
This commit is contained in:
Xiang Xiao 2019-10-07 02:37:56 -06:00 committed by Gregory Nutt
parent e806097c70
commit 31a7b99f9c
49 changed files with 110 additions and 461 deletions

View File

@ -41,9 +41,7 @@ examples/adc
Specific configuration options for this example include: Specific configuration options for this example include:
CONFIG_EXAMPLES_ADC_DEVPATH - The default path to the ADC device. Default: /dev/adc0 CONFIG_EXAMPLES_ADC_DEVPATH - The default path to the ADC device. Default: /dev/adc0
CONFIG_EXAMPLES_ADC_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS CONFIG_EXAMPLES_ADC_NSAMPLES - This number of samples is
is defined, then the number of samples is provided on the command line
and this value is ignored. Otherwise, this number of samples is
collected and the program terminates. Default: Samples are collected collected and the program terminates. Default: Samples are collected
indefinitely. indefinitely.
CONFIG_EXAMPLES_ADC_GROUPSIZE - The number of samples to read at once. CONFIG_EXAMPLES_ADC_GROUPSIZE - The number of samples to read at once.
@ -174,11 +172,8 @@ examples/can
Specific configuration options for this example include: Specific configuration options for this example include:
CONFIG_EXAMPLES_CAN_DEVPATH - The path to the CAN device. Default: /dev/can0 CONFIG_EXAMPLES_CAN_DEVPATH - The path to the CAN device. Default: /dev/can0
CONFIG_EXAMPLES_CAN_NMSGS - If CONFIG_NSH_BUILTIN_APPS CONFIG_EXAMPLES_CAN_NMSGS - This number of CAN message is collected
is defined, then the number of loops is provided on the command line and the program terminates. Default: messages are sent and received
and this value is ignored. Otherwise, this number of CAN message is
collected and the program terminates. Default: If built as an NSH
built-in, the default is 32. Otherwise messages are sent and received
indefinitely. indefinitely.
The default behavior assumes loopback mode. Messages are sent, then read The default behavior assumes loopback mode. Messages are sent, then read
@ -470,7 +465,7 @@ examples/ftpd
configuration if the network is configuration prior to running the configuration if the network is configuration prior to running the
example. example.
NSH always initializes the network so if CONFIG_NSH_BUILTIN_APPS is NSH always initializes the network so if CONFIG_NSH_NETINIT is
defined, so is CONFIG_EXAMPLES_FTPD_NONETINIT (se it does not explicitly defined, so is CONFIG_EXAMPLES_FTPD_NONETINIT (se it does not explicitly
need to be defined in that case): need to be defined in that case):
@ -1447,15 +1442,11 @@ examples/qencoder
CONFIG_EXAMPLES_QENCODER_DEVPATH - The path to the QE device. Default: CONFIG_EXAMPLES_QENCODER_DEVPATH - The path to the QE device. Default:
/dev/qe0 /dev/qe0
CONFIG_EXAMPLES_QENCODER_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS CONFIG_EXAMPLES_QENCODER_NSAMPLES - This number of samples is
is defined, then the number of samples is provided on the command line
and this value is ignored. Otherwise, this number of samples is
collected and the program terminates. Default: Samples are collected collected and the program terminates. Default: Samples are collected
indefinitely. indefinitely.
CONFIG_EXAMPLES_QENCODER_DELAY - This value provides the delay (in CONFIG_EXAMPLES_QENCODER_DELAY - This value provides the delay (in
milliseonds) between each sample. If CONFIG_NSH_BUILTIN_APPS milliseonds) between each sample. Default: 100 milliseconds
is defined, then this value is the default delay if no other delay is
provided on the command line. Default: 100 milliseconds
examples/random examples/random
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
@ -1805,9 +1796,7 @@ examples/touchscreen
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen
device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR. device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR.
Default: "/dev/input0" Default: "/dev/input0"
CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - This number of samples is
is defined, then the number of samples is provided on the command line
and this value is ignored. Otherwise, this number of samples is
collected and the program terminates. Default: Samples are collected collected and the program terminates. Default: Samples are collected
indefinitely. indefinitely.
CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE - The touchscreen test can also be CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE - The touchscreen test can also be
@ -2121,15 +2110,15 @@ examples/xmlrpc
CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE - HTTP buffer size. Default 1024 CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE - HTTP buffer size. Default 1024
CONFIG_EXAMPLES_XMLRPC_DHCPC - Use DHCP Client. Default n. Ignored CONFIG_EXAMPLES_XMLRPC_DHCPC - Use DHCP Client. Default n. Ignored
if CONFIG_NSH_BUILTIN_APPS is selected. if CONFIG_NSH_NETINIT is selected.
CONFIG_EXAMPLES_XMLRPC_NOMAC - Use Canned MAC Address. Defaul n. Ignored CONFIG_EXAMPLES_XMLRPC_NOMAC - Use Canned MAC Address. Defaul n. Ignored
if CONFIG_NSH_BUILTIN_APPS is selected. if CONFIG_NSH_NETINIT is selected.
CONFIG_EXAMPLES_XMLRPC_IPADDR - Target IP address. Default 0x0a000002. CONFIG_EXAMPLES_XMLRPC_IPADDR - Target IP address. Default 0x0a000002.
Ignored if CONFIG_NSH_BUILTIN_APPS is selected. Ignored if CONFIG_NSH_NETINIT is selected.
CONFIG_EXAMPLES_XMLRPC_DRIPADDR - Default Router IP address (Gateway). CONFIG_EXAMPLES_XMLRPC_DRIPADDR - Default Router IP address (Gateway).
Default 0x0a000001. Ignored if CONFIG_NSH_BUILTIN_APPS is selected. Default 0x0a000001. Ignored if CONFIG_NSH_NETINIT is selected.
CONFIG_EXAMPLES_XMLRPC_NETMASK - Network Mask. Default 0xffffff00 CONFIG_EXAMPLES_XMLRPC_NETMASK - Network Mask. Default 0xffffff00
Ignored if CONFIG_NSH_BUILTIN_APPS is selected. Ignored if CONFIG_NSH_NETINIT is selected.
examples/zerocross examples/zerocross
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^

View File

@ -21,12 +21,9 @@ config EXAMPLES_ADC_DEVPATH
config EXAMPLES_ADC_NSAMPLES config EXAMPLES_ADC_NSAMPLES
int "Number of Sample Groups" int "Number of Sample Groups"
default 0 default 0
depends on !NSH_BUILTIN_APPS
---help--- ---help---
If NSH_BUILTIN_APPS is defined, then the number of samples is provided This number of samples is collected and the program terminates.
on the command line and this value is ignored. Otherwise, this number Default: 0 (samples are collected indefinitely).
of samples is collected and the program terminates. Default: 0 (samples
are collected indefinitely).
config EXAMPLES_ADC_GROUPSIZE config EXAMPLES_ADC_GROUPSIZE
int "Number of Samples per Group" int "Number of Samples per Group"

View File

@ -49,9 +49,7 @@
/* CONFIG_NSH_BUILTIN_APPS - Build the ADC test as an NSH built-in function. /* CONFIG_NSH_BUILTIN_APPS - Build the ADC test as an NSH built-in function.
* Default: Built as a standalone program * Default: Built as a standalone program
* CONFIG_EXAMPLES_ADC_DEVPATH - The default path to the ADC device. Default: /dev/adc0 * CONFIG_EXAMPLES_ADC_DEVPATH - The default path to the ADC device. Default: /dev/adc0
* CONFIG_EXAMPLES_ADC_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS * CONFIG_EXAMPLES_ADC_NSAMPLES - This number of samples is
* is defined, then the number of samples is provided on the command line
* and this value is ignored. Otherwise, this number of samples is
* collected and the program terminates. Default: Samples are collected * collected and the program terminates. Default: Samples are collected
* indefinitely. * indefinitely.
* CONFIG_EXAMPLES_ADC_GROUPSIZE - The number of samples to read at once. * CONFIG_EXAMPLES_ADC_GROUPSIZE - The number of samples to read at once.
@ -78,9 +76,7 @@ struct adc_state_s
{ {
bool initialized; bool initialized;
FAR char *devpath; FAR char *devpath;
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_ADC_NSAMPLES)
int count; int count;
#endif
}; };
/**************************************************************************** /****************************************************************************

View File

@ -59,14 +59,6 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Use CONFIG_EXAMPLES_ADC_NSAMPLES == 0 to mean to collect samples
* indefinitely.
*/
#ifndef CONFIG_EXAMPLES_ADC_NSAMPLES
# define CONFIG_EXAMPLES_ADC_NSAMPLES 0
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -111,7 +103,6 @@ static void adc_devpath(FAR struct adc_state_s *adc, FAR const char *devpath)
* Name: adc_help * Name: adc_help
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void adc_help(FAR struct adc_state_s *adc) static void adc_help(FAR struct adc_state_s *adc)
{ {
printf("Usage: adc [OPTIONS]\n"); printf("Usage: adc [OPTIONS]\n");
@ -125,13 +116,11 @@ static void adc_help(FAR struct adc_state_s *adc)
"Default: 1 Current: %d\n", adc->count); "Default: 1 Current: %d\n", adc->count);
printf(" [-h] shows this message and exits\n"); printf(" [-h] shows this message and exits\n");
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_string * Name: arg_string
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value) static int arg_string(FAR char **arg, FAR char **value)
{ {
FAR char *ptr = *arg; FAR char *ptr = *arg;
@ -147,13 +136,11 @@ static int arg_string(FAR char **arg, FAR char **value)
return 1; return 1;
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_decimal * Name: arg_decimal
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR long *value) static int arg_decimal(FAR char **arg, FAR long *value)
{ {
FAR char *string; FAR char *string;
@ -163,13 +150,11 @@ static int arg_decimal(FAR char **arg, FAR long *value)
*value = strtol(string, NULL, 10); *value = strtol(string, NULL, 10);
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: parse_args * Name: parse_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(FAR struct adc_state_s *adc, int argc, FAR char **argv) static void parse_args(FAR struct adc_state_s *adc, int argc, FAR char **argv)
{ {
FAR char *ptr; FAR char *ptr;
@ -218,7 +203,6 @@ static void parse_args(FAR struct adc_state_s *adc, int argc, FAR char **argv)
} }
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -255,25 +239,17 @@ int main(int argc, FAR char *argv[])
g_adcstate.initialized = true; g_adcstate.initialized = true;
} }
#if CONFIG_EXAMPLES_ADC_NSAMPLES > 0
g_adcstate.count = CONFIG_EXAMPLES_ADC_NSAMPLES; g_adcstate.count = CONFIG_EXAMPLES_ADC_NSAMPLES;
#else
g_adcstate.count = 1;
#endif
/* Parse the command line */ /* Parse the command line */
#ifdef CONFIG_NSH_BUILTIN_APPS
parse_args(&g_adcstate, argc, argv); parse_args(&g_adcstate, argc, argv);
#endif
/* If this example is configured as an NX add-on, then limit the number of /* If this example is configured as an NX add-on, then limit the number of
* samples that we collect before returning. Otherwise, we never return * samples that we collect before returning. Otherwise, we never return
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS) || CONFIG_EXAMPLES_ADC_NSAMPLES > 0
printf("adc_main: g_adcstate.count: %d\n", g_adcstate.count); printf("adc_main: g_adcstate.count: %d\n", g_adcstate.count);
#endif
/* Open the ADC device for reading */ /* Open the ADC device for reading */
@ -292,15 +268,7 @@ int main(int argc, FAR char *argv[])
* ADC samples. * ADC samples.
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS)
for (; g_adcstate.count > 0; g_adcstate.count--)
#elif CONFIG_EXAMPLES_ADC_NSAMPLES > 0
for (g_adcstate.count = 0;
g_adcstate.count < CONFIG_EXAMPLES_ADC_NSAMPLES;
g_adcstate.count++)
#else
for (;;) for (;;)
#endif
{ {
/* Flush any output before the loop entered or from the previous pass /* Flush any output before the loop entered or from the previous pass
* through the loop. * through the loop.
@ -364,6 +332,11 @@ int main(int argc, FAR char *argv[])
} }
} }
} }
if (g_adcstate.count && --g_adcstate.count <= 0)
{
break;
}
} }
close(fd); close(fd);

View File

@ -431,19 +431,12 @@ int main(int argc, char *argv[])
ajoy_calibrate(fd); ajoy_calibrate(fd);
/* Then loop, receiving signals indicating joystick events. If this is an /* Then loop, receiving signals indicating joystick events. */
* NSH builtin application, we will turn as soon as the SELECT button is
* depressed.
*/
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_nsec = 600*1000*1000; timeout.tv_nsec = 600*1000*1000;
#ifdef CONFIG_NSH_BUILTIN_APPS
while ((g_ajoylast & AJOY_BUTTON_SELECT_BIT) == 0)
#else
for (;;) for (;;)
#endif
{ {
struct ajoy_sample_s sample; struct ajoy_sample_s sample;

View File

@ -41,7 +41,7 @@ config EXAMPLES_BRIDGE_NET1_IOBUFIZE
---help--- ---help---
Size of the UDP send/receive I/O buffer Size of the UDP send/receive I/O buffer
if !NSH_BUILTIN_APPS if !NSH_NETINIT
config EXAMPLES_BRIDGE_NET1_DHCPC config EXAMPLES_BRIDGE_NET1_DHCPC
bool "DHCP Client" bool "DHCP Client"
@ -79,7 +79,7 @@ config EXAMPLES_BRIDGE_NET1_NETMASK
hex "Network Mask" hex "Network Mask"
default 0xffffff00 default 0xffffff00
endif # !NSH_BUILTIN_APPS endif # !NSH_NETINIT
config EXAMPLES_BRIDGE_NET1_IPHOST config EXAMPLES_BRIDGE_NET1_IPHOST
hex "Host IP address" hex "Host IP address"
@ -123,7 +123,7 @@ config EXAMPLES_BRIDGE_NET2_IOBUFIZE
---help--- ---help---
Size of the UDP send/receive I/O buffer Size of the UDP send/receive I/O buffer
if !NSH_BUILTIN_APPS if !NSH_NETINIT
config EXAMPLES_BRIDGE_NET2_DHCPC config EXAMPLES_BRIDGE_NET2_DHCPC
bool "DHCP Client" bool "DHCP Client"
@ -161,7 +161,7 @@ config EXAMPLES_BRIDGE_NET2_NETMASK
hex "Network Mask" hex "Network Mask"
default 0xffffff00 default 0xffffff00
endif # !NSH_BUILTIN_APPS endif # !NSH_NETINIT
config EXAMPLES_BRIDGE_NET2_IPHOST config EXAMPLES_BRIDGE_NET2_IPHOST
hex "Host IP address" hex "Host IP address"

View File

@ -85,7 +85,7 @@ static int briget_net1_setup(void)
* network has already been configured by NSH's start-up logic. * network has already been configured by NSH's start-up logic.
*/ */
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_NETINIT
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLES_BRIDGE_NET1_DHCPC) || \ #if defined(CONFIG_EXAMPLES_BRIDGE_NET1_DHCPC) || \
defined(CONFIG_EXAMPLES_BRIDGE_NET1_NOMAC) defined(CONFIG_EXAMPLES_BRIDGE_NET1_NOMAC)
@ -191,13 +191,13 @@ printf("NET1: Configuring %s\n", CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME);
#endif /* CONFIG_EXAMPLES_BRIDGE_NET1_DHCPC */ #endif /* CONFIG_EXAMPLES_BRIDGE_NET1_DHCPC */
#else /* CONFIG_NSH_BUILTIN_APPS */ #else /* CONFIG_NSH_NETINIT */
/* Hmmm.. there is an issue here. Where do we get the IP address if we /* Hmmm.. there is an issue here. Where do we get the IP address if we
* are a builtin in application? * are a builtin in application?
*/ */
# warning Missing logic # warning Missing logic
#endif /* CONFIG_NSH_BUILTIN_APPS */ #endif /* CONFIG_NSH_NETINIT */
return OK; return OK;
} }
@ -212,7 +212,7 @@ static int briget_net2_setup(void)
* network has already been configured by NSH's start-up logic. * network has already been configured by NSH's start-up logic.
*/ */
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_NETINIT
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLES_BRIDGE_NET2_DHCPC) || \ #if defined(CONFIG_EXAMPLES_BRIDGE_NET2_DHCPC) || \
defined(CONFIG_EXAMPLES_BRIDGE_NET2_NOMAC) defined(CONFIG_EXAMPLES_BRIDGE_NET2_NOMAC)
@ -312,13 +312,13 @@ printf("NET2: Configuring %s\n", CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME);
#endif /* CONFIG_EXAMPLES_BRIDGE_NET2_DHCPC */ #endif /* CONFIG_EXAMPLES_BRIDGE_NET2_DHCPC */
#else /* CONFIG_NSH_BUILTIN_APPS */ #else /* CONFIG_NSH_NETINIT */
/* Hmmm.. there is an issue here. Where do we get the IP address if we /* Hmmm.. there is an issue here. Where do we get the IP address if we
* are a builtin in application? * are a builtin in application?
*/ */
# warning Missing logic # warning Missing logic
#endif /* CONFIG_NSH_BUILTIN_APPS */ #endif /* CONFIG_NSH_NETINIT */
return OK; return OK;
} }

View File

@ -20,8 +20,7 @@ config EXAMPLES_CAN_DEVPATH
config EXAMPLES_CAN_NMSGS config EXAMPLES_CAN_NMSGS
int "Number of Messages" int "Number of Messages"
default 32 default 0
depends on NSH_BUILTIN_APPS
---help--- ---help---
The number of CAN messages to send before returning The number of CAN messages to send before returning

View File

@ -55,16 +55,10 @@
* *
* Specific configuration options for this example include: * Specific configuration options for this example include:
* *
* CONFIG_NSH_BUILTIN_APPS - Build the CAN test as an NSH built-in function.
* Default: Built as a standalone program
* CONFIG_CAN_LOOPBACK * CONFIG_CAN_LOOPBACK
* CONFIG_EXAMPLES_CAN_DEVPATH - The path to the CAN device. Default: /dev/can0 * CONFIG_EXAMPLES_CAN_DEVPATH - The path to the CAN device. Default: /dev/can0
* CONFIG_EXAMPLES_CAN_NMSGS - If CONFIG_NSH_BUILTIN_APPS * CONFIG_EXAMPLES_CAN_NMSGS - This number of CAN message is collected and
* is defined, then the number of loops is provided on the command line * the program terminates. Default: 32.
* and this value is ignored. Otherwise, this number of CAN message is
* collected and the program terminates. Default: If built as an NSH
* built-in, the default is 32. Otherwise messages are sent and received
* indefinitely.
* CONFIG_EXAMPLES_CAN_READ - Only receive messages * CONFIG_EXAMPLES_CAN_READ - Only receive messages
* CONFIG_EXAMPLES_CAN_WRITE - Only send messages * CONFIG_EXAMPLES_CAN_WRITE - Only send messages
* CONFIG_EXAMPLES_CAN_READWRITE - Receive and send messages * CONFIG_EXAMPLES_CAN_READWRITE - Receive and send messages

View File

@ -76,26 +76,14 @@
# endif # endif
#endif #endif
#ifdef CONFIG_NSH_BUILTIN_APPS #ifdef CONFIG_EXAMPLES_CAN_WRITE
# ifdef CONFIG_EXAMPLES_CAN_WRITE # ifdef CONFIG_CAN_EXTID
# ifdef CONFIG_CAN_EXTID # define OPT_STR ":n:a:b:hs"
# define OPT_STR ":n:a:b:hs"
# else
# define OPT_STR ":n:a:b:h"
# endif
# else # else
# define OPT_STR ":n:h" # define OPT_STR ":n:a:b:h"
# endif # endif
#else #else
# ifdef CONFIG_EXAMPLES_CAN_WRITE # define OPT_STR ":n:h"
# ifdef CONFIG_CAN_EXTID
# define OPT_STR ":a:b:hs"
# else
# define OPT_STR ":a:b:h"
# endif
# else
# define OPT_STR ":h"
# endif
#endif #endif
/**************************************************************************** /****************************************************************************
@ -121,9 +109,7 @@
static void show_usage(FAR const char *progname) static void show_usage(FAR const char *progname)
{ {
fprintf(stderr, "USAGE: %s" fprintf(stderr, "USAGE: %s"
#ifdef CONFIG_NSH_BUILTIN_APPS
" [-n <nmsgs]" " [-n <nmsgs]"
#endif
#ifdef CONFIG_EXAMPLES_CAN_WRITE #ifdef CONFIG_EXAMPLES_CAN_WRITE
#ifdef CONFIG_CAN_EXTID #ifdef CONFIG_CAN_EXTID
" [-s]" " [-s]"
@ -135,9 +121,7 @@ static void show_usage(FAR const char *progname)
fprintf(stderr, "USAGE: %s -h\n", fprintf(stderr, "USAGE: %s -h\n",
progname); progname);
fprintf(stderr, "\nWhere:\n"); fprintf(stderr, "\nWhere:\n");
#ifdef CONFIG_NSH_BUILTIN_APPS
fprintf(stderr, "-n <nmsgs>: The number of messages to send. Default: 32\n"); fprintf(stderr, "-n <nmsgs>: The number of messages to send. Default: 32\n");
#endif
#ifdef CONFIG_EXAMPLES_CAN_WRITE #ifdef CONFIG_EXAMPLES_CAN_WRITE
#ifdef CONFIG_CAN_EXTID #ifdef CONFIG_CAN_EXTID
fprintf(stderr, "-s: Use standard IDs. Default: Extended ID\n"); fprintf(stderr, "-s: Use standard IDs. Default: Extended ID\n");
@ -183,10 +167,8 @@ int main(int argc, FAR char *argv[])
ssize_t nbytes; ssize_t nbytes;
bool badarg = false; bool badarg = false;
bool help = false; bool help = false;
#ifdef CONFIG_NSH_BUILTIN_APPS
long nmsgs = CONFIG_EXAMPLES_CAN_NMSGS; long nmsgs = CONFIG_EXAMPLES_CAN_NMSGS;
long msgno; long msgno;
#endif
int option; int option;
int fd; int fd;
int errval = 0; int errval = 0;
@ -228,7 +210,6 @@ int main(int argc, FAR char *argv[])
help = true; help = true;
break; break;
#ifdef CONFIG_NSH_BUILTIN_APPS
case 'n': case 'n':
nmsgs = strtol(optarg, NULL, 10); nmsgs = strtol(optarg, NULL, 10);
if (nmsgs < 1) if (nmsgs < 1)
@ -237,7 +218,6 @@ int main(int argc, FAR char *argv[])
badarg = true; badarg = true;
} }
break; break;
#endif
case ':': case ':':
fprintf(stderr, "ERROR: Bad option argument\n"); fprintf(stderr, "ERROR: Bad option argument\n");
@ -282,9 +262,7 @@ int main(int argc, FAR char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#ifdef CONFIG_NSH_BUILTIN_APPS
printf("nmsgs: %d\n", nmsgs); printf("nmsgs: %d\n", nmsgs);
#endif
#ifdef CONFIG_EXAMPLES_CAN_WRITE #ifdef CONFIG_EXAMPLES_CAN_WRITE
printf("min ID: %ld max ID: %ld\n", minid, maxid); printf("min ID: %ld max ID: %ld\n", minid, maxid);
#endif #endif
@ -332,11 +310,7 @@ int main(int argc, FAR char *argv[])
msgdata = 0; msgdata = 0;
#endif #endif
#ifdef CONFIG_NSH_BUILTIN_APPS for (msgno = 0; !nmsgs || msgno < nmsgs; msgno++)
for (msgno = 0; msgno < nmsgs; msgno++)
#else
for (; ; )
#endif
{ {
/* Flush any output before the loop entered or from the previous pass /* Flush any output before the loop entered or from the previous pass
* through the loop. * through the loop.

View File

@ -274,7 +274,6 @@ static int cmd_dac_putv(int argc, FAR const char *argv[])
return ret; return ret;
} }
#ifdef CONFIG_NSH_BUILTIN_APPS
static void dac_help(void) static void dac_help(void)
{ {
printf("Usage: dac [OPTIONS] command [CMD OPTIONS]\n"); printf("Usage: dac [OPTIONS] command [CMD OPTIONS]\n");
@ -292,9 +291,7 @@ static void dac_help(void)
CONFIG_EXAMPLES_DAC_DEVPATH, g_dacstate.devpath ? g_dacstate.devpath : "NONE"); CONFIG_EXAMPLES_DAC_DEVPATH, g_dacstate.devpath ? g_dacstate.devpath : "NONE");
print_cmds("\nCommands:\n", commands, ARRAY_SIZE(commands), "\n"); print_cmds("\nCommands:\n", commands, ARRAY_SIZE(commands), "\n");
} }
#endif
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR const char **arg, FAR const char **value) static int arg_string(FAR const char **arg, FAR const char **value)
{ {
FAR const char *ptr = *arg; FAR const char *ptr = *arg;
@ -310,9 +307,7 @@ static int arg_string(FAR const char **arg, FAR const char **value)
return 1; return 1;
} }
} }
#endif
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR const char **arg, FAR long *value) static int arg_decimal(FAR const char **arg, FAR long *value)
{ {
FAR const char *string; FAR const char *string;
@ -322,9 +317,7 @@ static int arg_decimal(FAR const char **arg, FAR long *value)
*value = strtol(string, NULL, 10); *value = strtol(string, NULL, 10);
return ret; return ret;
} }
#endif
#ifdef CONFIG_NSH_BUILTIN_APPS
static int parse_args(FAR struct dac_state_s *dac, static int parse_args(FAR struct dac_state_s *dac,
int argc, int argc,
const char *argv[]) const char *argv[])
@ -403,7 +396,6 @@ static int parse_args(FAR struct dac_state_s *dac,
return n; return n;
} }
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -430,9 +422,7 @@ int main(int argc, FAR const char *argv[])
/* Parse the command line */ /* Parse the command line */
#ifdef CONFIG_NSH_BUILTIN_APPS
nargs = parse_args(&g_dacstate, argc, argv); nargs = parse_args(&g_dacstate, argc, argv);
#endif
argc -= nargs; argc -= nargs;
argv += nargs; argv += nargs;

View File

@ -20,26 +20,26 @@ config EXAMPLES_DISCOVER
config EXAMPLES_DISCOVER_DHCPC config EXAMPLES_DISCOVER_DHCPC
bool "DHCP Client" bool "DHCP Client"
default n default n
depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS depends on EXAMPLES_DISCOVER && !NSH_NETINIT
select NETUTILS_DHCPC select NETUTILS_DHCPC
select NETDB_DNSCLIENT select NETDB_DNSCLIENT
config EXAMPLES_DISCOVER_NOMAC config EXAMPLES_DISCOVER_NOMAC
bool "Use Canned MAC Address" bool "Use Canned MAC Address"
default n default n
depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS depends on EXAMPLES_DISCOVER && !NSH_NETINIT
config EXAMPLES_DISCOVER_IPADDR config EXAMPLES_DISCOVER_IPADDR
hex "Target IP address" hex "Target IP address"
default 0x0a000002 default 0x0a000002
depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS && !EXAMPLES_DISCOVER_DHCPC depends on EXAMPLES_DISCOVER && !NSH_NETINIT && !EXAMPLES_DISCOVER_DHCPC
config EXAMPLES_DISCOVER_DRIPADDR config EXAMPLES_DISCOVER_DRIPADDR
hex "Default Router IP address (Gateway)" hex "Default Router IP address (Gateway)"
default 0x0a000001 default 0x0a000001
depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS depends on EXAMPLES_DISCOVER && !NSH_NETINIT
config EXAMPLES_DISCOVER_NETMASK config EXAMPLES_DISCOVER_NETMASK
hex "Network Mask" hex "Network Mask"
default 0xffffff00 default 0xffffff00
depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS depends on EXAMPLES_DISCOVER && !NSH_NETINIT

View File

@ -90,7 +90,7 @@ int main(int argc, FAR char *argv[])
* network has already been configured by NSH's start-up logic. * network has already been configured by NSH's start-up logic.
*/ */
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_NETINIT
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLES_DISCOVER_DHCPC) || defined(CONFIG_EXAMPLES_DISCOVER_NOMAC) #if defined(CONFIG_EXAMPLES_DISCOVER_DHCPC) || defined(CONFIG_EXAMPLES_DISCOVER_NOMAC)
uint8_t mac[IFHWADDRLEN]; uint8_t mac[IFHWADDRLEN];
@ -176,7 +176,7 @@ int main(int argc, FAR char *argv[])
} }
#endif /* CONFIG_EXAMPLES_DISCOVER_DHCPC */ #endif /* CONFIG_EXAMPLES_DISCOVER_DHCPC */
#endif /* CONFIG_NSH_BUILTIN_APPS */ #endif /* CONFIG_NSH_NETINIT */
if (discover_start(NULL) < 0) if (discover_start(NULL) < 0)
{ {

View File

@ -190,16 +190,9 @@ int main(int argc, FAR char *argv[])
goto errout_with_fd; goto errout_with_fd;
} }
/* Then loop, receiving signals indicating joystick events. If this is an /* Then loop, receiving signals indicating joystick events. */
* NSH builtin application, we will turn as soon as the SELECT button is
* depressed.
*/
#ifdef CONFIG_NSH_BUILTIN_APPS
while ((g_djoylast & DJOY_BUTTON_SELECT_BIT) == 0)
#else
for (;;) for (;;)
#endif
{ {
struct siginfo value; struct siginfo value;
sigset_t set; sigset_t set;

View File

@ -87,7 +87,7 @@
/* NSH always initializes the network */ /* NSH always initializes the network */
#if defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_EXAMPLES_FTPD_NONETINIT) #if defined(CONFIG_NSH_NETINIT) && !defined(CONFIG_EXAMPLES_FTPD_NONETINIT)
# define CONFIG_EXAMPLES_FTPD_NONETINIT 1 # define CONFIG_EXAMPLES_FTPD_NONETINIT 1
#endif #endif
@ -130,10 +130,8 @@ struct ftpd_globals_s
bool initialized; /* True: Networking is initialized. The bool initialized; /* True: Networking is initialized. The
* network must be initialized only once. * network must be initialized only once.
*/ */
#ifdef CONFIG_NSH_BUILTIN_APPS
volatile bool stop; /* True: Request daemon to exit */ volatile bool stop; /* True: Request daemon to exit */
volatile bool running; /* True: The daemon is running */ volatile bool running; /* True: The daemon is running */
#endif
pid_t pid; /* Task ID of the FTPD daemon. The value pid_t pid; /* Task ID of the FTPD daemon. The value
* -1 is a redundant indication that the * -1 is a redundant indication that the
* daemon is not running. * daemon is not running.

View File

@ -174,9 +174,7 @@ int ftpd_daemon(int s_argc, char **s_argv)
/* The FTPD daemon has been started */ /* The FTPD daemon has been started */
#ifdef CONFIG_NSH_BUILTIN_APPS
g_ftpdglob.running = true; g_ftpdglob.running = true;
#endif
printf("FTP daemon [%d] started\n", g_ftpdglob.pid); printf("FTP daemon [%d] started\n", g_ftpdglob.pid);
/* Open FTPD */ /* Open FTPD */
@ -190,10 +188,8 @@ int ftpd_daemon(int s_argc, char **s_argv)
if (!handle) if (!handle)
{ {
printf("FTP daemon [%d] failed to open FTPD\n", g_ftpdglob.pid); printf("FTP daemon [%d] failed to open FTPD\n", g_ftpdglob.pid);
#ifdef CONFIG_NSH_BUILTIN_APPS
g_ftpdglob.running = false; g_ftpdglob.running = false;
g_ftpdglob.stop = false; g_ftpdglob.stop = false;
#endif
g_ftpdglob.pid = -1; g_ftpdglob.pid = -1;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -204,11 +200,7 @@ int ftpd_daemon(int s_argc, char **s_argv)
/* Then drive the FTPD server. */ /* Then drive the FTPD server. */
#ifdef CONFIG_NSH_BUILTIN_APPS
while (g_ftpdglob.stop == 0) while (g_ftpdglob.stop == 0)
#else
for (;;)
#endif
{ {
/* If ftpd_session returns success, it means that a new FTP session /* If ftpd_session returns success, it means that a new FTP session
* has been started. * has been started.
@ -226,17 +218,14 @@ int ftpd_daemon(int s_argc, char **s_argv)
} }
} }
/* Close the FTPD server and exit (we can get here only if /* Close the FTPD server and exit. */
* CONFIG_NSH_BUILTIN_APPS is defined).
*/
#ifdef CONFIG_NSH_BUILTIN_APPS
printf("FTP daemon [%d] stopping\n", g_ftpdglob.pid); printf("FTP daemon [%d] stopping\n", g_ftpdglob.pid);
g_ftpdglob.running = false; g_ftpdglob.running = false;
g_ftpdglob.stop = false; g_ftpdglob.stop = false;
g_ftpdglob.pid = -1; g_ftpdglob.pid = -1;
ftpd_close(handle); ftpd_close(handle);
#endif
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -263,22 +252,17 @@ int main(int argc, FAR char *argv[])
g_ftpdglob.initialized = true; g_ftpdglob.initialized = true;
g_ftpdglob.pid = -1; g_ftpdglob.pid = -1;
#ifdef CONFIG_NSH_BUILTIN_APPS
g_ftpdglob.stop = false; g_ftpdglob.stop = false;
g_ftpdglob.running = false; g_ftpdglob.running = false;
#endif
} }
/* Then start the new daemon (if it is not already running) */ /* Then start the new daemon (if it is not already running) */
#ifdef CONFIG_NSH_BUILTIN_APPS
if (g_ftpdglob.stop && g_ftpdglob.running) if (g_ftpdglob.stop && g_ftpdglob.running)
{ {
printf("Waiting for FTP daemon [%d] to stop\n", g_ftpdglob.pid); printf("Waiting for FTP daemon [%d] to stop\n", g_ftpdglob.pid);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else
#endif
if (!g_ftpdglob.running) if (!g_ftpdglob.running)
{ {
printf("Starting the FTP daemon\n"); printf("Starting the FTP daemon\n");

View File

@ -47,9 +47,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* CONFIG_NSH_BUILTIN_APPS - Build the I2SCHAR test as an NSH built-in /* CONFIG_EXAMPLES_I2SCHAR_DEVPATH - The default path to the I2S character
* function. Default: Built as a standalone program
* CONFIG_EXAMPLES_I2SCHAR_DEVPATH - The default path to the I2S character
* device. Default: /dev/i2schar0 * device. Default: /dev/i2schar0
*/ */

View File

@ -99,7 +99,6 @@ static void i2schar_devpath(FAR struct i2schar_state_s *i2schar,
* Name: i2schar_help * Name: i2schar_help
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void i2schar_help(FAR struct i2schar_state_s *i2schar) static void i2schar_help(FAR struct i2schar_state_s *i2schar)
{ {
printf("Usage: i2schar [OPTIONS]\n"); printf("Usage: i2schar [OPTIONS]\n");
@ -121,13 +120,11 @@ static void i2schar_help(FAR struct i2schar_state_s *i2schar)
#endif #endif
printf(" [-h] shows this message and exits\n"); printf(" [-h] shows this message and exits\n");
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_string * Name: arg_string
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value) static int arg_string(FAR char **arg, FAR char **value)
{ {
FAR char *ptr = *arg; FAR char *ptr = *arg;
@ -143,13 +140,11 @@ static int arg_string(FAR char **arg, FAR char **value)
return 1; return 1;
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_decimal * Name: arg_decimal
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR long *value) static int arg_decimal(FAR char **arg, FAR long *value)
{ {
FAR char *string; FAR char *string;
@ -159,13 +154,11 @@ static int arg_decimal(FAR char **arg, FAR long *value)
*value = strtol(string, NULL, 10); *value = strtol(string, NULL, 10);
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: parse_args * Name: parse_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(FAR struct i2schar_state_s *i2schar, int argc, FAR char **argv) static void parse_args(FAR struct i2schar_state_s *i2schar, int argc, FAR char **argv)
{ {
FAR char *ptr; FAR char *ptr;
@ -284,9 +277,7 @@ int main(int argc, FAR char *argv[])
/* Parse the command line */ /* Parse the command line */
#ifdef CONFIG_NSH_BUILTIN_APPS
parse_args(&g_i2schar, argc, argv); parse_args(&g_i2schar, argc, argv);
#endif
sched_lock(); sched_lock();
#ifdef CONFIG_EXAMPLES_I2SCHAR_RX #ifdef CONFIG_EXAMPLES_I2SCHAR_RX

View File

@ -70,8 +70,7 @@
#undef NEED_BOARDINIT #undef NEED_BOARDINIT
#if defined(CONFIG_LIB_BOARDCTL) && !defined(CONFIG_BOARD_LATE_INITIALIZE) && \ #if defined(CONFIG_LIB_BOARDCTL) && !defined(CONFIG_NSH_ARCHINIT)
(!defined(CONFIG_NSH_BUILTIN_APPS) || !defined(CONFIG_NSH_ARCHINIT))
# define NEED_BOARDINIT 1 # define NEED_BOARDINIT 1
#endif #endif

View File

@ -47,9 +47,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* CONFIG_NSH_BUILTIN_APPS - Build the touchscreen test as /* CONFIG_EXAMPLES_LGVLDEMO_MINOR - The minor device number. Minor=N
* an NSH built-in function. Default: Built as a standalone program
* CONFIG_EXAMPLES_LGVLDEMO_MINOR - The minor device number. Minor=N
* corresponds to touchscreen device /dev/input0. Note this value must * corresponds to touchscreen device /dev/input0. Note this value must
* with CONFIG_EXAMPLES_LGVLDEMO_DEVPATH. Default 0. * with CONFIG_EXAMPLES_LGVLDEMO_DEVPATH. Default 0.
* CONFIG_EXAMPLES_LGVLDEMO_DEVPATH - The path to the touchscreen * CONFIG_EXAMPLES_LGVLDEMO_DEVPATH - The path to the touchscreen

View File

@ -29,8 +29,8 @@ config EXAMPLES_MLD_STACKSIZE
config EXAMPLES_MLD_INIT config EXAMPLES_MLD_INIT
bool "Initialize network" bool "Initialize network"
default n if NSH_BUILTIN_APPS default n if NSH_NETINIT
default y if !NSH_BUILTIN_APPS default y if !NSH_NETINIT
---help--- ---help---
Include logic to initialize the network. This should not be done if Include logic to initialize the network. This should not be done if
the network is already initialized when nettest runs. This is the network is already initialized when nettest runs. This is

View File

@ -129,8 +129,8 @@ endchoice # IP Domain
config EXAMPLES_NETTEST_INIT config EXAMPLES_NETTEST_INIT
bool "Initialize network" bool "Initialize network"
default n if NSH_BUILTIN_APPS default n if NSH_NETINIT
default y if !NSH_BUILTIN_APPS default y if !NSH_NETINIT
depends on !EXAMPLES_NETTEST_LOOPBACK depends on !EXAMPLES_NETTEST_LOOPBACK
---help--- ---help---
Include logic to initialize the network. This should not be done if Include logic to initialize the network. This should not be done if

View File

@ -352,17 +352,9 @@ void nxlines_test(NXWINDOW hwnd)
if (angle > (31 * (2 * b16PI) / 32)) if (angle > (31 * (2 * b16PI) / 32))
{ {
#ifdef CONFIG_NSH_BUILTIN_APPS
/* If this example was built as an NSH add-on, then exit after we
* have gone all the way around once.
*/
return;
#else
/* Wrap back to zero and continue with the test */ /* Wrap back to zero and continue with the test */
angle = 0; angle = 0;
#endif
} }
usleep(500*1000); usleep(500*1000);
} }

View File

@ -126,7 +126,6 @@ struct args_s g_args;
* Name: powerled_help * Name: powerled_help
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void powerled_help(FAR struct args_s *args) static void powerled_help(FAR struct args_s *args)
{ {
printf("Usage: powerled [OPTIONS]\n\n"); printf("Usage: powerled [OPTIONS]\n\n");
@ -145,13 +144,11 @@ static void powerled_help(FAR struct args_s *args)
printf(" -1 for infinity [default]\n"); printf(" -1 for infinity [default]\n");
printf("\n"); printf("\n");
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_string * Name: arg_string
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value) static int arg_string(FAR char **arg, FAR char **value)
{ {
FAR char *ptr = *arg; FAR char *ptr = *arg;
@ -167,13 +164,11 @@ static int arg_string(FAR char **arg, FAR char **value)
return 1; return 1;
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_decimal * Name: arg_decimal
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR int *value) static int arg_decimal(FAR char **arg, FAR int *value)
{ {
FAR char *string; FAR char *string;
@ -184,13 +179,11 @@ static int arg_decimal(FAR char **arg, FAR int *value)
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_float * Name: arg_float
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_float(FAR char **arg, FAR float *value) static int arg_float(FAR char **arg, FAR float *value)
{ {
FAR char *string; FAR char *string;
@ -201,13 +194,11 @@ static int arg_float(FAR char **arg, FAR float *value)
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: parse_args * Name: parse_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(FAR struct args_s *args, int argc, FAR char **argv) static void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
{ {
FAR char *ptr; FAR char *ptr;
@ -336,13 +327,11 @@ static void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
} }
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: validate_args * Name: validate_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int validate_args(FAR struct args_s *args) static int validate_args(FAR struct args_s *args)
{ {
int ret = OK; int ret = OK;
@ -421,7 +410,6 @@ static int validate_args(FAR struct args_s *args)
errout: errout:
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -463,22 +451,18 @@ int main(int argc, char *argv[])
/* Parse the command line */ /* Parse the command line */
#ifdef CONFIG_NSH_BUILTIN_APPS
parse_args(args, argc, argv); parse_args(args, argc, argv);
#endif
/* Validate arguments */ /* Validate arguments */
#ifdef CONFIG_NSH_BUILTIN_APPS
ret = validate_args(args); ret = validate_args(args);
if (ret != OK) if (ret != OK)
{ {
printf("powerled_main: validate arguments failed!\n"); printf("powerled_main: validate arguments failed!\n");
goto errout; goto errout;
} }
#endif
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_ARCHINIT
/* Perform architecture-specific initialization (if configured) */ /* Perform architecture-specific initialization (if configured) */
(void)boardctl(BOARDIOC_INIT, 0); (void)boardctl(BOARDIOC_INIT, 0);

View File

@ -21,11 +21,8 @@ config EXAMPLES_QENCODER_DEVPATH
config EXAMPLES_QENCODER_NSAMPLES config EXAMPLES_QENCODER_NSAMPLES
int "Number of samples" int "Number of samples"
default 0 default 0
depends on !NSH_BUILTIN_APPS
---help--- ---help---
If CONFIG_NSH_BUILTIN_APPS is defined, then the number of This number of samples is collected and the program
samples is provided on the command line and this value is ignored.
Otherwise, this number of samples is collected and the program
terminates. If the value is 0, samples are collected indefinitely. terminates. If the value is 0, samples are collected indefinitely.
config EXAMPLES_QENCODER_DELAY config EXAMPLES_QENCODER_DELAY

View File

@ -53,11 +53,9 @@
struct qe_example_s struct qe_example_s
{ {
FAR char *devpath; /* Path to the QE device */ FAR char *devpath; /* Path to the QE device */
#ifdef CONFIG_NSH_BUILTIN_APPS
bool reset; /* True: set the count back to zero */ bool reset; /* True: set the count back to zero */
unsigned int nloops; /* Collect this number of samples */ unsigned int nloops; /* Collect this number of samples */
unsigned int delay; /* Delay this number of seconds between samples */ unsigned int delay; /* Delay this number of seconds between samples */
#endif
}; };
/**************************************************************************** /****************************************************************************

View File

@ -103,7 +103,6 @@ static void qe_devpath(FAR const char *devpath)
* Name: qe_help * Name: qe_help
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void qe_help(void) static void qe_help(void)
{ {
printf("\nUsage: qe [OPTIONS]\n\n"); printf("\nUsage: qe [OPTIONS]\n\n");
@ -114,13 +113,11 @@ static void qe_help(void)
printf(" [-r] Reset the position to zero\n"); printf(" [-r] Reset the position to zero\n");
printf(" [-h] Shows this message and exits\n\n"); printf(" [-h] Shows this message and exits\n\n");
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_string * Name: arg_string
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value) static int arg_string(FAR char **arg, FAR char **value)
{ {
FAR char *ptr = *arg; FAR char *ptr = *arg;
@ -136,13 +133,11 @@ static int arg_string(FAR char **arg, FAR char **value)
return 1; return 1;
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_decimal * Name: arg_decimal
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR long *value) static int arg_decimal(FAR char **arg, FAR long *value)
{ {
FAR char *string; FAR char *string;
@ -152,13 +147,11 @@ static int arg_decimal(FAR char **arg, FAR long *value)
*value = strtol(string, NULL, 10); *value = strtol(string, NULL, 10);
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: parse_args * Name: parse_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(int argc, FAR char **argv) static void parse_args(int argc, FAR char **argv)
{ {
FAR char *ptr; FAR char *ptr;
@ -168,7 +161,7 @@ static void parse_args(int argc, FAR char **argv)
int nargs; int nargs;
g_qeexample.reset = false; g_qeexample.reset = false;
g_qeexample.nloops = 1; g_qeexample.nloops = CONFIG_EXAMPLES_QENCODER_NSAMPLES;
g_qeexample.delay = CONFIG_EXAMPLES_QENCODER_DELAY; g_qeexample.delay = CONFIG_EXAMPLES_QENCODER_DELAY;
for (index = 1; index < argc; ) for (index = 1; index < argc; )
@ -228,7 +221,6 @@ static void parse_args(int argc, FAR char **argv)
} }
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -244,9 +236,7 @@ int main(int argc, FAR char *argv[])
int fd; int fd;
int exitval = EXIT_SUCCESS; int exitval = EXIT_SUCCESS;
int ret; int ret;
#if defined(CONFIG_NSH_BUILTIN_APPS) || CONFIG_EXAMPLES_QENCODER_NSAMPLES > 0
int nloops; int nloops;
#endif
/* Set the default values */ /* Set the default values */
@ -254,9 +244,7 @@ int main(int argc, FAR char *argv[])
/* Parse command line arguments */ /* Parse command line arguments */
#ifdef CONFIG_NSH_BUILTIN_APPS
parse_args(argc, argv); parse_args(argc, argv);
#endif
/* Open the encoder device for reading */ /* Open the encoder device for reading */
@ -273,7 +261,6 @@ int main(int argc, FAR char *argv[])
/* Reset the count if so requested */ /* Reset the count if so requested */
#ifdef CONFIG_NSH_BUILTIN_APPS
if (g_qeexample.reset) if (g_qeexample.reset)
{ {
printf("qe_main: Resetting the count...\n"); printf("qe_main: Resetting the count...\n");
@ -285,21 +272,13 @@ int main(int argc, FAR char *argv[])
goto errout_with_dev; goto errout_with_dev;
} }
} }
#endif
/* Now loop the appropriate number of times, displaying the collected /* Now loop the appropriate number of times, displaying the collected
* encoder samples. * encoder samples.
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS)
printf("qe_main: Number of samples: %u\n", g_qeexample.nloops); printf("qe_main: Number of samples: %u\n", g_qeexample.nloops);
for (nloops = 0; nloops < g_qeexample.nloops; nloops++) for (nloops = 0; !g_qeexample.nloops || nloops < g_qeexample.nloops; nloops++)
#elif CONFIG_EXAMPLES_QENCODER_NSAMPLES > 0
printf("qe_main: Number of samples: %d\n", CONFIG_EXAMPLES_QENCODER_NSAMPLES);
for (nloops = 0; nloops < CONFIG_EXAMPLES_QENCODER_NSAMPLES; nloops++)
#else
for (;;)
#endif
{ {
/* Flush any output before the loop entered or from the previous pass /* Flush any output before the loop entered or from the previous pass
* through the loop. * through the loop.
@ -321,20 +300,12 @@ int main(int argc, FAR char *argv[])
else else
{ {
#if defined(CONFIG_NSH_BUILTIN_APPS) || CONFIG_EXAMPLES_QENCODER_NSAMPLES > 0
printf("qe_main: %3d. %d\n", nloops+1, position); printf("qe_main: %3d. %d\n", nloops+1, position);
#else
printf("qe_main: %d\n", position);
#endif
} }
/* Delay a little bit */ /* Delay a little bit */
#if defined(CONFIG_NSH_BUILTIN_APPS)
usleep(g_qeexample.delay * 1000); usleep(g_qeexample.delay * 1000);
#else
usleep(CONFIG_EXAMPLES_QENCODER_DELAY * 1000);
#endif
} }
errout_with_dev: errout_with_dev:

View File

@ -257,12 +257,10 @@ int main(int argc, FAR char *argv[])
* is supported. * is supported.
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS)
if (argc > 1) if (argc > 1)
{ {
str = argv[1]; str = argv[1];
} }
#endif
/* Open the SLCD device */ /* Open the SLCD device */

View File

@ -133,7 +133,6 @@ struct args_s g_args;
* Name: smps_help * Name: smps_help
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void smps_help(FAR struct args_s *args) static void smps_help(FAR struct args_s *args)
{ {
printf("Usage: smps [OPTIONS]\n\n"); printf("Usage: smps [OPTIONS]\n\n");
@ -148,13 +147,11 @@ static void smps_help(FAR struct args_s *args)
printf(" -1 for infinity [default]\n"); printf(" -1 for infinity [default]\n");
printf("\n"); printf("\n");
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_string * Name: arg_string
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value) static int arg_string(FAR char **arg, FAR char **value)
{ {
FAR char *ptr = *arg; FAR char *ptr = *arg;
@ -170,13 +167,11 @@ static int arg_string(FAR char **arg, FAR char **value)
return 1; return 1;
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_decimal * Name: arg_decimal
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR int *value) static int arg_decimal(FAR char **arg, FAR int *value)
{ {
FAR char *string; FAR char *string;
@ -187,13 +182,11 @@ static int arg_decimal(FAR char **arg, FAR int *value)
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_float * Name: arg_float
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_float(FAR char **arg, FAR float *value) static int arg_float(FAR char **arg, FAR float *value)
{ {
FAR char *string; FAR char *string;
@ -204,13 +197,11 @@ static int arg_float(FAR char **arg, FAR float *value)
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: parse_args * Name: parse_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(FAR struct args_s *args, int argc, FAR char **argv) static void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
{ {
FAR char *ptr; FAR char *ptr;
@ -322,13 +313,11 @@ static void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
} }
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: validate_args * Name: validate_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int validate_args(FAR struct args_s *args) static int validate_args(FAR struct args_s *args)
{ {
int ret = OK; int ret = OK;
@ -357,7 +346,6 @@ static int validate_args(FAR struct args_s *args)
errout: errout:
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: feedback_print * Name: feedback_print
@ -490,22 +478,18 @@ int main(int argc, char *argv[])
/* Parse the command line */ /* Parse the command line */
#ifdef CONFIG_NSH_BUILTIN_APPS
parse_args(args, argc, argv); parse_args(args, argc, argv);
#endif
/* Validate arguments */ /* Validate arguments */
#ifdef CONFIG_NSH_BUILTIN_APPS
ret = validate_args(args); ret = validate_args(args);
if (ret != OK) if (ret != OK)
{ {
printf("powerled_main: validate arguments failed!\n"); printf("powerled_main: validate arguments failed!\n");
goto errout; goto errout;
} }
#endif
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_ARCHINIT
/* Perform architecture-specific initialization (if configured) */ /* Perform architecture-specific initialization (if configured) */
(void)boardctl(BOARDIOC_INIT, 0); (void)boardctl(BOARDIOC_INIT, 0);

View File

@ -107,8 +107,6 @@ struct args_s g_args;
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
/**************************************************************************** /****************************************************************************
* Name: sx127x_help * Name: sx127x_help
****************************************************************************/ ****************************************************************************/
@ -339,7 +337,6 @@ static int validate_args(FAR struct args_s *args)
return ret; return ret;
} }
#endif /* CONFIG_NSH_BUILTIN_APPS */
/**************************************************************************** /****************************************************************************
* Name: print_hex * Name: print_hex
@ -466,7 +463,6 @@ int main(int argc, FAR char *argv[])
args->time = CONFIG_EXAMPLES_SX127X_TIME; args->time = CONFIG_EXAMPLES_SX127X_TIME;
args->datalen = CONFIG_EXAMPLES_SX127X_TXDATA; args->datalen = CONFIG_EXAMPLES_SX127X_TXDATA;
#ifdef CONFIG_NSH_BUILTIN_APPS
/* Parse the command line */ /* Parse the command line */
parse_args(args, argc, argv); parse_args(args, argc, argv);
@ -479,7 +475,6 @@ int main(int argc, FAR char *argv[])
printf("sx127x_main: validate arguments failed!\n"); printf("sx127x_main: validate arguments failed!\n");
goto errout; goto errout;
} }
#endif
printf("Start sx127x_demo\n"); printf("Start sx127x_demo\n");

View File

@ -139,8 +139,8 @@ endchoice # IP Domain
config EXAMPLES_TCPBLASTER_INIT config EXAMPLES_TCPBLASTER_INIT
bool "Initialize network" bool "Initialize network"
default n if NSH_BUILTIN_APPS default n if NSH_NETINIT
default y if !NSH_BUILTIN_APPS default y if !NSH_NETINIT
depends on !EXAMPLES_TCPBLASTER_LOOPBACK depends on !EXAMPLES_TCPBLASTER_LOOPBACK
---help--- ---help---
Include logic to initialize the network. This should not be done if Include logic to initialize the network. This should not be done if

View File

@ -29,26 +29,26 @@ config EXAMPLES_TCPECHO_NCONN
config EXAMPLES_TCPECHO_DHCPC config EXAMPLES_TCPECHO_DHCPC
bool "DHCP Client" bool "DHCP Client"
default n default n
depends on EXAMPLES_TCPECHO && !NSH_BUILTIN_APPS depends on EXAMPLES_TCPECHO && !NSH_NETINIT
select NETUTILS_DHCPC select NETUTILS_DHCPC
select NETDB_DNSCLIENT select NETDB_DNSCLIENT
config EXAMPLES_TCPECHO_NOMAC config EXAMPLES_TCPECHO_NOMAC
bool "Use Canned MAC Address" bool "Use Canned MAC Address"
default n default n
depends on EXAMPLES_TCPECHO && !NSH_BUILTIN_APPS depends on EXAMPLES_TCPECHO && !NSH_NETINIT
config EXAMPLES_TCPECHO_IPADDR config EXAMPLES_TCPECHO_IPADDR
hex "Target IP address" hex "Target IP address"
default 0x0a000002 default 0x0a000002
depends on EXAMPLES_TCPECHO && !NSH_BUILTIN_APPS && !EXAMPLES_TCPECHO_DHCPC depends on EXAMPLES_TCPECHO && !NSH_NETINIT && !EXAMPLES_TCPECHO_DHCPC
config EXAMPLES_TCPECHO_DRIPADDR config EXAMPLES_TCPECHO_DRIPADDR
hex "Default Router IP address (Gateway)" hex "Default Router IP address (Gateway)"
default 0x0a000001 default 0x0a000001
depends on EXAMPLES_TCPECHO && !NSH_BUILTIN_APPS depends on EXAMPLES_TCPECHO && !NSH_NETINIT
config EXAMPLES_TCPECHO_NETMASK config EXAMPLES_TCPECHO_NETMASK
hex "Network Mask" hex "Network Mask"
default 0xffffff00 default 0xffffff00
depends on EXAMPLES_TCPECHO && !NSH_BUILTIN_APPS depends on EXAMPLES_TCPECHO && !NSH_NETINITd

View File

@ -102,7 +102,7 @@ static int tcpecho_netsetup()
* network has already been configured by NSH's start-up logic. * network has already been configured by NSH's start-up logic.
*/ */
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_NETINIT
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLES_TCPECHO_DHCPC) || defined(CONFIG_EXAMPLES_TCPECHO_NOMAC) #if defined(CONFIG_EXAMPLES_TCPECHO_DHCPC) || defined(CONFIG_EXAMPLES_TCPECHO_NOMAC)
uint8_t mac[IFHWADDRLEN]; uint8_t mac[IFHWADDRLEN];
@ -193,7 +193,7 @@ static int tcpecho_netsetup()
printf("IP: %s\n", inet_ntoa(ds.ipaddr)); printf("IP: %s\n", inet_ntoa(ds.ipaddr));
#endif /* CONFIG_EXAMPLES_TCPECHO_DHCPC */ #endif /* CONFIG_EXAMPLES_TCPECHO_DHCPC */
#endif /* CONFIG_NSH_BUILTIN_APPS */ #endif /* CONFIG_NSH_NETINIT */
return OK; return OK;
} }

View File

@ -29,11 +29,8 @@ config EXAMPLES_TOUCHSCREEN_DEVPATH
config EXAMPLES_TOUCHSCREEN_NSAMPLES config EXAMPLES_TOUCHSCREEN_NSAMPLES
int "Number of samples" int "Number of samples"
default 0 default 0
depends on !NSH_BUILTIN_APPS
---help--- ---help---
If NSH_BUILTIN_APPS is defined, then the number of touchscreen This number of samples is collected and the program.
samples is provided on the command line and this value is ignored.
Otherwise, this number of samples is collected and the program
terminates. Default: Zero (Samples are collected indefinitely). terminates. Default: Zero (Samples are collected indefinitely).
config EXAMPLES_TOUCHSCREEN_MOUSE config EXAMPLES_TOUCHSCREEN_MOUSE

View File

@ -46,18 +46,14 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* CONFIG_NSH_BUILTIN_APPS - Build the touchscreen test as /* CONFIG_EXAMPLES_TOUCHSCREEN_MINOR - The minor device number. Minor=N
* an NSH built-in function. Default: Built as a standalone program
* CONFIG_EXAMPLES_TOUCHSCREEN_MINOR - The minor device number. Minor=N
* corresponds to touchscreen device /dev/input0. Note this value must * corresponds to touchscreen device /dev/input0. Note this value must
* with CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH. Default 0. * with CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH. Default 0.
* CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen * CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen
* device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR. * device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR.
* Default: "/dev/input0" * Default: "/dev/input0"
* CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS * CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - This number of samples is collected
* is defined, then the number of samples is provided on the command line * and the program terminates. Default: Zero (Samples are collected
* and this value is ignored. Otherwise, this number of samples is
* collected and the program terminates. Default: Zero (Samples are collected
* indefinitely). * indefinitely).
* CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE - The touchscreen test can also be * CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE - The touchscreen test can also be
* configured to work with a mouse driver by setting this option. * configured to work with a mouse driver by setting this option.

View File

@ -96,9 +96,7 @@ int main(int argc, FAR char *argv[])
struct touch_sample_s sample; struct touch_sample_s sample;
#endif #endif
ssize_t nbytes; ssize_t nbytes;
#if defined(CONFIG_NSH_BUILTIN_APPS) || CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES > 0
long nsamples; long nsamples;
#endif
int fd; int fd;
int errval = 0; int errval = 0;
@ -106,16 +104,12 @@ int main(int argc, FAR char *argv[])
* samples that we collect before returning. Otherwise, we never return * samples that we collect before returning. Otherwise, we never return
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS) nsamples = CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES;
nsamples = 1;
if (argc > 1) if (argc > 1)
{ {
nsamples = strtol(argv[1], NULL, 10); nsamples = strtol(argv[1], NULL, 10);
} }
printf("tc_main: nsamples: %d\n", nsamples); printf("tc_main: nsamples: %d\n", nsamples);
#elif CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES > 0
printf("tc_main: nsamples: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES);
#endif
/* Open the touchscreen device for reading */ /* Open the touchscreen device for reading */
@ -133,13 +127,7 @@ int main(int argc, FAR char *argv[])
* touchscreen samples. * touchscreen samples.
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS)
for (; nsamples > 0; nsamples--)
#elif CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES > 0
for (nsamples = 0; nsamples < CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES; nsamples++)
#else
for (;;) for (;;)
#endif
{ {
/* Flush any output before the loop entered or from the previous pass /* Flush any output before the loop entered or from the previous pass
* through the loop. * through the loop.
@ -231,6 +219,11 @@ int main(int argc, FAR char *argv[])
printf(" pressure : %d\n", sample.point[0].pressure); printf(" pressure : %d\n", sample.point[0].pressure);
} }
#endif #endif
if (nsamples && --nsamples <= 0)
{
break;
}
} }
errout_with_dev: errout_with_dev:

View File

@ -57,8 +57,8 @@ endchoice # IP Domain
config EXAMPLES_UDPBLASTER_INIT config EXAMPLES_UDPBLASTER_INIT
bool "Initialize network" bool "Initialize network"
default n if NSH_BUILTIN_APPS default n if NSH_NETINIT
default y if !NSH_BUILTIN_APPS default y if !NSH_NETINIT
depends on !EXAMPLES_UDPBLASTER_LOOPBACK depends on !EXAMPLES_UDPBLASTER_LOOPBACK
---help--- ---help---
Include logic to initialize the network. This should not be done if Include logic to initialize the network. This should not be done if

View File

@ -97,7 +97,7 @@
int main(int argc, FAR char *argv[]) int main(int argc, FAR char *argv[])
{ {
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_NETINIT
/* We are running standalone (as opposed to a NSH built-in app). Therefore /* We are running standalone (as opposed to a NSH built-in app). Therefore
* we need to initialize the network before we start. * we need to initialize the network before we start.
*/ */
@ -186,7 +186,7 @@ int main(int argc, FAR char *argv[])
printf("IP: %s\n", inet_ntoa(ds.ipaddr)); printf("IP: %s\n", inet_ntoa(ds.ipaddr));
} }
#endif #endif
#endif /* CONFIG_NSH_BUILTIN_APPS */ #endif /* CONFIG_NSH_NETINIT */
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
printf("Starting webserver\n"); printf("Starting webserver\n");
@ -197,7 +197,6 @@ int main(int argc, FAR char *argv[])
httpd_listen(); httpd_listen();
#endif #endif
#ifndef CONFIG_NSH_BUILTIN_APPS
/* We are running standalone (as opposed to a NSH built-in app). Therefore /* We are running standalone (as opposed to a NSH built-in app). Therefore
* we should not exit after httpd failure. * we should not exit after httpd failure.
*/ */
@ -208,7 +207,6 @@ int main(int argc, FAR char *argv[])
printf("webserver_main: Still running\n"); printf("webserver_main: Still running\n");
fflush(stdout); fflush(stdout);
} }
#endif /* CONFIG_NSH_BUILTIN_APPS */
return 0; return 0;
} }

View File

@ -21,26 +21,26 @@ config EXAMPLES_XMLRPC_BUFFERSIZE
config EXAMPLES_XMLRPC_DHCPC config EXAMPLES_XMLRPC_DHCPC
bool "DHCP Client" bool "DHCP Client"
default n default n
depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS depends on EXAMPLES_XMLRPC && !NSH_NETINIT
select NETUTILS_DHCPC select NETUTILS_DHCPC
select NETDB_DNSCLIENT select NETDB_DNSCLIENT
config EXAMPLES_XMLRPC_NOMAC config EXAMPLES_XMLRPC_NOMAC
bool "Use Canned MAC Address" bool "Use Canned MAC Address"
default n default n
depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS depends on EXAMPLES_XMLRPC && !NSH_NETINIT
config EXAMPLES_XMLRPC_IPADDR config EXAMPLES_XMLRPC_IPADDR
hex "Target IP address" hex "Target IP address"
default 0x0a000002 default 0x0a000002
depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS && !EXAMPLES_XMLRPC_DHCPC depends on EXAMPLES_XMLRPC && !NSH_NETINIT && !EXAMPLES_XMLRPC_DHCPC
config EXAMPLES_XMLRPC_DRIPADDR config EXAMPLES_XMLRPC_DRIPADDR
hex "Default Router IP address (Gateway)" hex "Default Router IP address (Gateway)"
default 0x0a000001 default 0x0a000001
depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS depends on EXAMPLES_XMLRPC && !NSH_NETINIT
config EXAMPLES_XMLRPC_NETMASK config EXAMPLES_XMLRPC_NETMASK
hex "Network Mask" hex "Network Mask"
default 0xffffff00 default 0xffffff00
depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS depends on EXAMPLES_XMLRPC && !NSH_NETINIT

View File

@ -268,7 +268,7 @@ static int xmlrpc_netinit(void)
* has already been configured by NSH's start-up logic. * has already been configured by NSH's start-up logic.
*/ */
#ifndef CONFIG_NSH_BUILTIN_APPS #ifndef CONFIG_NSH_NETINIT
struct in_addr addr; struct in_addr addr;
#if defined(CONFIG_EXAMPLES_XMLRPC_DHCPC) || defined(CONFIG_EXAMPLES_XMLRPC_NOMAC) #if defined(CONFIG_EXAMPLES_XMLRPC_DHCPC) || defined(CONFIG_EXAMPLES_XMLRPC_NOMAC)
uint8_t mac[IFHWADDRLEN]; uint8_t mac[IFHWADDRLEN];
@ -355,7 +355,7 @@ static int xmlrpc_netinit(void)
} }
#endif /* CONFIG_EXAMPLES_XMLRPC_DHCPC */ #endif /* CONFIG_EXAMPLES_XMLRPC_DHCPC */
#endif /* CONFIG_NSH_BUILTIN_APPS */ #endif /* CONFIG_NSH_NETINIT */
return OK; return OK;
} }

View File

@ -58,7 +58,7 @@ config TWM4NX_NETINIT
default y default y
depends on NET depends on NET
select NETUTILS_NETINIT select NETUTILS_NETINIT
depends on !NSH_ARCHINIT depends on !NSH_NETINIT
---help--- ---help---
This option enables/disables all network initialization in Twm4Nx. This option enables/disables all network initialization in Twm4Nx.

View File

@ -115,10 +115,8 @@
struct cdcacm_state_s struct cdcacm_state_s
{ {
/* This is the handle that references to this particular USB CDC/ACM driver /* This is the handle that references to this particular USB CDC/ACM driver
* instance. It is only needed if the USB CDC/ACM device add-on is * instance. The value of the driver handle must be remembered between the
* built using CONFIG_NSH_BUILTIN_APPS. In this case, the value * 'sercon' and 'msdis' commands.
* of the driver handle must be remembered between the 'sercon' and 'msdis'
* commands.
*/ */
FAR void *handle; FAR void *handle;

View File

@ -55,8 +55,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* CONFIG_NSH_BUILTIN_APPS - Build the tools as an NSH built-in command /* CONFIG_I2CTOOL_MINBUS - Smallest bus index supported by the hardware (default 0).
* CONFIG_I2CTOOL_MINBUS - Smallest bus index supported by the hardware (default 0).
* CONFIG_I2CTOOL_MAXBUS - Largest bus index supported by the hardware (default 3) * CONFIG_I2CTOOL_MAXBUS - Largest bus index supported by the hardware (default 3)
* CONFIG_I2CTOOL_MINADDR - Minium device address (default: 0x03) * CONFIG_I2CTOOL_MINADDR - Minium device address (default: 0x03)
* CONFIG_I2CTOOL_MAXADDR - Largest device address (default: 0x77) * CONFIG_I2CTOOL_MAXADDR - Largest device address (default: 0x77)

View File

@ -82,7 +82,6 @@ static int g_samples = 1;
* Name: lm75_help * Name: lm75_help
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void lm75_help(void) static void lm75_help(void)
{ {
printf("Usage: temp [OPTIONS]\n"); printf("Usage: temp [OPTIONS]\n");
@ -90,13 +89,11 @@ static void lm75_help(void)
"Default: 1 Current: %d\n", g_samples); "Default: 1 Current: %d\n", g_samples);
printf(" [-h] shows this message and exits\n"); printf(" [-h] shows this message and exits\n");
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_string * Name: arg_string
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value) static int arg_string(FAR char **arg, FAR char **value)
{ {
FAR char *ptr = *arg; FAR char *ptr = *arg;
@ -112,13 +109,11 @@ static int arg_string(FAR char **arg, FAR char **value)
return 1; return 1;
} }
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: arg_decimal * Name: arg_decimal
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR long *value) static int arg_decimal(FAR char **arg, FAR long *value)
{ {
FAR char *string; FAR char *string;
@ -128,13 +123,11 @@ static int arg_decimal(FAR char **arg, FAR long *value)
*value = strtol(string, NULL, 10); *value = strtol(string, NULL, 10);
return ret; return ret;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: parse_args * Name: parse_args
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(int argc, FAR char **argv) static void parse_args(int argc, FAR char **argv)
{ {
FAR char *ptr; FAR char *ptr;
@ -176,7 +169,6 @@ static void parse_args(int argc, FAR char **argv)
} }
} }
} }
#endif
/**************************************************************************** /****************************************************************************
@ -228,9 +220,7 @@ int main(int argc, FAR char *argv[])
/* Parse the command line */ /* Parse the command line */
#ifdef CONFIG_NSH_BUILTIN_APPS
parse_args(argc, argv); parse_args(argc, argv);
#endif
for (i = 0; i < g_samples; i++) for (i = 0; i < g_samples; i++)
{ {

View File

@ -6,7 +6,7 @@
menuconfig SYSTEM_USBMSC menuconfig SYSTEM_USBMSC
tristate "USB Mass Storage Device Commands" tristate "USB Mass Storage Device Commands"
default n default n
depends on LIB_BOARDCTL && USBMSC && !KERNEL_BUILD depends on LIB_BOARDCTL && USBMSC && !BUILD_PROTECTED && !BUILD_KERNEL
select BOARDCTL_USBDEVCTRL select BOARDCTL_USBDEVCTRL
---help--- ---help---
Enable the USB mass storage class controls. These controls include: Enable the USB mass storage class controls. These controls include:

View File

@ -97,19 +97,14 @@
* order to avoid name collisions. * order to avoid name collisions.
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_SYSTEM_USBMSC_DEBUGMM)
struct usbmsc_state_s struct usbmsc_state_s
{ {
/* This is the handle that references to this particular USB storage driver /* This is the handle that references to this particular USB storage driver
* instance. It is only needed if the USB mass storage device add-on is * instance. The value of the driver handle must be remembered between the
* built using CONFIG_NSH_BUILTIN_APPS. In this case, the value * 'msconn' and 'msdis' commands.
* of the driver handle must be remembered between the 'msconn' and 'msdis'
* commands.
*/ */
#ifdef CONFIG_NSH_BUILTIN_APPS
FAR void *mshandle; FAR void *mshandle;
#endif
/* Heap usage samples. These are useful for checking USB storage memory /* Heap usage samples. These are useful for checking USB storage memory
* usage and for tracking down memoryh leaks. * usage and for tracking down memoryh leaks.
@ -121,7 +116,6 @@ struct usbmsc_state_s
struct mallinfo mmcurrent; /* The current memory usage sample */ struct mallinfo mmcurrent; /* The current memory usage sample */
#endif #endif
}; };
#endif
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
@ -131,9 +125,7 @@ struct usbmsc_state_s
* order to avoid name collisions. * order to avoid name collisions.
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_SYSTEM_USBMSC_DEBUGMM)
extern struct usbmsc_state_s g_usbmsc; extern struct usbmsc_state_s g_usbmsc;
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions

View File

@ -102,9 +102,7 @@
* order to avoid name collisions. * order to avoid name collisions.
*/ */
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_SYSTEM_USBMSC_DEBUGMM)
struct usbmsc_state_s g_usbmsc; struct usbmsc_state_s g_usbmsc;
#endif
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@ -445,7 +443,6 @@ int main(int argc, FAR char *argv[])
* called re-entrantly. * called re-entrantly.
*/ */
#ifdef CONFIG_NSH_BUILTIN_APPS
/* Check if there is a non-NULL USB mass storage device handle (meaning that the /* Check if there is a non-NULL USB mass storage device handle (meaning that the
* USB mass storage device is already configured). * USB mass storage device is already configured).
*/ */
@ -455,7 +452,6 @@ int main(int argc, FAR char *argv[])
printf("mcsonn_main: ERROR: Already connected\n"); printf("mcsonn_main: ERROR: Already connected\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#endif
#ifdef CONFIG_SYSTEM_USBMSC_DEBUGMM #ifdef CONFIG_SYSTEM_USBMSC_DEBUGMM
# ifdef CONFIG_CAN_PASS_STRUCTS # ifdef CONFIG_CAN_PASS_STRUCTS
@ -571,17 +567,22 @@ int main(int argc, FAR char *argv[])
check_test_memory_usage("After usbmsc_exportluns()"); check_test_memory_usage("After usbmsc_exportluns()");
/* It this program was configured as an NSH command, then just exit now. */ /* Return the USB mass storage device handle so it can be used by the 'msconn'
* command.
*/
#ifndef CONFIG_NSH_BUILTIN_APPS printf("mcsonn_main: Connected\n");
/* Otherwise, this thread will hang around and monitor the USB storage activity */ g_usbmsc.mshandle = handle;
check_test_memory_usage("After MS connection");
#ifdef CONFIG_SYSTEM_USBMSC_TRACE
/* This thread will hang around and monitor the USB storage activity */
for (; ; ) for (; ; )
{ {
fflush(stdout); fflush(stdout);
sleep(5); sleep(5);
# ifdef CONFIG_SYSTEM_USBMSC_TRACE
printf("\nmcsonn_main: USB TRACE DATA:\n"); printf("\nmcsonn_main: USB TRACE DATA:\n");
ret = usbtrace_enumerate(usbmsc_enumerate, NULL); ret = usbtrace_enumerate(usbmsc_enumerate, NULL);
if (ret < 0) if (ret < 0)
@ -592,19 +593,7 @@ int main(int argc, FAR char *argv[])
} }
check_test_memory_usage("After usbtrace_enumerate()"); check_test_memory_usage("After usbtrace_enumerate()");
# else
printf("mcsonn_main: Still alive\n");
# endif
} }
#else
/* Return the USB mass storage device handle so it can be used by the 'msconn'
* command.
*/
printf("mcsonn_main: Connected\n");
g_usbmsc.mshandle = handle;
check_test_memory_usage("After MS connection");
#endif #endif
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -8,8 +8,7 @@ config TESTING_SMART_TEST
default n default n
---help--- ---help---
Performs a file-based test on a SMART (or any) filesystem. Validates Performs a file-based test on a SMART (or any) filesystem. Validates
seek, append and seek-with-write operations. This test can be built seek, append and seek-with-write operations.
only as an NSH command
if TESTING_SMART_TEST if TESTING_SMART_TEST
endif endif

View File

@ -128,93 +128,6 @@ static struct i8shark_state_s g_i8shark;
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: i8shark_help
****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void i8shark_help(void)
{
printf("Usage: i8shark ![interface] [OPTIONS]\n");
printf("\nArguments are \"sticky\".\n");
printf("\nInterface only needs to be specified the first time\n");
printf("OPTIONS include:\n");
printf(" [-h] shows this message and exits\n");
}
#endif
/****************************************************************************
* Name: arg_string
****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_string(FAR char **arg, FAR char **value)
{
FAR char *ptr = *arg;
if (ptr[2] == '\0')
{
*value = arg[1];
return 2;
}
else
{
*value = &ptr[2];
return 1;
}
}
#endif
/****************************************************************************
* Name: arg_decimal
****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static int arg_decimal(FAR char **arg, FAR long *value)
{
FAR char *string;
int ret;
ret = arg_string(arg, &string);
*value = strtol(string, NULL, 10);
return ret;
}
#endif
/****************************************************************************
* Name: parse_args
****************************************************************************/
#ifdef CONFIG_NSH_BUILTIN_APPS
static void parse_args(FAR struct i8shark_state_s *i8shark, int argc, FAR char **argv)
{
FAR char *ptr;
int index;
for (index = 1; index < argc; )
{
ptr = argv[index];
if (ptr[0] != '-')
{
printf("Invalid options format: %s\n", ptr);
exit(0);
}
switch (ptr[1])
{
case 'h':
i8shark_help();
exit(0);
default:
printf("Unsupported option: %s\n", ptr);
i8shark_help();
exit(1);
}
}
}
#endif
/**************************************************************************** /****************************************************************************
* Name: i8shark_init * Name: i8shark_init
****************************************************************************/ ****************************************************************************/