From 4c163cf43baf965a2998e7f89dbaeefb09c3c47e Mon Sep 17 00:00:00 2001 From: Roland Takacs Date: Mon, 19 Jun 2017 12:18:05 +0200 Subject: [PATCH 1/4] Throw error when error happens in the tcp_listen function --- net/socket/listen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/socket/listen.c b/net/socket/listen.c index b05d18acebd..6c39f19b6d3 100644 --- a/net/socket/listen.c +++ b/net/socket/listen.c @@ -151,7 +151,13 @@ int psock_listen(FAR struct socket *psock, int backlog) * accept() is called and enables poll()/select() logic. */ - tcp_listen(conn); + errcode = tcp_listen(conn); + + if (errcode < 0) + { + errcode = -errcode; + goto errout; + } #else errcode = EOPNOTSUPP; goto errout; From bea5140156641217086ae89fbc87d6bb2b01ef94 Mon Sep 17 00:00:00 2001 From: Roland Takacs Date: Mon, 19 Jun 2017 12:52:48 +0200 Subject: [PATCH 2/4] Support listening sockets in the getsockname function --- net/socket/getsockname.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/socket/getsockname.c b/net/socket/getsockname.c index ba7cc764340..a8d02552dbd 100644 --- a/net/socket/getsockname.c +++ b/net/socket/getsockname.c @@ -157,6 +157,10 @@ int ipv4_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, #ifdef CONFIG_NETDEV_MULTINIC /* Find the device matching the IPv4 address in the connection structure */ + if (ripaddr == 0) + { + ripaddr = lipaddr; + } dev = netdev_findby_ipv4addr(lipaddr, ripaddr); #else @@ -280,6 +284,10 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, #ifdef CONFIG_NETDEV_MULTINIC /* Find the device matching the IPv6 address in the connection structure */ + if (*ripaddr == 0) + { + ripaddr = lipaddr; + } dev = netdev_findby_ipv6addr(*lipaddr, *ripaddr); #else From 25689d911c47988779301fc02c9581393edb03fe Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 19 Jun 2017 07:48:26 -0600 Subject: [PATCH 3/4] Some changes from review of last PR --- net/socket/getsockname.c | 14 +++++++++++--- net/socket/listen.c | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/net/socket/getsockname.c b/net/socket/getsockname.c index a8d02552dbd..e19d48b45ce 100644 --- a/net/socket/getsockname.c +++ b/net/socket/getsockname.c @@ -156,7 +156,11 @@ int ipv4_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, net_lock(); #ifdef CONFIG_NETDEV_MULTINIC - /* Find the device matching the IPv4 address in the connection structure */ + /* Find the device matching the IPv4 address in the connection structure. + * NOTE: listening sockets have no ripaddr. Work around is to use the + * lipaddr when ripaddr is not available. + */ +` if (ripaddr == 0) { ripaddr = lipaddr; @@ -283,8 +287,12 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, net_lock(); #ifdef CONFIG_NETDEV_MULTINIC - /* Find the device matching the IPv6 address in the connection structure */ - if (*ripaddr == 0) + /* Find the device matching the IPv6 address in the connection structure. + * NOTE: listening sockets have no ripaddr. Work around is to use the + * lipaddr when ripaddr is not available. + */ + + if (net_ipv6addr_cmp(ripaddr, g_ipv6_allzeroaddr)) { ripaddr = lipaddr; } diff --git a/net/socket/listen.c b/net/socket/listen.c index 6c39f19b6d3..26a9501807c 100644 --- a/net/socket/listen.c +++ b/net/socket/listen.c @@ -152,7 +152,6 @@ int psock_listen(FAR struct socket *psock, int backlog) */ errcode = tcp_listen(conn); - if (errcode < 0) { errcode = -errcode; From a1ee9547f3f54ad7e85932654bdef088743759e2 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Mon, 19 Jun 2017 07:52:19 -0600 Subject: [PATCH 4/4] stm32_adc: invalidate dma buffer before use. Missing invalidation caused old samples being fetched from cache. --- arch/arm/src/stm32f7/stm32_adc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/stm32f7/stm32_adc.c b/arch/arm/src/stm32f7/stm32_adc.c index 8695a6a8e0c..1de1d91865a 100644 --- a/arch/arm/src/stm32f7/stm32_adc.c +++ b/arch/arm/src/stm32f7/stm32_adc.c @@ -67,6 +67,7 @@ #include "up_internal.h" #include "up_arch.h" +#include "cache.h" #include "chip.h" #include "stm32_rcc.h" #include "stm32_tim.h" @@ -1131,6 +1132,9 @@ static void adc_dmaconvcallback(DMA_HANDLE handle, uint8_t isr, FAR void *arg) FAR struct stm32_dev_s *priv = (FAR struct stm32_dev_s *)dev->ad_priv; int i; + arch_invalidate_dcache((uintptr_t)priv->dmabuffer, + (uintptr_t)priv->dmabuffer + sizeof(priv->dmabuffer)); + /* Verify that the upper-half driver has bound its callback functions */ if (priv->cb != NULL) @@ -1149,6 +1153,7 @@ static void adc_dmaconvcallback(DMA_HANDLE handle, uint8_t isr, FAR void *arg) } } } + /* Restart DMA for the next conversion series */ adc_modifyreg(priv, STM32_ADC_DMAREG_OFFSET, ADC_DMAREG_DMA, 0); @@ -1347,7 +1352,7 @@ static void adc_reset(FAR struct adc_dev_s *dev) adc_getreg(priv, STM32_ADC_SR_OFFSET), adc_getreg(priv, STM32_ADC_CR1_OFFSET), adc_getreg(priv, STM32_ADC_CR2_OFFSET)); - + ainfo("SQR1: 0x%08x SQR2: 0x%08x SQR3: 0x%08x\n", adc_getreg(priv, STM32_ADC_SQR1_OFFSET), adc_getreg(priv, STM32_ADC_SQR2_OFFSET),