516016efb9
Wait for every navigation-ready tracking channel in a GPS epoch, remove unlocked channels without a timeout, and keep late joins for the next epoch. Reset PLIC ownership during warm initialization and extend Linux synthetic, integrity, and fake-MMIO regression coverage.
71 lines
1.6 KiB
C
71 lines
1.6 KiB
C
#ifndef GPS_NAV_EPOCH_H
|
|
#define GPS_NAV_EPOCH_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
/*
|
|
* The current receiver exposes nine tracking channels. Keep the epoch
|
|
* selector bounded so its exhaustive, allocation-free search has a fixed
|
|
* worst-case cost on the embedded target.
|
|
*/
|
|
#define GPS_NAV_EPOCH_MAX_CANDIDATES 9u
|
|
|
|
typedef struct {
|
|
int week;
|
|
double tow_sec;
|
|
uint32_t raw_sample;
|
|
} gps_nav_epoch_key_t;
|
|
|
|
typedef struct {
|
|
uint32_t selected_mask;
|
|
unsigned int selected_count;
|
|
unsigned int reference_index;
|
|
} gps_nav_epoch_selection_t;
|
|
|
|
typedef struct {
|
|
uint64_t epoch_id;
|
|
uint32_t expected_mask;
|
|
uint32_t received_mask;
|
|
bool active;
|
|
} gps_nav_epoch_assembly_t;
|
|
|
|
typedef enum {
|
|
GPS_NAV_EPOCH_EVENT_INVALID = 0,
|
|
GPS_NAV_EPOCH_EVENT_ACCEPTED,
|
|
GPS_NAV_EPOCH_EVENT_DUPLICATE,
|
|
GPS_NAV_EPOCH_EVENT_STALE,
|
|
GPS_NAV_EPOCH_EVENT_FUTURE,
|
|
GPS_NAV_EPOCH_EVENT_COMPLETE
|
|
} gps_nav_epoch_event_result_t;
|
|
|
|
bool gps_nav_epoch_select(
|
|
const gps_nav_epoch_key_t candidates[GPS_NAV_EPOCH_MAX_CANDIDATES],
|
|
unsigned int candidate_count,
|
|
uint32_t sample_window,
|
|
double tow_tolerance_sec,
|
|
gps_nav_epoch_selection_t* selection);
|
|
|
|
bool gps_nav_epoch_id(
|
|
int week,
|
|
double tow_sec,
|
|
unsigned int period_ms,
|
|
uint64_t* epoch_id);
|
|
|
|
void gps_nav_epoch_assembly_reset(gps_nav_epoch_assembly_t* assembly);
|
|
|
|
gps_nav_epoch_event_result_t gps_nav_epoch_assembly_push(
|
|
gps_nav_epoch_assembly_t* assembly,
|
|
uint64_t epoch_id,
|
|
unsigned int channel,
|
|
uint32_t ready_mask);
|
|
|
|
bool gps_nav_epoch_assembly_remove_channel(
|
|
gps_nav_epoch_assembly_t* assembly,
|
|
unsigned int channel);
|
|
|
|
bool gps_nav_epoch_assembly_complete(
|
|
const gps_nav_epoch_assembly_t* assembly);
|
|
|
|
#endif
|