For 47511 or 4752 TCXO Calibration please refer to the Android documentation package When adding custom code to do TCXO calibration, set the CONFIG_HAL_FRQ_CUSTOM to 'yes' in the appropriate makefile:
CONFIG_HAL_FRQ_CUSTOM=yes
This overrides the default implementation by controlling the inclusion of the file glhal\unix\src\glgps_hal_frq.c (from the glhal makefiles):
ifneq ($(CONFIG_HAL_FRQ_CUSTOM), yes) LOCAL_SRC_FILES += $(GLHAL_UNIX)/src/glgps_hal_frq.c endif
TCXO calibration can be implemented using the GpsHalRefFreqOn, GpsHalRefFreqOff, and GpsHalRefFreqQuery functions.
GpsHalRefFreqOn is called to notify that a measurement is starting for CNTIN. The reference frequency should be started during this call. A response to indicate the signal is present and ready to use should be sent. This can be done using glgps_event_put_pending and GLCTEV_PAL_ENG_FREQ_DATA:
static GL_FREQ otFreqStat; otFreqStat.lFreqOff = 0; otFreqStat.ulFreqStat = REFCLKSTAT_ADJUSTING; otFreqStat.ulFreqChange = 0; glgps_event_put_pending(GLCTEV_PAL_ENG_FREQ_DATA,&otFreqStat, sizeof(otFreqStat));
GpsHalRefFreqQuery is called when checking the status of the clock. As with GpsHalRefFreqOn, a response to indicate the signal is ready should be sent. This can be done using glgps_event_put_pending and GLCTEV_PAL_ENG_FREQ_DATA:
short GpsHalRefFreqQuery(GpsHal *pHal) { static GL_FREQ otFreqStat; otFreqStat.lFreqOff = 0; otFreqStat.ulFreqStat = REFCLKSTAT_ADJUSTING; otFreqStat.ulFreqChange = 0; glgps_event_put_pending(GLCTEV_PAL_ENG_FREQ_DATA,&otFreqStat, sizeof(otFreqStat)); return 1; }
GpsHalRefFreqOff is called when the reference frequency is no longer needed. The signal can be stopped during this call.