|
HERMES Modem
Hermes ARQ/Broadcast modem
|
#include "arq_modem.h"#include "arq_protocol.h"#include <pthread.h>#include <string.h>#include <time.h>#include <errno.h>#include "../modem/freedv/freedv_api.h"
Macros | |
| #define | MAX_QUEUE_CAPACITY 128 |
Functions | |
| int | arq_modem_queue_init (size_t capacity) |
| Initialise the action queue. | |
| void | arq_modem_queue_shutdown (void) |
| Flush and destroy the action queue. | |
| int | arq_modem_enqueue (const arq_action_t *action) |
| Enqueue a modem action (called from FSM action callbacks). | |
| bool | arq_modem_dequeue (arq_action_t *action, int timeout_ms) |
| Dequeue the next modem action (called from modem TX worker). | |
| void | arq_modem_set_event_fn (void(*fn)(int mode, bool ptt_on)) |
| Register the PTT event injection function (called from arq.c init). | |
| void | arq_modem_ptt_on (int mode, size_t frame_size) |
| Notify ARQ that PTT has gone ON. | |
| void | arq_modem_ptt_off (void) |
| Notify ARQ that PTT has gone OFF. | |
| int | arq_modem_preferred_rx_mode (const arq_session_t *sess) |
| Return the preferred RX FreeDV mode for the current session state. | |
| int | arq_modem_preferred_tx_mode (const arq_session_t *sess) |
| Return the preferred TX FreeDV mode for the current session state. | |
Variables | |
| static arq_action_t | g_queue [MAX_QUEUE_CAPACITY] |
| static size_t | g_head |
| static size_t | g_tail |
| static size_t | g_count |
| static size_t | g_cap |
| static pthread_mutex_t | g_qmtx = PTHREAD_MUTEX_INITIALIZER |
| static pthread_cond_t | g_qcond = PTHREAD_COND_INITIALIZER |
| static bool | g_shutdown = false |
| static void(* | g_inject_event )(int mode, bool ptt_on) = NULL |
| #define MAX_QUEUE_CAPACITY 128 |
| bool arq_modem_dequeue | ( | arq_action_t * | action, |
| int | timeout_ms | ||
| ) |
Dequeue the next modem action (called from modem TX worker).
Blocks up to timeout_ms milliseconds waiting for an action.
| action | Output action. |
| timeout_ms | Wait timeout in milliseconds. |
| int arq_modem_enqueue | ( | const arq_action_t * | action | ) |
Enqueue a modem action (called from FSM action callbacks).
| int arq_modem_preferred_rx_mode | ( | const arq_session_t * | sess | ) |
Return the preferred RX FreeDV mode for the current session state.
| sess | Current session (read-only). |
| int arq_modem_preferred_tx_mode | ( | const arq_session_t * | sess | ) |
Return the preferred TX FreeDV mode for the current session state.
| sess | Current session (read-only). |
| void arq_modem_ptt_off | ( | void | ) |
Notify ARQ that PTT has gone OFF.
| void arq_modem_ptt_on | ( | int | mode, |
| size_t | frame_size | ||
| ) |
Notify ARQ that PTT has gone ON.
| mode | FreeDV mode of the frame now on air. |
| frame_size | Frame size in bytes. |
| int arq_modem_queue_init | ( | size_t | capacity | ) |
Initialise the action queue.
| capacity | Maximum number of pending actions. |
| void arq_modem_queue_shutdown | ( | void | ) |
Flush and destroy the action queue.
| void arq_modem_set_event_fn | ( | void(*)(int mode, bool ptt_on) | fn | ) |
Register the PTT event injection function (called from arq.c init).
| fn | Callback: mode >= 0 and ptt_on=true → TX_STARTED; ptt_on=false → TX_COMPLETE. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |