Merge remote-tracking branch 'origin/master' into ieee802154

This commit is contained in:
Gregory Nutt 2017-06-15 10:47:46 -06:00
commit e7409b3b16
33 changed files with 1121 additions and 82 deletions

View File

@ -558,7 +558,7 @@
* apps/netutils/discover: Added a runtime configuration for the
UDP discover utility. From Max Holtzberg (2013-5-21).
* apps/examples/tcpecho: Added a simple single threaded, poll based
TCP echo server based on W. Richard Stevens UNIX Network Programming
TCP echo server based on W. Richard Stevens UNIX Network Programming
Book. Contributed by Max Holtzberg (2013-5-22).
* apps/examples/slcd: Add an example for testing alphanumeric,
segment LCDs (2013-5-24).
@ -1867,4 +1867,217 @@
httpd_sendfile.c but It was not present in Kconfig menu. From Maciej
Wójcik (2017-03-05).
7.21 2017-xx-xx Gregory Nutt <gnutt@nuttx.org>
7.21 2017-06-05 Gregory Nutt <gnutt@nuttx.org>
* Add c++ platform/bambino-200e with C++ initialization. From Alan
Carvalho de Assis (2017-03-08).
* increase number of supported PWM channels from 4 to 6. From Andreas
Bihlmaier (2017-03-09).
* NSH library: In nsh_argexand(), if CONFIG_NSH_ARGCAT is defined but
CONFIG_NSH_CMDPARMS defined and/or CONFIG_DISABLE_ENVIRON not
defined, then there is a situation that causes an infinite loop in
the parser. Noted by Freddie Chopin (2017-03-09).
* apps/examples/hidkbd: Remove call to arch_usbhost_initialize().
That is violation of the OS interfacing rules and will no longer be
supported. USB host should be initialized as part of the normal
board bring-up logic as with any other devices and should not involve
illegal calls from applications into the OS (2017-03-09).
* apps/examples/usbterm: Removed because it is not very useful and
because it can be configured to use an illegal call into the OS
(2017-03-09).
* netutils/netlib: Add one wireless IOCTL wrapper. For now, this is
just a test to be sure that the wireless IOCTL definitions are in
place (2017-03-13).
* netutils/nshlib: Add wrapper to get the wireless ESSID (2017-03-13).
* Adds a test program for the XBox One controller driver (xbc_test).
From Brian Webb (2017-03-18).
* built-in libc defect workaround: replace '%6.6u' format with an
equivalent '%06u'. From Tomasz Wozniak (2017-03-21).
* Clicker-STM32: Add platform directory w/ C++ support (2017-03-22).
* examples/ostest: Add a test of robust mutexes (2017-03-26).
* examples/ostest: Robust mutex test needs to call
pthread_mutexattr_setrobust() (2017-03-27).
* Rename CONFIG_MUTEX_TYPES to CONFIG_PTHREAD_MUTEX_TYPES (2017-03-27).
* examples/mm: Fix Makefile. Built-in was not being registered
(2017-03-28).
* nshlib: fix building when CONFIG_NET_USRSOCK enabled with other
link-layer. From Jussi Kivilinna (2017-03-31).
* Add examples/usrsocktest application for USRSOCK testing. From Jussi
Kivilinna (2017-04-03).
* NSH: Fix some warnings about integer/pointer casts of different sizes
(probably only effects 64-bit simulation) (2017-04-03).
* examples/nettest: Trying to adapt to use for testing 6loWPAN
(2017-04-03).
* examples/nettest: If doing loopback, but not using the official
loopback device, then use the server should use the configured client
IP address (2017-04-04).
* Added support for set [{+|-}{e|x|xe|ex}] [<name> <value>]. Set the
'exit on error control' and/or 'print a trace' of commands when
parsing scripts in NSH. The settinngs are in effect from the point
of exection, until they are changed again, or in the case of the init
script, the settings are returned to the default settings when it
exits. Included child scripts will run with the parents settings and
changes made in the child script will effect the parent on return.
Use 'set -e' to enable and 'set +e' to disable (ignore) the exit
condition on commands. The default is -e. Errors cause script to
exit. Use 'set -x' to enable and 'set +x' to disable (silence)
printing a trace of the script commands as they are ececuted. The
default is +x. No printing of a trace of script commands as they are
executed. From David Sidrane (2017-04-05).
* Print expanded variables if -x. From David Sidrane (2017-04-05).
* examples/udpblaster: Several fixes to work with 6loWPAN (2017-04-06).
* examples/udpblaster: Add logic to bind the local UDP socket to a
well-known address (2017-04-06).
* 6loWPAN: Add network IOCTL support to set the node address
(2017-04-06).
* examples/ostest: Add tests for pthread_rwlock. Adding tests to be
used to verify the pthread_rwlock lock works. From Mark Schulte
(2017-04-07).
* Remove CONFIG_PTHREAD_RWLOCK. Rwlock interfaces built
unconditionally (2017-04-07).
* examples/ostest: pthread rwlock additional tests and bugfixes. From
Mark Schulte (2017-04-07).
* netutils: Add a helper function to convert a string to a 6loWPAN node
address (2017-04-08).
* NSH library: Extend ifconfig to support 6loWPAN. Adapt to some
changes in configuration variable usage (2017-04-08).
* NSH set command: Eliminate useless argc check of SCRIPTS are enabled
but ENVIRONMENT is disabled (2017-04-09).
* examples/ostest: additional test for rwlock and one for cancel
cleanup handlers. From Juha Niskanen (2017-04-10).
* wireless/wapi: Quick port of Wapi wireless services. No build
support yet. This also depends on features not supported by NuttX.
This is a work in progress (2017-04-10).
* wireless/wapi: Remove logic that depnds on Linux netlink. Add
(untested) build support (2017-04-10).
* wireless/wapi: Remove functionality that depends on the Linux
procfs: This includes only 1) listing of available interfaces and 2)
listing of all routes (2017-04-10).
* Beginning real design of wapi application based on Wapi sample code
(2017-04-10).
* wireless/wapi: Re-write of wapi tool UI (2017-04-11).
* examples/ostest: clarify when pthread clean-up test mutex need to
remain usable. From Juha Niskanen (2017-04-12).
* examples/hidkbd: Add some missing configuration settings (2017-04-18).
* NSH library: Fix open flags in nsh_codeccmd.c. From Masayuki
Ishikawa (2017-04-19).
* netlib and NSH: Add logic to set the IEEE802.15.4 PAN ID (2017-04-18).
* wireless/ieee802154: Starts framing out iwpan tool, similar in
concept to wapi. From Anthony Merlino (2017-04-20).
* ieee802154: Move non-radio files from libradio to libutils. Add
ieee802154_getpanid() (2017-04-21).
* wireless/ieee802154: Beginning of support for IEEE 802.15.4 MAC
library (2017-04-21).
* wireless/ieee802154/libmac: Finishes all defined MAC IOCTL helpers
(there are a few that are not defined) (2017-04-21).
* netlib: Get and/or set PAN ID of IEEE 802.15.4 radio (2017-04-21).
* wireless/ieee802154: libaudio and libmac need to return the correct
error codes (2017-04-22).
* nshlib: nsh_netcmds.c should include netlib.h even if neither TCP nor
UDP are enabled (2017-04-25).
* apps/wireless/wapi: Correct an error in dependency generation
(2017-04-25).
* examples: random: avoid stack overflows. From Juha Niskanen
(2017-04-26).
* wireless/wapi: Improve error reporting IOCTL failures (2017-04-26).
* I need to look at the registers that are at or around 0xe000ef90.
Using mw and xd, I see that nsh does not support pointers greater
than 0x7fffffff. A quick look at the source shows that the pointers
for those two commands are set with calls to strtol() rather than
strtoul(). Changing the two pointer-setting instances to strtoul()
fixes the problem, at least for my architecture/config. From Ian
McAfee (2017-04-26).
* NSH: Needs to include tftp.h if TFTP not disabled (2017-04-29).
* netutils/dhcpc: Make the network device name a configuration
option. Was hardcoded to eth0 but may, instead, need to be wlan0
(2017-05-02).
* nshlib/nsh_netinit.c: If IEEE802.11 selected use wlan0 instead of
eth0 for network device name (2017-05-02).
* wireless/wext: Add drivers_wext from the WPA supplicant; Integrate
into NSH. From Simon Piriou (2017-05-02).
* 6loWPAN: Replace some Rime address naming with more consistent
short/exended address terminology (2017-05-04).
* wireless/ieee802154: Removes libradio to coincide with removal of
ioctl with radio. Moves all functionality from libradio to libmac.
From Anthony Merlino (2017-05-05).
* wireless/wapi: wpa_driver_wext_associate() now accepts a
configuration parameter that can be used to specify the wireless
properties (2017-05-06).
* nshlib: NSH now has configuration options to select the
wireless properties. It builds the configuration structure and
passes this to wpa_driver_wext_associate() so that it will set the
network as configured (2017-05-06).
* Add platform files for nucleo-l452re and nucleo-l496zg. From Juha
Niskanen (2017-05-08).
* wireless/ieee802154: Adds rxonidle attribute helpers. From Anthony
Merlino (2017-05-08).
* wireless/ieee802154: Adds sniffer functionality back in to I8SAK
app. From Anthony Merlino (2017-05-08).
* NSH wireless setup: Move call to nsh_associate(). It should be
possible to associate with an AP when DHCPC is disabled (2017-05-09).
* Fix some calls to task_create(): argv[0] is the first parameter, not
the name of the task (2017-05-09).
* wireless/ieee802154: Restructures i8sak app and adds blaster
functionality. From Anthony Merlino (2017-05-09).
* examples/configdata: add stacksize and priority. From Juha Niskanen
(2017-05-10).
* Bitbucket Issue 5: I found an unexpected behavior in apps/
configuration generation. Adding external symbolic link in apps/
directory and using Make.defs for Kconfig generation, Kconfig file
has a wrong path in the source argument. It contains original dir
path outside of the source tree instead path to sub-directory in
apps/. The problem is connected with make/system symbolic link path
resolution. Corrected by a patch submitted by Artur Madrzak with
Issue 5 (2017-05-11).
* Bitbucket Issue 5, apps build system: The previous patch wasn't
complete, it was just idea how to resolve issue. Please, find
attached issue5.patch to resolve it. It can be applied on top current
apps/master. From Artur Madrzak (2017-05-12).
* Fix the new can.h header location. From Alan Carvalho de Assis
(2017-05-12).
* Fix libcanard github download link to get it compiling correctly.
From Alan Carvalho de Assis (2017-05-12).
* Fix to use the new canardInit() function. From Alan Carvalho de
Assis (2017-05-12).
* apps/platform: Create gnu/ subdirectory that contains the one and
only GNU C++ initialization function. Remove all other C++
initialization functions (2017-05-13).
* Move up_cxxinitialize() prototype from nuttx/include/nuttx/arch.h to
apps/include/platform/cxxinitialize.h (2017-05-13).
* apps/examples/nettest: Fix an error in pre-processor expression
(2017-05-13).
* wireless/ieee802154: i8sak adds event handling from MAC char driver.
From Anthony Merlino (2017-05-16).
* apps/examples/mtdpart: Prevent part array overflow. mtdpart examples
create partions and allocate from 1 index not a 0 index to part[]
array. This cause buffer overflow for part array. This change fixes
this problem. From EunBong Song (2017-05-17).
* apps/examples/can: Fix can example app to print data when
CONFIG_EXAMPLE_CAN_READ is defined. From Alan Carvalho de Assis
(2017-05-17).
* apps/: Make more globals static to avoid name clashes. From Juha
Niskanen (2017-05-19).
* Ensure netlib will not be broken when setip will not bring the
network up anymore. From Sebastien Lorquet (2017-05-19).
* DHCPC: Remove hard-coded interface device. Now passed as a parameter
to dhcpc_open(). From Sebastien Lorquet (2017-05-19).
* nshlib: Fix a resource leak in cmd_hexdump(). From Nobutaka
Toyoshima (2017-05-22).
* wapi: add basic wapi_event_stream_extract implementation. From Simon
Piriou (2017-05-21).
* apps/system/dhcpc: Add a command to renew or establish a lease on an
IPv4 address (2017-05-21).
* apps/system/ntpc: Add a command to start or stop the NTPC daemon
(2017-05-21).
* apps/system/dhcpc: Add missing argument of fprintf (2017-05-21).
* apps/nshlib: Add a new option CONFIG_NSH_NETLOCAL that will suppress
some built in operations and will support manual configuration of a
wireless network (2017-05-21).
* apps/system/ramtest: Make stacksize and priority conigurable
(2017-05-22).
* The dedicated windows tool at tools/mkkconfig.bat uses $APPSDIR,
which is not a windows shell variable, and is left uninitialized, but
in fact should be the current directory. From Sebastien Lorquet
(2017-05-22).
7.22 2017-xx-xx Gregory Nutt <gnutt@nuttx.org>

