Platform/ECM3532/M3/hw/csp/ecm3532/m3/csp/src/eta_csp_hfo.c
/***************************************************************************/
/**
 *
 *  EtaCspHfoTuneInit - Tuning algorithm used for cold start (POR or RESET_N).
 *                      Uses coarse and fine tuning.  Use this one at POR,
 *                      RESET_N or anytime the AO BUCK voltage is changed.
 *
 *  @param ui32CoarseWindow The +/- tolerance for coarse tuning success.
 *  @param ui32FineWindow The +/- tolerance for fine tuning success.
 *  @param ui32CoarseSamples How many samples to average for getting frequency
 *                           for coarse tuning.
 *  @param ui32FineSamples How many samples to average for getting frequency for
 *                         fine tuning.
 *  @param ui32CoarseTimeout Number of calibration cycles after which the
 *                           algorithm gives up for coarse tuning.
 *  @param ui32FineTimeout Number of calibration cycles after which the
 *                         algorithm gives up for coarse tuning.
 *  @return Return the frequency.
 *
 ******************************************************************************/
Tuning algorithm used for cold start (POR or RESET_N).
Uses coarse and fine tuning.  Use this one at POR,
RESET_N or anytime the AO BUCK voltage is changed.

@param ui32CoarseWindow The +/- tolerance for coarse tuning success.
@param ui32FineWindow The +/- tolerance for fine tuning success.
@param ui32CoarseSamples How many samples to average for getting frequency
for coarse tuning.
@param ui32FineSamples How many samples to average for getting frequency for
fine tuning.
@param ui32CoarseTimeout Number of calibration cycles after which the
algorithm gives up for coarse tuning.
@param ui32FineTimeout Number of calibration cycles after which the
algorithm gives up for coarse tuning.
@return Return the frequency.
Tuning algorithm used for cold start ( POR or RESET_N ) . Uses coarse and fine tuning . Use this one at POR RESET_N or anytime the AO BUCK voltage is changed . @param ui32CoarseWindow The + / - tolerance for coarse tuning success . @param ui32FineWindow The + / - tolerance for fine tuning success . @param ui32CoarseSamples How many samples to average for getting frequency for coarse tuning . @param ui32FineSamples How many samples to average for getting frequency for fine tuning . @param ui32CoarseTimeout Number of calibration cycles after which the algorithm gives up for coarse tuning . @param ui32FineTimeout Number of calibration cycles after which the algorithm gives up for coarse tuning . @return Return the frequency .
uint32_t
EtaCspHfoTuneInit(uint32_t ui32CoarseWindow, uint32_t ui32FineWindow,
                  uint32_t ui32CoarseSamples, uint32_t ui32FineSamples,
                  uint32_t ui32CoarseTimeout, uint32_t ui32FineTimeout)
{
    uint32_t ui32Freq;
     First thing we clock gate the HFO.
    EtaCspHfoStop();
     Coarse tune the HFO using a binary search algorithm.
    HfoBinCoarseTune(ui32CoarseWindow, ui32CoarseSamples, ui32CoarseTimeout);
     Fine tune the HFO using a linear search algorithm with more samples.
    HfoLinFineTune(ui32FineWindow, ui32FineSamples, ui32FineTimeout, 0);
     Check fine tuning using a large number of samples.
    ui32Freq = HfoLinFineTune(ui32FineWindow, 128, 2, 0);
     Now that we are done calibrating, ungate the HFO.
    EtaCspHfoStart();
     Check for voltage droop after ungating the HFO
    ui32Freq = EtaCspHfoTuneCheck(ui32FineWindow, ui32FineSamples, ui32FineTimeout);
     Return the frequency.
    return(ui32Freq);
}
uint32_t EtaCspHfoTuneInit ( uint32_t ui32CoarseWindow , uint32_t ui32FineWindow , uint32_t ui32CoarseSamples , uint32_t ui32FineSamples , uint32_t ui32CoarseTimeout , uint32_t ui32FineTimeout ) { uint32_t ui32Freq ; EtaCspHfoStop ( ) ; HfoBinCoarseTune ( ui32CoarseWindow , ui32CoarseSamples , ui32CoarseTimeout ) ; HfoLinFineTune ( ui32FineWindow , ui32FineSamples , ui32FineTimeout , 0 ) ; ui32Freq = HfoLinFineTune ( ui32FineWindow , 128 , 2 , 0 ) ; EtaCspHfoStart ( ) ; ui32Freq = EtaCspHfoTuneCheck ( ui32FineWindow , ui32FineSamples , ui32FineTimeout ) ; return ( ui32Freq ) ; }
EtaCspHfoTuneInit - Tuning algorithm used for cold start (POR or RESET_N).
EtaCspHfoTuneInit - Tuning algorithm used for cold start ( POR or RESET_N ) .
// // First thing we clock gate the HFO. // // // Coarse tune the HFO using a binary search algorithm. // // // Fine tune the HFO using a linear search algorithm with more samples. // // // Check fine tuning using a large number of samples. // // // Now that we are done calibrating, ungate the HFO. // // // Check for voltage droop after ungating the HFO // // // Return the frequency. //