1*5d5fbe79SDavid van Moolenbroek /** 2*5d5fbe79SDavid van Moolenbroek * @file 3*5d5fbe79SDavid van Moolenbroek * 4*5d5fbe79SDavid van Moolenbroek * SLIP netif API 5*5d5fbe79SDavid van Moolenbroek */ 6*5d5fbe79SDavid van Moolenbroek 7*5d5fbe79SDavid van Moolenbroek /* 8*5d5fbe79SDavid van Moolenbroek * Copyright (c) 2001, Swedish Institute of Computer Science. 9*5d5fbe79SDavid van Moolenbroek * All rights reserved. 10*5d5fbe79SDavid van Moolenbroek * 11*5d5fbe79SDavid van Moolenbroek * Redistribution and use in source and binary forms, with or without 12*5d5fbe79SDavid van Moolenbroek * modification, are permitted provided that the following conditions 13*5d5fbe79SDavid van Moolenbroek * are met: 14*5d5fbe79SDavid van Moolenbroek * 1. Redistributions of source code must retain the above copyright 15*5d5fbe79SDavid van Moolenbroek * notice, this list of conditions and the following disclaimer. 16*5d5fbe79SDavid van Moolenbroek * 2. Redistributions in binary form must reproduce the above copyright 17*5d5fbe79SDavid van Moolenbroek * notice, this list of conditions and the following disclaimer in the 18*5d5fbe79SDavid van Moolenbroek * documentation and/or other materials provided with the distribution. 19*5d5fbe79SDavid van Moolenbroek * 3. Neither the name of the Institute nor the names of its contributors 20*5d5fbe79SDavid van Moolenbroek * may be used to endorse or promote products derived from this software 21*5d5fbe79SDavid van Moolenbroek * without specific prior written permission. 22*5d5fbe79SDavid van Moolenbroek * 23*5d5fbe79SDavid van Moolenbroek * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24*5d5fbe79SDavid van Moolenbroek * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25*5d5fbe79SDavid van Moolenbroek * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26*5d5fbe79SDavid van Moolenbroek * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27*5d5fbe79SDavid van Moolenbroek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28*5d5fbe79SDavid van Moolenbroek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29*5d5fbe79SDavid van Moolenbroek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30*5d5fbe79SDavid van Moolenbroek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31*5d5fbe79SDavid van Moolenbroek * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32*5d5fbe79SDavid van Moolenbroek * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33*5d5fbe79SDavid van Moolenbroek * SUCH DAMAGE. 34*5d5fbe79SDavid van Moolenbroek * 35*5d5fbe79SDavid van Moolenbroek * This file is part of the lwIP TCP/IP stack. 36*5d5fbe79SDavid van Moolenbroek * 37*5d5fbe79SDavid van Moolenbroek * Author: Adam Dunkels <adam@sics.se> 38*5d5fbe79SDavid van Moolenbroek * 39*5d5fbe79SDavid van Moolenbroek */ 40*5d5fbe79SDavid van Moolenbroek #ifndef LWIP_HDR_NETIF_SLIPIF_H 41*5d5fbe79SDavid van Moolenbroek #define LWIP_HDR_NETIF_SLIPIF_H 42*5d5fbe79SDavid van Moolenbroek 43*5d5fbe79SDavid van Moolenbroek #include "lwip/opt.h" 44*5d5fbe79SDavid van Moolenbroek #include "lwip/netif.h" 45*5d5fbe79SDavid van Moolenbroek 46*5d5fbe79SDavid van Moolenbroek /** Set this to 1 to start a thread that blocks reading on the serial line 47*5d5fbe79SDavid van Moolenbroek * (using sio_read()). 48*5d5fbe79SDavid van Moolenbroek */ 49*5d5fbe79SDavid van Moolenbroek #ifndef SLIP_USE_RX_THREAD 50*5d5fbe79SDavid van Moolenbroek #define SLIP_USE_RX_THREAD !NO_SYS 51*5d5fbe79SDavid van Moolenbroek #endif 52*5d5fbe79SDavid van Moolenbroek 53*5d5fbe79SDavid van Moolenbroek /** Set this to 1 to enable functions to pass in RX bytes from ISR context. 54*5d5fbe79SDavid van Moolenbroek * If enabled, slipif_received_byte[s]() process incoming bytes and put assembled 55*5d5fbe79SDavid van Moolenbroek * packets on a queue, which is fed into lwIP from slipif_poll(). 56*5d5fbe79SDavid van Moolenbroek * If disabled, slipif_poll() polls the serial line (using sio_tryread()). 57*5d5fbe79SDavid van Moolenbroek */ 58*5d5fbe79SDavid van Moolenbroek #ifndef SLIP_RX_FROM_ISR 59*5d5fbe79SDavid van Moolenbroek #define SLIP_RX_FROM_ISR 0 60*5d5fbe79SDavid van Moolenbroek #endif 61*5d5fbe79SDavid van Moolenbroek 62*5d5fbe79SDavid van Moolenbroek /** Set this to 1 (default for SLIP_RX_FROM_ISR) to queue incoming packets 63*5d5fbe79SDavid van Moolenbroek * received by slipif_received_byte[s]() as long as PBUF_POOL pbufs are available. 64*5d5fbe79SDavid van Moolenbroek * If disabled, packets will be dropped if more than one packet is received. 65*5d5fbe79SDavid van Moolenbroek */ 66*5d5fbe79SDavid van Moolenbroek #ifndef SLIP_RX_QUEUE 67*5d5fbe79SDavid van Moolenbroek #define SLIP_RX_QUEUE SLIP_RX_FROM_ISR 68*5d5fbe79SDavid van Moolenbroek #endif 69*5d5fbe79SDavid van Moolenbroek 70*5d5fbe79SDavid van Moolenbroek #ifdef __cplusplus 71*5d5fbe79SDavid van Moolenbroek extern "C" { 72*5d5fbe79SDavid van Moolenbroek #endif 73*5d5fbe79SDavid van Moolenbroek 74*5d5fbe79SDavid van Moolenbroek err_t slipif_init(struct netif * netif); 75*5d5fbe79SDavid van Moolenbroek void slipif_poll(struct netif *netif); 76*5d5fbe79SDavid van Moolenbroek #if SLIP_RX_FROM_ISR 77*5d5fbe79SDavid van Moolenbroek void slipif_process_rxqueue(struct netif *netif); 78*5d5fbe79SDavid van Moolenbroek void slipif_received_byte(struct netif *netif, u8_t data); 79*5d5fbe79SDavid van Moolenbroek void slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len); 80*5d5fbe79SDavid van Moolenbroek #endif /* SLIP_RX_FROM_ISR */ 81*5d5fbe79SDavid van Moolenbroek 82*5d5fbe79SDavid van Moolenbroek #ifdef __cplusplus 83*5d5fbe79SDavid van Moolenbroek } 84*5d5fbe79SDavid van Moolenbroek #endif 85*5d5fbe79SDavid van Moolenbroek 86*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_HDR_NETIF_SLIPIF_H */ 87*5d5fbe79SDavid van Moolenbroek 88