aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/phy_common.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-01-25 13:00:00 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-25 16:39:03 -0500
commit6f98e62a9f1bdbd83d8d1be8c2ca6f58099846ef (patch)
treecdfabc6feccd4e01b56fbf44bdce3eea25e573f4 /drivers/net/wireless/b43/phy_common.c
parent986504540306137dfc90a936f9f25086d15621c5 (diff)
b43: update cordic code to match current specs
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Tested-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_common.c')
-rw-r--r--drivers/net/wireless/b43/phy_common.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 446c41bb1e9f..8f7d7eff2d80 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -422,21 +422,28 @@ void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on)
422 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4); 422 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
423} 423}
424 424
425/* http://bcm-v4.sipsolutions.net/802.11/PHY/Cordic */
425struct b43_c32 b43_cordic(int theta) 426struct b43_c32 b43_cordic(int theta)
426{ 427{
427 u32 arctg[] = { 2949120, 1740967, 919879, 466945, 234379, 117304, 428 u32 arctg[] = { 2949120, 1740967, 919879, 466945, 234379, 117304,
428 58666, 29335, 14668, 7334, 3667, 1833, 917, 458, 429 58666, 29335, 14668, 7334, 3667, 1833, 917, 458,
429 229, 115, 57, 29, }; 430 229, 115, 57, 29, };
430 int i, tmp, signx = 1, angle = 0; 431 u8 i;
432 s32 tmp;
433 s8 signx = 1;
434 u32 angle = 0;
431 struct b43_c32 ret = { .i = 39797, .q = 0, }; 435 struct b43_c32 ret = { .i = 39797, .q = 0, };
432 436
433 theta = clamp_t(int, theta, -180, 180); 437 while (theta > (180 << 16))
438 theta -= (360 << 16);
439 while (theta < -(180 << 16))
440 theta += (360 << 16);
434 441
435 if (theta > 90) { 442 if (theta > (90 << 16)) {
436 theta -= 180; 443 theta -= (180 << 16);
437 signx = -1; 444 signx = -1;
438 } else if (theta < -90) { 445 } else if (theta < -(90 << 16)) {
439 theta += 180; 446 theta += (180 << 16);
440 signx = -1; 447 signx = -1;
441 } 448 }
442 449