ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
hdlc_common.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_common.h
5 * Purpose: HDLC common utilities API (CRC and shared helpers).
6 *
7 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Copyright (c) 2026 Florian <f.leuze@outlook.de>
10 */
11
12#ifndef HDLC_COMMON_H
13#define HDLC_COMMON_H
14
15// Related headers
16
17// Standard library headers
18#include <stddef.h>
19#include <stdint.h>
20
21// Project Headers
22
23// Generated headers
24
29#define HDLC_FLAG_BYTE 0x7E
30#define HDLC_ESCAPE_BYTE 0x7D
31#define HDLC_ESCAPE_XOR 0x20
37typedef struct
38{
40 uint8_t* payload;
42 size_t length;
44 size_t capacity;
46
53uint16_t hdlc_crc16(const uint8_t* payload, size_t num_bytes);
54
55#endif /* HDLC_COMMON_H */
uint16_t hdlc_crc16(const uint8_t *payload, size_t num_bytes)
Compute HDLC CRC16 (FCS) over a payload.
Definition hdlc_common.c:45
Generic HDLC frame buffer descriptor.
Definition hdlc_common.h:38
size_t capacity
Definition hdlc_common.h:44
size_t length
Definition hdlc_common.h:42
uint8_t * payload
Definition hdlc_common.h:40