Appendix D _________________________________________________ RVP900 Developer's Notes
VAISALA______________________________________________________________________ 413
D.5.2 Example: Standard Trigger/Antenna
Events
Refer to the source file rvp8main/open/rtctrl.c, which contains the
standard RVP8 code for live trigger control and angle synchronization.
The software consists of these pieces:
-initProcSection_dflt—This is the default routine for initial entry into
each PROC section. Its primary job is deciding what kind of real-time
callback responses are needed for the current RVP8 configuration. It
sets up an area of private memory that later controls the real-time
activity (see calling example in rvp8main/open/mt_fft.c).
- rtCtrlCBF_dflt—This is the default real-time callback of the
RT-Ctrl thread. It receives a subset of the private memory for this
PROC section that was set aside for real-time control (see calling
example in rvp8main/open/mt_fft.c ), and performs one of the
following:
- Angle synchronization—A brief history of prior antenna angles
are entered into a least squares model, which is then used to
predict how long it will be until the next sync angle boundary is
crossed. A callback based on the 1MHz counter is then requested
for that time using one of the timers:
cbt >iTVWaitOnNext = RTCBTV_1MHZ ;
cbt– >iTimerWait = (1000 * iFutureMS) ;
along with an immediate hardware assisted trigger bank change
using:
cbi_a– >iTgBank = iBankNew ; cbt– >lTgBankAutoStart
= TRUE ;
- Freerunning Dual-PRF—This mode alters the pattern of
triggers after a computed number of pulses have occurred:
cbt– >iTVWaitOnNext = RTCBTV_TRIG ;
cbt– >iTimerWait = ceil( MAX( 1.0, fTrigs ) - 1E-4 ) ;
cbt– >iTimerWait –= cbt– >iTimerError ;
The interrupt latencies are absorbed differently in these two cases. For
angle syncing, we compute the expected crossing time based on where the
antenna happens to be when the callback was entered. It does not matter if
a callback is delayed, because we compute a shorter future time in such
cases. For Dual-PRF triggers, we need to shorten the next interrupt,
whenever the present callback is delayed, but we do this using the
iTimerError field that keeps track of how late (measured in timer events)
we presently are.