@theparasol
static uint32_t ICC_Async_GetPLL_Divider (struct s_reader * reader)
{
int32_t divider = reader->divider;
if (reader->divider !=0) return divider;
double cardclock1, cardclock2;
while (divider != reader->mhz/100){
divider++;
cardclock1 = reader->mhz / divider;
divider++;
cardclock2 = reader->mhz / (divider);
if ((cardclock1 > reader->cardmhz) && (cardclock2 > reader->cardmhz)) continue;
if ( abs(cardclock1 - reader->cardmhz) > abs(cardclock2 - reader->cardmhz) ) break;
divider--;
break;
}
cs_debug_mask(D_DEVICE,"PLL maxmhz = %.2f, wanted cardmhz = %.2f, divider used = %d, actualcardclock=%.2f", (float) reader->mhz/100, (float) reader->cardmhz/100, divider$
reader->divider = divider;
return (divider);
}
Misschien veranderen in:
static uint32_t ICC_Async_GetPLL_Divider (struct s_reader * reader)
{
float divider;
if (reader->divider !=0) return reader->divider;
divider = ((float) reader->mhz) / ((float) reader->cardmhz);
reader->divider = (int32_t) (divider + 0.5);
cs_debug_mask(D_DEVICE,"PLL maxmhz = %.2f, wanted cardmhz = %.2f, divider used = %d, actualcardclock=%.2f", (float) reader->mhz/100, (float) reader->cardmhz/100, divider$
reader->divider = divider;
return reader->divider;
}