View File

@ -21,15 +21,15 @@ config EXAMPLES_BUTTONS_PROGNAME
program is installed.
config EXAMPLES_BUTTONS_PRIORITY
int "LED task priority"
int "Button task priority"
default 100
config EXAMPLES_BUTTONS_STACKSIZE
int "LED stack size"
int "Button stack size"
default 2048
config EXAMPLES_BUTTONS_DEVPATH
string "LED device path"
string "Button device path"
default "/dev/buttons"
config EXAMPLES_BUTTONS_NAMES

View File

@ -104,12 +104,12 @@ int main(int argc, char **argv)
// Tell MyThingSayer that "Hello, World!" is the string to be said
printf("main: Calling MyThingSayer->Initialize\n");;
printf("main: Calling MyThingSayer->Initialize\n");
MyThingSayer->Initialize("Hello, World!");
// Tell MyThingSayer to say the thing we told it to say
printf("main: Calling MyThingSayer->SayThing\n");;
printf("main: Calling MyThingSayer->SayThing\n");
MyThingSayer->SayThing();
// We should see the message from the destructor,
@ -118,6 +118,6 @@ int main(int argc, char **argv)
printf("main: Destroying MyThingSayer\n");
delete MyThingSayer;
printf("main: Returning\n");;
printf("main: Returning\n");
return 0;
}

