1195972f6Sopenharmony_ci/** 2195972f6Sopenharmony_ci * @file 3195972f6Sopenharmony_ci * 4195972f6Sopenharmony_ci * SLIP netif API 5195972f6Sopenharmony_ci */ 6195972f6Sopenharmony_ci 7195972f6Sopenharmony_ci/* 8195972f6Sopenharmony_ci * Copyright (c) 2001, Swedish Institute of Computer Science. 9195972f6Sopenharmony_ci * All rights reserved. 10195972f6Sopenharmony_ci * 11195972f6Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 12195972f6Sopenharmony_ci * modification, are permitted provided that the following conditions 13195972f6Sopenharmony_ci * are met: 14195972f6Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 15195972f6Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 16195972f6Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 17195972f6Sopenharmony_ci * notice, this list of conditions and the following disclaimer in the 18195972f6Sopenharmony_ci * documentation and/or other materials provided with the distribution. 19195972f6Sopenharmony_ci * 3. Neither the name of the Institute nor the names of its contributors 20195972f6Sopenharmony_ci * may be used to endorse or promote products derived from this software 21195972f6Sopenharmony_ci * without specific prior written permission. 22195972f6Sopenharmony_ci * 23195972f6Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24195972f6Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25195972f6Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26195972f6Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27195972f6Sopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28195972f6Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29195972f6Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30195972f6Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31195972f6Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32195972f6Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33195972f6Sopenharmony_ci * SUCH DAMAGE. 34195972f6Sopenharmony_ci * 35195972f6Sopenharmony_ci * This file is part of the lwIP TCP/IP stack. 36195972f6Sopenharmony_ci * 37195972f6Sopenharmony_ci * Author: Adam Dunkels <adam@sics.se> 38195972f6Sopenharmony_ci * 39195972f6Sopenharmony_ci */ 40195972f6Sopenharmony_ci#ifndef LWIP_HDR_NETIF_SLIPIF_H 41195972f6Sopenharmony_ci#define LWIP_HDR_NETIF_SLIPIF_H 42195972f6Sopenharmony_ci 43195972f6Sopenharmony_ci#include "lwip/opt.h" 44195972f6Sopenharmony_ci#include "lwip/netif.h" 45195972f6Sopenharmony_ci 46195972f6Sopenharmony_ci/** Set this to 1 to start a thread that blocks reading on the serial line 47195972f6Sopenharmony_ci * (using sio_read()). 48195972f6Sopenharmony_ci */ 49195972f6Sopenharmony_ci#ifndef SLIP_USE_RX_THREAD 50195972f6Sopenharmony_ci#define SLIP_USE_RX_THREAD !NO_SYS 51195972f6Sopenharmony_ci#endif 52195972f6Sopenharmony_ci 53195972f6Sopenharmony_ci/** Set this to 1 to enable functions to pass in RX bytes from ISR context. 54195972f6Sopenharmony_ci * If enabled, slipif_received_byte[s]() process incoming bytes and put assembled 55195972f6Sopenharmony_ci * packets on a queue, which is fed into lwIP from slipif_poll(). 56195972f6Sopenharmony_ci * If disabled, slipif_poll() polls the serial line (using sio_tryread()). 57195972f6Sopenharmony_ci */ 58195972f6Sopenharmony_ci#ifndef SLIP_RX_FROM_ISR 59195972f6Sopenharmony_ci#define SLIP_RX_FROM_ISR 0 60195972f6Sopenharmony_ci#endif 61195972f6Sopenharmony_ci 62195972f6Sopenharmony_ci/** Set this to 1 (default for SLIP_RX_FROM_ISR) to queue incoming packets 63195972f6Sopenharmony_ci * received by slipif_received_byte[s]() as long as PBUF_POOL pbufs are available. 64195972f6Sopenharmony_ci * If disabled, packets will be dropped if more than one packet is received. 65195972f6Sopenharmony_ci */ 66195972f6Sopenharmony_ci#ifndef SLIP_RX_QUEUE 67195972f6Sopenharmony_ci#define SLIP_RX_QUEUE SLIP_RX_FROM_ISR 68195972f6Sopenharmony_ci#endif 69195972f6Sopenharmony_ci 70195972f6Sopenharmony_ci#ifdef __cplusplus 71195972f6Sopenharmony_ciextern "C" { 72195972f6Sopenharmony_ci#endif 73195972f6Sopenharmony_ci 74195972f6Sopenharmony_cierr_t slipif_init(struct netif * netif); 75195972f6Sopenharmony_civoid slipif_poll(struct netif *netif); 76195972f6Sopenharmony_ci#if SLIP_RX_FROM_ISR 77195972f6Sopenharmony_civoid slipif_process_rxqueue(struct netif *netif); 78195972f6Sopenharmony_civoid slipif_received_byte(struct netif *netif, u8_t data); 79195972f6Sopenharmony_civoid slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len); 80195972f6Sopenharmony_ci#endif /* SLIP_RX_FROM_ISR */ 81195972f6Sopenharmony_ci 82195972f6Sopenharmony_ci#ifdef __cplusplus 83195972f6Sopenharmony_ci} 84195972f6Sopenharmony_ci#endif 85195972f6Sopenharmony_ci 86195972f6Sopenharmony_ci#endif /* LWIP_HDR_NETIF_SLIPIF_H */ 87195972f6Sopenharmony_ci 88