Merge branch 'develop' into fix-rpl-address-selection

This commit is contained in:
Simon Duquennoy 2017-12-22 11:48:14 +01:00 committed by GitHub
commit 62752fce63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 2 deletions

View File

@ -67,9 +67,11 @@ typedef uint16_t u16_t;
typedef uint32_t u32_t;
typedef int32_t s32_t;
typedef unsigned short uip_stats_t;
typedef unsigned int uip_stats_t;
#ifndef UIP_CONF_BYTE_ORDER
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
#endif
#if NETSTACK_CONF_WITH_IPV6

View File

@ -70,12 +70,44 @@
#define LOG_MODULE "Native"
#define LOG_LEVEL LOG_LEVEL_MAIN
/*---------------------------------------------------------------------------*/
/**
* \name Native Platform Configuration
*
* @{
*/
/*
* Defines the maximum number of file descriptors monitored by the platform
* main loop.
*/
#ifdef SELECT_CONF_MAX
#define SELECT_MAX SELECT_CONF_MAX
#else
#define SELECT_MAX 8
#endif
/*
* Defines the timeout (in msec) of the select operation if no monitored file
* descriptors becomes ready.
*/
#ifdef SELECT_CONF_TIMEOUT
#define SELECT_TIMEOUT SELECT_CONF_TIMEOUT
#else
#define SELECT_TIMEOUT 1000
#endif
/*
* Adds the STDIN file descriptor to the list of monitored file descriptors.
*/
#ifdef SELECT_CONF_STDIN
#define SELECT_STDIN SELECT_CONF_STDIN
#else
#define SELECT_STDIN 1
#endif
/** @} */
/*---------------------------------------------------------------------------*/
static const struct select_callback *select_callback[SELECT_MAX];
static int select_max = 0;
@ -116,6 +148,7 @@ select_set_callback(int fd, const struct select_callback *callback)
return 0;
}
/*---------------------------------------------------------------------------*/
#if SELECT_STDIN
static int
stdin_set_fd(fd_set *rset, fd_set *wset)
{
@ -135,6 +168,7 @@ stdin_handle_fd(fd_set *rset, fd_set *wset)
const static struct select_callback stdin_fd = {
stdin_set_fd, stdin_handle_fd
};
#endif /* SELECT_STDIN */
/*---------------------------------------------------------------------------*/
static void
set_lladdr(void)
@ -240,7 +274,9 @@ platform_init_stage_three()
void
platform_main_loop()
{
#if SELECT_STDIN
select_set_callback(STDIN_FILENO, &stdin_fd);
#endif /* SELECT_STDIN */
while(1) {
fd_set fdr;
fd_set fdw;
@ -252,7 +288,7 @@ platform_main_loop()
retval = process_run();
tv.tv_sec = 0;
tv.tv_usec = retval ? 1 : 1000;
tv.tv_usec = retval ? 1 : SELECT_TIMEOUT;
FD_ZERO(&fdr);
FD_ZERO(&fdw);