ConOpSys V2970
P004.07
ANVILEX control operating system
|
Functions | |
err_t | slipif_init (struct netif *netif) |
void | slipif_poll (struct netif *netif) |
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:
1) For NO_SYS==0, an RX thread can be used which blocks on sio_read() until data is received.
2) In your main loop, call slipif_poll() to check for new RX bytes, completed packets are fed into netif->input().
3) 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!).
SLIP netif initialisation
Call the arch specific sio_open and remember the opened device in the state field of the netif.
netif | the lwip network interface structure for this slipif |
References ERR_IF, ERR_MEM, ERR_OK, slipif_priv::i, netif::input, LWIP_ASSERT, LWIP_DEBUGF, LWIP_PTR_NUMERIC_CAST, mem_free(), mem_malloc(), MIB2_INIT_NETIF, netif::mtu, netif::name, NULL, slipif_priv::p, slipif_priv::q, slipif_priv::recved, slipif_priv::sd, sio_open(), SLIP_DEBUG, SLIP_MAX_SIZE, SLIP_RECV_NORMAL, SLIP_SIO_SPEED, SLIPIF_THREAD_NAME, SLIPIF_THREAD_PRIO, SLIPIF_THREAD_STACKSIZE, netif::state, slipif_priv::state, sys_thread_new(), and U16_F.
void slipif_poll | ( | struct netif * | netif | ) |
Polls the serial device and feeds the IP layer with incoming packets.
netif | The lwip network interface structure for this slipif |
References LWIP_ASSERT, NULL, slipif_priv::sd, sio_tryread(), slipif_rxbyte_input(), and netif::state.