ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
app_context.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/system/app_context.h
6 * Purpose: Central application context and shared runtime state types.
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Copyright (c) 2026 Florian <f.leuze@outlook.de>
11 */
12
13#ifndef APP_CONTEXT_H
14#define APP_CONTEXT_H
15
16// Related headers
17
18// Standard library headers
19#include <inttypes.h>
20#include <stdint.h>
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24
25// Library Headers
26#include "pico/stdio.h"
27#include "pico/time.h"
28
29// Project Headers
31#include "drivers/tx_queue.h"
33#include "platform/pinmap.h"
36#include "protocol/hdlc_sync.h"
38#include "system/cli_commands.h"
39#include "system/cli_usb_cdc.h"
40#include "system/common.h"
41#include "system/event_queue.h"
43
44// Generated headers
45
93
124
130void init_app(app_ctx_t* app, const config_t* persistent_config);
131
138
139#endif /* APP_CONTEXT_H */
void init_app(app_ctx_t *app, const config_t *persistent_config)
Initialize application context from persistent/default configuration.
Definition app_init.c:39
app_ctx_t * get_app_ctx(void)
Get access to the app context. This context is owned by main, app_init just takes hold of a pointer t...
Definition app_init.c:34
#define RX_HDLC_SYNC_MAX_BUFFER_SIZE
Maximum raw RX bytes retained in the HDLC sync accumulator.
Definition hdlc_sync.h:30
Generic HDLC frame buffer descriptor.
Definition hdlc_common.h:38
Accumulator and state for HDLC bit-offset synchronization.
Definition hdlc_sync.h:54
Network configuration wrapper used by the W5500 driver.
One queued HDLC frame plus drain offset state.
Definition tx_queue.h:60
TX queue runtime state.
Definition tx_queue.h:73
UDP endpoint configuration.
UDP payload container.
Runtime V.24 configuration and TX holdoff state.
Definition v24_config.h:87
Global application context shared across modules.
Definition app_context.h:98
UDP_FRAME_T tx_frame_buffer
bool need_prompt
UDP_FRAME_T rx_frame_buffer
HDLC_SYNC_ACCUMULATOR_T accumulator
TX_QUEUE_T tx_queue
payload_statistics_t stats
NETWORK_CONFIG_T net_config
UDP_CONFIG_T sender_config
UDP_CONFIG_T local_config
V24_CONFIG_T v24_config
config_t persistent_config
Definition app_context.h:99
UDP_CONFIG_T destination_config
bool config_valid
HDLC_FRAME_T reconstructed_frame
Persistent configuration blob stored in flash.
Runtime pipeline statistics and counters.
Definition app_context.h:50
uint64_t rx_fifo_stall_events
Definition app_context.h:87
uint64_t sync_candidate_consume
Definition app_context.h:65
uint64_t hdlc_decode_fail
Definition app_context.h:56
uint64_t tx_queue_used_max
Definition app_context.h:79
uint64_t resync_no_progress_count
Definition app_context.h:77
uint64_t decode_fail_crc_mismatch
Definition app_context.h:73
uint64_t sync_hardcap_drop_events
Definition app_context.h:66
uint64_t udp_rx_throttle_enter
Definition app_context.h:58
uint64_t tx_queue_drop_frames
Definition app_context.h:80
uint64_t accumulator_pos_max
Definition app_context.h:86
uint64_t hunt_idle_drop_bytes
Definition app_context.h:89
uint64_t event_queue_drop_events
Definition app_context.h:82
uint64_t decode_fail_unstuff_error
Definition app_context.h:72
uint64_t udp_rx_throttle_skips
Definition app_context.h:59
uint64_t log_queue_used_max
Definition app_context.h:84
uint64_t hdlc_frame_ready
Definition app_context.h:54
uint64_t serial_rx_drop_acc_full
Definition app_context.h:88
uint64_t decode_fail_invalid_frame
Definition app_context.h:69
uint64_t event_queue_used_max
Definition app_context.h:81
uint64_t decode_fail_too_short
Definition app_context.h:70
uint64_t sync_hardcap_drop_bytes
Definition app_context.h:67
uint64_t resync_idle_timeout_count
Definition app_context.h:75
uint64_t sync_lookahead_wait_syncing
Definition app_context.h:63
uint64_t resync_hard_fail_count
Definition app_context.h:76
uint64_t udp_tx_buffer_full_counts
Definition app_context.h:61
uint64_t decode_fail_payload_too_long
Definition app_context.h:71
uint64_t sync_lookahead_wait_synced
Definition app_context.h:64
uint64_t udp_rx_buffer_full_counts
Definition app_context.h:60
#define TX_FRAME_QUEUE_SIZE
Number of frame entries available in the TX queue ring buffer.
Definition tx_queue.h:32
#define TX_BUF_SIZE
#define RX_BUF_SIZE