slipdev.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-17 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef SLIPDEV_H
22 #define SLIPDEV_H
23 
24 #include <stdint.h>
25 
26 #include "cib.h"
27 #include "net/netdev.h"
28 #include "periph/uart.h"
29 #include "tsrb.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
43 #ifndef SLIPDEV_BUFSIZE
44 #define SLIPDEV_BUFSIZE (2048U)
45 #endif
46 
50 typedef struct {
52  uint32_t baudrate;
54 
60 typedef struct {
64  char rxmem[SLIPDEV_BUFSIZE];
65  uint16_t inesc;
67 } slipdev_t;
68 
75 void slipdev_setup(slipdev_t *dev, const slipdev_params_t *params);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif /* SLIPDEV_H */
82 
Low-level UART peripheral driver interface definition.
Definitions low-level network driver interface.
netdev_t netdev
parent class
Definition: slipdev.h:61
uint16_t inesc
device previously received an escape byte
Definition: slipdev.h:65
unsigned int uart_t
Define default UART type identifier.
Definition: uart.h:65
#define SLIPDEV_BUFSIZE
UART buffer size used for TX and RX buffers.
Definition: slipdev.h:44
Configuration parameters for a slipdev.
Definition: slipdev.h:50
uart_t uart
UART interface the device is connected to.
Definition: slipdev.h:51
uint32_t baudrate
baudrate to use with slipdev_params_t::uart
Definition: slipdev.h:52
thread-safe ringbuffer struct
Definition: tsrb.h:39
Structure to hold driver state.
Definition: netdev.h:275
Thread-safe ringbuffer interface definition.
void slipdev_setup(slipdev_t *dev, const slipdev_params_t *params)
Setup a slipdev device state.
Circular integer buffer interface.
tsrb_t inbuf
RX buffer.
Definition: slipdev.h:63
Device descriptor for slipdev.
Definition: slipdev.h:60
slipdev_params_t config
configuration parameters
Definition: slipdev.h:62