Skip to content

Commit 34c1fac

Browse files
authored
Merge pull request ARMmbed#3585 from ARMmbed/release-candidate
Release candidate for mbed-os-5.3.3
2 parents 2885c1b + 27ba238 commit 34c1fac

File tree

263 files changed

+55565
-10769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+55565
-10769
lines changed

events/equeue/equeue_mbed.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ static void equeue_sema_timeout(equeue_sema_t *s) {
124124
bool equeue_sema_wait(equeue_sema_t *s, int ms) {
125125
int signal = 0;
126126
Timeout timeout;
127-
timeout.attach_us(s, equeue_sema_timeout, ms*1000);
127+
if (ms > 0) {
128+
timeout.attach_us(callback(equeue_sema_timeout, s), ms*1000);
129+
}
128130

129131
core_util_critical_section_enter();
130132
while (!*s) {

features/FEATURE_LWIP/lwip-interface/lwip_stack.c

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -243,37 +243,43 @@ const ip_addr_t *mbed_lwip_get_ip_addr(bool any_addr, const struct netif *netif)
243243
return NULL;
244244
}
245245

246-
#if LWIP_IPV6
247246
void add_dns_addr(struct netif *lwip_netif)
248247
{
248+
// Do nothing if not brought up
249249
const ip_addr_t *ip_addr = mbed_lwip_get_ip_addr(true, lwip_netif);
250-
if (ip_addr) {
251-
if (IP_IS_V6(ip_addr)) {
252-
const ip_addr_t *dns_ip_addr;
253-
bool dns_addr_exists = false;
254-
255-
for (char numdns = 0; numdns < DNS_MAX_SERVERS; numdns++) {
256-
dns_ip_addr = dns_getserver(numdns);
257-
if (!ip_addr_isany(dns_ip_addr)) {
258-
dns_addr_exists = true;
259-
break;
260-
}
261-
}
250+
if (!ip_addr) {
251+
return;
252+
}
262253

263-
if (!dns_addr_exists) {
264-
/* 2001:4860:4860::8888 google */
265-
ip_addr_t ipv6_dns_addr = IPADDR6_INIT(
266-
PP_HTONL(0x20014860UL),
267-
PP_HTONL(0x48600000UL),
268-
PP_HTONL(0x00000000UL),
269-
PP_HTONL(0x00008888UL));
270-
dns_setserver(0, &ipv6_dns_addr);
271-
}
254+
// Check for existing dns server
255+
for (char numdns = 0; numdns < DNS_MAX_SERVERS; numdns++) {
256+
const ip_addr_t *dns_ip_addr = dns_getserver(numdns);
257+
if (!ip_addr_isany(dns_ip_addr)) {
258+
return;
272259
}
273260
}
274-
}
261+
262+
#if LWIP_IPV6
263+
if (IP_IS_V6(ip_addr)) {
264+
/* 2001:4860:4860::8888 google */
265+
ip_addr_t ipv6_dns_addr = IPADDR6_INIT(
266+
PP_HTONL(0x20014860UL),
267+
PP_HTONL(0x48600000UL),
268+
PP_HTONL(0x00000000UL),
269+
PP_HTONL(0x00008888UL));
270+
dns_setserver(0, &ipv6_dns_addr);
271+
}
275272
#endif
276273

274+
#if LWIP_IPV4
275+
if (IP_IS_V4(ip_addr)) {
276+
/* 8.8.8.8 google */
277+
ip_addr_t ipv4_dns_addr = IPADDR4_INIT(0x08080808);
278+
dns_setserver(0, &ipv4_dns_addr);
279+
}
280+
#endif
281+
}
282+
277283
static sys_sem_t lwip_tcpip_inited;
278284
static void mbed_lwip_tcpip_init_irq(void *eh)
279285
{
@@ -495,7 +501,6 @@ nsapi_error_t mbed_lwip_bringup(bool dhcp, const char *ip, const char *netmask,
495501
if (ret == SYS_ARCH_TIMEOUT) {
496502
return NSAPI_ERROR_DHCP_FAILURE;
497503
}
498-
lwip_connected = true;
499504
}
500505

501506
#if ADDR_TIMEOUT
@@ -506,10 +511,9 @@ nsapi_error_t mbed_lwip_bringup(bool dhcp, const char *ip, const char *netmask,
506511
}
507512
#endif
508513

509-
#if LWIP_IPV6
510514
add_dns_addr(&lwip_netif);
511-
#endif
512515

516+
lwip_connected = true;
513517
return 0;
514518
}
515519

@@ -618,6 +622,22 @@ static nsapi_error_t mbed_lwip_gethostbyname(nsapi_stack_t *stack, const char *h
618622
return 0;
619623
}
620624

625+
static nsapi_error_t mbed_lwip_add_dns_server(nsapi_stack_t *stack, nsapi_addr_t addr)
626+
{
627+
// Shift all dns servers down to give precedence to new server
628+
for (int i = DNS_MAX_SERVERS-1; i > 0; i--) {
629+
dns_setserver(i, dns_getserver(i-1));
630+
}
631+
632+
ip_addr_t ip_addr;
633+
if (!convert_mbed_addr_to_lwip(&ip_addr, &addr)) {
634+
return NSAPI_ERROR_PARAMETER;
635+
}
636+
637+
dns_setserver(0, &ip_addr);
638+
return 0;
639+
}
640+
621641
static nsapi_error_t mbed_lwip_socket_open(nsapi_stack_t *stack, nsapi_socket_t *handle, nsapi_protocol_t proto)
622642
{
623643
// check if network is connected
@@ -874,6 +894,7 @@ static void mbed_lwip_socket_attach(nsapi_stack_t *stack, nsapi_socket_t handle,
874894
/* LWIP network stack */
875895
const nsapi_stack_api_t lwip_stack_api = {
876896
.gethostbyname = mbed_lwip_gethostbyname,
897+
.add_dns_server = mbed_lwip_add_dns_server,
877898
.socket_open = mbed_lwip_socket_open,
878899
.socket_close = mbed_lwip_socket_close,
879900
.socket_bind = mbed_lwip_socket_bind,

features/unsupported/USBDevice/USBDevice/USBEndpoints_M453.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#define NU_MAX_EPX_BUFSIZE 4096
1717
#define NU_EP2EPL(ep) ((ep) >> 1)
1818
#define NU_EP2EPH(ep) (((ep) >> 1) + 1)
19-
#define NU_EPL2EPH(ep) ((ep) + 1)
20-
#define NU_EPH2EPL(ep) ((ep) - 1)
19+
#define NU_EPL2EPH(ep) ((ep) + 1)
20+
#define NU_EPH2EPL(ep) ((ep) - 1)
2121
#define NU_EP_DIR_Pos 0
2222
#define NU_EP_DIR_Msk (1 << NU_EP_DIR_Pos)
2323
#define NU_EP_DIR_OUT 0
@@ -37,22 +37,22 @@
3737
#define EP2IN (5)
3838
#define EP3OUT (6)
3939
#define EP3IN (7)
40-
#define EP4OUT (8)
41-
#define EP4IN (9)
40+
#define EP4OUT (8)
41+
#define EP4IN (9)
4242
#define EP5OUT (10)
4343
#define EP5IN (11)
4444
#define EP6OUT (12)
4545
#define EP6IN (13)
4646

4747
/* Maximum Packet sizes */
48-
#define MAX_PACKET_SIZE_EP0 64
49-
#define MAX_PACKET_SIZE_EP1 64
50-
#define MAX_PACKET_SIZE_EP2 64
51-
#define MAX_PACKET_SIZE_EP3 0x60
52-
#define MAX_PACKET_SIZE_EP4 64
53-
#define MAX_PACKET_SIZE_EP5 64
54-
#define MAX_PACKET_SIZE_EP6 64
55-
#define MAX_PACKET_SIZE_EP7 64
48+
#define MAX_PACKET_SIZE_EP0 64
49+
#define MAX_PACKET_SIZE_EP1 64
50+
#define MAX_PACKET_SIZE_EP2 64
51+
#define MAX_PACKET_SIZE_EP3 0x60
52+
#define MAX_PACKET_SIZE_EP4 64
53+
#define MAX_PACKET_SIZE_EP5 64
54+
#define MAX_PACKET_SIZE_EP6 64
55+
#define MAX_PACKET_SIZE_EP7 64
5656

5757
/* Generic endpoints - intended to be portable accross devices */
5858
/* and be suitable for simple USB devices. */

features/unsupported/USBDevice/USBDevice/USBEndpoints_NUC472.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#define NU_MAX_EPX_BUFSIZE 4096
1717
#define NU_EP2EPL(ep) ((ep) >> 1)
1818
#define NU_EP2EPH(ep) (((ep) >> 1) - 1)
19-
#define NU_EPX2EP(ep) ((ep == CEP) ? EP0OUT : ((ep) - EPA + EP1OUT))
20-
#define NU_EPL2EPH(ep) ((ep) - 1)
21-
#define NU_EPH2EPL(ep) ((ep) + 1)
19+
#define NU_EPX2EP(ep) ((ep == CEP) ? EP0OUT : ((ep) - EPA + EP1OUT))
20+
#define NU_EPL2EPH(ep) ((ep) - 1)
21+
#define NU_EPH2EPL(ep) ((ep) + 1)
2222
#define NU_EP_DIR_Pos 0
2323
#define NU_EP_DIR_Msk (1 << NU_EP_DIR_Pos)
2424
#define NU_EP_DIR_OUT 0
@@ -39,26 +39,26 @@
3939
#define EP2IN (5)
4040
#define EP3OUT (6)
4141
#define EP3IN (7)
42-
#define EP4OUT (8)
43-
#define EP4IN (9)
42+
#define EP4OUT (8)
43+
#define EP4IN (9)
4444
#define EP5OUT (10)
4545
#define EP5IN (11)
4646
#define EP6OUT (12)
4747
#define EP6IN (13)
4848

4949
/* Maximum Packet sizes */
50-
#define MAX_PACKET_SIZE_EP0 64
51-
#define MAX_PACKET_SIZE_EP1 64
52-
#define MAX_PACKET_SIZE_EP2 64
53-
#define MAX_PACKET_SIZE_EP3 0x60
54-
#define MAX_PACKET_SIZE_EP4 64
55-
#define MAX_PACKET_SIZE_EP5 64
56-
#define MAX_PACKET_SIZE_EP6 64
57-
#define MAX_PACKET_SIZE_EP7 64
58-
#define MAX_PACKET_SIZE_EP8 64
59-
#define MAX_PACKET_SIZE_EP9 64
60-
#define MAX_PACKET_SIZE_EP10 64
61-
#define MAX_PACKET_SIZE_EP11 64
50+
#define MAX_PACKET_SIZE_EP0 64
51+
#define MAX_PACKET_SIZE_EP1 64
52+
#define MAX_PACKET_SIZE_EP2 64
53+
#define MAX_PACKET_SIZE_EP3 0x60
54+
#define MAX_PACKET_SIZE_EP4 64
55+
#define MAX_PACKET_SIZE_EP5 64
56+
#define MAX_PACKET_SIZE_EP6 64
57+
#define MAX_PACKET_SIZE_EP7 64
58+
#define MAX_PACKET_SIZE_EP8 64
59+
#define MAX_PACKET_SIZE_EP9 64
60+
#define MAX_PACKET_SIZE_EP10 64
61+
#define MAX_PACKET_SIZE_EP11 64
6262

6363
/* Generic endpoints - intended to be portable accross devices */
6464
/* and be suitable for simple USB devices. */
@@ -83,7 +83,7 @@
8383
#define MAX_PACKET_SIZE_EPINT 64
8484
#define MAX_PACKET_SIZE_EPISO 1023
8585

86-
#define USBD_GET_EP_MAX_PAYLOAD(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAMPS + (uint32_t)((ep)*0x28))))
87-
#define USBD_GET_EP_DATA_COUNT(ep) ((*((__IO uint32_t *) ((uint32_t)&USBD->EPADATCNT + (uint32_t)((ep)*0x28)))) & 0xFFFFF)
88-
#define USBD_SET_EP_SHORT_PACKET(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPARSPCTL + (uint32_t)((ep)*0x28))) = (*((__IO uint32_t *) ((uint32_t)&USBD->EPARSPCTL + (uint32_t)((ep)*0x28)))) & 0x10 | 0x40)
89-
#define USBD_GET_EP_INT_EN(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAINTEN + (uint32_t)((ep)*0x28))))
86+
#define USBD_GET_EP_MAX_PAYLOAD(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAMPS + (uint32_t)((ep)*0x28))))
87+
#define USBD_GET_EP_DATA_COUNT(ep) ((*((__IO uint32_t *) ((uint32_t)&USBD->EPADATCNT + (uint32_t)((ep)*0x28)))) & 0xFFFFF)
88+
#define USBD_SET_EP_SHORT_PACKET(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPARSPCTL + (uint32_t)((ep)*0x28))) = (*((__IO uint32_t *) ((uint32_t)&USBD->EPARSPCTL + (uint32_t)((ep)*0x28)))) & 0x10 | 0x40)
89+
#define USBD_GET_EP_INT_EN(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAINTEN + (uint32_t)((ep)*0x28))))

0 commit comments

Comments
 (0)