View File

@ -114,12 +114,12 @@ int main(int argc, char **argv)
// Tell MyThingSayer that "Hello, World!" is the string to be said
printf("main: Calling MyThingSayer.Initialize\n");;
printf("main: Calling MyThingSayer.Initialize\n");
MyThingSayer.Initialize("Hello, World!");
// Tell MyThingSayer to say the thing we told it to say
printf("main: Calling MyThingSayer.SayThing\n");;
printf("main: Calling MyThingSayer.SayThing\n");
MyThingSayer.SayThing();
// We are finished, return. We should see the message from the
@ -127,6 +127,6 @@ int main(int argc, char **argv)
// message. That is proof that the C++ static destructor logic
// is working
printf("main: Returning. MyThingSayer should be destroyed\n");;
printf("main: Returning. MyThingSayer should be destroyed\n");
return 0;
}

View File

@ -800,7 +800,7 @@ static void ltdc_dma2d_fillarea(void)
active->vinfo.xres, active->vinfo.yres,
ltdc_color(&active->vinfo, LTDC_BLACK));
area.xpos = active->vinfo.xres/2;;
area.xpos = active->vinfo.xres/2;
area.ypos = active->vinfo.yres/2;
active->layer->fillarea(active->layer, &area,

View File

@ -1730,7 +1730,7 @@ FAR struct fb_cmap_s * ltdc_createcmap(uint16_t ncolors)
{
_err("ERROR: malloc() failed\n");
free(cmap);
return NULL;;
return NULL;
}
#ifdef CONFIG_FB_TRANSPARENCY

View File

@ -104,12 +104,12 @@ int main(int argc, char **argv)
// Tell MyThingSayer that "Hello, World!" is the string to be said
printf("main: Calling MyThingSayer->Initialize\n");;
printf("main: Calling MyThingSayer->Initialize\n");
MyThingSayer->Initialize("Hello, World!");
// Tell MyThingSayer to say the thing we told it to say
printf("main: Calling MyThingSayer->SayThing\n");;
printf("main: Calling MyThingSayer->SayThing\n");
MyThingSayer->SayThing();
// We should see the message from the destructor,
@ -118,6 +118,6 @@ int main(int argc, char **argv)
printf("main: Destroying MyThingSayer\n");
delete MyThingSayer;
printf("main: Returning\n");;
printf("main: Returning\n");
return 0;
}

