mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-12 03:26:26 +00:00
staging: vt6656: CARDqGetNextTBTT replace code using do_div.
uBeaconInterval becomes u32 get next TBTT value using vendor's equation as shown. This patch was checked against the original code and yields exactly the same value. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9acec059c0
commit
6e28024e16
1 changed files with 11 additions and 19 deletions
|
@ -720,28 +720,20 @@ bool CARDbClearCurrentTSF(struct vnt_private *pDevice)
|
||||||
*/
|
*/
|
||||||
u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval)
|
u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval)
|
||||||
{
|
{
|
||||||
|
u32 uBeaconInterval;
|
||||||
|
|
||||||
unsigned int uLowNextTBTT;
|
uBeaconInterval = wBeaconInterval * 1024;
|
||||||
unsigned int uHighRemain, uLowRemain;
|
|
||||||
unsigned int uBeaconInterval;
|
|
||||||
|
|
||||||
uBeaconInterval = wBeaconInterval * 1024;
|
/* Next TBTT =
|
||||||
// Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval
|
* ((local_current_TSF / beacon_interval) + 1) * beacon_interval
|
||||||
uLowNextTBTT = ((qwTSF & 0xffffffffULL) >> 10) << 10;
|
*/
|
||||||
uLowRemain = (uLowNextTBTT) % uBeaconInterval;
|
if (uBeaconInterval) {
|
||||||
uHighRemain = ((0x80000000 % uBeaconInterval) * 2 * (u32)(qwTSF >> 32))
|
do_div(qwTSF, uBeaconInterval);
|
||||||
% uBeaconInterval;
|
qwTSF += 1;
|
||||||
uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
|
qwTSF *= uBeaconInterval;
|
||||||
uLowRemain = uBeaconInterval - uLowRemain;
|
}
|
||||||
|
|
||||||
// check if carry when add one beacon interval
|
return qwTSF;
|
||||||
if ((~uLowNextTBTT) < uLowRemain)
|
|
||||||
qwTSF = ((qwTSF >> 32) + 1) << 32;
|
|
||||||
|
|
||||||
qwTSF = (qwTSF & 0xffffffff00000000ULL) |
|
|
||||||
(u64)(uLowNextTBTT + uLowRemain);
|
|
||||||
|
|
||||||
return (qwTSF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue