This commit is contained in:
刘可亮
2024-01-27 08:47:24 +08:00
parent d3bd993b5f
commit 9f7ba67007
2345 changed files with 74421 additions and 76616 deletions

View File

@@ -42,15 +42,15 @@ if LPKG_USING_LWIP
#select NETDEV_IPV6_SCOPES if LPKG_USING_LWIP213
endif
menuconfig LPKG_LWIP_EXAMPLES
config LPKG_LWIP_EXAMPLES
bool "LwIP Examples"
default n
if LPKG_LWIP_EXAMPLES
config LPKG_LWIP_EXAMPLES_TEST
bool "example test"
default n
endif
# if LPKG_LWIP_EXAMPLES
# config LPKG_LWIP_EXAMPLES_TEST
# bool "example test"
# default n
# endif
config LPKG_LWIP_IGMP
bool "IGMP protocol"
@@ -183,7 +183,6 @@ if LPKG_USING_LWIP
menuconfig LPKG_LWIP_USING_PING
bool "Enable ping features"
default n
select NETDEV_USING_PING
select LPKG_LWIP_ICMP
select LPKG_LWIP_RAW
@@ -207,7 +206,6 @@ if LPKG_USING_LWIP
config LPKG_LWIP_USING_PING
bool "Enable ping features"
default n
select NETDEV_USING_PING
select LPKG_LWIP_ICMP
select LPKG_LWIP_RAW
endif

View File

@@ -261,10 +261,9 @@ contrib/ports/drv/aic/sys/ethernetif.c
lwipexample_SRCS = Split("""
contrib/examples/example_app/test.c
contrib/examples/example_app/netif_startup.c
contrib/examples/lwiperf/lwiperf_example.c
""")
# 20.1
# 20.1
src = []
path = []
@@ -315,7 +314,7 @@ if GetDepend(['AIC_GMAC_DRV']):
path += [cwd + '/contrib/ports/drv/aic/sys/',
cwd + '/contrib/ports/drv/aic/']
if GetDepend(['LPKG_LWIP_EXAMPLES_TEST']):
if GetDepend(['LPKG_LWIP_EXAMPLES']):
src += lwipexample_SRCS
group = DefineGroup('lwIP', src, depend = ['LPKG_USING_LWIP'], CPPPATH = path)

View File

