mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-16 19:38:56 +00:00
V1.0.5
This commit is contained in:
@@ -21,10 +21,13 @@ static void list_ifconfig(void)
|
||||
struct netif *netif;
|
||||
|
||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||
printf("%s%d:\n",netif->name, netif->num);
|
||||
printf(" IPv4 Address : %s\n", ip4addr_ntoa(&netif->ip_addr));
|
||||
printf(" Default Gateway: %s\n", ip4addr_ntoa(&netif->gw));
|
||||
printf(" Subnet mask : %s\n", ip4addr_ntoa(&netif->netmask));
|
||||
printf("%c%c%d:\n",netif->name[0], netif->name[1], netif->num);
|
||||
printf(" IPv4 Address : %s\n", ip_ntoa(&netif->ip_addr));
|
||||
printf(" Default Gateway: %s\n", ip_ntoa(&netif->gw));
|
||||
printf(" Subnet mask : %s\n", ip_ntoa(&netif->netmask));
|
||||
#if LWIP_IPV6
|
||||
printf(" IPv6 Local address : %s\n", ip6addr_ntoa(netif_ip6_addr(netif, 0)));
|
||||
#endif
|
||||
printf(" MAC addr : %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
netif->hwaddr[0],
|
||||
netif->hwaddr[1],
|
||||
@@ -39,36 +42,38 @@ static void list_ifconfig(void)
|
||||
#include "ethernetif.h"
|
||||
#include "aic_mac.h"
|
||||
|
||||
aicmac_netif_t aic_netif;
|
||||
|
||||
#if LWIP_IPV4
|
||||
void init_gmac_netif(const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw)
|
||||
void init_gmac_netif(int gmac_no, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw)
|
||||
#else
|
||||
void init_gmac_netif(void)
|
||||
#endif
|
||||
void init_gmac_netif(int gmac_no)
|
||||
#endif /* LWIP_IPV4 */
|
||||
{
|
||||
/* Select aic mac port num */
|
||||
aic_netif.port = 0;
|
||||
/* ethernet init */
|
||||
#ifdef AIC_USING_GMAC0
|
||||
#if LWIP_IPV4
|
||||
aicmac_netif_t *aic_netif = malloc(sizeof(aicmac_netif_t));
|
||||
if (aic_netif == NULL) {
|
||||
printf("No enough memory for ethernet%d\n", gmac_no);
|
||||
return;
|
||||
}
|
||||
/* Select aic mac port num */
|
||||
aic_netif->port = gmac_no;
|
||||
|
||||
#if LWIP_IPV4
|
||||
#if NO_SYS
|
||||
netif_add(&aic_netif.netif, ipaddr, netmask, gw, NULL, ethernetif_init, netif_input);
|
||||
netif_add(&aic_netif->netif, ipaddr, netmask, gw, NULL, ethernetif_init, netif_input);
|
||||
#else /* NO_SYS */
|
||||
netif_add(&aic_netif.netif, ipaddr, netmask, gw, NULL, ethernetif_init, tcpip_input);
|
||||
netif_add(&aic_netif->netif, ipaddr, netmask, gw, NULL, ethernetif_init, tcpip_input);
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
#else /* LWIP_IPV4 */
|
||||
|
||||
#if NO_SYS
|
||||
netif_add(&aic_netif.netif, NULL, ethernetif_init, netif_input);
|
||||
netif_add(&aic_netif->netif, NULL, ethernetif_init, netif_input);
|
||||
#else
|
||||
netif_add(&aic_netif.netif, NULL, ethernetif_init, tcpip_input);
|
||||
netif_add(&aic_netif->netif, NULL, ethernetif_init, tcpip_input);
|
||||
#endif /* !NO_SYS */
|
||||
#endif /* !LWIP_IPV4 */
|
||||
netif_set_up(&aic_netif.netif);
|
||||
#endif /* AIC_USING_GMAC0 */
|
||||
|
||||
netif_set_up(&aic_netif->netif);
|
||||
}
|
||||
#endif /* defined(AIC_USING_GMAC0) | defined(AIC_USING_GMAC1) */
|
||||
|
||||
@@ -90,11 +95,25 @@ void netif_startup(void)
|
||||
ip4addr_aton(AIC_DEV_GMAC0_IPADDR, &ipaddr);
|
||||
ip4addr_aton(AIC_DEV_GMAC0_NETMASK, &netmask);
|
||||
#endif
|
||||
init_gmac_netif(&ipaddr, &netmask, &gw);
|
||||
init_gmac_netif(0, &ipaddr, &netmask, &gw);
|
||||
#else
|
||||
init_gmac_netif();
|
||||
init_gmac_netif(0);
|
||||
#endif /* LWIP_IPV4 */
|
||||
#endif /* WLAN */
|
||||
#endif /* AIC_USING_GMAC0 */
|
||||
|
||||
#ifdef AIC_USING_GMAC1
|
||||
#if LWIP_IPV4
|
||||
#if !LWIP_DHCP
|
||||
ip4addr_aton(AIC_DEV_GMAC1_GW, &gw);
|
||||
ip4addr_aton(AIC_DEV_GMAC1_IPADDR, &ipaddr);
|
||||
ip4addr_aton(AIC_DEV_GMAC1_NETMASK, &netmask);
|
||||
#endif
|
||||
init_gmac_netif(1, &ipaddr, &netmask, &gw);
|
||||
#else
|
||||
init_gmac_netif(1);
|
||||
#endif /* LWIP_IPV4 */
|
||||
#endif /* AIC_USING_GMAC1 */
|
||||
|
||||
|
||||
#ifdef AIC_USING_REALTEK_WLAN0
|
||||
#if LWIP_IPV4
|
||||
@@ -129,16 +148,15 @@ void netif_startup(void)
|
||||
}
|
||||
|
||||
#if NO_SYS
|
||||
extern void aic_phy_poll(void);
|
||||
extern void aic_phy_poll(struct netif *netif);
|
||||
void netif_baremetal_poll(void)
|
||||
{
|
||||
struct netif *netif;
|
||||
|
||||
aic_phy_poll();
|
||||
|
||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||
aic_phy_poll(netif);
|
||||
if (netif_is_link_up(netif)) {
|
||||
ethernetif_input_poll();
|
||||
ethernetif_input_poll(netif);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user