Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
61b6fca3
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
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看板
提交
61b6fca3
编写于
12月 27, 2018
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp] Update tm4c19x and fix the mb_recv warning in lwip-1.4.1
上级
96e6deac
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
366 addition
and
201 deletion
+366
-201
bsp/tm4c129x/.config
bsp/tm4c129x/.config
+185
-19
bsp/tm4c129x/drivers/drv_eth.c
bsp/tm4c129x/drivers/drv_eth.c
+113
-113
bsp/tm4c129x/rtconfig.h
bsp/tm4c129x/rtconfig.h
+52
-56
components/net/lwip-1.4.1/src/arch/include/arch/cc.h
components/net/lwip-1.4.1/src/arch/include/arch/cc.h
+8
-7
components/net/lwip-1.4.1/src/arch/sys_arch.c
components/net/lwip-1.4.1/src/arch/sys_arch.c
+6
-4
components/net/lwip-1.4.1/src/netif/ethernetif.c
components/net/lwip-1.4.1/src/netif/ethernetif.c
+2
-2
未找到文件。
bsp/tm4c129x/.config
浏览文件 @
61b6fca3
...
...
@@ -7,18 +7,32 @@
# RT-Thread Kernel
#
CONFIG_RT_NAME_MAX
=
8
# CONFIG_RT_USING_SMP is not set
CONFIG_RT_ALIGN_SIZE
=
4
# CONFIG_RT_THREAD_PRIORITY_8 is not set
CONFIG_RT_THREAD_PRIORITY_32
=
y
# CONFIG_RT_THREAD_PRIORITY_256 is not set
CONFIG_RT_THREAD_PRIORITY_MAX
=
32
CONFIG_RT_TICK_PER_SECOND
=
100
CONFIG_RT_DEBUG
=
y
CONFIG_RT_USING_OVERFLOW_CHECK
=
y
CONFIG_RT_DEBUG_INIT
=
0
# CONFIG_RT_DEBUG_THREAD is not set
CONFIG_RT_USING_HOOK
=
y
CONFIG_RT_USING_IDLE_HOOK
=
y
CONFIG_RT_IDEL_HOOK_LIST_SIZE
=
4
CONFIG_IDLE_THREAD_STACK_SIZE
=
256
CONFIG_RT_USING_TIMER_SOFT
=
y
CONFIG_RT_TIMER_THREAD_PRIO
=
4
CONFIG_RT_TIMER_THREAD_STACK_SIZE
=
512
CONFIG_RT_DEBUG
=
y
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
# CONFIG_RT_DEBUG_IPC_CONFIG is not set
# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
# CONFIG_RT_DEBUG_MEM_CONFIG is not set
# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
#
# Inter-Thread communication
...
...
@@ -35,24 +49,32 @@ CONFIG_RT_USING_MESSAGEQUEUE=y
#
CONFIG_RT_USING_MEMPOOL
=
y
CONFIG_RT_USING_MEMHEAP
=
y
CONFIG_RT_USING_HEAP
=
y
# CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM
=
y
# CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
# CONFIG_RT_USING_MEMTRACE is not set
CONFIG_RT_USING_HEAP
=
y
#
# Kernel Device Object
#
CONFIG_RT_USING_DEVICE
=
y
# CONFIG_RT_USING_DEVICE_OPS is not set
# CONFIG_RT_USING_INTERRUPT_INFO is not set
CONFIG_RT_USING_CONSOLE
=
y
CONFIG_RT_CONSOLEBUF_SIZE
=
128
CONFIG_RT_CONSOLE_DEVICE_NAME
=
"uart0"
# CONFIG_RT_USING_MODULE is not set
CONFIG_RT_VER_NUM
=
0
x40000
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
#
# RT-Thread Components
#
CONFIG_RT_USING_COMPONENTS_INIT
=
y
CONFIG_RT_USING_USER_MAIN
=
y
CONFIG_RT_MAIN_THREAD_STACK_SIZE
=
2048
CONFIG_RT_MAIN_THREAD_PRIORITY
=
10
#
# C++ features
...
...
@@ -63,9 +85,12 @@ CONFIG_RT_USING_USER_MAIN=y
# Command shell
#
CONFIG_RT_USING_FINSH
=
y
CONFIG_FINSH_THREAD_NAME
=
"tshell"
CONFIG_FINSH_USING_HISTORY
=
y
CONFIG_FINSH_HISTORY_LINES
=
5
CONFIG_FINSH_USING_SYMTAB
=
y
CONFIG_FINSH_USING_DESCRIPTION
=
y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
CONFIG_FINSH_THREAD_PRIORITY
=
20
CONFIG_FINSH_THREAD_STACK_SIZE
=
4096
CONFIG_FINSH_CMD_SIZE
=
80
...
...
@@ -81,30 +106,51 @@ CONFIG_FINSH_CMD_SIZE=80
# Device Drivers
#
CONFIG_RT_USING_DEVICE_IPC
=
y
CONFIG_RT_PIPE_BUFSZ
=
512
CONFIG_RT_USING_SERIAL
=
y
CONFIG_RT_SERIAL_USING_DMA
=
y
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PIN is not set
# CONFIG_RT_USING_ADC is not set
# CONFIG_RT_USING_PWM is not set
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_MTD is not set
# CONFIG_RT_USING_PM is not set
# CONFIG_RT_USING_RTC is not set
# CONFIG_RT_USING_SDIO is not set
# CONFIG_RT_USING_SPI is not set
# CONFIG_RT_USING_WDT is not set
# CONFIG_RT_USING_AUDIO is not set
#
# Using WiFi
#
# CONFIG_RT_USING_WIFI is not set
#
# Using USB
#
# CONFIG_RT_USING_USB_HOST is not set
# CONFIG_RT_USING_USB_DEVICE is not set
#
# POSIX layer and C standard library
#
# CONFIG_RT_USING_LIBC is not set
CONFIG_RT_USING_LIBC
=
y
# CONFIG_RT_USING_PTHREADS is not set
#
# Network stack
# Network
#
#
# Socket abstraction layer
#
# CONFIG_RT_USING_SAL is not set
#
# light weight TCP/IP stack
...
...
@@ -112,6 +158,7 @@ CONFIG_RT_SERIAL_USING_DMA=y
CONFIG_RT_USING_LWIP
=
y
CONFIG_RT_USING_LWIP141
=
y
# CONFIG_RT_USING_LWIP202 is not set
# CONFIG_RT_USING_LWIP210 is not set
# CONFIG_RT_LWIP_IGMP is not set
CONFIG_RT_LWIP_ICMP
=
y
# CONFIG_RT_LWIP_SNMP is not set
...
...
@@ -119,7 +166,6 @@ CONFIG_RT_LWIP_DNS=y
CONFIG_RT_LWIP_DHCP
=
y
CONFIG_IP_SOF_BROADCAST
=
1
CONFIG_IP_SOF_BROADCAST_RECV
=
1
# CONFIG_LWIP_USING_DHCPD is not set
#
# Static IPv4 Address
...
...
@@ -131,8 +177,7 @@ CONFIG_RT_LWIP_UDP=y
CONFIG_RT_LWIP_TCP
=
y
# CONFIG_RT_LWIP_RAW is not set
# CONFIG_RT_LWIP_PPP is not set
# CONFIG_RT_LWIP_PPPOE is not set
# CONFIG_RT_LWIP_PPPOS is not set
CONFIG_RT_MEMP_NUM_NETCONN
=
8
CONFIG_RT_LWIP_PBUF_NUM
=
16
CONFIG_RT_LWIP_RAW_PCB_NUM
=
4
CONFIG_RT_LWIP_UDP_PCB_NUM
=
4
...
...
@@ -143,6 +188,8 @@ CONFIG_RT_LWIP_TCP_WND=8196
CONFIG_RT_LWIP_TCPTHREAD_PRIORITY
=
10
CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE
=
8
CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE
=
1024
# CONFIG_LWIP_NO_RX_THREAD is not set
# CONFIG_LWIP_NO_TX_THREAD is not set
CONFIG_RT_LWIP_ETHTHREAD_PRIORITY
=
12
CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE
=
1024
CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE
=
8
...
...
@@ -152,69 +199,188 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO
=
1
CONFIG_LWIP_SO_SNDTIMEO
=
1
CONFIG_LWIP_SO_RCVBUF
=
1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK
=
0
# CONFIG_RT_LWIP_STATS is not set
# CONFIG_RT_LWIP_DEBUG is not set
#
# Modbus master and slave stack
#
# CONFIG_RT_USING_MODBUS is not set
# CONFIG_RT_USING_NETUTILS is not set
#
#
RT-Thread UI Engine
#
AT commands
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_RT_USING_AT is not set
# CONFIG_LWIP_USING_DHCPD is not set
#
#
RT-Thread online packages
#
VBUS(Virtual Software BUS)
#
# CONFIG_RT_USING_VBUS is not set
#
# system packages
# Utilities
#
# CONFIG_RT_USING_LOGTRACE is not set
# CONFIG_RT_USING_RYM is not set
# CONFIG_RT_USING_ULOG is not set
# CONFIG_RT_USING_UTEST is not set
#
# RT-Thread online packages
#
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set
#
# IoT - internet of things
#
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_WEBCLIENT is not set
# CONFIG_PKG_USING_WEBNET is not set
# CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
# Wi-Fi
#
#
# Marvell WiFi
#
# CONFIG_PKG_USING_MARVELLWIFI is not set
# CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS is not set
# CONFIG_PKG_USING_AT_DEVICE is not set
# CONFIG_PKG_USING_WIZNET is not set
#
# IoT Cloud
#
# CONFIG_PKG_USING_ONENET is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
# CONFIG_PKG_USING_ALI_IOTKIT is not set
# CONFIG_PKG_USING_AZURE is not set
# CONFIG_PKG_USING_TENCENT_IOTKIT is not set
#
# security packages
#
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_libsodium is not set
# CONFIG_PKG_USING_TINYCRYPT is not set
#
# language packages
#
# CONFIG_PKG_USING_LUA is not set
# CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
#
# multimedia packages
#
# CONFIG_PKG_USING_OPENMV is not set
# CONFIG_PKG_USING_MUPDF is not set
#
# tools packages
#
# CONFIG_PKG_USING_CMBACKTRACE is not set
# CONFIG_PKG_USING_EASYFLASH is not set
# CONFIG_PKG_USING_EASYLOGGER is not set
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
#
# system packages
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_FAL is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
# CONFIG_PKG_USING_CMSIS is not set
# CONFIG_PKG_USING_DFS_YAFFS is not set
# CONFIG_PKG_USING_LITTLEFS is not set
#
# peripheral libraries and drivers
#
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_AHT10 is not set
# CONFIG_PKG_USING_AP3216C is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_U8G2 is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_MPU6XXX is not set
# CONFIG_PKG_USING_PCF8574 is not set
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
#
# miscellaneous packages
#
# CONFIG_PKG_USING_LIBCSV is not set
# CONFIG_PKG_USING_OPTPARSE is not set
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
# CONFIG_PKG_USING_CANFESTIVAL is not set
# CONFIG_PKG_USING_ZLIB is not set
# CONFIG_PKG_USING_DSTR is not set
# CONFIG_PKG_USING_TINYFRAME is not set
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
#
# samples: kernel and components samples
#
# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
# CONFIG_PKG_USING_HELLO is not set
#
# BSP_SPECIAL CONFIG
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_COREMARK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RDBD_SRC is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
CONFIG_RT_USING_UART0
=
y
bsp/tm4c129x/drivers/drv_eth.c
浏览文件 @
61b6fca3
...
...
@@ -248,11 +248,11 @@ volatile uint32_t g_ui32AbnormalInts;
typedef
struct
{
/* inherit from ethernet device */
struct
eth_device
parent
;
tStellarisIF
*
dma_if
;
/* for rx_thread async get pbuf */
rt_mailbox_t
rx_pbuf_mb
;
/* inherit from ethernet device */
struct
eth_device
parent
;
tStellarisIF
*
dma_if
;
/* for rx_thread async get pbuf */
rt_mailbox_t
rx_pbuf_mb
;
}
net_device
;
typedef
net_device
*
net_device_t
;
...
...
@@ -862,8 +862,8 @@ tivaif_receive(net_device_t dev)
{
#else
//if(tcpip_input(pBuf, psNetif) != RT_EOK)
if
((
rt_mb_send
(
dev
->
rx_pbuf_mb
,
(
rt_uint32_t
)
pBuf
)
!=
RT_EOK
)
||
(
eth_device_ready
(
&
(
dev
->
parent
))
!=
RT_EOK
))
if
((
rt_mb_send
(
dev
->
rx_pbuf_mb
,
(
rt_uint32_t
)
pBuf
)
!=
RT_EOK
)
||
(
eth_device_ready
(
&
(
dev
->
parent
))
!=
RT_EOK
))
{
#endif
/* drop the packet */
...
...
@@ -950,10 +950,10 @@ tivaif_process_phy_interrupt(net_device_t dev)
*/
ui16Val
=
EMACPHYRead
(
EMAC0_BASE
,
PHY_PHYS_ADDR
,
EPHY_MISR1
);
/*
* Dummy read PHY REG EPHY_BMSR, it will force update the EPHY_STS register
*/
EMACPHYRead
(
EMAC0_BASE
,
PHY_PHYS_ADDR
,
EPHY_BMSR
);
/*
* Dummy read PHY REG EPHY_BMSR, it will force update the EPHY_STS register
*/
EMACPHYRead
(
EMAC0_BASE
,
PHY_PHYS_ADDR
,
EPHY_BMSR
);
/* Read the current PHY status. */
ui16Status
=
EMACPHYRead
(
EMAC0_BASE
,
PHY_PHYS_ADDR
,
EPHY_STS
);
...
...
@@ -968,7 +968,7 @@ tivaif_process_phy_interrupt(net_device_t dev)
netif_set_link_up
(
psNetif
);
#else
//tcpip_callback((tcpip_callback_fn)netif_set_link_up, psNetif);
eth_device_linkchange
(
&
(
dev
->
parent
),
RT_TRUE
);
eth_device_linkchange
(
&
(
dev
->
parent
),
RT_TRUE
);
#endif
/* In this case we drop through since we may need to reconfigure
...
...
@@ -982,7 +982,7 @@ tivaif_process_phy_interrupt(net_device_t dev)
netif_set_link_down
(
psNetif
);
#else
//tcpip_callback((tcpip_callback_fn)netif_set_link_down, psNetif);
eth_device_linkchange
(
&
(
dev
->
parent
),
RT_FALSE
);
eth_device_linkchange
(
&
(
dev
->
parent
),
RT_FALSE
);
#endif
}
}
...
...
@@ -1168,40 +1168,40 @@ void lwIPEthernetIntHandler(void)
// OUI:00-12-37 (hex) Texas Instruments, only for test
static
int
tiva_eth_mac_addr_init
(
void
)
{
int
retVal
=
0
;
uint32_t
ulUser
[
2
];
uint8_t
mac_addr
[
6
];
MAP_FlashUserGet
(
&
ulUser
[
0
],
&
ulUser
[
1
]);
if
((
ulUser
[
0
]
==
0xffffffff
)
||
(
ulUser
[
1
]
==
0xffffffff
))
{
rt_kprintf
(
"Fail to get mac address from eeprom.
\n
"
);
rt_kprintf
(
"Using default mac address
\n
"
);
// OUI:00-12-37 (hex) Texas Instruments, only for test
// Configure the hardware MAC address
ulUser
[
0
]
=
0x00371200
;
ulUser
[
1
]
=
0x00563412
;
//FlashUserSet(ulUser0, ulUser1);
retVal
=-
1
;
}
//Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
//address needed to program the hardware registers, then program the MAC
//address into the Ethernet Controller registers.
mac_addr
[
0
]
=
((
ulUser
[
0
]
>>
0
)
&
0xff
);
mac_addr
[
1
]
=
((
ulUser
[
0
]
>>
8
)
&
0xff
);
mac_addr
[
2
]
=
((
ulUser
[
0
]
>>
16
)
&
0xff
);
mac_addr
[
3
]
=
((
ulUser
[
1
]
>>
0
)
&
0xff
);
mac_addr
[
4
]
=
((
ulUser
[
1
]
>>
8
)
&
0xff
);
mac_addr
[
5
]
=
((
ulUser
[
1
]
>>
16
)
&
0xff
);
//
int
retVal
=
0
;
uint32_t
ulUser
[
2
];
uint8_t
mac_addr
[
6
];
MAP_FlashUserGet
(
&
ulUser
[
0
],
&
ulUser
[
1
]);
if
((
ulUser
[
0
]
==
0xffffffff
)
||
(
ulUser
[
1
]
==
0xffffffff
))
{
rt_kprintf
(
"Fail to get mac address from eeprom.
\n
"
);
rt_kprintf
(
"Using default mac address
\n
"
);
// OUI:00-12-37 (hex) Texas Instruments, only for test
// Configure the hardware MAC address
ulUser
[
0
]
=
0x00371200
;
ulUser
[
1
]
=
0x00563412
;
//FlashUserSet(ulUser0, ulUser1);
retVal
=-
1
;
}
//Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
//address needed to program the hardware registers, then program the MAC
//address into the Ethernet Controller registers.
mac_addr
[
0
]
=
((
ulUser
[
0
]
>>
0
)
&
0xff
);
mac_addr
[
1
]
=
((
ulUser
[
0
]
>>
8
)
&
0xff
);
mac_addr
[
2
]
=
((
ulUser
[
0
]
>>
16
)
&
0xff
);
mac_addr
[
3
]
=
((
ulUser
[
1
]
>>
0
)
&
0xff
);
mac_addr
[
4
]
=
((
ulUser
[
1
]
>>
8
)
&
0xff
);
mac_addr
[
5
]
=
((
ulUser
[
1
]
>>
16
)
&
0xff
);
//
// Program the hardware with its MAC address (for filtering).
//
MAP_EMACAddrSet
(
EMAC0_BASE
,
0
,
mac_addr
);
return
retVal
;
return
retVal
;
}
void
tiva_eth_lowlevel_init
(
void
)
...
...
@@ -1214,7 +1214,7 @@ static int tiva_eth_mac_addr_init(void)
MAP_GPIOPinConfigure
(
GPIO_PF4_EN0LED1
);
GPIOPinTypeEthernetLED
(
GPIO_PORTF_BASE
,
GPIO_PIN_0
);
GPIOPinTypeEthernetLED
(
GPIO_PORTF_BASE
,
GPIO_PIN_4
);
//
// Enable the ethernet peripheral.
//
...
...
@@ -1243,7 +1243,7 @@ static int tiva_eth_mac_addr_init(void)
//
// Internal PHY is not present on this part so hang here.
//
rt_kprintf
(
"Internal PHY is not present on this part.
\n
"
);
rt_kprintf
(
"Internal PHY is not present on this part.
\n
"
);
while
(
1
)
{
}
...
...
@@ -1283,17 +1283,17 @@ static int tiva_eth_mac_addr_init(void)
EMAC_MODE_TX_STORE_FORWARD
|
EMAC_MODE_TX_THRESHOLD_64_BYTES
|
EMAC_MODE_RX_THRESHOLD_64_BYTES
),
0
);
EMACIntRegister
(
EMAC0_BASE
,
lwIPEthernetIntHandler
);
EMACIntRegister
(
EMAC0_BASE
,
lwIPEthernetIntHandler
);
}
static
rt_err_t
eth_dev_init
(
rt_device_t
device
)
{
net_device_t
net_dev
=
(
net_device_t
)
device
;
struct
netif
*
psNetif
=
(
net_dev
->
parent
.
netif
);
LWIP_ASSERT
(
"psNetif != NULL"
,
(
psNetif
!=
NULL
));
net_device_t
net_dev
=
(
net_device_t
)
device
;
struct
netif
*
psNetif
=
(
net_dev
->
parent
.
netif
);
LWIP_ASSERT
(
"psNetif != NULL"
,
(
psNetif
!=
NULL
));
#if LWIP_NETIF_HOSTNAME
/* Initialize interface hostname */
...
...
@@ -1320,91 +1320,91 @@ static rt_err_t eth_dev_init(rt_device_t device)
/* control the interface */
static
rt_err_t
eth_dev_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
switch
(
cmd
)
{
case
NIOCTL_GADDR
:
/* get mac address */
if
(
args
)
MAP_EMACAddrGet
(
EMAC0_BASE
,
0
,
(
uint8_t
*
)
args
);
else
return
-
RT_ERROR
;
break
;
default
:
break
;
}
return
RT_EOK
;
switch
(
cmd
)
{
case
NIOCTL_GADDR
:
/* get mac address */
if
(
args
)
MAP_EMACAddrGet
(
EMAC0_BASE
,
0
,
(
uint8_t
*
)
args
);
else
return
-
RT_ERROR
;
break
;
default
:
break
;
}
return
RT_EOK
;
}
/* Open the interface */
static
rt_err_t
eth_dev_open
(
rt_device_t
dev
,
rt_uint16_t
oflag
)
{
return
RT_EOK
;
return
RT_EOK
;
}
/* Close the interface */
static
rt_err_t
eth_dev_close
(
rt_device_t
dev
)
{
return
RT_EOK
;
return
RT_EOK
;
}
/* Read */
static
rt_size_t
eth_dev_read
(
rt_device_t
dev
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
size
)
{
rt_set_errno
(
-
RT_ENOSYS
);
return
0
;
rt_set_errno
(
-
RT_ENOSYS
);
return
0
;
}
/* Write */
static
rt_size_t
eth_dev_write
(
rt_device_t
dev
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
size
)
{
rt_set_errno
(
-
RT_ENOSYS
);
return
0
;
rt_set_errno
(
-
RT_ENOSYS
);
return
0
;
}
static
rt_err_t
eth_dev_tx
(
rt_device_t
dev
,
struct
pbuf
*
p
)
{
return
tivaif_transmit
((
net_device_t
)
dev
,
p
);
return
tivaif_transmit
((
net_device_t
)
dev
,
p
);
}
static
struct
pbuf
*
eth_dev_rx
(
rt_device_t
dev
)
{
rt_err_t
result
;
rt_uint32_t
temp
=
0
;
net_device_t
net_dev
=
(
net_device_t
)
dev
;
result
=
rt_mb_recv
(
net_dev
->
rx_pbuf_mb
,
&
temp
,
RT_WAITING_NO
);
return
(
result
==
RT_EOK
)
?
(
struct
pbuf
*
)
temp
:
RT_NULL
;
rt_err_t
result
;
rt_uint32_t
temp
=
0
;
net_device_t
net_dev
=
(
net_device_t
)
dev
;
result
=
rt_mb_recv
(
net_dev
->
rx_pbuf_mb
,
(
rt_ubase_t
*
)
&
temp
,
RT_WAITING_NO
);
return
(
result
==
RT_EOK
)
?
(
struct
pbuf
*
)
temp
:
RT_NULL
;
}
int
rt_hw_tiva_eth_init
(
void
)
{
rt_err_t
result
;
/* Clock GPIO and etc */
tiva_eth_lowlevel_init
();
tiva_eth_mac_addr_init
();
/* init rt-thread device interface */
eth_dev
->
parent
.
parent
.
init
=
eth_dev_init
;
eth_dev
->
parent
.
parent
.
open
=
eth_dev_open
;
eth_dev
->
parent
.
parent
.
close
=
eth_dev_close
;
eth_dev
->
parent
.
parent
.
read
=
eth_dev_read
;
eth_dev
->
parent
.
parent
.
write
=
eth_dev_write
;
eth_dev
->
parent
.
parent
.
control
=
eth_dev_control
;
eth_dev
->
parent
.
eth_rx
=
eth_dev_rx
;
eth_dev
->
parent
.
eth_tx
=
eth_dev_tx
;
result
=
rt_mb_init
(
&
eth_rx_pbuf_mb
,
"epbuf"
,
rt_err_t
result
;
/* Clock GPIO and etc */
tiva_eth_lowlevel_init
();
tiva_eth_mac_addr_init
();
/* init rt-thread device interface */
eth_dev
->
parent
.
parent
.
init
=
eth_dev_init
;
eth_dev
->
parent
.
parent
.
open
=
eth_dev_open
;
eth_dev
->
parent
.
parent
.
close
=
eth_dev_close
;
eth_dev
->
parent
.
parent
.
read
=
eth_dev_read
;
eth_dev
->
parent
.
parent
.
write
=
eth_dev_write
;
eth_dev
->
parent
.
parent
.
control
=
eth_dev_control
;
eth_dev
->
parent
.
eth_rx
=
eth_dev_rx
;
eth_dev
->
parent
.
eth_tx
=
eth_dev_tx
;
result
=
rt_mb_init
(
&
eth_rx_pbuf_mb
,
"epbuf"
,
&
rx_pbuf_mb_pool
[
0
],
sizeof
(
rx_pbuf_mb_pool
)
/
4
,
RT_IPC_FLAG_FIFO
);
RT_ASSERT
(
result
==
RT_EOK
);
eth_dev
->
rx_pbuf_mb
=
&
eth_rx_pbuf_mb
;
result
=
eth_device_init
(
&
(
eth_dev
->
parent
),
"e0"
);
return
result
;
RT_ASSERT
(
result
==
RT_EOK
);
eth_dev
->
rx_pbuf_mb
=
&
eth_rx_pbuf_mb
;
result
=
eth_device_init
(
&
(
eth_dev
->
parent
),
"e0"
);
return
result
;
}
// eth_device_init using malloc
// We use INIT_COMPONENT_EXPORT insted of INIT_BOARD_EXPORT
...
...
@@ -1416,28 +1416,28 @@ INIT_COMPONENT_EXPORT(rt_hw_tiva_eth_init);
#include "finsh.h"
void PHY_Read(uint8_t addr)
{
uint16_t data = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, addr);
rt_kprintf("R PHY_REG[0x%02X] = 0x%04X\n", addr, data);
uint16_t data = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, addr);
rt_kprintf("R PHY_REG[0x%02X] = 0x%04X\n", addr, data);
}
FINSH_FUNCTION_EXPORT(PHY_Read, (add));
void PHY_Write(uint8_t addr , uint16_t data)
{
EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, addr, data);
rt_kprintf("W PHY_REG[0x%02X] = 0x%04X\n", addr, data);
rt_kprintf("W PHY_REG[0x%02X] = 0x%04X\n", addr, data);
}
FINSH_FUNCTION_EXPORT(PHY_Write, (add, data));
void PHY_SetAdd(uint8_t addr0, uint8_t addr1, uint8_t addr2,
uint8_t addr3, uint8_t addr4, uint8_t addr5)
{
uint32_t ulUser[2];
ulUser[0] = (((addr2<<8)|addr1)<<8)|addr0;
ulUser[1] = (((addr5<<8)|addr4)<<8)|addr3;
MAP_FlashUserSet(ulUser[0], ulUser[1]);
MAP_FlashUserSave();
rt_kprintf("Save to EEPROM. please reboot.");
uint32_t ulUser[2];
ulUser[0] = (((addr2<<8)|addr1)<<8)|addr0;
ulUser[1] = (((addr5<<8)|addr4)<<8)|addr3;
MAP_FlashUserSet(ulUser[0], ulUser[1]);
MAP_FlashUserSave();
rt_kprintf("Save to EEPROM. please reboot.");
}
FINSH_FUNCTION_EXPORT(PHY_SetAdd, (add0-add5));
#endif //RT_USING_FINSH
...
...
bsp/tm4c129x/rtconfig.h
浏览文件 @
61b6fca3
...
...
@@ -8,17 +8,18 @@
#define RT_NAME_MAX 8
#define RT_ALIGN_SIZE 4
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 100
#define RT_DEBUG
#define RT_USING_OVERFLOW_CHECK
#define RT_DEBUG_INIT 0
/* RT_DEBUG_THREAD is not set */
#define RT_USING_HOOK
#define RT_USING_IDLE_HOOK
#define RT_IDEL_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256
#define RT_USING_TIMER_SOFT
#define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 512
#define RT_DEBUG
/* Inter-Thread communication */
...
...
@@ -27,15 +28,13 @@
#define RT_USING_EVENT
#define RT_USING_MAILBOX
#define RT_USING_MESSAGEQUEUE
/* RT_USING_SIGNALS is not set */
/* Memory Management */
#define RT_USING_MEMPOOL
#define RT_USING_MEMHEAP
#define RT_USING_HEAP
#define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */
#define RT_USING_HEAP
/* Kernel Device Object */
...
...
@@ -43,71 +42,64 @@
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart0"
/* RT_USING_MODULE is not set */
#define RT_VER_NUM 0x40000
/* RT-Thread Components */
#define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
#define RT_MAIN_THREAD_PRIORITY 10
/* C++ features */
/* RT_USING_CPLUSPLUS is not set */
/* Command shell */
#define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 4096
#define FINSH_CMD_SIZE 80
/* FINSH_USING_AUTH is not set */
/* FINSH_USING_MSH is not set */
/* Device virtual file system */
/* RT_USING_DFS is not set */
/* Device Drivers */
#define RT_USING_DEVICE_IPC
#define RT_PIPE_BUFSZ 512
#define RT_USING_SERIAL
#define RT_SERIAL_USING_DMA
/* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */
/* RT_USING_I2C is not set */
/* RT_USING_PIN is not set */
/* RT_USING_MTD_NOR is not set */
/* RT_USING_MTD_NAND is not set */
/* RT_USING_RTC is not set */
/* RT_USING_SDIO is not set */
/* RT_USING_SPI is not set */
/* RT_USING_WDT is not set */
/* RT_USING_USB_HOST is not set */
/* RT_USING_USB_DEVICE is not set */
/* Using WiFi */
/* Using USB */
/* POSIX layer and C standard library */
/* RT_USING_LIBC is not set */
/* RT_USING_PTHREADS is not set */
#define RT_USING_LIBC
/* Network */
/* Socket abstraction layer */
/* Network stack */
/* light weight TCP/IP stack */
#define RT_USING_LWIP
#define RT_USING_LWIP141
/* RT_USING_LWIP202 is not set */
/* RT_LWIP_IGMP is not set */
#define RT_LWIP_ICMP
/* RT_LWIP_SNMP is not set */
#define RT_LWIP_DNS
#define RT_LWIP_DHCP
#define IP_SOF_BROADCAST 1
#define IP_SOF_BROADCAST_RECV 1
/* LWIP_USING_DHCPD is not set */
/* Static IPv4 Address */
...
...
@@ -116,10 +108,7 @@
#define RT_LWIP_MSKADDR "255.255.255.0"
#define RT_LWIP_UDP
#define RT_LWIP_TCP
/* RT_LWIP_RAW is not set */
/* RT_LWIP_PPP is not set */
/* RT_LWIP_PPPOE is not set */
/* RT_LWIP_PPPOS is not set */
#define RT_MEMP_NUM_NETCONN 8
#define RT_LWIP_PBUF_NUM 16
#define RT_LWIP_RAW_PCB_NUM 4
#define RT_LWIP_UDP_PCB_NUM 4
...
...
@@ -133,62 +122,69 @@
#define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
/* RT_LWIP_REASSEMBLY_FRAG is not set */
#define LWIP_NETIF_STATUS_CALLBACK 1
#define SO_REUSE 1
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */
/* RT_USING_NETUTILS is not set */
/*
RT-Thread UI Engine
*/
/*
AT commands
*/
/* PKG_USING_GUIENGINE is not set */
/*
RT-Thread online packages
*/
/*
VBUS(Virtual Software BUS)
*/
/* system packages */
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */
/* Utilities */
/* RT-Thread online packages */
/* IoT - internet of things */
/* PKG_USING_PAHOMQTT is not set */
/* PKG_USING_WEBCLIENT is not set */
/* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */
/* PKG_USING_EZXML is not set */
/* Wi-Fi */
/* Marvell WiFi */
/* PKG_USING_MARVELLWIFI is not set */
/* Wiced WiFi */
/* IoT Cloud */
/* security packages */
/* PKG_USING_MBEDTLS is not set */
/* language packages */
/* PKG_USING_JERRYSCRIPT is not set */
/* multimedia packages */
/* tools packages */
/* PKG_USING_CMBACKTRACE is not set */
/* PKG_USING_EASYLOGGER is not set */
/* system packages */
/* peripheral libraries and drivers */
/* miscellaneous packages */
/* PKG_USING_HELLO is not set */
/* BSP_SPECIAL CONFIG */
/* samples: kernel and components samples */
/* Privated Packages of RealThread */
/* Network Utilities */
#define RT_USING_UART0
...
...
components/net/lwip-1.4.1/src/arch/include/arch/cc.h
浏览文件 @
61b6fca3
...
...
@@ -38,13 +38,14 @@
#include <rthw.h>
#include <rtthread.h>
typedef
rt_uint8_t
u8_t
;
typedef
rt_int8_t
s8_t
;
typedef
rt_uint16_t
u16_t
;
typedef
rt_int16_t
s16_t
;
typedef
rt_uint32_t
u32_t
;
typedef
rt_int32_t
s32_t
;
typedef
rt_uint32_t
mem_ptr_t
;
#include <stdint.h>
typedef
uint8_t
u8_t
;
typedef
int8_t
s8_t
;
typedef
uint16_t
u16_t
;
typedef
int16_t
s16_t
;
typedef
uint32_t
u32_t
;
typedef
int32_t
s32_t
;
typedef
uintptr_t
mem_ptr_t
;
#define U16_F "hu"
#define S16_F "hd"
...
...
components/net/lwip-1.4.1/src/arch/sys_arch.c
浏览文件 @
61b6fca3
...
...
@@ -497,10 +497,11 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
t
=
timeout
/
(
1000
/
RT_TICK_PER_SECOND
);
}
ret
=
rt_mb_recv
(
*
mbox
,
(
rt_uint32_t
*
)
msg
,
t
);
ret
=
rt_mb_recv
(
*
mbox
,
(
rt_ubase_t
*
)
msg
,
t
);
if
(
ret
==
-
RT_ETIMEOUT
)
{
return
SYS_ARCH_TIMEOUT
;
}
else
{
LWIP_ASSERT
(
"rt_mb_recv returned with error!"
,
ret
==
RT_EOK
);
...
...
@@ -528,10 +529,11 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
{
int
ret
;
ret
=
rt_mb_recv
(
*
mbox
,
(
rt_uint32_t
*
)
msg
,
0
);
ret
=
rt_mb_recv
(
*
mbox
,
(
rt_ubase_t
*
)
msg
,
0
);
if
(
ret
==
-
RT_ETIMEOUT
)
{
return
SYS_ARCH_TIMEOUT
;
}
else
{
if
(
ret
==
RT_EOK
)
...
...
components/net/lwip-1.4.1/src/netif/ethernetif.c
浏览文件 @
61b6fca3
...
...
@@ -307,7 +307,7 @@ static void eth_tx_thread_entry(void* parameter)
while
(
1
)
{
if
(
rt_mb_recv
(
&
eth_tx_thread_mb
,
(
rt_u
int32
_t
*
)
&
msg
,
RT_WAITING_FOREVER
)
==
RT_EOK
)
if
(
rt_mb_recv
(
&
eth_tx_thread_mb
,
(
rt_u
base
_t
*
)
&
msg
,
RT_WAITING_FOREVER
)
==
RT_EOK
)
{
struct
eth_device
*
enetif
;
...
...
@@ -339,7 +339,7 @@ static void eth_rx_thread_entry(void* parameter)
while
(
1
)
{
if
(
rt_mb_recv
(
&
eth_rx_thread_mb
,
(
rt_u
int32
_t
*
)
&
device
,
RT_WAITING_FOREVER
)
==
RT_EOK
)
if
(
rt_mb_recv
(
&
eth_rx_thread_mb
,
(
rt_u
base
_t
*
)
&
device
,
RT_WAITING_FOREVER
)
==
RT_EOK
)
{
struct
pbuf
*
p
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录