Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunke120
rt-thread
提交
7dbb4dc9
R
rt-thread
项目概览
yunke120
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7dbb4dc9
编写于
6月 26, 2014
作者:
B
bernard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[lwIP] Add LWIP_NO_RX_THREAD/LWIP_NO_TX_THREAD options for lwIP.
上级
a1766b6c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
53 addition
and
6 deletion
+53
-6
components/net/lwip-1.4.1/src/include/netif/ethernetif.h
components/net/lwip-1.4.1/src/include/netif/ethernetif.h
+4
-0
components/net/lwip-1.4.1/src/lwipopts.h
components/net/lwip-1.4.1/src/lwipopts.h
+8
-2
components/net/lwip-1.4.1/src/netif/ethernetif.c
components/net/lwip-1.4.1/src/netif/ethernetif.c
+41
-4
未找到文件。
components/net/lwip-1.4.1/src/include/netif/ethernetif.h
浏览文件 @
7dbb4dc9
...
...
@@ -5,7 +5,11 @@
#include <rtthread.h>
#define NIOCTL_GADDR 0x01
#ifndef RT_LWIP_ETH_MTU
#define ETHERNET_MTU 1500
#else
#define ETHERNET_MTU RT_LWIP_ETH_MTU
#endif
struct
eth_device
{
...
...
components/net/lwip-1.4.1/src/lwipopts.h
浏览文件 @
7dbb4dc9
...
...
@@ -38,8 +38,9 @@
#define LWIP_PLATFORM_BYTESWAP 0
#define BYTE_ORDER LITTLE_ENDIAN
/* Enable SO_RCVTIMEO processing. */
/* Enable SO_RCVTIMEO
/LWIP_SO_SNDTIMEO
processing. */
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
/* #define RT_LWIP_DEBUG */
...
...
@@ -232,10 +233,15 @@
/* IP reassembly and segmentation.These are orthogonal even
* if they both deal with IP fragments */
#define IP_REASSEMBLY 0
#ifdef RT_LWIP_REASSEMBLY_FRAG
#define IP_REASSEMBLY 1
#define IP_FRAG 1
#define IP_REASS_MAX_PBUFS 10
#define MEMP_NUM_REASSDATA 10
#else
#define IP_REASSEMBLY 0
#define IP_FRAG 0
#endif
/* ---------- ICMP options ---------- */
#define ICMP_TTL 255
...
...
components/net/lwip-1.4.1/src/netif/ethernetif.c
浏览文件 @
7dbb4dc9
...
...
@@ -67,6 +67,7 @@
#define netifapi_netif_set_link_up(n) netifapi_netif_common(n, netif_set_link_up, NULL)
#define netifapi_netif_set_link_down(n) netifapi_netif_common(n, netif_set_link_down, NULL)
#ifndef LWIP_NO_TX_THREAD
/**
* Tx message structure for Ethernet interface
*/
...
...
@@ -85,7 +86,9 @@ static char eth_tx_thread_stack[512];
static
char
eth_tx_thread_mb_pool
[
RT_LWIP_ETHTHREAD_MBOX_SIZE
*
4
];
static
char
eth_tx_thread_stack
[
RT_LWIP_ETHTHREAD_STACKSIZE
];
#endif
#endif
#ifndef LWIP_NO_RX_THREAD
static
struct
rt_mailbox
eth_rx_thread_mb
;
static
struct
rt_thread
eth_rx_thread
;
#ifndef RT_LWIP_ETHTHREAD_PRIORITY
...
...
@@ -97,12 +100,15 @@ static char eth_rx_thread_stack[1024];
static
char
eth_rx_thread_mb_pool
[
RT_LWIP_ETHTHREAD_MBOX_SIZE
*
4
];
static
char
eth_rx_thread_stack
[
RT_LWIP_ETHTHREAD_STACKSIZE
];
#endif
#endif
static
err_t
ethernetif_linkoutput
(
struct
netif
*
netif
,
struct
pbuf
*
p
)
{
#ifndef LWIP_NO_TX_THREAD
struct
eth_tx_msg
msg
;
struct
eth_device
*
enetif
;
RT_ASSERT
(
netif
!=
RT_NULL
);
enetif
=
(
struct
eth_device
*
)
netif
->
state
;
/* send a message to eth tx thread */
...
...
@@ -113,7 +119,17 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)
/* waiting for ack */
rt_sem_take
(
&
(
enetif
->
tx_ack
),
RT_WAITING_FOREVER
);
}
#else
struct
eth_device
*
enetif
;
RT_ASSERT
(
netif
!=
RT_NULL
);
enetif
=
(
struct
eth_device
*
)
netif
->
state
;
if
(
enetif
->
eth_tx
(
&
(
enetif
->
parent
),
p
)
!=
RT_EOK
)
{
return
ERR_IF
;
}
#endif
return
ERR_OK
;
}
...
...
@@ -241,6 +257,7 @@ rt_err_t eth_device_init(struct eth_device * dev, char *name)
return
eth_device_init_with_flag
(
dev
,
name
,
flags
);
}
#ifndef LWIP_NO_RX_THREAD
rt_err_t
eth_device_ready
(
struct
eth_device
*
dev
)
{
if
(
dev
->
netif
)
...
...
@@ -267,7 +284,20 @@ rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up)
/* post message to ethernet thread */
return
rt_mb_send
(
&
eth_rx_thread_mb
,
(
rt_uint32_t
)
dev
);
}
#else
/* NOTE: please not use it in interrupt when no RxThread exist */
rt_err_t
eth_device_linkchange
(
struct
eth_device
*
dev
,
rt_bool_t
up
)
{
if
(
up
==
RT_TRUE
)
netifapi_netif_set_link_up
(
dev
->
netif
);
else
netifapi_netif_set_link_down
(
dev
->
netif
);
return
RT_EOK
;
}
#endif
#ifndef LWIP_NO_TX_THREAD
/* Ethernet Tx Thread */
static
void
eth_tx_thread_entry
(
void
*
parameter
)
{
...
...
@@ -297,7 +327,9 @@ static void eth_tx_thread_entry(void* parameter)
}
}
}
#endif
#ifndef LWIP_NO_RX_THREAD
/* Ethernet Rx Thread */
static
void
eth_rx_thread_entry
(
void
*
parameter
)
{
...
...
@@ -349,13 +381,15 @@ static void eth_rx_thread_entry(void* parameter)
}
}
}
#endif
int
eth_system_device_init
(
void
)
{
rt_err_t
result
=
RT_EOK
;
/* initialize Rx thread.
* initialize mailbox and create Ethernet Rx thread */
/* initialize Rx thread. */
#ifndef LWIP_NO_RX_THREAD
/* initialize mailbox and create Ethernet Rx thread */
result
=
rt_mb_init
(
&
eth_rx_thread_mb
,
"erxmb"
,
&
eth_rx_thread_mb_pool
[
0
],
sizeof
(
eth_rx_thread_mb_pool
)
/
4
,
RT_IPC_FLAG_FIFO
);
...
...
@@ -367,8 +401,10 @@ int eth_system_device_init(void)
RT_ASSERT
(
result
==
RT_EOK
);
result
=
rt_thread_startup
(
&
eth_rx_thread
);
RT_ASSERT
(
result
==
RT_EOK
);
#endif
/* initialize Tx thread */
#ifndef LWIP_NO_TX_THREAD
/* initialize mailbox and create Ethernet Tx thread */
result
=
rt_mb_init
(
&
eth_tx_thread_mb
,
"etxmb"
,
&
eth_tx_thread_mb_pool
[
0
],
sizeof
(
eth_tx_thread_mb_pool
)
/
4
,
...
...
@@ -382,8 +418,9 @@ int eth_system_device_init(void)
result
=
rt_thread_startup
(
&
eth_tx_thread
);
RT_ASSERT
(
result
==
RT_EOK
);
#endif
return
0
;
return
(
int
)
result
;
}
INIT_DEVICE_EXPORT
(
eth_system_device_init
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录