Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
cordic.c File Reference
#include <linux/module.h>
#include <linux/cordic.h>

Go to the source code of this file.

Macros

#define CORDIC_ANGLE_GEN   39797
 
#define CORDIC_PRECISION_SHIFT   16
 
#define CORDIC_NUM_ITER   (CORDIC_PRECISION_SHIFT + 2)
 
#define FIXED(X)   ((s32)((X) << CORDIC_PRECISION_SHIFT))
 
#define FLOAT(X)
 

Functions

struct cordic_iq cordic_calc_iq (s32 theta)
 
 EXPORT_SYMBOL (cordic_calc_iq)
 
 MODULE_DESCRIPTION ("CORDIC algorithm")
 
 MODULE_AUTHOR ("Broadcom Corporation")
 
 MODULE_LICENSE ("Dual BSD/GPL")
 

Macro Definition Documentation

#define CORDIC_ANGLE_GEN   39797

Definition at line 19 of file cordic.c.

#define CORDIC_NUM_ITER   (CORDIC_PRECISION_SHIFT + 2)

Definition at line 21 of file cordic.c.

#define CORDIC_PRECISION_SHIFT   16

Definition at line 20 of file cordic.c.

#define FIXED (   X)    ((s32)((X) << CORDIC_PRECISION_SHIFT))

Definition at line 23 of file cordic.c.

#define FLOAT (   X)
Value:
(((X) >= 0) \
? ((((X) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1) \
: -((((-(X)) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1))

Definition at line 24 of file cordic.c.

Function Documentation

struct cordic_iq cordic_calc_iq ( s32  theta)
read

cordic_calc_iq() - calculates the i/q coordinate for given angle.

: angle in degrees for which i/q coordinate is to be calculated. : function output parameter holding the i/q coordinate.

The function calculates the i/q coordinate for a given angle using the CORDIC algorithm. The coordinate consists of a real (i) and an imaginary (q) part. The real part is essentially the cosine of the angle and the imaginary part is the sine of the angle. The returned values are scaled by 2^16 for precision. The range for theta is for -180 degrees to +180 degrees. Passed values outside this range are converted before doing the actual calculation.

Definition at line 55 of file cordic.c.

EXPORT_SYMBOL ( cordic_calc_iq  )
MODULE_AUTHOR ( "Broadcom Corporation"  )
MODULE_DESCRIPTION ( "CORDIC algorithm )
MODULE_LICENSE ( "Dual BSD/GPL"  )