summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-08-04 08:52:30 +0800
committerGitHub <[email protected]>2021-08-04 08:52:30 +0800
commitb8a75f8f2809c3bbefd8a9925e054337b6965721 (patch)
treedab09ac39a2a067462a39519341776f6bc61e9d4 /components
parent230b7b3bfea331aacd398bcc1deb415360185740 (diff)
parentb339b5cf330cb4ca880a204389b851a7d23f99a6 (diff)
Merge pull request #4901 from mysterywolf/eth
[stm32][eth] beautify codes
Diffstat (limited to 'components')
-rw-r--r--components/net/lwip-1.4.1/src/lwipopts.h7
-rw-r--r--components/net/lwip-1.4.1/src/netif/ethernetif.c8
-rw-r--r--components/net/lwip-2.0.2/src/lwipopts.h11
-rw-r--r--components/net/lwip-2.0.2/src/netif/ethernetif.c8
-rw-r--r--components/net/lwip-2.0.3/src/lwipopts.h11
-rw-r--r--components/net/lwip-2.0.3/src/netif/ethernetif.c8
-rw-r--r--components/net/lwip-2.1.2/src/lwipopts.h11
-rw-r--r--components/net/lwip-2.1.2/src/netif/ethernetif.c8
8 files changed, 50 insertions, 22 deletions
diff --git a/components/net/lwip-1.4.1/src/lwipopts.h b/components/net/lwip-1.4.1/src/lwipopts.h
index 0b7e092d6c..9148066d50 100644
--- a/components/net/lwip-1.4.1/src/lwipopts.h
+++ b/components/net/lwip-1.4.1/src/lwipopts.h
@@ -222,6 +222,13 @@
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
/* ---------- Memory options ---------- */
+#ifdef RT_USING_ASM_MEMCPY
+#define MEMCPY(dst,src,len) rt_memcpy(dst,src,len)
+#else
+#define MEMCPY(dst,src,len) memcpy(dst,src,len)
+#endif /* RT_USING_ASM_MEMCPY */
+#define SMEMCPY(dst,src,len) MEMCPY(dst,src,len)
+
#define MEM_ALIGNMENT 4
#define MEM_LIBC_MALLOC 1
diff --git a/components/net/lwip-1.4.1/src/netif/ethernetif.c b/components/net/lwip-1.4.1/src/netif/ethernetif.c
index 4565f5e528..40cd8fb6ef 100644
--- a/components/net/lwip-1.4.1/src/netif/ethernetif.c
+++ b/components/net/lwip-1.4.1/src/netif/ethernetif.c
@@ -201,14 +201,14 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
{
return -RT_ERROR;
}
- rt_memcpy(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
- rt_memcpy(&ina, &h->sin_addr, sizeof(ina));
+ SMEMCPY(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
+ SMEMCPY(&ina, &h->sin_addr, sizeof(ina));
lwip_freeaddrinfo(res);
if (inet_aton(inet_ntoa(ina), &target_addr) == 0)
{
return -RT_ERROR;
}
- rt_memcpy(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
+ SMEMCPY(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
/* new a socket */
if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0)
@@ -331,7 +331,7 @@ static int netdev_add(struct netif *lwip_netif)
netdev->mtu = lwip_netif->mtu;
netdev->ops = &lwip_netdev_ops;
netdev->hwaddr_len = lwip_netif->hwaddr_len;
- rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
+ SMEMCPY(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
netdev->ip_addr = lwip_netif->ip_addr;
netdev->gw = lwip_netif->gw;
netdev->netmask = lwip_netif->netmask;
diff --git a/components/net/lwip-2.0.2/src/lwipopts.h b/components/net/lwip-2.0.2/src/lwipopts.h
index d559684c02..fdfe1437b2 100644
--- a/components/net/lwip-2.0.2/src/lwipopts.h
+++ b/components/net/lwip-2.0.2/src/lwipopts.h
@@ -230,14 +230,21 @@
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
/* ---------- Memory options ---------- */
+#ifdef RT_USING_ASM_MEMCPY
+#define MEMCPY(dst,src,len) rt_memcpy(dst,src,len)
+#else
+#define MEMCPY(dst,src,len) memcpy(dst,src,len)
+#endif /* RT_USING_ASM_MEMCPY */
+#define SMEMCPY(dst,src,len) MEMCPY(dst,src,len)
+
#ifdef RT_LWIP_MEM_ALIGNMENT
#define MEM_ALIGNMENT RT_LWIP_MEM_ALIGNMENT
#else
#define MEM_ALIGNMENT 4
#endif
-#define MEMP_OVERFLOW_CHECK 1 ////
-#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1 ////
+#define MEMP_OVERFLOW_CHECK 1
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
//#define MEM_LIBC_MALLOC 1
//#define MEM_USE_POOLS 1
//#define MEMP_USE_CUSTOM_POOLS 1
diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c
index 1c0f3ca9b2..0b1943fdff 100644
--- a/components/net/lwip-2.0.2/src/netif/ethernetif.c
+++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c
@@ -210,14 +210,14 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
{
return -RT_ERROR;
}
- rt_memcpy(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
- rt_memcpy(&ina, &h->sin_addr, sizeof(ina));
+ SMEMCPY(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
+ SMEMCPY(&ina, &h->sin_addr, sizeof(ina));
lwip_freeaddrinfo(res);
if (inet_aton(inet_ntoa(ina), &target_addr) == 0)
{
return -RT_ERROR;
}
- rt_memcpy(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
+ SMEMCPY(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
/* new a socket */
if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0)
@@ -340,7 +340,7 @@ static int netdev_add(struct netif *lwip_netif)
netdev->mtu = lwip_netif->mtu;
netdev->ops = &lwip_netdev_ops;
netdev->hwaddr_len = lwip_netif->hwaddr_len;
- rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
+ SMEMCPY(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
netdev->ip_addr = lwip_netif->ip_addr;
netdev->gw = lwip_netif->gw;
netdev->netmask = lwip_netif->netmask;
diff --git a/components/net/lwip-2.0.3/src/lwipopts.h b/components/net/lwip-2.0.3/src/lwipopts.h
index d559684c02..fdfe1437b2 100644
--- a/components/net/lwip-2.0.3/src/lwipopts.h
+++ b/components/net/lwip-2.0.3/src/lwipopts.h
@@ -230,14 +230,21 @@
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
/* ---------- Memory options ---------- */
+#ifdef RT_USING_ASM_MEMCPY
+#define MEMCPY(dst,src,len) rt_memcpy(dst,src,len)
+#else
+#define MEMCPY(dst,src,len) memcpy(dst,src,len)
+#endif /* RT_USING_ASM_MEMCPY */
+#define SMEMCPY(dst,src,len) MEMCPY(dst,src,len)
+
#ifdef RT_LWIP_MEM_ALIGNMENT
#define MEM_ALIGNMENT RT_LWIP_MEM_ALIGNMENT
#else
#define MEM_ALIGNMENT 4
#endif
-#define MEMP_OVERFLOW_CHECK 1 ////
-#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1 ////
+#define MEMP_OVERFLOW_CHECK 1
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
//#define MEM_LIBC_MALLOC 1
//#define MEM_USE_POOLS 1
//#define MEMP_USE_CUSTOM_POOLS 1
diff --git a/components/net/lwip-2.0.3/src/netif/ethernetif.c b/components/net/lwip-2.0.3/src/netif/ethernetif.c
index 1c0f3ca9b2..0b1943fdff 100644
--- a/components/net/lwip-2.0.3/src/netif/ethernetif.c
+++ b/components/net/lwip-2.0.3/src/netif/ethernetif.c
@@ -210,14 +210,14 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
{
return -RT_ERROR;
}
- rt_memcpy(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
- rt_memcpy(&ina, &h->sin_addr, sizeof(ina));
+ SMEMCPY(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
+ SMEMCPY(&ina, &h->sin_addr, sizeof(ina));
lwip_freeaddrinfo(res);
if (inet_aton(inet_ntoa(ina), &target_addr) == 0)
{
return -RT_ERROR;
}
- rt_memcpy(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
+ SMEMCPY(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
/* new a socket */
if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0)
@@ -340,7 +340,7 @@ static int netdev_add(struct netif *lwip_netif)
netdev->mtu = lwip_netif->mtu;
netdev->ops = &lwip_netdev_ops;
netdev->hwaddr_len = lwip_netif->hwaddr_len;
- rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
+ SMEMCPY(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
netdev->ip_addr = lwip_netif->ip_addr;
netdev->gw = lwip_netif->gw;
netdev->netmask = lwip_netif->netmask;
diff --git a/components/net/lwip-2.1.2/src/lwipopts.h b/components/net/lwip-2.1.2/src/lwipopts.h
index 2cd7cb023a..a964ab13ac 100644
--- a/components/net/lwip-2.1.2/src/lwipopts.h
+++ b/components/net/lwip-2.1.2/src/lwipopts.h
@@ -242,9 +242,16 @@
#endif
/* ---------- Memory options ---------- */
+#ifdef RT_USING_ASM_MEMCPY
+#define MEMCPY(dst,src,len) rt_memcpy(dst,src,len)
+#else
+#define MEMCPY(dst,src,len) memcpy(dst,src,len)
+#endif /* RT_USING_ASM_MEMCPY */
+#define SMEMCPY(dst,src,len) MEMCPY(dst,src,len)
+
#define MEM_ALIGNMENT 4
-#define MEMP_OVERFLOW_CHECK 1 ////
-#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1 ////
+#define MEMP_OVERFLOW_CHECK 1
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
//#define MEM_LIBC_MALLOC 1
//#define MEM_USE_POOLS 1
//#define MEMP_USE_CUSTOM_POOLS 1
diff --git a/components/net/lwip-2.1.2/src/netif/ethernetif.c b/components/net/lwip-2.1.2/src/netif/ethernetif.c
index 81dd792f29..bd4db225ee 100644
--- a/components/net/lwip-2.1.2/src/netif/ethernetif.c
+++ b/components/net/lwip-2.1.2/src/netif/ethernetif.c
@@ -208,14 +208,14 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
{
return -RT_ERROR;
}
- rt_memcpy(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
- rt_memcpy(&ina, &h->sin_addr, sizeof(ina));
+ SMEMCPY(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
+ SMEMCPY(&ina, &h->sin_addr, sizeof(ina));
lwip_freeaddrinfo(res);
if (inet_aton(inet_ntoa(ina), &target_addr) == 0)
{
return -RT_ERROR;
}
- rt_memcpy(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
+ SMEMCPY(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t));
/* new a socket */
if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0)
@@ -338,7 +338,7 @@ static int netdev_add(struct netif *lwip_netif)
netdev->mtu = lwip_netif->mtu;
netdev->ops = &lwip_netdev_ops;
netdev->hwaddr_len = lwip_netif->hwaddr_len;
- rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
+ SMEMCPY(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
netdev->ip_addr = lwip_netif->ip_addr;
netdev->gw = lwip_netif->gw;
netdev->netmask = lwip_netif->netmask;