I'm also new to lwip. I might be wrong but I did get SLIP to work recently. All I did is provide implementation on all functions found in: src/include/lwip/sio.h
sio.h has function called sio_open() which is where I choose which serial port to use. I never have to modify slipif.c but I do know slipif_init() will call sio_open() passing serial port number to use.
Hope it helps.
On Tue, Nov 15, 2011 at 11:09 AM,
<address@hidden> wrote:
Hi,
please understand this is the first time I attempt to use lwIP, so I might ask stupid questions ;)
I need to implement slip connection over a (fast) serial line.
My initialization code looks like:
IP4_ADDR(&gw, 192, 168, 0, 1);
IP4_ADDR(&ipaddr, 192, 168, 0, 2);
IP4_ADDR(&netmask, 255, 255, 255, 0);
lwip_init();
netif_add(&netif, &ipaddr, &netmask, &gw, NULL, slipif_init, tcpip_input);
netif_set_default(&netif);
This way I have no means to specify which serial line should be used for the communication (my hardware has three UARTs).
slipif_init() has a comment saying:
* @note netif->num must contain the number of the serial port to open
* (0 by default)
This is good, but adding something like:
netif.num = MY_UART_NUM;
before the call to netif_add() is no good because netif_add() itself changes netif->num setting it to a sequential number:
struct netif *
netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
{
static u8_t netifnum = 0;
...
netif->num = netifnum++;
...
What am I missing?
This looks like a bug, but I would like confirmation before I modify some internal lwIP file.
Many Thanks in Advance.
Mauro
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users