The Pedigree Project  0.1
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:

Go to the source code of this file.

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

err_t slipif_init (struct netif *netif)
 
void slipif_poll (struct netif *netif)
 

Detailed Description

SLIP Interface

Definition in file slipif.c.

Macro Definition Documentation

#define SLIP_MAX_SIZE   1500

Maximum packet size that is received by this netif

Definition at line 98 of file slipif.c.

Referenced by slipif_init().

#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'.

Definition at line 106 of file slipif.c.

Referenced by slipif_init().

Function Documentation

err_t slipif_init ( struct netif netif)

SLIP netif initialization

Call the arch specific sio_open and remember the opened device in the state field of the netif.

Parameters
netifthe 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
netif->num must contain the number of the serial port to open (0 by default). If netif->state is != NULL, it is interpreted as an u8_t pointer pointing to the serial port number instead of netif->num.

Definition at line 380 of file slipif.c.

References ERR_IF, ERR_MEM, ERR_OK, LWIP_DEBUGF, mem_free(), mem_malloc(), netif::mtu, netif::name, netif::num, SLIP_DEBUG, SLIP_MAX_SIZE, SLIP_SIO_SPEED, SLIPIF_THREAD_NAME, SLIPIF_THREAD_PRIO, SLIPIF_THREAD_STACKSIZE, netif::state, and sys_thread_new().

void slipif_poll ( struct netif netif)

Polls the serial device and feeds the IP layer with incoming packets.

Parameters
netifThe lwip network interface structure for this slipif

Definition at line 446 of file slipif.c.

References ERR_OK, netif::input, pbuf::len, pbuf::next, pbuf_free(), netif::state, SYS_ARCH_DECL_PROTECT, and pbuf::tot_len.