Files

57 lines
2.2 KiB
C
Executable File

#ifndef __IQ_RX_H__
#define __IQ_RX_H__
/* ORx IQ receive/analysis thread (task/iq_rx.c). */
void *iq_rx_thr(void *arg);
/* Runtime spectrum/IQ processing switch. Defaults to disabled after boot. */
int iq_spec_get_enable(void);
void iq_spec_set_enable(int enable);
/*
* Newest UIMD/LIMD measured on the imx6's own 10 MSPS ORx window.
*
* Same taps as the FPGA's imd_imd_fft_meas -- centre bin at +24.414 kHz and the two
* shoulder bins at +-3.1494 MHz -- but averaged over 11 bins (+-12.2 kHz) each and
* Welch-averaged over the whole 26.2 ms window. LIMD is always the shoulder on the
* pilot's side of the carrier; which one that is follows the measured pilot, so a
* spectral inversion cannot silently swap the two.
*
* The FPGA's own registers cannot be used any more: its 20-bit |DFT|^2 output
* quantises the shoulder bins to 0 once the shoulder is better than ~45 dB, and
* lcd_task.c's `if (imd_l == 0) imd_l = 1` then reports a constant.
*
* limd_db/uimd_db are 10*log10(P_centre / P_shoulder), i.e. positive dB, no +11 dB
* display offset applied.
*
* Returns 1 and fills both pointers when a window newer than IQ_IMD_MAX_AGE seconds
* is available, 0 otherwise (caller should keep whatever it had).
*/
#define IQ_IMD_MAX_AGE 10
/* The 8VSB demod runs on a nice'd thread on a core that is already ~40% busy in
* softirq, so a fresh window lands every ~10 s rather than every second. */
#define IQ_SNR_MAX_AGE 30
int iq_get_imd(float *limd_db, float *uimd_db);
/*
* 8VSB demodulation of one complete window (task/iq_vsb.c): matched filter, symbol
* recovery, SNR and the eye-diagram density map, published as /tmp/iq_eye.json.
* `win` is the raw window buffer (262144 big-endian int16 I/Q pairs).
*/
void iq_vsb_analyse(const unsigned char *win, int wid);
/*
* Newest 8VSB SNR (== MER, I-path definition) measured on that window. Returns 1 and
* fills snr_db when a window newer than IQ_IMD_MAX_AGE seconds has been demodulated
* with segment sync locked, 0 otherwise.
*
* This replaces the value lcd_task.c used to fabricate: its "limit snr display" block
* overwrote the FPGA's SNR with a two-valued function of the (bottomed-out) IMD.
*/
int iq_get_snr(float *snr_db);
void iq_vsb_clear_results(void);
#endif /* __IQ_RX_H__ */