|
ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
|


Go to the source code of this file.
Data Structures | |
| struct | HDLC_SYNC_ACCUMULATOR_T |
| Accumulator and state for HDLC bit-offset synchronization. More... | |
Macros | |
| #define | RX_HDLC_SYNC_MAX_BUFFER_SIZE 8192 |
| Maximum raw RX bytes retained in the HDLC sync accumulator. | |
| #define | HDLC_SYNC_DEFAULT_SYNC_BYTE HDLC_FLAG_BYTE |
| Default sync byte used for HDLC framing. | |
Enumerations | |
| enum | HDLC_SYNC_STATE_T { HDLC_SYNC_STATE_HUNTING , HDLC_SYNC_STATE_SYNCING , HDLC_SYNC_STATE_SYNCED } |
| HDLC synchronizer state machine states. More... | |
Functions | |
| void | hdlc_sync_acc_init (HDLC_SYNC_ACCUMULATOR_T *accumulator, uint8_t sync_byte) |
| Initialize HDLC sync accumulator state. | |
| bool | hdlc_sync_acc_process_byte (HDLC_SYNC_ACCUMULATOR_T *accumulator, uint8_t byte) |
| Append one received raw byte to the accumulator. | |
| 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. | |
| void | hdlc_sync_acc_consume_candidate (HDLC_SYNC_ACCUMULATOR_T *accumulator, bool accept) |
| Consume current candidate and advance accumulator window. | |
| #define HDLC_SYNC_DEFAULT_SYNC_BYTE HDLC_FLAG_BYTE |
Default sync byte used for HDLC framing.
Definition at line 35 of file hdlc_sync.h.
| #define RX_HDLC_SYNC_MAX_BUFFER_SIZE 8192 |
Maximum raw RX bytes retained in the HDLC sync accumulator.
Definition at line 30 of file hdlc_sync.h.
| enum HDLC_SYNC_STATE_T |
HDLC synchronizer state machine states.
Definition at line 40 of file hdlc_sync.h.
| void hdlc_sync_acc_consume_candidate | ( | HDLC_SYNC_ACCUMULATOR_T * | accumulator, |
| bool | accept | ||
| ) |
Consume current candidate and advance accumulator window.
| accumulator | Accumulator instance. |
| accept | Acceptance hint for candidate handling. |
Definition at line 622 of file hdlc_sync.c.
References HDLC_SYNC_ACCUMULATOR_T::candidate_end, HDLC_SYNC_ACCUMULATOR_T::candidate_start, HDLC_SYNC_ACCUMULATOR_T::candidate_valid, HDLC_SYNC_ACCUMULATOR_T::consume_count, HDLC_SYNC_ACCUMULATOR_T::hardcap_drop_bytes, HDLC_SYNC_ACCUMULATOR_T::hardcap_drop_events, hdlc_sync_drop_prefix(), hdlc_sync_reset_hunting_state(), HDLC_SYNC_ACCUMULATOR_T::position, HDLC_SYNC_ACCUMULATOR_T::processed, and RX_HDLC_SYNC_MAX_BUFFER_SIZE.
Referenced by decode_hdlc_to_udp_tx().


| void hdlc_sync_acc_init | ( | HDLC_SYNC_ACCUMULATOR_T * | accumulator, |
| uint8_t | sync_byte | ||
| ) |
Initialize HDLC sync accumulator state.
| accumulator | Accumulator instance. |
| sync_byte | Sync/flag byte to detect. |
Definition at line 507 of file hdlc_sync.c.
References HDLC_SYNC_ACCUMULATOR_T::align_shift_right, HDLC_SYNC_ACCUMULATOR_T::bit_offset, HDLC_SYNC_ACCUMULATOR_T::candidate_end, HDLC_SYNC_ACCUMULATOR_T::candidate_start, HDLC_SYNC_ACCUMULATOR_T::candidate_valid, HDLC_SYNC_ACCUMULATOR_T::consume_count, HDLC_SYNC_ACCUMULATOR_T::frame_ready_count, HDLC_SYNC_ACCUMULATOR_T::hardcap_drop_bytes, HDLC_SYNC_ACCUMULATOR_T::hardcap_drop_events, HDLC_SYNC_STATE_HUNTING, HDLC_SYNC_ACCUMULATOR_T::lookahead_wait_synced, HDLC_SYNC_ACCUMULATOR_T::lookahead_wait_syncing, HDLC_SYNC_ACCUMULATOR_T::position, HDLC_SYNC_ACCUMULATOR_T::processed, HDLC_SYNC_ACCUMULATOR_T::state, and HDLC_SYNC_ACCUMULATOR_T::sync_byte.
Referenced by decode_hdlc_to_udp_tx(), drain_hdlc_frames_to_udp(), event_dispatch(), init_app(), poll_hdlc_idle_timeout(), and poll_hdlc_no_progress().

| 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.
| accumulator | Accumulator instance. |
| out_frame | Output aligned frame buffer. |
E2S_ERR_HDLC_ACC_FRAME_READY when a candidate is available, otherwise status code. Definition at line 549 of file hdlc_sync.c.
References HDLC_SYNC_ACCUMULATOR_T::bit_offset, HDLC_FRAME_T::capacity, E2S_ERR_HDLC_ACC_FRAME_READY, E2S_OK, hdlc_sync_finalize_poll_no_frame(), HDLC_SYNC_POLL_STEP_ERROR, HDLC_SYNC_POLL_STEP_FRAME_READY, HDLC_SYNC_POLL_STEP_PROGRESS, HDLC_SYNC_POLL_STEP_STOP, HDLC_SYNC_STATE_HUNTING, HDLC_SYNC_STATE_SYNCED, HDLC_SYNC_STATE_SYNCING, hdlc_sync_step_hunting(), hdlc_sync_step_synced(), hdlc_sync_step_syncing(), HDLC_FRAME_T::payload, HDLC_SYNC_ACCUMULATOR_T::position, HDLC_SYNC_ACCUMULATOR_T::processed, and HDLC_SYNC_ACCUMULATOR_T::state.
Referenced by drain_hdlc_frames_to_udp().


| bool hdlc_sync_acc_process_byte | ( | HDLC_SYNC_ACCUMULATOR_T * | accumulator, |
| uint8_t | byte | ||
| ) |
Append one received raw byte to the accumulator.
| accumulator | Accumulator instance. |
| byte | Received raw byte. |
Definition at line 527 of file hdlc_sync.c.
References HDLC_SYNC_ACCUMULATOR_T::buffer, HDLC_SYNC_ACCUMULATOR_T::position, and RX_HDLC_SYNC_MAX_BUFFER_SIZE.
Referenced by drain_rx_until_empty().
