ConOpSys V2970  P004.07
ANVILEX control operating system
Classes | Macros | Enumerations | Functions
slipif.c File Reference
#include "netif/slipif.h"
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
#include "lwip/snmp.h"
#include "lwip/sys.h"
#include "lwip/sio.h"
Include dependency graph for slipif.c:

Classes

struct  slipif_priv
 

Macros

#define SLIP_END   0xC0 /* 0300: start and end of every packet */
 
#define SLIP_ESC   0xDB /* 0333: escape start (one byte escaped data follows) */
 
#define SLIP_ESC_END   0xDC /* 0334: following escape: original byte is 0xC0 (END) */
 
#define SLIP_ESC_ESC   0xDD /* 0335: following escape: original byte is 0xDB (ESC) */
 
#define SLIP_MAX_SIZE   1500
 
#define SLIP_SIO_SPEED(sio_fd)   0
 

Enumerations

enum  slipif_recv_state { SLIP_RECV_NORMAL , SLIP_RECV_ESCAPE }
 

Functions

static err_t slipif_output (struct netif *netif, struct pbuf *p)
 
static struct pbufslipif_rxbyte (struct netif *netif, u8_t c)
 
static void slipif_rxbyte_input (struct netif *netif, u8_t c)
 
err_t slipif_init (struct netif *netif)
 
void slipif_poll (struct netif *netif)
 

Detailed Description

SLIP Interface

Macro Definition Documentation

◆ SLIP_END

#define SLIP_END   0xC0 /* 0300: start and end of every packet */

◆ SLIP_ESC

#define SLIP_ESC   0xDB /* 0333: escape start (one byte escaped data follows) */

◆ SLIP_ESC_END

#define SLIP_ESC_END   0xDC /* 0334: following escape: original byte is 0xC0 (END) */

◆ SLIP_ESC_ESC

#define SLIP_ESC_ESC   0xDD /* 0335: following escape: original byte is 0xDB (ESC) */

◆ SLIP_MAX_SIZE

#define SLIP_MAX_SIZE   1500

Maximum packet size that is received by this netif

◆ SLIP_SIO_SPEED

#define SLIP_SIO_SPEED (   sio_fd)    0

Define this to the interface speed for SNMP (sio_fd is the sio_fd_t returned by sio_open). The default value of zero means 'unknown'.

Enumeration Type Documentation

◆ slipif_recv_state

Enumerator
SLIP_RECV_NORMAL 
SLIP_RECV_ESCAPE 

Function Documentation

◆ slipif_output()

static err_t slipif_output ( struct netif netif,
struct pbuf p 
)
static

Send a pbuf doing the necessary SLIP encapsulation

Uses the serial layer's sio_send()

Parameters
netifthe lwip network interface structure for this slipif
pthe pbuf chain packet to send
Returns
always returns ERR_OK since the serial layer does not provide return values

References ERR_OK, slipif_priv::i, pbuf::len, LWIP_ASSERT, LWIP_DEBUGF, pbuf::next, NULL, slipif_priv::p, pbuf::payload, slipif_priv::q, slipif_priv::sd, sio_send(), SLIP_DEBUG, SLIP_END, SLIP_ESC, SLIP_ESC_END, SLIP_ESC_ESC, netif::state, pbuf::tot_len, and U16_F.

Here is the call graph for this function:

◆ slipif_rxbyte()

static struct pbuf* slipif_rxbyte ( struct netif netif,
u8_t  c 
)
static

Handle the incoming SLIP stream character by character

Parameters
netifthe lwip network interface structure for this slipif
creceived character (multiple calls to this function will return a complete packet, NULL is returned before - used for polling)
Returns
The IP packet when SLIP_END is received

References slipif_priv::i, pbuf::len, LINK_STATS_INC, LWIP_ASSERT, LWIP_DEBUGF, pbuf::next, NULL, slipif_priv::p, pbuf::payload, pbuf_alloc(), pbuf_cat(), PBUF_LINK, PBUF_LINK_ENCAPSULATION_HLEN, PBUF_LINK_HLEN, PBUF_POOL, PBUF_POOL_BUFSIZE, pbuf_realloc(), slipif_priv::q, slipif_priv::recved, SLIP_DEBUG, SLIP_END, SLIP_ESC, SLIP_ESC_END, SLIP_ESC_ESC, SLIP_MAX_SIZE, SLIP_RECV_ESCAPE, SLIP_RECV_NORMAL, netif::state, slipif_priv::state, and U16_F.

Referenced by slipif_rxbyte_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ slipif_rxbyte_input()

static void slipif_rxbyte_input ( struct netif netif,
u8_t  c 
)
static

Like slipif_rxbyte, but passes completed packets to netif->input

Parameters
netifThe lwip network interface structure for this slipif
creceived character

References ERR_OK, netif::input, NULL, pbuf_free(), and slipif_rxbyte().

Referenced by slipif_poll().

Here is the call graph for this function:
Here is the caller graph for this function: