#include <stdio.h>
#include <string.h>
#include "contiki.h"
#include "net/ip/uip.h"
#include "net/ipv4/uip-fw.h"
#include "dev/slip.h"
Macros | |
#define | BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) |
#define | RX_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN + 16) |
#define | SLIP_END 0300 |
#define | SLIP_ESC 0333 |
#define | SLIP_ESC_END 0334 |
#define | SLIP_ESC_ESC 0335 |
#define | SLIP_STATISTICS(statement) |
Enumerations | |
enum | { STATE_TWOPACKETS = 0, STATE_OK = 1, STATE_ESC = 2, STATE_RUBBISH = 3 } |
Functions | |
PROCESS (slip_process,"SLIP driver") | |
PROCESS_THREAD (slip_process, ev, data) | |
static void | rxbuf_init (void) |
int | slip_input_byte (unsigned char c) |
Input a SLIP byte. More... | |
static uint16_t | slip_poll_handler (uint8_t *outbuf, uint16_t blen) |
uint8_t | slip_send (void) |
Send an IP packet from the uIP buffer with SLIP. More... | |
void | slip_set_input_callback (void(*c)(void)) |
Set a function to be called when there is activity on the SLIP interface; used for detecting if a node is a gateway node. More... | |
uint8_t | slip_write (const void *_ptr, int len) |
Variables | |
static uint16_t | begin |
static uint16_t | end |
static void(* | input_callback )(void) = NULL |
static uint16_t | pkt_end |
static uint8_t | rxbuf [RX_BUFSIZE] |
uint8_t | slip_active |
static uint8_t | state = STATE_TWOPACKETS |
#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) |
Referenced by PROCESS_THREAD().
#define RX_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN + 16) |
Referenced by slip_input_byte(), and slip_poll_handler().
#define SLIP_END 0300 |
Referenced by slip_input_byte(), slip_poll_handler(), slip_send(), and slip_write().
#define SLIP_ESC 0333 |
Referenced by slip_input_byte(), slip_send(), and slip_write().
#define SLIP_ESC_END 0334 |
Referenced by slip_input_byte(), slip_send(), and slip_write().
#define SLIP_ESC_ESC 0335 |
Referenced by slip_input_byte(), slip_send(), and slip_write().
#define SLIP_STATISTICS | ( | statement | ) |
Referenced by PROCESS_THREAD(), and slip_input_byte().
PROCESS | ( | slip_process | , |
"SLIP driver" | |||
) |
PROCESS_THREAD | ( | slip_process | , |
ev | , | ||
data | |||
) |
References BUF, buf, input_callback, PROCESS_BEGIN, PROCESS_END, PROCESS_EVENT_POLL, PROCESS_YIELD_UNTIL, rxbuf_init(), slip_active, slip_ip_drop, slip_poll_handler(), SLIP_STATISTICS, slip_write(), tcpip_input(), uip_buf, UIP_BUFSIZE, uip_hostaddr, uip_htons(), uip_ipchksum(), uip_len, and UIP_LLH_LEN.
|
static |
References begin, end, pkt_end, state, and STATE_OK.
Referenced by PROCESS_THREAD(), and slip_poll_handler().
int slip_input_byte | ( | unsigned char | c | ) |
Input a SLIP byte.
This function is called by the RS232/SIO device driver to pass incoming bytes to the SLIP driver. The function can be called from an interrupt context.
For systems using low-power CPU modes, the return value of the function can be used to determine if the CPU should be woken up or not. If the function returns non-zero, the CPU should be powered up. If the function returns zero, the CPU can continue to be powered down.
c | The data that is to be passed to the SLIP driver |
References begin, c, end, pkt_end, process_poll(), RX_BUFSIZE, rxbuf, SLIP_END, SLIP_ESC, SLIP_ESC_END, SLIP_ESC_ESC, slip_overflow, slip_rubbish, SLIP_STATISTICS, slip_twopackets, state, STATE_ESC, STATE_OK, STATE_RUBBISH, and STATE_TWOPACKETS.
|
static |
References addr, begin, end, i, j, len, pkt_end, process_poll(), RX_BUFSIZE, rxbuf, rxbuf_init(), slip_arch_writeb(), SLIP_END, state, STATE_OK, STATE_TWOPACKETS, and linkaddr_t::u8.
Referenced by PROCESS_THREAD().
uint8_t slip_send | ( | void | ) |
Send an IP packet from the uIP buffer with SLIP.
References c, i, ptr, slip_arch_writeb(), SLIP_END, SLIP_ESC, SLIP_ESC_END, SLIP_ESC_ESC, uip_appdata, uip_buf, UIP_FW_OK, uip_len, UIP_LLH_LEN, and UIP_TCPIP_HLEN.
Referenced by input_callback(), and output().
void slip_set_input_callback | ( | void(*)(void) | c | ) |
Set a function to be called when there is activity on the SLIP interface; used for detecting if a node is a gateway node.
References c, and input_callback.
Referenced by init().
uint8_t slip_write | ( | const void * | _ptr, |
int | len | ||
) |
References c, i, len, ptr, slip_arch_writeb(), SLIP_END, SLIP_ESC, SLIP_ESC_END, and SLIP_ESC_ESC.
Referenced by PROCESS_THREAD().
|
static |
Referenced by rxbuf_init(), slip_input_byte(), and slip_poll_handler().
|
static |
Referenced by dis_input(), handle_incoming_rreq(), jsmn_fill_token(), jsmn_parse(), msg_for_me(), parse_options(), rpl_alloc_dag(), rpl_alloc_instance(), rpl_free_instance(), rpl_ipv6_neighbor_callback(), rpl_link_neighbor_callback(), rpl_select_dag(), rxbuf_init(), send_discover(), send_request(), slip_input_byte(), and slip_poll_handler().
|
static |
Referenced by PROCESS_THREAD(), slip_set_input_callback(), tcp_socket_register(), and udp_socket_register().
|
static |
Referenced by rxbuf_init(), slip_input_byte(), and slip_poll_handler().
|
static |
Referenced by slip_input_byte(), and slip_poll_handler().
uint8_t slip_active |
Referenced by PROCESS_THREAD().
|
static |