diff mbox series

[4/7] backports: Add CORDIC_FLOAT

Message ID 20190126220033.27634-5-hauke@hauke-m.de (mailing list archive)
State Accepted
Headers show
Series backport: update to Linux 5.0-rc3 | expand

Commit Message

Hauke Mehrtens Jan. 26, 2019, 10 p.m. UTC
This was introduced in Linux commit 58d81d64e06f ("lib: cordic: Move
cordic macros and defines to header file") and is used by the b43 and
brcmsmac driver.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/cordic.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/cordic.h b/backport/backport-include/linux/cordic.h
index 7f27b007..67d6a4ae 100644
--- a/backport/backport-include/linux/cordic.h
+++ b/backport/backport-include/linux/cordic.h
@@ -57,4 +57,16 @@  struct cordic_iq cordic_calc_iq(s32 theta);
 
 #endif /* __CORDIC_H_ */
 #endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3,1,0)) */
+
+#ifndef CORDIC_FLOAT
+#define CORDIC_ANGLE_GEN	39797
+#define CORDIC_PRECISION_SHIFT	16
+#define CORDIC_NUM_ITER	(CORDIC_PRECISION_SHIFT + 2)
+
+#define CORDIC_FIXED(X)	((s32)((X) << CORDIC_PRECISION_SHIFT))
+#define CORDIC_FLOAT(X)	(((X) >= 0) \
+		? ((((X) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1) \
+		: -((((-(X)) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1))
+#endif
+
 #endif /* _BACKPORT_LINUX_CORDIC_H */