XilinxProcessorIPLib/drivers/v_hdmitxss1/examples/xhdmi_example/si5324drv.c
int Si5324_CalcNclsLimits(si5324_settings_t *settings) {
    // Calculate limits for NCn_LS
    settings->nc_ls_min = settings->n1_min / settings->n1_hs;
    if (settings->nc_ls_min < SI5324_NC_LS_MIN) {
        settings->nc_ls_min = SI5324_NC_LS_MIN;
    }
    // Make sure NC_ls_min is one or even
    if ((settings->nc_ls_min > 1) && ((settings->nc_ls_min & 0x1) == 1)) {
        settings->nc_ls_min++;
    }
    settings->nc_ls_max = settings->n1_max / settings->n1_hs;
    if (settings->nc_ls_max > SI5324_NC_LS_MAX) {
        settings->nc_ls_max = SI5324_NC_LS_MAX;
    }
    // Make sure NC_ls_max is even
    if ((settings->nc_ls_max & 0x1) == 1) {
        settings->nc_ls_max--;
    }
    // Check if actual N1 is within limits
    if ((settings->nc_ls_max * settings->n1_hs < settings->n1_min) ||
        (settings->nc_ls_min * settings->n1_hs > settings->n1_max)) {
        // No valid NC_ls possible: take next N1_hs
        return -1;
    }
    return 0;
}
/*****************************************************************************/
/**
 * Calculates the valid range for NCn_LS with the value for the output
 * frequency and N1_HS already set in settings.
 *
 * @param settings Holds the input and output frequencies and the setting
 *                 for N1_HS.
 * @return -1 when there are no valid settings for NCn_LS, 0 otherwise.
 * @note     Private function.
 */
Calculates the valid range for NCn_LS with the value for the output
frequency and N1_HS already set in settings.

@param settings Holds the input and output frequencies and the setting
for N1_HS.
@return -1 when there are no valid settings for NCn_LS, 0 otherwise.
@note     Private function.
Calculates the valid range for NCn_LS with the value for the output frequency and N1_HS already set in settings . @param settings Holds the input and output frequencies and the setting for N1_HS . @return - 1 when there are no valid settings for NCn_LS 0 otherwise . @note Private function .
int Si5324_CalcNclsLimits(si5324_settings_t *settings) {
    settings->nc_ls_min = settings->n1_min / settings->n1_hs;
    if (settings->nc_ls_min < SI5324_NC_LS_MIN) {
        settings->nc_ls_min = SI5324_NC_LS_MIN;
    }
    if ((settings->nc_ls_min > 1) && ((settings->nc_ls_min & 0x1) == 1)) {
        settings->nc_ls_min++;
    }
    settings->nc_ls_max = settings->n1_max / settings->n1_hs;
    if (settings->nc_ls_max > SI5324_NC_LS_MAX) {
        settings->nc_ls_max = SI5324_NC_LS_MAX;
    }
    if ((settings->nc_ls_max & 0x1) == 1) {
        settings->nc_ls_max--;
    }
    if ((settings->nc_ls_max * settings->n1_hs < settings->n1_min) ||
        (settings->nc_ls_min * settings->n1_hs > settings->n1_max)) {
        return -1;
    }
    return 0;
}
int Si5324_CalcNclsLimits ( si5324_settings_t * settings ) { settings -> nc_ls_min = settings -> n1_min / settings -> n1_hs ; if ( settings -> nc_ls_min < SI5324_NC_LS_MIN ) { settings -> nc_ls_min = SI5324_NC_LS_MIN ; } if ( ( settings -> nc_ls_min > 1 ) && ( ( settings -> nc_ls_min & 0x1 ) == 1 ) ) { settings -> nc_ls_min ++ ; } settings -> nc_ls_max = settings -> n1_max / settings -> n1_hs ; if ( settings -> nc_ls_max > SI5324_NC_LS_MAX ) { settings -> nc_ls_max = SI5324_NC_LS_MAX ; } if ( ( settings -> nc_ls_max & 0x1 ) == 1 ) { settings -> nc_ls_max -- ; } if ( ( settings -> nc_ls_max * settings -> n1_hs < settings -> n1_min ) || ( settings -> nc_ls_min * settings -> n1_hs > settings -> n1_max ) ) { return -1 ; } return 0 ; }
Calculates the valid range for NCn_LS with the value for the output
 frequency and N1_HS already set in settings.
Calculates the valid range for NCn_LS with the value for the output frequency and N1_HS already set in settings .
// Calculate limits for NCn_LS // Make sure NC_ls_min is one or even // Make sure NC_ls_max is even // Check if actual N1 is within limits // No valid NC_ls possible: take next N1_hs