This is an arch independent SLIP netif. The specific serial hooks must be provided by another file. They are sio_open, sio_read/sio_tryread and sio_send
Usage: This netif can be used in three ways:
- For NO_SYS==0, an RX thread can be used which blocks on sio_read() until data is received.
- In your main loop, call slipif_poll() to check for new RX bytes, completed packets are fed into netif->input().
- Call slipif_received_byte[s]() from your serial RX ISR and slipif_process_rxqueue() from your main loop. ISR level decodes packets and puts completed packets on a queue which is fed into the stack from the main loop (needs SYS_LIGHTWEIGHT_PROT for pbuf_alloc to work on ISR level!).
◆ slipif_init()
SLIP netif initialization
Call the arch specific sio_open and remember the opened device in the state field of the netif.
- Parameters
-
netif | the lwip network interface structure for this slipif |
- Returns
- ERR_OK if serial line could be opened, ERR_MEM if no memory could be allocated, ERR_IF is serial line couldn't be opened
- Note
- If netif->state is interpreted as an u8_t serial port number.
Definition at line 360 of file slipif.c.
361{
364
366
367
369
371
372
374 if (!priv) {
376 }
377
380#if LWIP_IPV4
381 netif->output = slipif_output_v4;
382#endif
383#if LWIP_IPV6
384 netif->output_ip6 = slipif_output_v6;
385#endif
387
388
391
394 }
395
396
402#if SLIP_RX_FROM_ISR
403 priv->rxpackets =
NULL;
404#endif
405
407
408
410
411#if SLIP_USE_RX_THREAD
412
415#endif
417}
#define mem_free(ptr, bsize)
void * mem_malloc(mem_size_t size_in)
#define LWIP_DEBUGF(debug, message)
#define LWIP_ASSERT(message, assertion)
sio_fd_t sio_open(u8_t devnum)
#define MIB2_INIT_NETIF(netif, type, speed)
#define LWIP_PTR_NUMERIC_CAST(target_type, val)
#define SLIPIF_THREAD_PRIO
#define SLIPIF_THREAD_STACKSIZE
#define SLIPIF_THREAD_NAME
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
#define SLIP_SIO_SPEED(sio_fd)
◆ slipif_poll()
Polls the serial device and feeds the IP layer with incoming packets.
- Parameters
-
netif | The lwip network interface structure for this slipif |
Definition at line 426 of file slipif.c.
427{
430
433
435
438 }
439}
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len)
static void slipif_rxbyte_input(struct netif *netif, u8_t c)