slipdev_internal.h File Reference
#include <stddef.h>
#include <stdint.h>
#include "isrpipe.h"
#include "periph/uart.h"
#include "mutex.h"
+ Include dependency graph for slipdev_internal.h:

Go to the source code of this file.

Functions

static void slipdev_write_byte (uart_t uart, uint8_t byte)
 Writes one byte to UART. More...
 
void slipdev_write_bytes (uart_t uart, const uint8_t *data, size_t len)
 Write multiple bytes SLIP-escaped to UART. More...
 
unsigned slipdev_unstuff_readbyte (uint8_t *buf, uint8_t byte, bool *escaped)
 Unstuffs a (SLIP-escaped) byte. More...
 

Variables

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.
 

SLIP marker bytes

See also
RFC 1055
#define SLIPDEV_END   (0xc0U)
 
#define SLIPDEV_ESC   (0xdbU)
 
#define SLIPDEV_END_ESC   (0xdcU)
 
#define SLIPDEV_ESC_ESC   (0xddU)
 
#define SLIPDEV_STDIO_START   (0x0aU)
 Marker byte for beginning of stdio. More...
 

Macro Definition Documentation

◆ SLIPDEV_STDIO_START

#define SLIPDEV_STDIO_START   (0x0aU)

Marker byte for beginning of stdio.

See also
taken from diagnostic transfer from SLIPMUX

Definition at line 48 of file slipdev_internal.h.

Function Documentation

◆ slipdev_unstuff_readbyte()

unsigned slipdev_unstuff_readbyte ( uint8_t *  buf,
uint8_t  byte,
bool *  escaped 
)

Unstuffs a (SLIP-escaped) byte.

Parameters
[out]bufThe buffer to write to. It must at least be able to receive 1 byte.
[in]byteThe byte to unstuff.
[in,out]escapedWhen set to false on in, byte will be read as though it was not escaped, when set to true it will be read as though it was escaped. On out it will be false unless byte was SLIPDEV_ESC.
Returns
0, when byte did not resolve to an actual byte
1, when byte resolves to an actual byte (or escaped was set to true on in and resolves to a byte that was previously escaped).

◆ slipdev_write_byte()

static void slipdev_write_byte ( uart_t  uart,
uint8_t  byte 
)
inlinestatic

Writes one byte to UART.

Parameters
[in]uartThe UART device to write to.
[in]byteThe byte to write to uart.

Definition at line 68 of file slipdev_internal.h.

◆ slipdev_write_bytes()

void slipdev_write_bytes ( uart_t  uart,
const uint8_t *  data,
size_t  len 
)

Write multiple bytes SLIP-escaped to UART.

Parameters
[in]uartThe UART device to write to.
[in]dataThe bytes to write SLIP-escaped to uart.
[in]lenNumber of bytes in data.