View File

@ -114,12 +114,12 @@ int main(int argc, char **argv)
// Tell MyThingSayer that "Hello, World!" is the string to be said
printf("main: Calling MyThingSayer.Initialize\n");;
printf("main: Calling MyThingSayer.Initialize\n");
MyThingSayer.Initialize("Hello, World!");
// Tell MyThingSayer to say the thing we told it to say
printf("main: Calling MyThingSayer.SayThing\n");;
printf("main: Calling MyThingSayer.SayThing\n");
MyThingSayer.SayThing();
// We are finished, return. We should see the message from the
@ -127,6 +127,6 @@ int main(int argc, char **argv)
// message. That is proof that the C++ static destructor logic
// is working
printf("main: Returning. MyThingSayer should be destroyed\n");;
printf("main: Returning. MyThingSayer should be destroyed\n");
return 0;
}

View File

@ -131,7 +131,7 @@ void recv_server(void)
#else
server.sin_family = AF_INET;
server.sin_port = HTONS(PORTNO);
server.sin_addr.s_addr = HTONL(INADDR_ANY);;
server.sin_addr.s_addr = HTONL(INADDR_ANY);
addrlen = sizeof(struct sockaddr_in);
#endif

View File

@ -420,7 +420,7 @@ bool xMBASCIIReceiveFSM(void)
/* Reset the input buffers to store the frame. */
usRcvBufferPos = 0;;
usRcvBufferPos = 0;
eBytePos = BYTE_HIGH_NIBBLE;
eRcvState = STATE_RX_RCV;
}

View File

@ -144,7 +144,7 @@ eMBException eMBFuncReadCoils(uint8_t *pucFrame, uint16_t *usLen)
* buffer because they are still valid.
*/
*usLen += ucNBytes;;
*usLen += ucNBytes;
}
}
else

View File

@ -131,7 +131,7 @@ eMBException eMBFuncReadDiscreteInputs(uint8_t *pucFrame, uint16_t *usLen)
* buffer because they are still valid.
*/
*usLen += ucNBytes;;
*usLen += ucNBytes;
}
}
else

View File

@ -541,6 +541,7 @@ int dhcpc_request(FAR void *handle, FAR struct dhcpc_state *presult)
{
return ERROR;
}
retries++;
/* Get the ACK/NAK response to the REQUEST (or timeout) */

View File

@ -1009,10 +1009,34 @@ config NSH_NETINIT
if NSH_NETINIT
config NSH_NETLOCAL
bool "Local network initialization"
default n
---help---
If this option is selected, then NSH will only initialize the local
attributes of the network: The MAC address if needed and any IP
addresses as needed. More importantly, it will not do the following:
- It will not bring the network up. That can be done later with the
NSH ifup command.
- It will not associate any wireless devices to an access point.
- It will not attempt to obtain an IP address if DHCPC is selected.
This may be done later from the NSH command line with the
apps/system/dhcpc 'renew' command.
- It will not start the NTPC daemon. This may be done later from
the NSH command line with the apps/system/ntpc 'ntpcstart' command.
This option permits you to divide the network configuration into two
parts: The local configuration of the network device and the dynamic
configuration of the device in the network. This may be important in
an environment when, for example, you need to manually scan for
available access points and associate the wireless driver with an
access point.
config NSH_NETINIT_THREAD
bool "Network initialization thread"
default n
depends on !DISABLE_PTHREAD
depends on !DISABLE_PTHREAD && !NSH_NETLOCAL
---help---
NSH is brought up through a series of sequential initialization
steps. This includes networking. If the network is available on

