Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers slipif.h Source File

slipif.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  *
00004  * SLIP netif API
00005  */
00006 
00007 /*
00008  * Copyright (c) 2001, Swedish Institute of Computer Science.
00009  * All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions
00013  * are met:
00014  * 1. Redistributions of source code must retain the above copyright
00015  *    notice, this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright
00017  *    notice, this list of conditions and the following disclaimer in the
00018  *    documentation and/or other materials provided with the distribution.
00019  * 3. Neither the name of the Institute nor the names of its contributors
00020  *    may be used to endorse or promote products derived from this software
00021  *    without specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00024  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00027  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00029  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00032  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * This file is part of the lwIP TCP/IP stack.
00036  *
00037  * Author: Adam Dunkels <adam@sics.se>
00038  *
00039  */
00040 #ifndef LWIP_HDR_NETIF_SLIPIF_H
00041 #define LWIP_HDR_NETIF_SLIPIF_H
00042 
00043 #include "lwip/opt.h"
00044 #include "lwip/netif.h"
00045 
00046 /** Set this to 1 to start a thread that blocks reading on the serial line
00047  * (using sio_read()).
00048  */
00049 #ifndef SLIP_USE_RX_THREAD
00050 #define SLIP_USE_RX_THREAD !NO_SYS
00051 #endif
00052 
00053 /** Set this to 1 to enable functions to pass in RX bytes from ISR context.
00054  * If enabled, slipif_received_byte[s]() process incoming bytes and put assembled
00055  * packets on a queue, which is fed into lwIP from slipif_poll().
00056  * If disabled, slipif_poll() polls the serial line (using sio_tryread()).
00057  */
00058 #ifndef SLIP_RX_FROM_ISR
00059 #define SLIP_RX_FROM_ISR 0
00060 #endif
00061 
00062 /** Set this to 1 (default for SLIP_RX_FROM_ISR) to queue incoming packets
00063  * received by slipif_received_byte[s]() as long as PBUF_POOL pbufs are available.
00064  * If disabled, packets will be dropped if more than one packet is received.
00065  */
00066 #ifndef SLIP_RX_QUEUE
00067 #define SLIP_RX_QUEUE SLIP_RX_FROM_ISR
00068 #endif
00069 
00070 #ifdef __cplusplus
00071 extern "C" {
00072 #endif
00073 
00074 err_t slipif_init(struct netif * netif);
00075 void slipif_poll(struct netif *netif);
00076 #if SLIP_RX_FROM_ISR
00077 void slipif_process_rxqueue(struct netif *netif);
00078 void slipif_received_byte(struct netif *netif, u8_t data);
00079 void slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len);
00080 #endif /* SLIP_RX_FROM_ISR */
00081 
00082 #ifdef __cplusplus
00083 }
00084 #endif
00085 
00086 #endif /* LWIP_HDR_NETIF_SLIPIF_H */
00087