@@ -12,7 +12,7 @@
#include "netif_startup.h"
#include <aic_core.h>
#ifdef AIC_USING_RTL8733_WLAN0
#ifdef AIC_USING_REALTEK_WLAN0
#include "ethernetif_wlan.h"
#endif
@@ -100,22 +100,27 @@ void netif_startup(void)
#endif /* LWIP_IPV4 */
#endif /* WLAN */
#ifdef AIC_USING_RTL8733_WLAN0
#ifdef AIC_USING_REALTEK_WLAN0
#if LWIP_IPV4
#if !LWIP_DHCP
ip4addr_aton(AIC_DEV_RTL8733_WLAN0_GW, &gw);
ip4addr_aton(AIC_DEV_RTL8733_WLAN0_IPADDR, &ipaddr);
ip4addr_aton(AIC_DEV_RTL8733_WLAN0_NETMASK, &netmask);
ip4addr_aton(AIC_DEV_REALTEK_WLAN0_GW, &gw);
ip4addr_aton(AIC_DEV_REALTEK_WLAN0_IPADDR, &ipaddr);
ip4addr_aton(AIC_DEV_REALTEK_WLAN0_NETMASK, &netmask);
#endif /* !LWIP_DHCP */
/* wlan init */
init_wlan_netif(&ipaddr, &netmask, &gw);
#else
init_wlan_netif();
#endif /* LWIP_IPV4 */
#endif /* AIC_USING_RTL8733_WLAN0 */
#endif /* AIC_USING_REALTEK_WLAN0 */
if (netif_list == NULL) {
printf("LwIP startup error!, Make sure you have enabled gmac or wlan\n");
return;
}
/* the first netif as the default netif */
for (netif = netif_list; netif != NULL; netif = netif->next) {
for (netif = netif_list; netif->next != NULL; netif = netif->next) {
}

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2001,2002 Florian Schulze.
* All rights reserved.
*
@@ -471,98 +471,6 @@ dns_dorequest(void *arg)
}
#endif /* LWIP_DNS_APP && LWIP_DNS */
/* This function initializes applications */
static void
apps_init(void)
{
#if LWIP_DNS_APP && LWIP_DNS
/* wait until the netif is up (for dhcp, autoip or ppp) */
sys_timeout(5000, dns_dorequest, NULL);
#endif /* LWIP_DNS_APP && LWIP_DNS */
#if LWIP_CHARGEN_APP && LWIP_SOCKET
chargen_init();
#endif /* LWIP_CHARGEN_APP && LWIP_SOCKET */
#if LWIP_PING_APP && LWIP_RAW && LWIP_ICMP
ping_init(&netif_default->gw);
#endif /* LWIP_PING_APP && LWIP_RAW && LWIP_ICMP */
#if LWIP_NETBIOS_APP && LWIP_UDP
netbiosns_init();
#ifndef NETBIOS_LWIP_NAME
#if LWIP_NETIF_HOSTNAME
netbiosns_set_name(netif_default->hostname);
#else
netbiosns_set_name("NETBIOSLWIPDEV");
#endif
#endif
#endif /* LWIP_NETBIOS_APP && LWIP_UDP */
#if LWIP_HTTPD_APP && LWIP_TCP
#ifdef LWIP_HTTPD_APP_NETCONN
http_server_netconn_init();
#else /* LWIP_HTTPD_APP_NETCONN */
#if defined(LWIP_HTTPD_EXAMPLE_CUSTOMFILES) && LWIP_HTTPD_EXAMPLE_CUSTOMFILES && defined(LWIP_HTTPD_EXAMPLE_CUSTOMFILES_ROOTDIR)
fs_ex_init(LWIP_HTTPD_EXAMPLE_CUSTOMFILES_ROOTDIR);
#endif
httpd_init();
#if defined(LWIP_HTTPD_EXAMPLE_SSI_SIMPLE) && LWIP_HTTPD_EXAMPLE_SSI_SIMPLE
ssi_ex_init();
#endif
#if defined(LWIP_HTTPD_EXAMPLE_CGI_SIMPLE) && LWIP_HTTPD_EXAMPLE_CGI_SIMPLE
cgi_ex_init();
#endif
#endif /* LWIP_HTTPD_APP_NETCONN */
#endif /* LWIP_HTTPD_APP && LWIP_TCP */
#if LWIP_NETIO_APP && LWIP_TCP
netio_init();
#endif /* LWIP_NETIO_APP && LWIP_TCP */
#if LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP
rtp_init();
#endif /* LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP */
#if LWIP_SHELL_APP && LWIP_NETCONN
shell_init();
#endif /* LWIP_SHELL_APP && LWIP_NETCONN */
#if LWIP_TCPECHO_APP
#if LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN)
tcpecho_init();
#else /* LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN) */
tcpecho_raw_init();
#endif
#endif /* LWIP_TCPECHO_APP && LWIP_NETCONN */
#if LWIP_UDPECHO_APP && LWIP_NETCONN
udpecho_init();
#endif /* LWIP_UDPECHO_APP && LWIP_NETCONN */
#if LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET
socket_examples_init();
#endif /* LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET */
#if LWIP_MDNS_APP
mdns_example_init();
#endif
#if LWIP_SNMP_APP
snmp_example_init();
#endif
#if LWIP_SNTP_APP
sntp_example_init();
#endif
#if LWIP_TFTP_APP
tftp_example_init();
#endif
#if LWIP_LWIPERF_APP
lwiperf_example_init();
#endif
#if LWIP_MQTT_APP
mqtt_example_init();
#endif
#ifdef LWIP_APP_INIT
LWIP_APP_INIT();
#endif
}
/* This function initializes this lwIP test. When NO_SYS=1, this is done in
* the main_loop context (there is no other one), when NO_SYS=0, this is done
@@ -584,9 +492,6 @@ test_init(void * arg)
/* init network interfaces */
test_netif_init();
/* init apps */
apps_init();
#if !NO_SYS
sys_sem_signal(init_sem);
#endif /* !NO_SYS */

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2022, Artinchip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
@@ -160,8 +160,18 @@ int aicmac_init(uint32_t port)
memset(dctl, 0, sizeof(dctl));
/* phy reset */
if (mac_config[port].phyrst_gpio_name){
/* HW Low-Level Init */
aicmac_low_level_init(port, ENABLE);
/* Software reset */
aicmac_sw_reset(port);
/* Wait for software reset */
while (aicmac_get_sw_reset_status(port) == SET) {
}
/* phy reset must after mac reset */
if (mac_config[port].phyrst_gpio_name) {
pin = hal_gpio_name2pin(mac_config[port].phyrst_gpio_name);
g = GPIO_GROUP(pin);
p = GPIO_GROUP_PIN(pin);
@@ -174,14 +184,6 @@ int aicmac_init(uint32_t port)
aicos_mdelay(50);
}
/* HW Low-Level Init */
aicmac_low_level_init(port, ENABLE);
/* Software reset */
aicmac_sw_reset(port);
/* Wait for software reset */
while (aicmac_get_sw_reset_status(port) == SET)
;
aicos_udelay(1000);
/* MDCIO Internal Clock Select */
@@ -198,8 +200,8 @@ int aicmac_init(uint32_t port)
tmpreg |= ETH_MDIOCTL_CR_Div62;
} else if ((ahbclk >= 150000000) && (ahbclk < 250000000)) {
tmpreg |= ETH_MDIOCTL_CR_Div102;
} else /* ((ahbclk >= 250000000)&&(ahbclk <= 300000000)) */
{
} else {
/* ((ahbclk >= 250000000)&&(ahbclk <= 300000000)) */
tmpreg |= ETH_MDIOCTL_CR_Div124;
}
writel(tmpreg, MAC(port, mdioctl));
@@ -569,7 +571,7 @@ void aicmac_dma_rx_desc_init(uint32_t port)
#else
/* get a pbuf from PBUF_POOL */
p = pbuf_alloc(PBUF_RAW, 1, PBUF_POOL);
if (p == NULL){
if (p == NULL) {
pr_err("%s pbuf_alloc fail!\n", __func__);
return;
}
@@ -728,7 +730,7 @@ aicmac_frame_t aicmac_get_rx_frame_interrupt(uint32_t port)
{
aicmac_dma_desc_t *pdesc = dctl[port].rx_desc_p;
aicmac_rx_frame_info_t *pinfo = dctl[port].rx_frame_info_p;
aicmac_frame_t frame = { 0, 0, 0, 0};
aicmac_frame_t frame = { 0, 0, 0, 0 };
uint32_t descriptor_scan_counter = 0;
/* before read: invalid cache */
@@ -807,13 +809,13 @@ void aicmac_release_rx_frame(uint32_t port)
while(pdesc != pdesc_end) {
#ifdef CONFIG_MAC_ZERO_COPY_RXBUF
index = pdesc->reserved1;
if (index >= ETH_RXBUFNB){
if (index >= ETH_RXBUFNB) {
pr_err("%s get dma desc index err.\n", __func__);
return;
}
/* get a pbuf from PBUF_POOL */
p = pbuf_alloc(PBUF_RAW, 1, PBUF_POOL);
if (p == NULL){
if (p == NULL) {
pr_info("%s rx pbuf_alloc fail!\n", __func__);
dctl[port].rx_buf_underrun = 1;
return;
@@ -843,7 +845,7 @@ void aicmac_release_rx_frame(uint32_t port)
}
#ifdef CONFIG_MAC_ZERO_COPY_RXBUF
if (dctl[port].rx_buf_underrun){
if (dctl[port].rx_buf_underrun) {
pr_info("%s rx pbuf underrun resume!\n", __func__);
dctl[port].rx_buf_underrun = 0;
}
@@ -869,8 +871,9 @@ int aicmac_submit_tx_frame(uint32_t port, u16 frame_len)
buf_count = frame_len / ETH_TX_BUF_SIZE;
if (frame_len % ETH_TX_BUF_SIZE)
buf_count++;
} else
} else {
buf_count = 1;
}
if (buf_count == 1) {
/* Set frame size */
@@ -955,13 +958,13 @@ void aicmac_confirm_tx_frame(uint32_t port)
((pdesc->control & ETH_DMARxDesc_OWN) == (uint32_t)RESET)) {
index = pdesc->reserved1;
if (index >= ETH_RXBUFNB){
if (index >= ETH_RXBUFNB) {
pr_err("%s get dma desc index err.\n", __func__);
return;
}
p = dctl[port].tx_buff[index];
if (p != NULL){
if (p != NULL) {
pbuf_free(p);
dctl[port].tx_buff[index] = NULL;
}
@@ -982,7 +985,7 @@ void aicmac_confirm_tx_frame(uint32_t port)
void aicmac_set_dma_tx_desc_int(uint32_t port, bool en)
{
aicmac_dma_desc_t *prxdesc;
uint32_t count = ETH_RXBUFNB;
uint32_t count = ETH_TXBUFNB;
uint32_t i;
for (i = 0; i < count; i++) {