ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
hdlc_sync.h
Go to the documentation of this file.
1
2/*
3 * ether2ser - Ethernet <-> synchronous V.24 (RS-232/V.28) bridge
4 *
5 * File: src/protocol/hdlc_sync.h
6 * Purpose: HDLC sync accumulator interface and constants.
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Copyright (c) 2026 Florian <f.leuze@outlook.de>
11 */
12
13#ifndef HDLC_SYNC_H
14#define HDLC_SYNC_H
15
16// Related headers
17
18// Standard library headers
19#include <stdbool.h>
20
21// Project Headers
22#include "hdlc_common.h"
23#include "system/error.h"
24
25// Generated headers
26
30#define RX_HDLC_SYNC_MAX_BUFFER_SIZE 8192
31
35#define HDLC_SYNC_DEFAULT_SYNC_BYTE HDLC_FLAG_BYTE
36
49
81
87void hdlc_sync_acc_init(HDLC_SYNC_ACCUMULATOR_T* accumulator, uint8_t sync_byte);
88
95bool hdlc_sync_acc_process_byte(HDLC_SYNC_ACCUMULATOR_T* accumulator, uint8_t byte);
96
104
110void hdlc_sync_acc_consume_candidate(HDLC_SYNC_ACCUMULATOR_T* accumulator, bool accept);
111
112#endif /* HDLC_SYNC_H */
e2s_error_t
Common error codes returned by ether2ser modules.
Definition error.h:27
void hdlc_sync_acc_consume_candidate(HDLC_SYNC_ACCUMULATOR_T *accumulator, bool accept)
Consume current candidate and advance accumulator window.
Definition hdlc_sync.c:622
#define RX_HDLC_SYNC_MAX_BUFFER_SIZE
Maximum raw RX bytes retained in the HDLC sync accumulator.
Definition hdlc_sync.h:30
void hdlc_sync_acc_init(HDLC_SYNC_ACCUMULATOR_T *accumulator, uint8_t sync_byte)
Initialize HDLC sync accumulator state.
Definition hdlc_sync.c:507
HDLC_SYNC_STATE_T
HDLC synchronizer state machine states.
Definition hdlc_sync.h:41
@ HDLC_SYNC_STATE_HUNTING
Definition hdlc_sync.h:43
@ HDLC_SYNC_STATE_SYNCED
Definition hdlc_sync.h:47
@ HDLC_SYNC_STATE_SYNCING
Definition hdlc_sync.h:45
e2s_error_t hdlc_sync_acc_poll(HDLC_SYNC_ACCUMULATOR_T *accumulator, HDLC_FRAME_T *out_frame)
Poll accumulator for an aligned HDLC frame candidate.
Definition hdlc_sync.c:549
bool hdlc_sync_acc_process_byte(HDLC_SYNC_ACCUMULATOR_T *accumulator, uint8_t byte)
Append one received raw byte to the accumulator.
Definition hdlc_sync.c:527
Generic HDLC frame buffer descriptor.
Definition hdlc_common.h:38
Accumulator and state for HDLC bit-offset synchronization.
Definition hdlc_sync.h:54
uint32_t lookahead_wait_synced
Definition hdlc_sync.h:75
uint32_t hardcap_drop_bytes
Definition hdlc_sync.h:79
uint32_t lookahead_wait_syncing
Definition hdlc_sync.h:74
HDLC_SYNC_STATE_T state
Definition hdlc_sync.h:71
uint32_t hardcap_drop_events
Definition hdlc_sync.h:78