Make sure you define NO_SYS in your lwip opts file and use the raw api.
basically you have to implement the functions like
netio_recv,netio_accept,netio_init
SYS_MBOX_NULL should be defined to NULL
example implementation:
static err_t netio_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
tcp_arg(pcb, NULL);
tcp_sent(pcb, NULL);
tcp_recv(pcb, netio_recv);
return ERR_OK;
}
void netio_init(void)
{
struct tcp_pcb *pcb;
pcb = tcp_new();
tcp_bind(pcb, IP_ADDR_ANY, 1000);
pcb = tcp_listen(pcb);
tcp_accept(pcb, netio_accept);
}
static err_t netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
struct pbuf* ptr;
int pktlen = 0;
if (err == ERR_OK && p != NULL)
{
tcp_recved(pcb, p->tot_len);
//just echo the same string
//pkt
received..
//do something with your pkt
if (ptr!=NULL)
{
err = tcp_write(pcb, ptr->payload, pktlen, 0);
}
//send the packet back out again using tcp_write
pbuf_free(p);
pbuf_free(ptr);
}
else
pbuf_free(p);
if (err == ERR_OK && p == NULL)
{
//check if we come here..
// free the connection number
tcp_arg(pcb, NULL);
tcp_sent(pcb, NULL);
tcp_recv(pcb,
NULL);
tcp_close(pcb);
}
return ERR_OK;
}
Nishen
Hi everybody,
i am using Nios II 5.0 IDE and i try to create one project with the NIOS using the lwIP as Standalone.
Is it possible to use the lwIP 0.7.1 without an operating system running with the NIOS II?
I use the Linux as development platform and i tried to run the example "unixsim/simhost" from lwIP together with the NIOS but dont works.
I thought the lwIP (api_lib.c) can provide the emulation of the operating system, but i dont understand why can I define the architecture (sys_arch.c, sys_arch.h) to my Hardware(NIOSII). I need really to do this?
I am getting error "SYS_MBOX_NULL undefined" when i try to compile with the Nios IDE. Under Linux the unixsim run ok.
Can someone help me please?
Thanks a lot
Mauricio
Besseren Schutz gegen Spam - jetzt bei dem neuen Yahoo! Mail .
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users