It appears on second look and your explanation of your problem that you are missing the function calls that actually make the LWIP do its work. This is generally done in a main loop. Here is the code that I have (taken mostly from the LWIP Web Server example included with the NIOS II IDE).
# if LWIP_DHCP# include "lwip/dhcp.h"# define DHCP_TMR_INTERVAL DHCP_FINE_TIMER_MSECS
void dhcp_tmr(void);# endif
# if IP_REASSEMBLY# define IP_REASS_TMO 1000
void ip_reass_timer(void);# endif
unsigned int net_last_tick = 0;
unsigned int net_tick = 0;
unsigned int net_tcp_timer = TCP_TMR_INTERVAL;
unsigned int net_arp_timer = ARP_TMR_INTERVAL;# if LWIP_DHCP
unsigned int net_dhcp_timer = DHCP_TMR_INTERVAL;# endif# if IP_REASSEMBLY
unsigned int net_reass_timer = IP_REASS_TMO;# endif
void net_init()
{
// Initialize the LWIP Stack (TCP/UDP ... ETC)
lwip_stack_init();
// Initialize the Hardware
lwip_devices_init();
// Initialize application(s)
httpd_init();
echo_init();
net_last_tick = alt_nticks();
}
void net_service()
{
// Check network devices for input
lwip_dev_rx();
// Retrieve the millisecond timestamp
net_tick = alt_nticks();
// Check to see if a millisecond has passed
if (net_tick != net_last_tick)
{
// Save the current timestamp
net_last_tick = net_tick;
// Decrement and check the TCP timer
if (--net_tcp_timer == 0)
{
net_tcp_timer = TCP_TMR_INTERVAL;
tcp_tmr();
}
// Decrement and check the ARP timer
if (--net_arp_timer == 0)
{
net_arp_timer = ARP_TMR_INTERVAL;
etharp_tmr();
}
# if LWIP_DHCP
// Decrement and check the DHCP timer
if (--net_dhcp_timer == 0)
{
net_dhcp_timer = DHCP_TMR_INTERVAL;
dhcp_tmr();
dhcp_timeout_task();
}# endif // LWIP_DHCP
# if IP_REASSEMBLY
// Decrement and check the Reassembly Timer
if (--net_reass_timer == 0)
{
net_reass_timer = IP_REASS_TMO;
ip_reass_timer();
} # endif // IP_REASSEMBLY
}
}
int main(void)
{
printf("Example web server using Light-Weight IP (LWIP)\n");
printf("and simple RAM-based file system.\n\n");
net_init();
// main loop to service the Ethernet device and expire TCP timers
while(1)
{
net_service();
}
}
You will want to pay attention to the net_service(). This is where the LWIP is called to acutally make it do things. The LWIP is a giant state machine... so you have to make it tick in order for it to do stuff.
Also I think your callback function for the accept needs to be different...
static err_t http_accept(void *arg, struct tcp_pcb *pcb, err_t err);
that is the decleration of the http_accept function in the example code.
This might or might not be a problem. I am do not know the LWIP that well to go into it. You may want to check out the rawapi.txt file that comes with the LWIP implementation.
Are you using the LWIP that comes with the OpenCores Ethernet IP?