slip.h

00001 /* -*- C -*- */
00002 /*
00003  * Copyright (c) 2005, Swedish Institute of Computer Science
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  * 3. Neither the name of the Institute nor the names of its contributors
00015  *    may be used to endorse or promote products derived from this software
00016  *    without specific prior written permission.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00019  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00022  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00023  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00024  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00025  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00026  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00027  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00028  * SUCH DAMAGE.
00029  *
00030  * This file is part of the Contiki operating system.
00031  *
00032  * @(#)$Id: slip.h,v 1.5 2008/02/24 21:00:53 adamdunkels Exp $
00033  */
00034 
00035 #ifndef __SLIP_H__
00036 #define __SLIP_H__
00037 
00038 #include "contiki.h"
00039 
00040 PROCESS_NAME(slip_process);
00041 
00042 /**
00043  * Send an IP packet from the uIP buffer with SLIP.
00044  */
00045 u8_t slip_send(void);
00046 
00047 /**
00048  * Input a SLIP byte.
00049  *
00050  * This function is called by the RS232/SIO device driver to pass
00051  * incoming bytes to the SLIP driver. The function can be called from
00052  * an interrupt context.
00053  *
00054  * For systems using low-power CPU modes, the return value of the
00055  * function can be used to determine if the CPU should be woken up or
00056  * not. If the function returns non-zero, the CPU should be powered
00057  * up. If the function returns zero, the CPU can continue to be
00058  * powered down.
00059  *
00060  * \param c The data that is to be passed to the SLIP driver
00061  *
00062  * \return Non-zero if the CPU should be powered up, zero otherwise.
00063  */
00064 int slip_input_byte(unsigned char c);
00065 
00066 u8_t slip_write(const void *ptr, int len);
00067 
00068 /* Did we receive any bytes lately? */
00069 extern u8_t slip_active;
00070 
00071 /* Statistics. */
00072 extern u16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
00073 
00074 /**
00075  * Set a function to be called when there is activity on the SLIP
00076  * interface; used for detecting if a node is a gateway node.
00077  */
00078 void slip_set_input_callback(void (*callback)(void));
00079 
00080 /*
00081  * These machine dependent functions and an interrupt service routine
00082  * must be provided externally (slip_arch.c).
00083  */
00084 void slip_arch_init(unsigned long ubr);
00085 void slip_arch_writeb(unsigned char c);
00086 
00087 #endif /* __SLIP_H__ */

Generated on Mon Apr 11 14:23:28 2011 for Contiki 2.5 by  doxygen 1.6.1