View File

@ -74,9 +74,15 @@ endif
ifeq ($(CONFIG_NET),y)
CSRCS += nsh_netinit.c nsh_netcmds.c
ifeq ($(CONFIG_WIRELESS_WAPI),y)
ifeq ($(CONFIG_NSH_NETINIT),y)
ifneq ($(CONFIG_NSH_NETLOCAL),y)
CSRCS += nsh_associate.c
endif
endif
endif
ifeq ($(CONFIG_NET_ROUTE),y)
CSRCS += nsh_routecmds.c
endif

View File

@ -395,6 +395,7 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
buffer = (FAR uint8_t *)malloc(IOBUFFERSIZE);
if(buffer == NULL)
{
(void)close(fd);
nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "malloc", NSH_ERRNO);
return ERROR;
}

View File

@ -248,11 +248,12 @@ static void nsh_netinit_configure(void)
struct in_addr addr;
#endif
#if defined(CONFIG_NSH_DHCPC)
#if defined(CONFIG_NSH_DHCPC) && !defined(CONFIG_NSH_NETLOCAL)
FAR void *handle;
#endif
#if (defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_NOMAC)) && defined(HAVE_MAC)
#if (((defined(CONFIG_NSH_DHCPC) && !defined(CONFIG_NSH_NETLOCAL)) || \
defined(CONFIG_NSH_NOMAC)) && defined(HAVE_MAC))
#if defined(CONFIG_NET_ETHERNET)
uint8_t mac[IFHWADDRLEN];
#elif defined(CONFIG_NET_6LOWPAN)
@ -358,9 +359,10 @@ static void nsh_netinit_configure(void)
netlib_set_ipv4dnsaddr(&addr);
#endif
/* New versions of netlib_set_ipvXaddr will not bring the network up,
* So ensure the network is really up at this point.
*/
/* That completes the 'local' initialization of the network device. */
#ifndef CONFIG_NSH_NETLOCAL
/* Bring the network up. */
netlib_ifup("eth0");
@ -413,6 +415,7 @@ static void nsh_netinit_configure(void)
ntpc_start();
#endif
#endif /* CONFIG_NSH_NETLOCAL */
#endif /* NSH_HAVE_NETDEV */
ninfo("Exit\n");

View File

