forked from xuos/xiuos
Support double lwip eport, use mongoose.a
This commit is contained in:
@@ -278,10 +278,7 @@ struct pbuf* low_level_input(struct netif* netif)
|
||||
return p;
|
||||
}
|
||||
|
||||
extern void LwipSetIPTest(int argc, char* argv[]);
|
||||
int HwEthInit(void)
|
||||
{
|
||||
// lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, lwip_gwaddr);
|
||||
LwipSetIPTest(1, NULL);
|
||||
return EOK;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ static int lwip_netdev_set_addr_info(struct netdev* netdev, ip_addr_t* ip_addr,
|
||||
netif_set_gw((struct netif*)netdev->user_data, ip_2_ip4(gw));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LWIP_DNS
|
||||
@@ -92,7 +93,7 @@ static int lwip_netdev_set_dns_server(struct netdev* netdev, uint8_t dns_num, ip
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
static int lwip_netdev_set_dhcp(struct netdev* netdev, bool is_enabled)
|
||||
{
|
||||
netdev_low_level_set_dhcp_status(netdev, is_enabled);
|
||||
@@ -120,7 +121,7 @@ static const struct netdev_ops lwip_netdev_ops = {
|
||||
#ifdef LWIP_DNS
|
||||
.set_dns_server = lwip_netdev_set_dns_server,
|
||||
#endif
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
.set_dhcp = lwip_netdev_set_dhcp,
|
||||
#endif
|
||||
.set_default = lwip_netdev_set_default,
|
||||
@@ -179,9 +180,9 @@ int lwip_netdev_add(struct netif* lwip_netif)
|
||||
netdev->ops = &lwip_netdev_ops;
|
||||
netdev->hwaddr_len = lwip_netif->hwaddr_len;
|
||||
memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
|
||||
netdev->ip_addr = lwip_netif->ip_addr;
|
||||
netdev->gw = lwip_netif->gw;
|
||||
netdev->netmask = lwip_netif->netmask;
|
||||
netdev->ip_addr = &lwip_netif->ip_addr;
|
||||
netdev->gw = &lwip_netif->gw;
|
||||
netdev->netmask = &lwip_netif->netmask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SRC_FILES := socket.c connect_w5500.c w5500.c wizchip_conf.c spi_interface.c wiz_ping.c connect_w5500_test.c wiz_iperf.c
|
||||
SRC_FILES := socket.c connect_w5500.c w5500.c wizchip_conf.c spi_interface.c wiz_ping.c connect_w5500_test.c w5x00_lwip.c wiz_iperf.c
|
||||
SRC_FILES := socket.c connect_w5500.c w5500.c wizchip_conf.c spi_interface.c w5x00_lwip.c
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
@@ -328,8 +328,12 @@ int HwWiznetInit(void)
|
||||
setSHAR(wiz_mac);
|
||||
ctlwizchip(CW_RESET_PHY, 0);
|
||||
|
||||
network_init();
|
||||
|
||||
wiz_interrupt_init(0, wiz_irq_handler);
|
||||
|
||||
network_init();
|
||||
|
||||
setSn_RXBUF_SIZE(0, 16);
|
||||
setSn_TXBUF_SIZE(0, 16);
|
||||
#define SOCK_ANY_PORT_NUM 0xC000
|
||||
@@ -349,7 +353,5 @@ int HwWiznetInit(void)
|
||||
}
|
||||
}
|
||||
|
||||
network_init();
|
||||
|
||||
return EOK;
|
||||
}
|
||||
@@ -152,6 +152,9 @@ static uint32 SpiDrvConfigure(void *drv, struct BusConfigureInfo *configure_info
|
||||
|
||||
static uint32 SpiWriteData(struct SpiHardwareDevice *spi_dev, struct SpiDataStandard *spi_datacfg)
|
||||
{
|
||||
#define WRITE_BUF_SIZE 1600
|
||||
static uint32_t write_buf[4 * WRITE_BUF_SIZE] = { 0 };
|
||||
|
||||
SpiDeviceParam *dev_param = (SpiDeviceParam *)(spi_dev->haldev.private_data);
|
||||
|
||||
uint8 device_id = dev_param->spi_slave_param->spi_slave_id;
|
||||
@@ -184,10 +187,15 @@ static uint32 SpiWriteData(struct SpiHardwareDevice *spi_dev, struct SpiDataStan
|
||||
dmac_set_single_mode(dev_param->spi_dma_param->spi_dmac_txchannel, &dummy, (void *)(&spi_instance[device_master_id]->dr[0]), DMAC_ADDR_NOCHANGE, DMAC_ADDR_NOCHANGE,
|
||||
DMAC_MSIZE_4, DMAC_TRANS_WIDTH_32, spi_datacfg->length);
|
||||
} else {
|
||||
tx_buff = x_malloc(spi_datacfg->length * 4);
|
||||
if (!tx_buff) {
|
||||
goto transfer_done;
|
||||
if (spi_datacfg->length > WRITE_BUF_SIZE) {
|
||||
tx_buff = x_malloc(spi_datacfg->length * 4);
|
||||
if (!tx_buff) {
|
||||
goto transfer_done;
|
||||
}
|
||||
} else {
|
||||
tx_buff = write_buf;
|
||||
}
|
||||
|
||||
for (i = 0; i < spi_datacfg->length; i++) {
|
||||
tx_buff[i] = ((uint8_t *)spi_datacfg->tx_buff)[i];
|
||||
}
|
||||
@@ -201,10 +209,10 @@ static uint32 SpiWriteData(struct SpiHardwareDevice *spi_dev, struct SpiDataStan
|
||||
spi_instance[device_master_id]->ser = 0x00;
|
||||
spi_instance[device_master_id]->ssienr = 0x00;
|
||||
|
||||
transfer_done:
|
||||
if (tx_buff != NULL) {
|
||||
x_free(tx_buff);
|
||||
}
|
||||
transfer_done:
|
||||
if (tx_buff != NULL && spi_datacfg->length > WRITE_BUF_SIZE) {
|
||||
x_free(tx_buff);
|
||||
}
|
||||
}
|
||||
|
||||
if (spi_datacfg->spi_cs_release) {
|
||||
@@ -219,6 +227,9 @@ static uint32 SpiWriteData(struct SpiHardwareDevice *spi_dev, struct SpiDataStan
|
||||
|
||||
static uint32 SpiReadData(struct SpiHardwareDevice *spi_dev, struct SpiDataStandard *spi_datacfg)
|
||||
{
|
||||
#define READ_BUF_SIZE 1600
|
||||
static uint32_t read_buf[4 * READ_BUF_SIZE] = { 0 };
|
||||
|
||||
SpiDeviceParam *dev_param = (SpiDeviceParam *)(spi_dev->haldev.private_data);
|
||||
|
||||
uint32 spi_read_length = 0;;
|
||||
@@ -251,12 +262,15 @@ static uint32 SpiReadData(struct SpiHardwareDevice *spi_dev, struct SpiDataStand
|
||||
dmac_set_single_mode(dev_param->spi_dma_param->spi_dmac_rxchannel, (void *)(&spi_instance[device_master_id]->dr[0]), &dummy, DMAC_ADDR_NOCHANGE, DMAC_ADDR_NOCHANGE,
|
||||
DMAC_MSIZE_1, DMAC_TRANS_WIDTH_32, spi_datacfg->length);
|
||||
} else {
|
||||
rx_buff = x_calloc(spi_datacfg->length * 4, 1);
|
||||
if(!rx_buff)
|
||||
{
|
||||
goto transfer_done;
|
||||
if (spi_datacfg->length > READ_BUF_SIZE) {
|
||||
rx_buff = x_calloc(spi_datacfg->length * 4, 1);
|
||||
if (!rx_buff) {
|
||||
goto transfer_done;
|
||||
}
|
||||
} else {
|
||||
rx_buff = read_buf;
|
||||
}
|
||||
|
||||
|
||||
dmac_set_single_mode(dev_param->spi_dma_param->spi_dmac_rxchannel, (void *)(&spi_instance[device_master_id]->dr[0]), rx_buff, DMAC_ADDR_NOCHANGE, DMAC_ADDR_INCREMENT,
|
||||
DMAC_MSIZE_1, DMAC_TRANS_WIDTH_32, spi_datacfg->length);
|
||||
}
|
||||
@@ -273,8 +287,8 @@ static uint32 SpiReadData(struct SpiHardwareDevice *spi_dev, struct SpiDataStand
|
||||
}
|
||||
}
|
||||
|
||||
transfer_done:
|
||||
if (rx_buff) {
|
||||
transfer_done:
|
||||
if (rx_buff && spi_datacfg->length > READ_BUF_SIZE) {
|
||||
x_free(rx_buff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ static int lwip_netdev_set_addr_info(struct netdev* netdev, ip_addr_t* ip_addr,
|
||||
netif_set_gw((struct netif*)netdev->user_data, ip_2_ip4(gw));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LWIP_DNS
|
||||
@@ -92,7 +93,7 @@ static int lwip_netdev_set_dns_server(struct netdev* netdev, uint8_t dns_num, ip
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
static int lwip_netdev_set_dhcp(struct netdev* netdev, bool is_enabled)
|
||||
{
|
||||
netdev_low_level_set_dhcp_status(netdev, is_enabled);
|
||||
@@ -120,7 +121,7 @@ static const struct netdev_ops lwip_netdev_ops = {
|
||||
#ifdef LWIP_DNS
|
||||
.set_dns_server = lwip_netdev_set_dns_server,
|
||||
#endif
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
.set_dhcp = lwip_netdev_set_dhcp,
|
||||
#endif
|
||||
.set_default = lwip_netdev_set_default,
|
||||
@@ -180,9 +181,9 @@ int lwip_netdev_add(struct netif* lwip_netif)
|
||||
netdev->ops = &lwip_netdev_ops;
|
||||
netdev->hwaddr_len = lwip_netif->hwaddr_len;
|
||||
memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
|
||||
netdev->ip_addr = lwip_netif->ip_addr;
|
||||
netdev->gw = lwip_netif->gw;
|
||||
netdev->netmask = lwip_netif->netmask;
|
||||
netdev->ip_addr = &lwip_netif->ip_addr;
|
||||
netdev->gw = &lwip_netif->gw;
|
||||
netdev->netmask = &lwip_netif->netmask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ static int lwip_netdev_set_addr_info(struct netdev* netdev, ip_addr_t* ip_addr,
|
||||
netif_set_gw((struct netif*)netdev->user_data, ip_2_ip4(gw));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LWIP_DNS
|
||||
@@ -92,7 +93,7 @@ static int lwip_netdev_set_dns_server(struct netdev* netdev, uint8_t dns_num, ip
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
static int lwip_netdev_set_dhcp(struct netdev* netdev, bool is_enabled)
|
||||
{
|
||||
netdev_low_level_set_dhcp_status(netdev, is_enabled);
|
||||
@@ -120,7 +121,7 @@ static const struct netdev_ops lwip_netdev_ops = {
|
||||
#ifdef LWIP_DNS
|
||||
.set_dns_server = lwip_netdev_set_dns_server,
|
||||
#endif
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
.set_dhcp = lwip_netdev_set_dhcp,
|
||||
#endif
|
||||
.set_default = lwip_netdev_set_default,
|
||||
@@ -180,9 +181,9 @@ int lwip_netdev_add(struct netif* lwip_netif)
|
||||
netdev->ops = &lwip_netdev_ops;
|
||||
netdev->hwaddr_len = lwip_netif->hwaddr_len;
|
||||
memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
|
||||
netdev->ip_addr = lwip_netif->ip_addr;
|
||||
netdev->gw = lwip_netif->gw;
|
||||
netdev->netmask = lwip_netif->netmask;
|
||||
netdev->ip_addr = &lwip_netif->ip_addr;
|
||||
netdev->gw = &lwip_netif->gw;
|
||||
netdev->netmask = &lwip_netif->netmask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ static int lwip_netdev_set_addr_info(struct netdev* netdev, ip_addr_t* ip_addr,
|
||||
netif_set_gw((struct netif*)netdev->user_data, ip_2_ip4(gw));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LWIP_DNS
|
||||
@@ -92,7 +93,7 @@ static int lwip_netdev_set_dns_server(struct netdev* netdev, uint8_t dns_num, ip
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
static int lwip_netdev_set_dhcp(struct netdev* netdev, bool is_enabled)
|
||||
{
|
||||
netdev_low_level_set_dhcp_status(netdev, is_enabled);
|
||||
@@ -120,7 +121,7 @@ static const struct netdev_ops lwip_netdev_ops = {
|
||||
#ifdef LWIP_DNS
|
||||
.set_dns_server = lwip_netdev_set_dns_server,
|
||||
#endif
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
.set_dhcp = lwip_netdev_set_dhcp,
|
||||
#endif
|
||||
.set_default = lwip_netdev_set_default,
|
||||
@@ -180,9 +181,9 @@ int lwip_netdev_add(struct netif* lwip_netif)
|
||||
netdev->ops = &lwip_netdev_ops;
|
||||
netdev->hwaddr_len = lwip_netif->hwaddr_len;
|
||||
memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
|
||||
netdev->ip_addr = lwip_netif->ip_addr;
|
||||
netdev->gw = lwip_netif->gw;
|
||||
netdev->netmask = lwip_netif->netmask;
|
||||
netdev->ip_addr = &lwip_netif->ip_addr;
|
||||
netdev->gw = &lwip_netif->gw;
|
||||
netdev->netmask = &lwip_netif->netmask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -15,4 +15,8 @@ ifeq ($(CONFIG_RESOURCES_LWIP), y)
|
||||
export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USE_MONGOOSE), y)
|
||||
export LINK_MONGOOSE := $(KERNEL_ROOT)/../../APP_Framework/Applications/mongoose/mongoose.a
|
||||
endif
|
||||
|
||||
export ARCH = arm
|
||||
|
||||
@@ -277,10 +277,7 @@ struct pbuf* low_level_input(struct netif* netif)
|
||||
return p;
|
||||
}
|
||||
|
||||
extern void LwipSetIPTest(int argc, char* argv[]);
|
||||
int HwEthInit(void)
|
||||
{
|
||||
// lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, lwip_gwaddr);
|
||||
LwipSetIPTest(1, NULL);
|
||||
return EOK;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ static int lwip_netdev_set_addr_info(struct netdev* netdev, ip_addr_t* ip_addr,
|
||||
netif_set_gw((struct netif*)netdev->user_data, ip_2_ip4(gw));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LWIP_DNS
|
||||
@@ -92,7 +93,7 @@ static int lwip_netdev_set_dns_server(struct netdev* netdev, uint8_t dns_num, ip
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
static int lwip_netdev_set_dhcp(struct netdev* netdev, bool is_enabled)
|
||||
{
|
||||
netdev_low_level_set_dhcp_status(netdev, is_enabled);
|
||||
@@ -120,7 +121,7 @@ static const struct netdev_ops lwip_netdev_ops = {
|
||||
#ifdef LWIP_DNS
|
||||
.set_dns_server = lwip_netdev_set_dns_server,
|
||||
#endif
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
.set_dhcp = lwip_netdev_set_dhcp,
|
||||
#endif
|
||||
.set_default = lwip_netdev_set_default,
|
||||
@@ -183,9 +184,9 @@ int lwip_netdev_add(struct netif* lwip_netif)
|
||||
netdev->ops = &lwip_netdev_ops;
|
||||
netdev->hwaddr_len = lwip_netif->hwaddr_len;
|
||||
memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
|
||||
netdev->ip_addr = lwip_netif->ip_addr;
|
||||
netdev->gw = lwip_netif->gw;
|
||||
netdev->netmask = lwip_netif->netmask;
|
||||
netdev->ip_addr = &lwip_netif->ip_addr;
|
||||
netdev->gw = &lwip_netif->gw;
|
||||
netdev->netmask = &lwip_netif->netmask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,6 @@ void ethernetif_input(void* netif_arg)
|
||||
/* Move received packet into a new pbuf */
|
||||
while (1) {
|
||||
sys_arch_sem_wait(get_eth_recv_sem(), WAITING_FOREVER);
|
||||
KPrintf("%s -->\n", netif->name);
|
||||
while (1) {
|
||||
p = low_level_input(netif);
|
||||
#ifndef ETHERNET_LOOPBACK_TEST
|
||||
|
||||
-1
@@ -113,7 +113,6 @@ void ethernetif_input2(void* netif_arg)
|
||||
struct pbuf* p = NULL;
|
||||
for (;;) {
|
||||
sys_arch_sem_wait(get_eth_recv_sem2(), WAITING_FOREVER);
|
||||
KPrintf("%s -->\n", netif->name);
|
||||
sys_mutex_lock(&wiz_trans_mtx);
|
||||
while (1) {
|
||||
|
||||
|
||||
+6
-5
@@ -76,6 +76,7 @@ static int lwip_netdev_set_addr_info(struct netdev* netdev, ip_addr_t* ip_addr,
|
||||
netif_set_gw((struct netif*)netdev->user_data, ip_2_ip4(gw));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LWIP_DNS
|
||||
@@ -92,7 +93,7 @@ static int lwip_netdev_set_dns_server(struct netdev* netdev, uint8_t dns_num, ip
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
static int lwip_netdev_set_dhcp(struct netdev* netdev, bool is_enabled)
|
||||
{
|
||||
netdev_low_level_set_dhcp_status(netdev, is_enabled);
|
||||
@@ -120,7 +121,7 @@ static const struct netdev_ops lwip_netdev_ops = {
|
||||
#ifdef LWIP_DNS
|
||||
.set_dns_server = lwip_netdev_set_dns_server,
|
||||
#endif
|
||||
#ifdef LWIP_DHCP
|
||||
#if LWIP_DHCP
|
||||
.set_dhcp = lwip_netdev_set_dhcp,
|
||||
#endif
|
||||
.set_default = lwip_netdev_set_default,
|
||||
@@ -180,9 +181,9 @@ int lwip_netdev_add(struct netif* lwip_netif)
|
||||
netdev->ops = &lwip_netdev_ops;
|
||||
netdev->hwaddr_len = lwip_netif->hwaddr_len;
|
||||
memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);
|
||||
netdev->ip_addr = lwip_netif->ip_addr;
|
||||
netdev->gw = lwip_netif->gw;
|
||||
netdev->netmask = lwip_netif->netmask;
|
||||
netdev->ip_addr = &lwip_netif->ip_addr;
|
||||
netdev->gw = &lwip_netif->gw;
|
||||
netdev->netmask = &lwip_netif->netmask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user