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

This commit is contained in:
Gregory Nutt
2017-07-11 19:45:44 -06:00
5 changed files with 91 additions and 42 deletions
+1 -1
View File
@@ -101,7 +101,7 @@
# define USART4_ASSIGNED 1 # define USART4_ASSIGNED 1
#elif defined(CONFIG_USART5_SERIAL_CONSOLE) #elif defined(CONFIG_USART5_SERIAL_CONSOLE)
# define CONSOLE_DEV g_usart5port /* USART5 is console */ # define CONSOLE_DEV g_usart5port /* USART5 is console */
# define TTYS5_DEV g_usart5port /* USART5 is ttyS0 */ # define TTYS0_DEV g_usart5port /* USART5 is ttyS0 */
#else #else
# undef CONSOLE_DEV /* No console */ # undef CONSOLE_DEV /* No console */
# if defined(SAMDL_HAVE_USART0) # if defined(SAMDL_HAVE_USART0)
+5
View File
@@ -1261,7 +1261,12 @@ static void spi_recvblock(struct spi_dev_s *dev, void *buffer, size_t nwords)
static void spi_wait_synchronization(struct sam_spidev_s *priv) static void spi_wait_synchronization(struct sam_spidev_s *priv)
{ {
#if defined(CONFIG_ARCH_FAMILY_SAMD20)
while ((spi_getreg16(priv, SAM_SPI_STATUS_OFFSET) & SPI_STATUS_SYNCBUSY) != 0); while ((spi_getreg16(priv, SAM_SPI_STATUS_OFFSET) & SPI_STATUS_SYNCBUSY) != 0);
#elif defined(CONFIG_ARCH_FAMILY_SAMD21) || defined(CONFIG_ARCH_FAMILY_SAML21)
while ((spi_getreg16(priv, SAM_SPI_SYNCBUSY_OFFSET) & SPI_SYNCBUSY_ALL) != 0);
#endif
} }
/**************************************************************************** /****************************************************************************
+2 -2
View File
@@ -301,7 +301,7 @@ static inline void sam_xosc_config(void)
/* Configure the XOSC clock */ /* Configure the XOSC clock */
regval = BOARD_XOSC_STARTUPTIME regval = BOARD_XOSC_STARTUPTIME;
#ifdef BOARD_XOSC_ISCRYSTAL #ifdef BOARD_XOSC_ISCRYSTAL
/* XOSC is a crystal */ /* XOSC is a crystal */
@@ -383,7 +383,7 @@ static inline void sam_xosc32k_config(void)
/* Configure XOSC32K */ /* Configure XOSC32K */
regval = BOARD_XOSC32K_STARTUPTIME regval = BOARD_XOSC32K_STARTUPTIME;
#ifdef BOARD_XOSC32K_ISCRYSTAL #ifdef BOARD_XOSC32K_ISCRYSTAL
regval |= SYSCTRL_XOSC32K_XTALEN; regval |= SYSCTRL_XOSC32K_XTALEN;
+7 -3
View File
@@ -224,6 +224,7 @@ void icmpv6_input(FAR struct net_driver_s *dev)
case ICMPV6_ROUTER_ADVERTISE: case ICMPV6_ROUTER_ADVERTISE:
{ {
FAR struct icmpv6_router_advertise_s *adv; FAR struct icmpv6_router_advertise_s *adv;
FAR uint8_t *options;
uint16_t pktlen; uint16_t pktlen;
uint16_t optlen; uint16_t optlen;
int ndx; int ndx;
@@ -241,14 +242,17 @@ void icmpv6_input(FAR struct net_driver_s *dev)
optlen = ICMPv6_RADV_OPTLEN(pktlen); optlen = ICMPv6_RADV_OPTLEN(pktlen);
/* We need to have a valid router advertisement with a Prefix and /* We need to have a valid router advertisement with a Prefix and
* with the "A" bit set in the flags. * with the "A" bit set in the flags. Options immediately follow
* the ICMPv6 router advertisement.
*/ */
adv = ICMPv6RADVERTISE; adv = ICMPv6RADVERTISE;
options = (FAR uint8_t *)adv + sizeof(struct icmpv6_router_advertise_s);
for (ndx = 0; ndx + sizeof(struct icmpv6_prefixinfo_s) <= optlen; ) for (ndx = 0; ndx + sizeof(struct icmpv6_prefixinfo_s) <= optlen; )
{ {
FAR struct icmpv6_prefixinfo_s *opt = FAR struct icmpv6_prefixinfo_s *opt =
(FAR struct icmpv6_prefixinfo_s *)&adv->options[ndx]; (FAR struct icmpv6_prefixinfo_s *)&options[ndx];
/* Is this the sought for prefix? Is it the correct size? Is /* Is this the sought for prefix? Is it the correct size? Is
* the "A" flag set? * the "A" flag set?
+76 -36
View File
@@ -200,6 +200,78 @@ static int psock_local_alloc(FAR struct socket *psock)
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL */
/****************************************************************************
* Name: usrsock_socket_setup
*
* Description:
* Special socket setup may be required by user sockets.
*
* Parameters:
* domain (see sys/socket.h)
* type (see sys/socket.h)
* protocol (see sys/socket.h)
* psock A pointer to a user allocated socket structure to be initialized.
*
* Returned Value:
* 0 on success; -1 on error with errno set appropriately
*
****************************************************************************/
#ifdef CONFIG_NET_USRSOCK
static int usrsock_socket_setup(int domain, int type, int protocol,
FAR struct socket *psock)
{
int errcode;
int ret;
switch (domain)
{
default:
break;
case PF_INET:
case PF_INET6:
{
#ifndef CONFIG_NET_USRSOCK_UDP
if (type == SOCK_DGRAM)
{
break;
}
#endif
#ifndef CONFIG_NET_USRSOCK_TCP
if (type == SOCK_STREAM)
{
break;
}
#endif
psock->s_type = 0;
psock->s_conn = NULL;
ret = usrsock_socket(domain, type, protocol, psock);
if (ret >= 0)
{
/* Successfully handled and opened by usrsock daemon. */
return OK;
}
else if (ret == -ENETDOWN)
{
/* Net down means that usrsock daemon is not running.
* Attempt to open socket with kernel networking stack.
*/
}
else
{
return ret;
}
}
}
return OK;
}
#else
#endif /* CONFIG_NET_USRSOCK */
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -252,43 +324,11 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
int errcode; int errcode;
#ifdef CONFIG_NET_USRSOCK #ifdef CONFIG_NET_USRSOCK
switch (domain) ret = usrsock_socket_setup(domain, type, protocol, psock);
if (ret < 0)
{ {
default: errcode = -ret;
break; goto errout;
case PF_INET:
case PF_INET6:
{
#ifndef CONFIG_NET_USRSOCK_UDP
if (type == SOCK_DGRAM)
break;
#endif
#ifndef CONFIG_NET_USRSOCK_TCP
if (type == SOCK_STREAM)
break;
#endif
psock->s_type = 0;
psock->s_conn = NULL;
ret = usrsock_socket(domain, type, protocol, psock);
if (ret >= 0)
{
/* Successfully handled and opened by usrsock daemon. */
return OK;
}
else if (ret == -ENETDOWN)
{
/* Net down means that usrsock daemon is not running.
* Attempt to open socket with kernel networking stack. */
}
else
{
errcode = -ret;
goto errout;
}
}
} }
#endif /* CONFIG_NET_USRSOCK */ #endif /* CONFIG_NET_USRSOCK */