@ -52,26 +52,6 @@
#ifdef CONFIG_PLATFORM_CONFIGDATA
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Private Types
************************************************************************************/
/************************************************************************************
* Private Function Prototypes
************************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
@ -109,12 +89,12 @@ int platform_setconfig(enum config_data_e id, int instance,
FAR const uint8_t *configdata, size_t datalen)
{
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
FILE* fd;
FILE *fd;
#endif
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_PART
struct config_data_s config;
int ret;
int fd;
struct config_data_s config;
int ret;
int fd;
/* Try to open the /dev/config device file */
@ -127,10 +107,10 @@ int platform_setconfig(enum config_data_e id, int instance,
/* Setup structure for the SETCONFIG ioctl */
config.id = (enum config_data_e)id;
config.instance = instance;
config.id = (enum config_data_e)id;
config.instance = instance;
config.configdata = (FAR uint8_t *) configdata;
config.len = datalen;
config.len = datalen;
ret = ioctl(fd, CFGDIOC_SETCONFIG, (unsigned long) &config);
close(fd);
@ -144,11 +124,13 @@ int platform_setconfig(enum config_data_e id, int instance,
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
/* Save config data in a file on the filesystem. Try to open
* the file. */
* the file.
*/
if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "w+")) == NULL)
{
/* Error opening the file */
set_errno(ENOENT);
return -1;
}
@ -167,7 +149,6 @@ int platform_setconfig(enum config_data_e id, int instance,
return OK;
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
/* We are reading from a read-only system, so nothing to do. */
return OK;
@ -220,15 +201,17 @@ int platform_getconfig(enum config_data_e id, int instance,
FAR uint8_t *configdata, size_t datalen)
{
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
FILE* fd;
FILE *fd;
size_t bytes;
enum config_data_e saved_id;
int saved_instance;
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
static const uint8_t touch_cal_data[] = {
static const uint8_t touch_cal_data[] =
{
0x9a, 0x2f, 0x00, 0x00,
0x40, 0xbc, 0x69, 0xfe, 0x70, 0x2e, 0x00,
0x00, 0xb8, 0x2d, 0xdb, 0xff };
0x00, 0xb8, 0x2d, 0xdb, 0xff
};
#endif
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_PART
struct config_data_s config;
@ -256,14 +239,14 @@ int platform_getconfig(enum config_data_e id, int instance,
return ret;
#else /* CONFIG_MIKROE_STM32F4_CONFIGDATA_PART */
switch (id)
{
case CONFIGDATA_TSCALIBRATION:
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
/* Load config data fram a file on the filesystem. Try to open
* the file. */
* the file.
*/
if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "r")) == NULL)
{
@ -294,12 +277,7 @@ int platform_getconfig(enum config_data_e id, int instance,
fclose(fd);
return OK;
/* Save config data in a file on the filesystem */
return OK;
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
memcpy(configdata, touch_cal_data, datalen);
return OK;
@ -318,3 +296,4 @@ int platform_getconfig(enum config_data_e id, int instance,
}
#endif /* CONFIG_PLATFORM_CONFIGDATA */

11
system/dhcpc/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
/Make.dep
/.depend
/.built
/*.asm
/*.obj
/*.rel
/*.lst
/*.sym
/*.adb
/*.lib
/*.src

32
system/dhcpc/Kconfig Normal file
View File

@ -0,0 +1,32 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config SYSTEM_DHCPC
bool "DHCP Address Renewal"
default n
select NETUTILS_DHCPC
depends on NET_UDP && NET_BROADCAST && NET_IPv4 && NET_ETHERNET
---help---
Enble the DHCP client 'renew' command
if SYSTEM_DHCPC
config SYSTEM_DHCPC_PROGNAME
string "Program name"
default "renew"
depends on BUILD_KERNEL
---help---
This is the name of the program that will be use when the NSH ELF
program is installed.
config SYSTEM_DHCPC_PRIORITY
int "DHCPC task priority"
default 100
config SYSTEM_DHCPC_STACKSIZE
int "DHCPC stack size"
default 2048
endif

40
system/dhcpc/Make.defs Normal file
View File

@ -0,0 +1,40 @@
############################################################################
# apps/system/dhcpc/Make.defs
# Adds selected applications to apps/ build
#
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_SYSTEM_DHCPC),y)
CONFIGURED_APPS += system/dhcpc
endif

142
system/dhcpc/Makefile Normal file
View File

@ -0,0 +1,142 @@
############################################################################
# apps/system/dhcpc/Makefile
#
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# DHCPC address renewal built-in application info
CONFIG_SYSTEM_DHCPC_PRIORITY ?= SCHED_PRIORITY_DEFAULT
CONFIG_SYSTEM_DHCPC_STACKSIZE ?= 2048
APPNAME = renew
PRIORITY = $(CONFIG_SYSTEM_DHCPC_PRIORITY)
STACKSIZE = $(CONFIG_SYSTEM_DHCPC_STACKSIZE)
CONFIG_SYSTEM_DHCPC_PROGNAME ?= renew$(EXEEXT)
PROGNAME = $(CONFIG_SYSTEM_DHCPC_PROGNAME)
# DHCPC address renewal
ASRCS =
CSRCS =
MAINSRC = dhcpc_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifneq ($(CONFIG_BUILD_KERNEL),y)
OBJS += $(MAINOBJ)
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
ROOTDEPPATH = --dep-path .
# Common build
VPATH =
all: .built
.PHONY: clean depend distclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
else
install:
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else
context:
endif
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
.PHONY: preconfig
preconfig:

138
system/dhcpc/dhcpc_main.c Normal file
View File

@ -0,0 +1,138 @@
/****************************************************************************
* system/dhcpc/dhcpc_main.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdlib.h>
#include <stdio.h>
#include <net/if.h>
#include "netutils/netlib.h"
#include "netutils/dhcpc.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* dhcpc_showusage
****************************************************************************/
static void dhcpc_showusage(FAR const char *progname, int exitcode)
{
fprintf(stderr, "Usage: %s <device-name>\n", progname);
exit(exitcode);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* dhcpc_main
****************************************************************************/
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int dhcpc_main(int argc, char *argv[])
#endif
{
FAR const char *devname;
FAR void *handle;
uint8_t mac[IFHWADDRLEN];
struct dhcpc_state ds;
int ret;
/* One and only one argument is expected: The network device name. */
if (argc != 2)
{
fprintf(stderr, "ERROR: Invalid number of arguments\n");
dhcpc_showusage(argv[0], EXIT_FAILURE);
}
devname = argv[1];
/* Get the MAC address of the NIC */
netlib_getmacaddr(devname, mac);
/* Set up the DHCPC modules */
handle = dhcpc_open(devname, &mac, IFHWADDRLEN);
if (handle == NULL)
{
fprintf(stderr, "ERROR: dhcpc_open() for '%s' failed\n", devname);
return EXIT_FAILURE;
}
/* Get an IP address. */
ret = dhcpc_request(handle, &ds);
if (ret < 0)
{
(void)dhcpc_close(handle);
fprintf(stderr, "ERROR: dhcpc_request() failed\n");
return EXIT_FAILURE;
}
/* Save the addresses that we obtained. */
netlib_set_ipv4addr(devname, &ds.ipaddr);
if (ds.netmask.s_addr != 0)
{
netlib_set_ipv4netmask(devname, &ds.netmask);
}
if (ds.default_router.s_addr != 0)
{
netlib_set_dripv4addr(devname, &ds.default_router);
}
if (ds.dnsaddr.s_addr != 0)
{
netlib_set_ipv4dnsaddr(&ds.dnsaddr);
}
dhcpc_close(handle);
return EXIT_SUCCESS;
}

11
system/ntpc/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
/Make.dep
/.depend
/.built
/*.asm
/*.obj
/*.rel
/*.lst
/*.sym
/*.adb
/*.lib
/*.src

25
system/ntpc/Kconfig Normal file
View File

@ -0,0 +1,25 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config SYSTEM_NTPC
bool "NTP Daemon Commands"
default n
select NETUTILS_NTPCLIENT
depends on NET_UDP
---help---
Enble the NTP client 'start' and 'stop' commands
if SYSTEM_NTPC
config SYSTEM_NTPC_PRIORITY
int "NTPC task priority"
default 100
config SYSTEM_NTPC_STACKSIZE
int "NTPC stack size"
default 2048
endif

39
system/ntpc/Make.defs Normal file
View File

@ -0,0 +1,39 @@
############################################################################
# apps/system/ntpc/Make.defs
# Adds selected applications to apps/ build
#
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_SYSTEM_NTPC),y)
CONFIGURED_APPS += system/ntpc
endif

155
system/ntpc/Makefile Normal file
View File

@ -0,0 +1,155 @@
############################################################################
# apps/system/ntpc/Makefile
#
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# NTPC address renewal built-in application info
CONFIG_SYSTEM_NTPC_PRIORITY ?= SCHED_PRIORITY_DEFAULT
CONFIG_SYSTEM_NTPC_STACKSIZE ?= 2048
APPNAME1 = ntpstart
APPNAME2 = ntpstop
PRIORITY = $(CONFIG_SYSTEM_NTPC_PRIORITY)
STACKSIZE = $(CONFIG_SYSTEM_NTPC_STACKSIZE)
PROGNAME1 = ntpstart$(EXEEXT)
PROGNAME2 = ntpstop$(EXEEXT)
# NTPC address renewal
ASRCS =
CSRCS =
MAINSRC1 = ntpcstart_main.c
MAINSRC2 = ntpcstop_main.c
MAINSRC = $(MAINSRC1) $(MAINSRC2)
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ1 = $(MAINSRC1:.c=$(OBJEXT))
MAINOBJ2 = $(MAINSRC2:.c=$(OBJEXT))
MAINOBJ = $(MAINOBJ1) $(MAINOBJ2)
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifneq ($(CONFIG_BUILD_KERNEL),y)
OBJS += $(MAINOBJ)
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
ROOTDEPPATH = --dep-path .
# Common build
VPATH =
all: .built
.PHONY: clean depend distclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y)
$(BIN_DIR)$(DELIM)$(PROGNAME1): $(OBJS) $(MAINOBJ1)
@echo "LD: $(PROGNAME1)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME1) $(ARCHCRT0OBJ) $(MAINOBJ1) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME1)
$(BIN_DIR)$(DELIM)$(PROGNAME2): $(OBJS) $(MAINOBJ2)
@echo "LD: $(PROGNAME2)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME2) $(ARCHCRT0OBJ) $(MAINOBJ2) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME2)
install: $(BIN_DIR)$(DELIM)$(PROGNAME1) $(BIN_DIR)$(DELIM)$(PROGNAME2)
else
install:
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME1),$(PRIORITY),$(STACKSIZE),$(APPNAME1)_main)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME2),$(PRIORITY),$(STACKSIZE),$(APPNAME2)_main)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat
else
context:
endif
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
.PHONY: preconfig
preconfig:

View File

@ -0,0 +1,70 @@
/****************************************************************************
* system/ntpc/ntpcstart_main.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdlib.h>
#include <stdio.h>
#include "netutils/ntpclient.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* ntpcstart_main
****************************************************************************/
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int ntpcstart_main(int argc, char *argv[])
#endif
{
int pid = ntpc_start();
if (pid < 0)
{
fprintf(stderr, "ERROR: ntpc_start() failed\n");
return EXIT_FAILURE;
}
printf("Started the NTP daemon as PID=%d\n", pid);
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,70 @@
/****************************************************************************
* system/ntpc/ntpc_main.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdlib.h>
#include <stdio.h>
#include "netutils/ntpclient.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* ntpcstop_main
****************************************************************************/
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int ntpcstop_main(int argc, char *argv[])
#endif
{
int ret = ntpc_stop();
if (ret < 0)
{
fprintf(stderr, "ERROR: ntpc_stop() failed\n");
return EXIT_FAILURE;
}
printf("Stopped the NTP daemon\n");
return EXIT_SUCCESS;
}

View File

@ -8,3 +8,23 @@ config SYSTEM_RAMTEST
default n
---help---
Enable a simple RAM test.
if SYSTEM_RAMTEST
config SYSTEM_RAMTEST_PROGNAME
string "Program name"
default "ramtest"
depends on BUILD_KERNEL
---help---
This is the name of the program that will be use when the NSH ELF
program is installed.
config SYSTEM_RAMTEST_PRIORITY
int "RAM test task priority"
default 100
config SYSTEM_RAMTEST_STACKSIZE
int "RAM test stack size"
default 1024
endif

View File

@ -1,7 +1,7 @@
############################################################################
# apps/system/ramtest/Makefile
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -39,8 +39,15 @@ include $(APPDIR)/Make.defs
# RAM test
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 768
CONFIG_SYSTEM_RAMTEST_PRIORITY ?= SCHED_PRIORITY_DEFAULT
CONFIG_SYSTEM_RAMTEST_STACKSIZE ?= 1024
APPNAME = ramtest
PRIORITY = $(CONFIG_SYSTEM_RAMTEST_PRIORITY)
STACKSIZE = $(CONFIG_SYSTEM_RAMTEST_STACKSIZE)
CONFIG_SYSTEM_RAMTEST_PROGNAME ?= ramtest$(EXEEXT)
PROGNAME = $(CONFIG_SYSTEM_RAMTEST_PROGNAME)
ASRCS =
CSRCS =
@ -73,9 +80,6 @@ else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_XYZ_PROGNAME ?= ramtest$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
ROOTDEPPATH = --dep-path .
# Common build
@ -111,10 +115,10 @@ endif
# Register application
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)ramtest.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,"ramtest",$(PRIORITY),$(STACKSIZE),ramtest_main)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME).bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
context: $(BUILTIN_REGISTRY)$(DELIM)ramtest.bdat
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME).bdat
else
context:
endif

View File

@ -75,6 +75,9 @@ REM GOTO :End
REM )
)
REM Get the current directory
SET APPSDIR=%~dp0
Echo # > %kconfig%
Echo # For a description of the syntax of this configuration file, >> %kconfig%
Echo # see the file kconfig-language.txt in the NuttX tools repository. >> %kconfig%
@ -89,10 +92,9 @@ IF %menu% NEQ "" (
DIR /B /A:D >_tmp_.dat
Echo source "$APPSDIR/builtin/Kconfig" >> %kconfig%
FOR /F "tokens=*" %%s IN (_tmp_.dat) do (
IF EXIST %%s\Kconfig (
Echo source "$APPSDIR/%%s/Kconfig" >> %kconfig%
Echo source "%APPSDIR%/%%s/Kconfig" >> %kconfig%
)
)
DEL _tmp_.dat

View File

@ -224,7 +224,57 @@ static int wapi_event_stream_extract(FAR struct wapi_event_stream_s *stream,
{
#warning Missing logic
// return iw_extract_event_stream((struct stream_descr *)stream, iwe, 0);
return -ENOSYS;
int ret;
struct iw_event *iwe_stream;
if (stream->current + offsetof(struct iw_event, u) > stream->end)
{
/* Nothing to process */
return 0;
}
iwe_stream = (struct iw_event*)stream->current;
if (stream->current + iwe_stream->len > stream->end ||
iwe_stream->len < offsetof(struct iw_event, u))
{
return -1;
}
ret = 1;
switch (iwe_stream->cmd)
{
case SIOCGIWESSID:
case IWEVGENIE:
iwe->cmd = iwe_stream->cmd;
iwe->len = offsetof(struct iw_event, u) + sizeof(struct iw_point);
iwe->u.data.flags = iwe_stream->u.data.flags;
iwe->u.data.length = iwe_stream->u.data.length;
iwe->u.data.pointer = (FAR void*)(stream->current +
offsetof(struct iw_event, u) +
(unsigned long)iwe_stream->u.data.pointer);
break;
default:
if (iwe_stream->len > sizeof(*iwe))
{
WAPI_ERROR("Unhandled event size 0x%x %d\n", iwe_stream->cmd,
iwe_stream->len);
iwe->cmd = 0;
iwe->len = offsetof(struct iw_event, u);
break;
}
memcpy(iwe, iwe_stream, iwe_stream->len);
}
/* Update stream to next event */
stream->current += iwe_stream->len;
return ret;
}
/****************************************************************************
@ -1113,6 +1163,8 @@ alloc:
return -errcode;
}
printf("got %d bytes\n", wrq.u.data.length);
/* We have the results, process them. */
if (wrq.u.data.length)
@ -1125,7 +1177,8 @@ alloc:
{
/* Get the next event from the stream */
if ((ret = wapi_event_stream_extract(&stream, &iwe)) >= 0)
ret = wapi_event_stream_extract(&stream, &iwe);
if (ret > 0)
{
int eventret = wapi_scan_event(&iwe, aps);
if (eventret < 0)
@ -1133,7 +1186,7 @@ alloc:
ret = eventret;
}
}
else
else if (ret < 0)
{
WAPI_ERROR("ERROR: wapi_event_stream_extract() failed!\n");
}