slipdev_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 
19 #ifndef SLIPDEV_INTERNAL_H
20 #define SLIPDEV_INTERNAL_H
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #include "isrpipe.h"
26 #include "periph/uart.h"
27 #include "mutex.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
38 #define SLIPDEV_END (0xc0U)
39 #define SLIPDEV_ESC (0xdbU)
40 #define SLIPDEV_END_ESC (0xdcU)
41 #define SLIPDEV_ESC_ESC (0xddU)
42 
48 #define SLIPDEV_STDIO_START (0x0aU)
55 
60 extern mutex_t slipdev_mutex;
61 
68 static inline void slipdev_write_byte(uart_t uart, uint8_t byte)
69 {
70  uart_write(uart, &byte, 1U);
71 }
72 
80 void slipdev_write_bytes(uart_t uart, const uint8_t *data, size_t len);
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* SLIPDEV_INTERNAL_H */
Low-level UART peripheral driver interface definition.
uint_fast8_t uart_t
Define default UART type identifier.
Definition: uart.h:85
void uart_write(uart_t uart, const uint8_t *data, size_t len)
Write data from the given buffer to the specified UART device.
isrpipe Interface
Mutex for thread synchronization.
isrpipe_t slipdev_stdio_isrpipe
ISR pipe to hand read bytes to stdin.
mutex_t slipdev_mutex
Mutex to synchronize write operations to the UART between stdio sub-module and normal SLIP.
static void slipdev_write_byte(uart_t uart, uint8_t byte)
Writes one byte to UART.
void slipdev_write_bytes(uart_t uart, const uint8_t *data, size_t len)
Write multiple bytes SLIP-escaped to UART.
Context structure for isrpipe.
Definition: isrpipe.h:37
Mutex structure.
Definition: mutex.h:146