Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
9818ee2d
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9818ee2d
编写于
3月 14, 2019
作者:
Z
zylx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[components][lwip]添加 LWIP 硬件校验和选项,修改 STM32 系列和 rt1052 系列以太网驱动,支持硬件校验和
上级
cdb469ce
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
33 deletion
+38
-33
bsp/imxrt/Libraries/imxrt1050/drivers/drv_eth.c
bsp/imxrt/Libraries/imxrt1050/drivers/drv_eth.c
+4
-0
bsp/stm32/libraries/HAL_Drivers/drv_eth.c
bsp/stm32/libraries/HAL_Drivers/drv_eth.c
+6
-33
components/net/Kconfig
components/net/Kconfig
+4
-0
components/net/lwip-2.0.2/src/lwipopts.h
components/net/lwip-2.0.2/src/lwipopts.h
+12
-0
components/net/lwip-2.1.0/src/lwipopts.h
components/net/lwip-2.1.0/src/lwipopts.h
+12
-0
未找到文件。
bsp/imxrt/Libraries/imxrt1050/drivers/drv_eth.c
浏览文件 @
9818ee2d
...
...
@@ -668,6 +668,10 @@ static void _enet_config(void)
//config.interrupt = 0xFFFFFFFF;
config
.
miiSpeed
=
imxrt_eth_device
.
speed
;
config
.
miiDuplex
=
imxrt_eth_device
.
duplex
;
#ifdef RT_LWIP_USING_HW_CHECKSUM
config
.
rxAccelerConfig
=
ENET_RACC_PRODIS_MASK
|
ENET_RACC_IPDIS_MASK
;
config
.
txAccelerConfig
=
ENET_TACC_IPCHK_MASK
|
ENET_TACC_PROCHK_MASK
;
#endif
/* Set SMI to get PHY link status. */
sysClock
=
CLOCK_GetFreq
(
kCLOCK_AhbClk
);
...
...
bsp/stm32/libraries/HAL_Drivers/drv_eth.c
浏览文件 @
9818ee2d
...
...
@@ -44,10 +44,8 @@ struct rt_stm32_eth
static
ETH_DMADescTypeDef
*
DMARxDscrTab
,
*
DMATxDscrTab
;
static
rt_uint8_t
*
Rx_Buff
,
*
Tx_Buff
;
static
rt_bool_t
tx_is_waiting
=
RT_FALSE
;
static
ETH_HandleTypeDef
EthHandle
;
static
struct
rt_stm32_eth
stm32_eth_device
;
static
struct
rt_semaphore
tx_wait
;
#if defined(ETH_RX_DUMP) || defined(ETH_TX_DUMP)
#define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
...
...
@@ -91,8 +89,12 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
EthHandle
.
Init
.
DuplexMode
=
ETH_MODE_FULLDUPLEX
;
EthHandle
.
Init
.
MediaInterface
=
ETH_MEDIA_INTERFACE_RMII
;
EthHandle
.
Init
.
RxMode
=
ETH_RXINTERRUPT_MODE
;
#ifdef RT_LWIP_USING_HW_CHECKSUM
EthHandle
.
Init
.
ChecksumMode
=
ETH_CHECKSUM_BY_HARDWARE
;
#else
EthHandle
.
Init
.
ChecksumMode
=
ETH_CHECKSUM_BY_SOFTWARE
;
#endif
HAL_ETH_DeInit
(
&
EthHandle
);
/* configure ethernet peripheral (GPIOs, clocks, MAC, DMA) */
...
...
@@ -190,29 +192,13 @@ rt_err_t rt_stm32_eth_tx(rt_device_t dev, struct pbuf *p)
DmaTxDesc
=
EthHandle
.
TxDesc
;
bufferoffset
=
0
;
/* Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) */
while
((
DmaTxDesc
->
Status
&
ETH_DMATXDESC_OWN
)
!=
(
uint32_t
)
RESET
)
{
rt_err_t
result
;
rt_uint32_t
level
;
level
=
rt_hw_interrupt_disable
();
tx_is_waiting
=
RT_TRUE
;
rt_hw_interrupt_enable
(
level
);
/* it's own bit set, wait it */
result
=
rt_sem_take
(
&
tx_wait
,
RT_WAITING_FOREVER
);
if
(
result
==
RT_EOK
)
break
;
if
(
result
==
-
RT_ERROR
)
return
-
RT_ERROR
;
}
/* copy frame from pbufs to driver buffers */
for
(
q
=
p
;
q
!=
NULL
;
q
=
q
->
next
)
{
/* Is this buffer available? If not, goto error */
if
((
DmaTxDesc
->
Status
&
ETH_DMATXDESC_OWN
)
!=
(
uint32_t
)
RESET
)
{
LOG_
E
(
"buffer not valid"
);
LOG_
D
(
"buffer not valid"
);
ret
=
ERR_USE
;
goto
error
;
}
...
...
@@ -391,15 +377,6 @@ void ETH_IRQHandler(void)
rt_interrupt_leave
();
}
void
HAL_ETH_TxCpltCallback
(
ETH_HandleTypeDef
*
heth
)
{
if
(
tx_is_waiting
==
RT_TRUE
)
{
tx_is_waiting
=
RT_FALSE
;
rt_sem_release
(
&
tx_wait
);
}
}
void
HAL_ETH_RxCpltCallback
(
ETH_HandleTypeDef
*
heth
)
{
rt_err_t
result
;
...
...
@@ -635,10 +612,6 @@ static int rt_hw_stm32_eth_init(void)
stm32_eth_device
.
parent
.
eth_rx
=
rt_stm32_eth_rx
;
stm32_eth_device
.
parent
.
eth_tx
=
rt_stm32_eth_tx
;
/* init tx semaphore */
rt_sem_init
(
&
tx_wait
,
"tx_wait"
,
0
,
RT_IPC_FLAG_FIFO
);
LOG_D
(
"initialize tx wait semaphore"
);
/* register eth device */
state
=
eth_device_init
(
&
(
stm32_eth_device
.
parent
),
"e0"
);
if
(
RT_EOK
==
state
)
...
...
components/net/Kconfig
浏览文件 @
9818ee2d
...
...
@@ -261,6 +261,10 @@ config RT_USING_LWIP
bool "Enable lwIP statistics"
default n
config RT_LWIP_USING_HW_CHECKSUM
bool "Enable hardware checksum"
default n
menuconfig RT_LWIP_DEBUG
bool "Enable lwIP Debugging Options"
default n
...
...
components/net/lwip-2.0.2/src/lwipopts.h
浏览文件 @
9818ee2d
...
...
@@ -383,6 +383,18 @@
#define ARP_TABLE_SIZE 10
#define ARP_QUEUEING 1
/* ---------- Checksum options ---------- */
#ifdef RT_LWIP_USING_HW_CHECKSUM
#define CHECKSUM_GEN_IP 0
#define CHECKSUM_GEN_UDP 0
#define CHECKSUM_GEN_TCP 0
#define CHECKSUM_GEN_ICMP 0
#define CHECKSUM_CHECK_IP 0
#define CHECKSUM_CHECK_UDP 0
#define CHECKSUM_CHECK_TCP 0
#define CHECKSUM_CHECK_ICMP 0
#endif
/* ---------- IP options ---------- */
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
IP packets across network interfaces. If you are going to run lwIP
...
...
components/net/lwip-2.1.0/src/lwipopts.h
浏览文件 @
9818ee2d
...
...
@@ -390,6 +390,18 @@
#define ARP_TABLE_SIZE 10
#define ARP_QUEUEING 1
/* ---------- Checksum options ---------- */
#ifdef RT_LWIP_USING_HW_CHECKSUM
#define CHECKSUM_GEN_IP 0
#define CHECKSUM_GEN_UDP 0
#define CHECKSUM_GEN_TCP 0
#define CHECKSUM_GEN_ICMP 0
#define CHECKSUM_CHECK_IP 0
#define CHECKSUM_CHECK_UDP 0
#define CHECKSUM_CHECK_TCP 0
#define CHECKSUM_CHECK_ICMP 0
#endif
/* ---------- IP options ---------- */
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
IP packets across network interfaces. If you are going to run lwIP
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录