Tidy-up file structure and code style

This commit is contained in:
George Oikonomou 2017-11-22 02:26:31 +00:00
parent 24b17e58b1
commit 4522b5b942
1 changed files with 17 additions and 22 deletions

View File

@ -26,46 +26,42 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
*/
#include <stdio.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "net/ipv6/uip.h"
#include "dev/slip.h"
#include <stdio.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
#define SLIP_END 0300
#define SLIP_ESC 0333
#define SLIP_ESC_END 0334
#define SLIP_ESC_ESC 0335
/*---------------------------------------------------------------------------*/
PROCESS(slip_process, "SLIP driver");
uint8_t slip_active;
/*---------------------------------------------------------------------------*/
#if 1
#define SLIP_STATISTICS(statement)
#else
uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop;
#define SLIP_STATISTICS(statement) statement
#endif
/*---------------------------------------------------------------------------*/
/* Must be at least one byte larger than UIP_BUFSIZE! */
#define RX_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN + 16)
/*---------------------------------------------------------------------------*/
enum {
STATE_TWOPACKETS = 0, /* We have 2 packets and drop incoming data. */
STATE_OK = 1,
STATE_ESC = 2,
STATE_RUBBISH = 3,
};
/*---------------------------------------------------------------------------*/
/*
* Variables begin and end manage the buffer space in a cyclic
* fashion. The first used byte is at begin and end is one byte past
@ -76,7 +72,6 @@ enum {
* [pkt_end, end). If more bytes arrive in state STATE_TWOPACKETS
* they are discarded.
*/
static uint8_t state = STATE_TWOPACKETS;
static uint16_t begin, next_free;
static uint8_t rxbuf[RX_BUFSIZE];