NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Embed: (wiki syntax)

« Back to documentation index

slipif.c File Reference

slipif.c File Reference

SLIP Interface. More...

Go to the source code of this file.

Functions

err_t slipif_output (struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
 Send a pbuf doing the necessary SLIP encapsulation.
static u32_t slip_sio_read (sio_fd_t fd, u8_t *data, u32_t len, u8_t block)
 Static function for easy use of blockig or non-blocking sio_read.
static struct pbuf * slipif_input (struct netif *netif, u8_t block)
 Handle the incoming SLIP stream character by character.
static void slipif_loop_thread (void *nf)
 The SLIP input thread.
err_t slipif_init (struct netif *netif)
 SLIP netif initialization.
void slipif_poll (struct netif *netif)
 Polls the serial device and feeds the IP layer with incoming packets.

Detailed Description

SLIP Interface.

Definition in file slipif.c.


Function Documentation

static u32_t slip_sio_read ( sio_fd_t  fd,
u8_t *  data,
u32_t  len,
u8_t  block 
) [static]

Static function for easy use of blockig or non-blocking sio_read.

Parameters:
fdserial device handle
datapointer to data buffer for receiving
lenmaximum length (in bytes) of data to receive
blockif 1, call sio_read; if 0, call sio_tryread
Returns:
return value of sio_read of sio_tryread

Definition at line 142 of file slipif.c.

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)

Definition at line 297 of file slipif.c.

static struct pbuf* slipif_input ( struct netif *  netif,
u8_t  block 
) [static, read]

Handle the incoming SLIP stream character by character.

Poll the serial layer by calling sio_read() or sio_tryread().

Parameters:
netifthe lwip network interface structure for this slipif
blockif 1, block until data is received; if 0, return when all data from the buffer is received (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

Definition at line 163 of file slipif.c.

static void slipif_loop_thread ( void *  nf ) [static]

The SLIP input thread.

Feed the IP layer with incoming packets

Parameters:
nfthe lwip network interface structure for this slipif

Definition at line 265 of file slipif.c.

err_t slipif_output ( struct netif *  netif,
struct pbuf *  p,
ip_addr_t *  ipaddr 
)

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 chaing packet to send
ipaddrthe ip address to send the packet to (not used for slipif)
Returns:
always returns ERR_OK since the serial layer does not provide return values

Definition at line 91 of file slipif.c.

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 350 of file slipif.c.