|
Mercury Modem
Mercury ARQ/Broadcast modem
|


Go to the source code of this file.
Data Structures | |
| struct | arq_info |
| Runtime ARQ connection and mode state shared across modules. More... | |
| struct | arq_keydown_t |
| struct | arq_action_t |
| Single modem action item popped by modem TX worker. More... | |
| struct | arq_runtime_snapshot_t |
| Snapshot of current ARQ runtime state for telemetry/decision making. More... | |
Macros | |
| #define | CALLSIGN_MAX_SIZE 16 |
| #define | CALLSIGN_MAX_SECONDARY 4 |
| #define | ARQ_BANDWIDTH_NARROW_HZ 500 |
| #define | ARQ_BANDWIDTH_FULL_HZ 2300 |
| #define | ARQ_BANDWIDTH_TACTICAL_HZ 2750 |
| #define | RX 0 |
| #define | TX 1 |
| #define | HEADER_SIZE 1 |
| #define | PACKET_ARQ_CONTROL 0x00 |
| #define | PACKET_ARQ_DATA 0x01 |
| #define | PACKET_ARQ_CALL 0x02 |
| #define | PACKET_BROADCAST_CONTROL 0x03 |
| #define | PACKET_BROADCAST_PAYLOAD 0x04 |
| #define | ARQ_NAV_GAP_MS 60 |
| #define | ARQ_NAV_LEAD_MS (640 + ARQ_NAV_GAP_MS) |
| #define | ARQ_KEYDOWN_FRAMES 17 |
| #define | ARQ_KEYDOWN_FRAME_MAX 1280 |
Enumerations | |
| enum | arq_action_type_t { ARQ_ACTION_NONE = 0 , ARQ_ACTION_TX_CONTROL = 1 , ARQ_ACTION_TX_PAYLOAD = 2 , ARQ_ACTION_MODE_SWITCH = 3 , ARQ_ACTION_TX_KEYDOWN = 4 , ARQ_ACTION_TX_PATTERN = 5 } |
| Action types emitted by ARQ for modem worker execution. More... | |
| enum | arq_pattern_kind_t { ARQ_PATTERN_ACK = 0 , ARQ_PATTERN_BREAK = 1 } |
| Pattern kind (ARQ_ACTION_TX_PATTERN). More... | |
Functions | |
| void | arq_set_trx (int trx) |
| int | arq_get_trx (void) |
| int | arq_get_bw (void) |
| void | arq_conn_get_calls (char *my_call, char *src_addr, char *dst_addr, size_t bufsz) |
| void | arq_notify_virtual_time (void) |
| int | arq_init (size_t frame_size, int mode) |
| Initialize ARQ subsystem. | |
| void | arq_shutdown () |
| Shut down ARQ workers and release ARQ resources. | |
| void | arq_tick_1hz (void) |
| Execute 1 Hz ARQ maintenance tick. | |
| void | arq_post_event (int event) |
| Post an FSM event to ARQ. | |
| void | arq_post_pattern_ack (bool is_break) |
| bool | arq_is_link_connected (void) |
| Check whether ARQ link is connected. | |
| void | arq_discard_stale_rx (void) |
| Drop received bytes an ended session left in the RX buffer. | |
| int | arq_reported_bandwidth_hz (void) |
| Get the configured ARQ bandwidth token to report to VARA clients. | |
| int | arq_queue_data (const uint8_t *data, size_t len) |
| Queue outbound payload bytes for ARQ transmission. | |
| int | arq_get_tx_backlog_bytes (void) |
| Get pending outbound payload backlog. | |
| void | arq_set_disconnect_drain_timeout_s (int seconds) |
| Set the absolute cap on how long an app DISCONNECT may stay deferred while draining the last TX bytes. | |
| int | arq_set_listen_mode (int mode) |
| void | arq_set_active_modem_mode (int mode, size_t frame_size) |
| Inform ARQ of modem mode/frame size actually active in modem. | |
| bool | arq_handle_incoming_connect_frame (uint8_t *data, size_t frame_size, float rx_snr, int mode) |
| Handle an incoming CALL/ACCEPT frame (protocol version 1). | |
| void | arq_handle_carousel_frame (const uint8_t *data, size_t frame_size, int mode, bool from_control, float rx_snr, uint32_t age_ms) |
| bool | arq_handle_incoming_cq_frame (uint8_t *data, size_t frame_size) |
| Handle incoming compact CQ frame and emit host-side CQFRAME notification. | |
| void | arq_notify_cq_tx_started (void) |
| Emit VARA-style async status for an outgoing CQFRAME transmission. | |
| void | arq_notify_cq_tx_complete (void) |
| void | arq_handle_incoming_frame (uint8_t *data, size_t frame_size, float rx_snr) |
| Handle incoming regular ARQ control/data frame. | |
| void | arq_update_link_metrics (int sync, float snr, int rx_status, bool frame_decoded) |
| Feed decoder/link metrics into ARQ adaptation. | |
| void | arq_note_rx_preamble (int mode) |
A decoder for mode has just caught a frame's preamble: the channel is busy for that frame's airtime even if the decoder then loses sync. | |
| void | arq_note_rx_frame_done (void) |
| void | arq_note_rx_nav (uint32_t age_ms, uint32_t hold_ms) |
A NAV header that began age_ms ago says the peer's keydown ends within hold_ms of its start: the channel is busy until then, whether or not any of the keydown's frames can be decoded. | |
| bool | arq_try_dequeue_action (arq_action_t *action) |
| Try to dequeue next modem action without blocking. | |
| bool | arq_wait_dequeue_action (arq_action_t *action, int timeout_ms) |
| Wait for next modem action. | |
| bool | arq_get_runtime_snapshot (arq_runtime_snapshot_t *snapshot) |
| Copy ARQ runtime snapshot. | |
| int | arq_submit_tcp_cmd (const arq_cmd_msg_t *cmd) |
| Submit parsed control command from TCP bridge to ARQ. | |
| int | arq_submit_tcp_payload (const uint8_t *data, size_t len) |
| Submit payload bytes from TCP bridge to ARQ. | |
| void | clear_connection_data () |
| Clear legacy ARQ connection state and buffers. | |
| void | reset_arq_info (arq_info *arq_conn) |
| Reset external arq_info structure. | |
| void | arq_set_retry_slots (int slots) |
| Set runtime retry slot counts. | |
| void | arq_set_retry_stagger_ms (int ms) |
| void | call_remote () |
| Trigger outgoing call attempt using current ARQ addresses. | |
| void | callee_accept_connection () |
| Trigger callee-side accept flow in compatibility path. | |
Variables | |
| arq_info | arq_conn |
| #define ARQ_BANDWIDTH_FULL_HZ 2300 |
| #define ARQ_BANDWIDTH_NARROW_HZ 500 |
| #define ARQ_BANDWIDTH_TACTICAL_HZ 2750 |
| #define ARQ_KEYDOWN_FRAME_MAX 1280 |
| #define ARQ_KEYDOWN_FRAMES 17 |
| #define ARQ_NAV_GAP_MS 60 |
| #define ARQ_NAV_LEAD_MS (640 + ARQ_NAV_GAP_MS) |
| #define CALLSIGN_MAX_SECONDARY 4 |
| #define CALLSIGN_MAX_SIZE 16 |
| #define HEADER_SIZE 1 |
| #define PACKET_ARQ_CALL 0x02 |
| #define PACKET_ARQ_CONTROL 0x00 |
| #define PACKET_ARQ_DATA 0x01 |
| #define PACKET_BROADCAST_CONTROL 0x03 |
| #define PACKET_BROADCAST_PAYLOAD 0x04 |
| #define RX 0 |
| #define TX 1 |
| enum arq_action_type_t |
| enum arq_pattern_kind_t |
| void arq_conn_get_calls | ( | char * | my_call, |
| char * | src_addr, | ||
| char * | dst_addr, | ||
| size_t | bufsz | ||
| ) |
| void arq_discard_stale_rx | ( | void | ) |
Drop received bytes an ended session left in the RX buffer.
Does nothing while a session is up. Check and clear are one step under the session lock, so they cannot straddle a session starting.
| int arq_get_bw | ( | void | ) |
| bool arq_get_runtime_snapshot | ( | arq_runtime_snapshot_t * | snapshot | ) |
Copy ARQ runtime snapshot.
| snapshot | Output snapshot pointer. |
| int arq_get_trx | ( | void | ) |
| int arq_get_tx_backlog_bytes | ( | void | ) |
Get pending outbound payload backlog.
| void arq_handle_carousel_frame | ( | const uint8_t * | data, |
| size_t | frame_size, | ||
| int | mode, | ||
| bool | from_control, | ||
| float | rx_snr, | ||
| uint32_t | age_ms | ||
| ) |
| bool arq_handle_incoming_connect_frame | ( | uint8_t * | data, |
| size_t | frame_size, | ||
| float | rx_snr, | ||
| int | mode | ||
| ) |
Handle an incoming CALL/ACCEPT frame (protocol version 1).
| data | Frame bytes. |
| frame_size | Frame length in bytes. |
| rx_snr | SNR the frame was decoded at (dB); sets the start rung. |
| mode | The carrier it came on (DATAC16 or MFSK); the answer goes on it. |
| bool arq_handle_incoming_cq_frame | ( | uint8_t * | data, |
| size_t | frame_size | ||
| ) |
Handle incoming compact CQ frame and emit host-side CQFRAME notification.
| data | Incoming frame bytes. |
| frame_size | Frame length in bytes. |
| void arq_handle_incoming_frame | ( | uint8_t * | data, |
| size_t | frame_size, | ||
| float | rx_snr | ||
| ) |
Handle incoming regular ARQ control/data frame.
| data | Frame bytes. |
| frame_size | Frame length in bytes. |
| rx_snr | Local receive SNR at decode time (dB); 0.0 = unknown. |
| int arq_init | ( | size_t | frame_size, |
| int | mode | ||
| ) |
Initialize ARQ subsystem.
| frame_size | Active modem frame size in bytes. |
| mode | Initial modem mode. |
| bool arq_is_link_connected | ( | void | ) |
Check whether ARQ link is connected.
| void arq_note_rx_frame_done | ( | void | ) |
| void arq_note_rx_nav | ( | uint32_t | age_ms, |
| uint32_t | hold_ms | ||
| ) |
A NAV header that began age_ms ago says the peer's keydown ends within hold_ms of its start: the channel is busy until then, whether or not any of the keydown's frames can be decoded.
| void arq_note_rx_preamble | ( | int | mode | ) |
A decoder for mode has just caught a frame's preamble: the channel is busy for that frame's airtime even if the decoder then loses sync.
arq_note_rx_frame_done() ends it when a frame decodes.
| void arq_notify_cq_tx_complete | ( | void | ) |
| void arq_notify_cq_tx_started | ( | void | ) |
Emit VARA-style async status for an outgoing CQFRAME transmission.
VARA clients such as varim treat CQFRAME as a pending operation and expect PENDING/CANCELPENDING around the actual send lifecycle.
| void arq_notify_virtual_time | ( | void | ) |
| void arq_post_event | ( | int | event | ) |
Post an FSM event to ARQ.
| event | Event identifier from fsm.h. |
| void arq_post_pattern_ack | ( | bool | is_break | ) |
| int arq_queue_data | ( | const uint8_t * | data, |
| size_t | len | ||
| ) |
Queue outbound payload bytes for ARQ transmission.
| data | Pointer to payload bytes. |
| len | Number of bytes to queue. |
| int arq_reported_bandwidth_hz | ( | void | ) |
Get the configured ARQ bandwidth token to report to VARA clients.
| void arq_set_active_modem_mode | ( | int | mode, |
| size_t | frame_size | ||
| ) |
Inform ARQ of modem mode/frame size actually active in modem.
| mode | Active FreeDV mode. |
| frame_size | Active frame size in bytes. |
| void arq_set_disconnect_drain_timeout_s | ( | int | seconds | ) |
Set the absolute cap on how long an app DISCONNECT may stay deferred while draining the last TX bytes.
| seconds | Window in seconds. Values <= 0 reset to the compiled default (ARQ_DISCONNECT_DRAIN_TIMEOUT_S_DEFAULT). |
| int arq_set_listen_mode | ( | int | mode | ) |
| void arq_set_retry_slots | ( | int | slots | ) |
Set runtime retry slot counts.
Updates the CALL and ACCEPT retry counters used by the ARQ FSM. DISCONNECT retries are left at the compiled default. Pass 0 to restore all counters to compiled defaults.
| slots | Number of retry slots, or 0 to restore defaults. |
| void arq_set_retry_stagger_ms | ( | int | ms | ) |
| void arq_set_trx | ( | int | trx | ) |
| void arq_shutdown | ( | ) |
Shut down ARQ workers and release ARQ resources.
| int arq_submit_tcp_cmd | ( | const arq_cmd_msg_t * | cmd | ) |
Submit parsed control command from TCP bridge to ARQ.
| cmd | Command message. |
| int arq_submit_tcp_payload | ( | const uint8_t * | data, |
| size_t | len | ||
| ) |
Submit payload bytes from TCP bridge to ARQ.
| data | Payload bytes. |
| len | Payload length in bytes. |
| void arq_tick_1hz | ( | void | ) |
Execute 1 Hz ARQ maintenance tick.
| bool arq_try_dequeue_action | ( | arq_action_t * | action | ) |
Try to dequeue next modem action without blocking.
| action | Output action item. |
| void arq_update_link_metrics | ( | int | sync, |
| float | snr, | ||
| int | rx_status, | ||
| bool | frame_decoded | ||
| ) |
Feed decoder/link metrics into ARQ adaptation.
| sync | Decoder sync flag. |
| snr | Estimated SNR. |
| rx_status | Decoder RX status flags. |
| frame_decoded | True when a frame decoded this cycle. |
| bool arq_wait_dequeue_action | ( | arq_action_t * | action, |
| int | timeout_ms | ||
| ) |
Wait for next modem action.
| action | Output action item. |
| timeout_ms | Wait timeout in milliseconds. |
| void call_remote | ( | ) |
Trigger outgoing call attempt using current ARQ addresses.
| void callee_accept_connection | ( | ) |
Trigger callee-side accept flow in compatibility path.
| void clear_connection_data | ( | ) |
Clear legacy ARQ connection state and buffers.
| void reset_arq_info | ( | arq_info * | arq_conn | ) |
Reset external arq_info structure.
| arq_conn | Pointer to structure to reset. |
|
extern |