* redo 42874 in the right direction
* fix a order of operations bug * fix a few long lines * pll computation should now be correct git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42876 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8a66cb4c63
commit
86a5585b2d
@ -237,18 +237,21 @@ pll_compute(pll_info *pll)
|
|||||||
|| pll->postDiv == 0
|
|| pll->postDiv == 0
|
||||||
|| targetClock == 0) {
|
|| targetClock == 0) {
|
||||||
TRACE("%s: Caught division by zero!\n", __func__);
|
TRACE("%s: Caught division by zero!\n", __func__);
|
||||||
TRACE("%s: referenceDiv %" B_PRIu32 "\n", __func__, pll->referenceDiv);
|
TRACE("%s: referenceDiv %" B_PRIu32 "\n",
|
||||||
TRACE("%s: postDiv %" B_PRIu32 "\n", __func__, pll->postDiv);
|
__func__, pll->referenceDiv);
|
||||||
TRACE("%s: targetClock %" B_PRIu32 "\n", __func__, targetClock);
|
TRACE("%s: postDiv %" B_PRIu32 "\n",
|
||||||
|
__func__, pll->postDiv);
|
||||||
|
TRACE("%s: targetClock %" B_PRIu32 "\n",
|
||||||
|
__func__, targetClock);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
uint32 tmp = (referenceFrequency * pll->feedbackDiv)
|
uint32 tmp = (referenceFrequency * pll->feedbackDiv)
|
||||||
/ (pll->postDiv * pll->referenceDiv);
|
/ (pll->postDiv * pll->referenceDiv);
|
||||||
tmp = (tmp * 100000) / targetClock;
|
tmp = (tmp * 1000) / targetClock;
|
||||||
|
|
||||||
if (tmp > (100000 + (MAX_TOLERANCE * 10)))
|
if (tmp > (1000 + (MAX_TOLERANCE / 10)))
|
||||||
pll->referenceDiv++;
|
pll->referenceDiv++;
|
||||||
else if (tmp >= (100000 - (MAX_TOLERANCE * 10)))
|
else if (tmp >= (1000 - (MAX_TOLERANCE / 10)))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
pll->referenceDiv++;
|
pll->referenceDiv++;
|
||||||
@ -262,9 +265,9 @@ pll_compute(pll_info *pll)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 calculatedClock
|
uint32 calculatedClock
|
||||||
= (referenceFrequency * pll->feedbackDiv)
|
= ((referenceFrequency * pll->feedbackDiv * 10)
|
||||||
+ (referenceFrequency * pll->feedbackDivFrac)
|
+ (referenceFrequency * pll->feedbackDivFrac))
|
||||||
/ (pll->referenceDiv * pll->postDiv);
|
/ (pll->referenceDiv * pll->postDiv * 10);
|
||||||
|
|
||||||
TRACE("%s: pixel clock: %" B_PRIu32 " gives:"
|
TRACE("%s: pixel clock: %" B_PRIu32 " gives:"
|
||||||
" feedbackDivider = %" B_PRIu32 ".%" B_PRIu32
|
" feedbackDivider = %" B_PRIu32 ".%" B_PRIu32
|
||||||
|
Loading…
Reference in New Issue
Block a user