aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cordic.h
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2018-11-19 13:01:22 -0500
committerKalle Valo <kvalo@codeaurora.org>2018-11-29 10:30:48 -0500
commit58d81d64e06ffaea6bddc85ae2b7295c371bcc55 (patch)
tree8b3212ca7189300141dbf644ae6a353cc052a314 /include/linux/cordic.h
parent559afaa2c506688a94969158cd83249ceacb2e27 (diff)
lib: cordic: Move cordic macros and defines to header file
Now that these macros are in header file, we can eventually clean up the duplicate macros present in the drivers that utilize the same cordic algorithm implementation. Also add CORDIC_ prefix to nonprefixed macros. Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Priit Laes <plaes@plaes.org> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'include/linux/cordic.h')
-rw-r--r--include/linux/cordic.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/cordic.h b/include/linux/cordic.h
index cf68ca4a508c..3d656f54d64f 100644
--- a/include/linux/cordic.h
+++ b/include/linux/cordic.h
@@ -18,6 +18,15 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20 20
21#define CORDIC_ANGLE_GEN 39797
22#define CORDIC_PRECISION_SHIFT 16
23#define CORDIC_NUM_ITER (CORDIC_PRECISION_SHIFT + 2)
24
25#define CORDIC_FIXED(X) ((s32)((X) << CORDIC_PRECISION_SHIFT))
26#define CORDIC_FLOAT(X) (((X) >= 0) \
27 ? ((((X) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1) \
28 : -((((-(X)) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1))
29
21/** 30/**
22 * struct cordic_iq - i/q coordinate. 31 * struct cordic_iq - i/q coordinate.
23 * 32 *