XilinxProcessorIPLib/drivers/v_hdmitxss1/examples/xhdmi_example/si5324drv.c
int Si5324_FindNcls(si5324_settings_t *settings) {
    u64 fosc_1;
    u32 result;

    fosc_1 = settings->fout * settings->n1_hs;
    for (settings->nc_ls = settings->nc_ls_min; settings->nc_ls <= settings->nc_ls_max;) {
        settings->fosc = fosc_1 * settings->nc_ls;
        if (SI5324_DEBUG) {
            xil_printf("\tTrying NCn_LS = %d: fosc = %dkHz.\r\n",
                    settings->nc_ls, (u32)((settings->fosc >> 28) / 1000));
        }
        result = Si5324_FindN2(settings);
        if (result) {
            // Best possible result found. Skip the rest of the possibilities.
            break;
        }
        if (settings->nc_ls == 1) {
            settings->nc_ls++;
        } else {
            settings->nc_ls += 2;
        }
    }
    return result;
}
/*****************************************************************************/
/**
 * Find a valid setting for NCn_LS that can deliver the correct output
 * frequency. Assumes that the valid range is relatively small so a full search
 * can be done (should be true for video clock frequencies).
 *
 * @param settings Holds the input and output frequencies, the setting for
 *                 N1_HS, and the limits for NCn_LS.
 * @return 1 when the best possible result has been found.
 * @note     Private function.
 */
Find a valid setting for NCn_LS that can deliver the correct output
frequency. Assumes that the valid range is relatively small so a full search
can be done (should be true for video clock frequencies).

@param settings Holds the input and output frequencies, the setting for
N1_HS, and the limits for NCn_LS.
@return 1 when the best possible result has been found.
@note     Private function.
Find a valid setting for NCn_LS that can deliver the correct output frequency . Assumes that the valid range is relatively small so a full search can be done ( should be true for video clock frequencies ) . @param settings Holds the input and output frequencies the setting for N1_HS and the limits for NCn_LS . @return 1 when the best possible result has been found . @note Private function .
int Si5324_FindNcls(si5324_settings_t *settings) {
    u64 fosc_1;
    u32 result;
    fosc_1 = settings->fout * settings->n1_hs;
    for (settings->nc_ls = settings->nc_ls_min; settings->nc_ls <= settings->nc_ls_max;) {
        settings->fosc = fosc_1 * settings->nc_ls;
        if (SI5324_DEBUG) {
            xil_printf("\tTrying NCn_LS = %d: fosc = %dkHz.\r\n",
                    settings->nc_ls, (u32)((settings->fosc >> 28) / 1000));
        }
        result = Si5324_FindN2(settings);
        if (result) {
            break;
        }
        if (settings->nc_ls == 1) {
            settings->nc_ls++;
        } else {
            settings->nc_ls += 2;
        }
    }
    return result;
}
int Si5324_FindNcls ( si5324_settings_t * settings ) { u64 fosc_1 ; u32 result ; fosc_1 = settings -> fout * settings -> n1_hs ; for ( settings -> nc_ls = settings -> nc_ls_min ; settings -> nc_ls <= settings -> nc_ls_max ; ) { settings -> fosc = fosc_1 * settings -> nc_ls ; if ( SI5324_DEBUG ) { xil_printf ( " \t \r \n " , settings -> nc_ls , ( u32 ) ( ( settings -> fosc >> 28 ) / 1000 ) ) ; } result = Si5324_FindN2 ( settings ) ; if ( result ) { break ; } if ( settings -> nc_ls == 1 ) { settings -> nc_ls ++ ; } else { settings -> nc_ls += 2 ; } } return result ; }
Find a valid setting for NCn_LS that can deliver the correct output
 frequency.
Find a valid setting for NCn_LS that can deliver the correct output frequency .
// Best possible result found. Skip the rest of the possibilities.