mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 23:03:34 +08:00
@@ -675,8 +675,8 @@ examples/mount
|
||||
when CONFIG_EXAMPLES_MOUNT_DEVNAME is not defined. The
|
||||
default is zero (meaning that "/dev/ram0" will be used).
|
||||
|
||||
examples/netttest
|
||||
^^^^^^^^^^^^^^^^^
|
||||
examples/nettest
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This is a simple network test for verifying client- and server-
|
||||
functionality in a TCP/IP connection.
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -82,7 +82,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -299,11 +299,11 @@ static void show_buttons(uint8_t oldset, uint8_t newset)
|
||||
state = "released";
|
||||
}
|
||||
|
||||
/* Use lib_lowprintf() because we make be executing from an
|
||||
/* Use lowsyslog() because we make be executing from an
|
||||
* interrupt handler.
|
||||
*/
|
||||
|
||||
lib_lowprintf(" %s %s\n", g_buttoninfo[BUTTON_INDEX(i)].name, state);
|
||||
lowsyslog(" %s %s\n", g_buttoninfo[BUTTON_INDEX(i)].name, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,8 +313,8 @@ static void button_handler(int id, int irq)
|
||||
{
|
||||
uint8_t newset = up_buttons();
|
||||
|
||||
lib_lowprintf("IRQ:%d Button %d:%s SET:%02x:\n",
|
||||
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
|
||||
lowsyslog("IRQ:%d Button %d:%s SET:%02x:\n",
|
||||
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
|
||||
show_buttons(g_oldset, newset);
|
||||
g_oldset = newset;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ int buttons_main(int argc, char *argv[])
|
||||
{
|
||||
maxbuttons = strtol(argv[1], NULL, 10);
|
||||
}
|
||||
lib_lowprintf("maxbuttons: %d\n", maxbuttons);
|
||||
lowsyslog("maxbuttons: %d\n", maxbuttons);
|
||||
#endif
|
||||
|
||||
/* Initialize the button GPIOs */
|
||||
@@ -423,11 +423,11 @@ int buttons_main(int argc, char *argv[])
|
||||
{
|
||||
xcpt_t oldhandler = up_irqbutton(i, g_buttoninfo[BUTTON_INDEX(i)].handler);
|
||||
|
||||
/* Use lib_lowprintf() for compatibility with interrrupt handler output. */
|
||||
/* Use lowsyslog() for compatibility with interrrupt handler output. */
|
||||
|
||||
lib_lowprintf("Attached handler at %p to button %d [%s], oldhandler:%p\n",
|
||||
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
|
||||
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
|
||||
lowsyslog("Attached handler at %p to button %d [%s], oldhandler:%p\n",
|
||||
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
|
||||
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
|
||||
|
||||
/* Some hardware multiplexes different GPIO button sources to the same
|
||||
* physical interrupt. If we register multiple such multiplexed button
|
||||
@@ -438,9 +438,9 @@ int buttons_main(int argc, char *argv[])
|
||||
|
||||
if (oldhandler != NULL)
|
||||
{
|
||||
lib_lowprintf("WARNING: oldhandler:%p is not NULL! "
|
||||
"Button events may be lost or aliased!\n",
|
||||
oldhandler);
|
||||
lowsyslog("WARNING: oldhandler:%p is not NULL! "
|
||||
"Button events may be lost or aliased!\n",
|
||||
oldhandler);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -468,11 +468,11 @@ int buttons_main(int argc, char *argv[])
|
||||
|
||||
flags = irqsave();
|
||||
|
||||
/* Use lib_lowprintf() for compatibility with interrrupt handler
|
||||
/* Use lowsyslog() for compatibility with interrrupt handler
|
||||
* output.
|
||||
*/
|
||||
|
||||
lib_lowprintf("POLL SET:%02x:\n", newset);
|
||||
lowsyslog("POLL SET:%02x:\n", newset);
|
||||
show_buttons(g_oldset, newset);
|
||||
g_oldset = newset;
|
||||
irqrestore(flags);
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -97,7 +97,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||
# define message(...) lowsyslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -120,7 +120,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_lowprintf
|
||||
# define message lowsyslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -43,8 +43,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/init.h>
|
||||
|
||||
#include "ostest.h"
|
||||
@@ -264,6 +267,31 @@ static int user_main(int argc, char *argv[])
|
||||
}
|
||||
check_test_memory_usage();
|
||||
|
||||
/* If retention of child status is enable, then suppress it for this task.
|
||||
* This task may produce many, many children (especially if
|
||||
* CONFIG_EXAMPLES_OSTEST_LOOPS) and it does not harvest their exit status.
|
||||
* As a result, the test may fail inappropriately unless retention of
|
||||
* child exit status is disabled.
|
||||
*
|
||||
* So basically, this tests that child status can be disabled, but cannot
|
||||
* verify that status is retained correctly.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS)
|
||||
{
|
||||
struct sigaction sa;
|
||||
int ret;
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sa.sa_flags = SA_NOCLDWAIT;
|
||||
ret = sigaction(SIGCHLD, &sa, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("user_main: ERROR: sigaction failed: %d\n", errno);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check environment variables */
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
show_environment(true, true, true);
|
||||
|
||||
@@ -113,14 +113,14 @@ static void waitpid_last(void)
|
||||
printf("waitpid_last: ERROR: PID %d waitpid failed: %d\n",
|
||||
g_waitpids[NCHILDREN-1], errcode);
|
||||
}
|
||||
else if (stat_loc != RETURN_STATUS)
|
||||
else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
|
||||
{
|
||||
printf("waitpid_last: ERROR: PID %d return status is %d, expected %d\n",
|
||||
g_waitpids[NCHILDREN-1], stat_loc, RETURN_STATUS);
|
||||
g_waitpids[NCHILDREN-1], WEXITSTATUS(stat_loc), RETURN_STATUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("waitpid_last: PID %d waitpid succeeded with stat_loc=%d\n",
|
||||
printf("waitpid_last: PID %d waitpid succeeded with stat_loc=%04x\n",
|
||||
g_waitpids[NCHILDREN-1], stat_loc);
|
||||
}
|
||||
}
|
||||
@@ -155,14 +155,14 @@ int waitpid_test(void)
|
||||
printf("waitpid_test: ERROR: PID %d wait returned PID %d\n",
|
||||
g_waitpids[0], ret);
|
||||
}
|
||||
else if (stat_loc != RETURN_STATUS)
|
||||
else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
|
||||
{
|
||||
printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n",
|
||||
g_waitpids[0], stat_loc, RETURN_STATUS);
|
||||
g_waitpids[0], WEXITSTATUS(stat_loc), RETURN_STATUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("waitpid_test: PID %d waitpid succeeded with stat_loc=%d\n",
|
||||
printf("waitpid_test: PID %d waitpid succeeded with stat_loc=%04x\n",
|
||||
g_waitpids[0], stat_loc);
|
||||
}
|
||||
|
||||
@@ -246,14 +246,14 @@ int waitpid_test(void)
|
||||
int errcode = errno;
|
||||
printf("waitpid_test: ERROR: wait failed: %d\n", errcode);
|
||||
}
|
||||
else if (stat_loc != RETURN_STATUS)
|
||||
else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
|
||||
{
|
||||
printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n",
|
||||
ret, stat_loc, RETURN_STATUS);
|
||||
ret, WEXITSTATUS(stat_loc), RETURN_STATUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("waitpid_test: PID %d wait succeeded with stat_loc=%d\n",
|
||||
printf("waitpid_test: PID %d wait succeeded with stat_loc=%04x\n",
|
||||
ret, stat_loc);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,26 @@
|
||||
config EXAMPLES_POLL
|
||||
bool "Poll example"
|
||||
default n
|
||||
depends on !NSH_BUILTIN_APPS
|
||||
---help---
|
||||
Enable the poll example
|
||||
|
||||
if EXAMPLES_POLL
|
||||
|
||||
config EXAMPLES_POLL_NOMAC
|
||||
bool "Use Canned MAC Address"
|
||||
default n
|
||||
|
||||
config EXAMPLES_POLL_IPADDR
|
||||
hex "Target IP address"
|
||||
default 0x0a000002
|
||||
|
||||
config EXAMPLES_POLL_DRIPADDR
|
||||
hex "Default Router IP address (Gateway)"
|
||||
default 0x0a000001
|
||||
|
||||
config EXAMPLES_POLL_NETMASK
|
||||
hex "Network Mask"
|
||||
default 0xffffff00
|
||||
|
||||
endif
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
# undef HAVE_NETPOLL
|
||||
#endif
|
||||
|
||||
/* If debug is enabled, then use lib_rawprintf so that OS debug output and
|
||||
/* If debug is enabled, then use syslog so that OS debug output and
|
||||
* the test output are synchronized.
|
||||
*
|
||||
* These macros will differ depending upon if the toolchain supports
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -88,7 +88,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -100,7 +100,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -85,7 +85,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -97,7 +97,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
Reference in New Issue
Block a user