ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
hdlc_decoder.h
Go to the documentation of this file.
1/*
2 * ether2ser — Ethernet <-> synchronous V.24 (RS-232/V.28) bridge
3 *
4 * File: src/protocol/hdlc_decoder.h
5 * Purpose: HDLC decoder API.
6 *
7 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Copyright (c) 2026 Florian <f.leuze@outlook.de>
10 */
11
12#ifndef HDLC_DECODER_H
13#define HDLC_DECODER_H
14
15// Related headers
16
17// Standard library headers
18#include <stdbool.h>
19#include <stddef.h>
20#include <stdint.h>
21
22// Project Headers
23#include "hdlc_common.h"
24
25// Generated headers
26
30typedef struct
31{
32 uint64_t invalid_frame;
33 uint64_t too_short;
35 uint64_t unstuff_error;
36 uint64_t crc_mismatch;
38
48bool hdlc_decode(const HDLC_FRAME_T* frame, uint8_t* payload, const size_t out_capacity,
49 size_t* payload_length, bool lsb_first);
50
59bool hdlc_decode_byte(const HDLC_FRAME_T* frame, uint8_t* payload, const size_t out_capacity,
60 size_t* payload_length);
61
67
72
73#endif /* HDLC_DECODER_H */
void hdlc_decode_stats_reset(void)
Reset cumulative HDLC decode statistics.
bool hdlc_decode(const HDLC_FRAME_T *frame, uint8_t *payload, const size_t out_capacity, size_t *payload_length, bool lsb_first)
Decode an HDLC bit-stuffed frame.
void hdlc_decode_stats_snapshot(hdlc_decode_stats_t *out_stats)
Copy cumulative HDLC decode statistics.
bool hdlc_decode_byte(const HDLC_FRAME_T *frame, uint8_t *payload, const size_t out_capacity, size_t *payload_length)
Decode a byte-escaped HDLC frame compatibility path.
Generic HDLC frame buffer descriptor.
Definition hdlc_common.h:38
Cumulative HDLC decode failure reason counters.
uint64_t payload_too_long