47 lines
1.7 KiB
C
47 lines
1.7 KiB
C
#ifndef GPS_RECEIVER_H
|
|
#define GPS_RECEIVER_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
struct gps_nav_solution;
|
|
|
|
/*
|
|
* High-level boundary around the legacy GPS acquisition/tracking subsystem.
|
|
*
|
|
* initialize(): resets GPS hardware/software state and installs the machine
|
|
* interrupt handler used by the receiver.
|
|
*
|
|
* start_acquisition(): schedules the initial PRN acquisition work.
|
|
*
|
|
* process_pending_events(): foreground half of GPS interrupt processing. It
|
|
* consumes ISR events, handles channel loss/reacquisition and timer work.
|
|
*
|
|
* solve_ready_epoch(): when at least four coherent channels report the same
|
|
* nav-solve epoch, snapshots them and runs WLS. The returned timestamp is the
|
|
* measurement epoch, not the later time at which WLS completed.
|
|
*/
|
|
void gps_receiver_initialize(unsigned int nav_solve_timer_ticks);
|
|
typedef void (*gps_receiver_external_irq_handler_t)(void);
|
|
/* Attach one application-owned PLIC source to the installed trap dispatcher.
|
|
* The source driver remains responsible for its priority and enable state. */
|
|
bool gps_receiver_attach_external_irq(
|
|
unsigned int irq_id,
|
|
gps_receiver_external_irq_handler_t handler);
|
|
void gps_receiver_start_acquisition(void);
|
|
void gps_receiver_process_pending_events(void);
|
|
bool gps_receiver_solve_ready_epoch(
|
|
struct gps_nav_solution* solution_out,
|
|
uint64_t* measurement_timestamp_ticks_out);
|
|
|
|
/* Slow status clock maintained by the GPS machine-timer interrupt. */
|
|
uint64_t gps_receiver_status_ticks(void);
|
|
uint64_t gps_receiver_status_ticks_per_second(void);
|
|
|
|
/* Select the low-latency Doppler EWMA used only by velocity WLS/ESKF.
|
|
* PPS keeps its independent fixed low-noise path. */
|
|
void gps_receiver_set_eskf_doppler_alpha(double alpha);
|
|
double gps_receiver_get_eskf_doppler_alpha(void);
|
|
|
|
#endif
|