ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
event_queue.h
Go to the documentation of this file.
1/*
2 * ether2ser — Ethernet <-> synchronous V.24 (RS-232/V.28) bridge
3 *
4 * File: src/system/event_queue.h
5 * Purpose: Event queue API with opaque payload pointers.
6 *
7 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Copyright (c) 2026 Florian <f.leuze@outlook.de>
10 */
11
12#ifndef SYSTEM_EVENT_QUEUE_H
13#define SYSTEM_EVENT_QUEUE_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 "drivers/v24_config.h"
24
25// Generated headers
29#define EVENT_QUEUE_CAPACITY 16
30
51
68
72typedef struct
73{
77 union
78 {
79 uint8_t ip[4];
80 uint16_t port;
84 } value;
86
90typedef struct
91{
95 size_t data_len;
97 union
98 {
99 const void* ptr; // for large/external data
100 uint8_t bytes[16]; // for small inline data
101 } data;
104} event_t;
105
109void event_queue_init(void);
110
116bool event_queue_push(const event_t* event_entry);
117
123bool event_queue_pop(event_t* event_out);
124
128bool event_queue_is_empty(void);
129
133bool event_queue_is_full(void);
134
139size_t event_queue_get_count(void);
140
146
152
160bool event_get_payload_ptr(const event_t* event, size_t required_size, const void** out);
161
162#endif /* SYSTEM_EVENT_QUEUE_H */
event_queue_data_types_t
Typed payload selector for configuration-oriented events.
Definition event_queue.h:56
@ SYS_REBOOT
Definition event_queue.h:66
@ NET_PORT_REMOTE
Definition event_queue.h:62
@ NET_IP_MASK
Definition event_queue.h:60
@ V24_POLARITIES
Definition event_queue.h:64
@ V24_CLOCK_MODE
Definition event_queue.h:65
@ V24_BAUDRATE
Definition event_queue.h:63
@ NET_PORT_LOCAL
Definition event_queue.h:61
@ NET_IP_LOCAL
Definition event_queue.h:59
@ NET_IP_REMOTE
Definition event_queue.h:57
@ NET_IP_GATEWAY
Definition event_queue.h:58
event_type_t
Event type identifiers.
Definition event_queue.h:35
@ EV_STATUS
Definition event_queue.h:42
@ EV_CLI_LINE
Definition event_queue.h:37
@ EV_SET_V24_SETTINGS
Definition event_queue.h:47
@ EV_GET_NET_SETTINGS
Definition event_queue.h:46
@ EV_MEM
Definition event_queue.h:43
@ EV_WIPE_CONFIG
Definition event_queue.h:44
@ EV_SET_NET_SETTINGS
Definition event_queue.h:45
@ EV_GET_V24_SETTINGS
Definition event_queue.h:48
@ EV_REBOOT
Definition event_queue.h:49
@ EV_SAVE_CONFIG
Definition event_queue.h:41
@ EV_HDLC_DECODE
Definition event_queue.h:40
@ EV_UDP_TX
Definition event_queue.h:39
@ EV_UDP_RX
Definition event_queue.h:38
@ EV_NONE
Definition event_queue.h:36
bool event_queue_is_empty(void)
Check whether the queue is empty.
Definition event_queue.c:78
bool event_queue_push(const event_t *event_entry)
Enqueue an event.
Definition event_queue.c:49
bool event_queue_is_full(void)
Check whether the queue is full.
Definition event_queue.c:83
bool event_get_payload_ptr(const event_t *event, size_t required_size, const void **out)
Resolve payload pointer and validate minimum payload size.
uint32_t event_queue_get_push_drop_count(void)
Get cumulative number of dropped push attempts.
Definition event_queue.c:99
void event_queue_init(void)
Initialize the event queue storage.
Definition event_queue.c:40
bool event_queue_pop(event_t *event_out)
Dequeue an event.
Definition event_queue.c:67
size_t event_queue_get_count(void)
Get current number of queued events.
Definition event_queue.c:89
size_t event_queue_get_high_water_mark(void)
Get peak queue fill count observed since init.
Definition event_queue.c:94
Combined TX and RX polarity configuration.
Definition v24_config.h:78
Generic event payload wrapper for network/V.24 config operations.
Definition event_queue.h:73
V24_BAUDRATE_T baudrate
Definition event_queue.h:82
V24_POLARITIES_T polarities
Definition event_queue.h:81
event_queue_data_types_t id
Definition event_queue.h:75
Event queue entry.
Definition event_queue.h:91
size_t data_len
Definition event_queue.h:95
event_type_t type
Definition event_queue.h:93
const void * ptr
Definition event_queue.h:99
bool is_inline
V24_BAUDRATE_T
Supported synchronous V.24 baudrates.
Definition v24_config.h:32