dsp_types.h File Reference


Detailed Description

Fixed Point DSP library data type definition.

This file defines the types used in the Fixed Point DSP library

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file dsp_types.h.

#include "compiler.h"
#include "preprocessor.h"

Go to the source code of this file.

Data Structures

struct  dsp16_complex_t
 16-bit complex signed fixed point type More...
struct  dsp32_complex_t
 32-bit complex signed fixed point type More...

Defines

#define A_ALIGNED   __attribute__ ((aligned(4)))
 Alignment attribute on 4 bytes for 32-bit or lower microcontroller optimization for GCC compiler.
#define A_PACKED   __attribute__ ((__packed__))
 Packed data attribute for GCC compiler.
#define CST_E   2.718281828459045235360287471352662497757
 E definition also known as the natural logarithmic base.
#define CST_INV_SQUARE_ROOT_2   0.70710678118654752440084436210485
 1/sqrt(2) definition
#define CST_LN_10   2.3025850929940456840179914546844
 ln(10) definition
#define CST_LN_2   0.69314718055994530941723212145818
 ln(2) definition
#define CST_PI   3.141592653589793238462643383279502884197
 PI definition also known as the Archimedes' constant.
#define CST_SQUARE_ROOT_2   1.4142135623730950488016887242097
 sqrt(2) definition
#define DSP16_PI_DIV_4   DSP16_Q(CST_PI/4.)
 PI/4 definition for the 16-bit fixed point type.
#define dsp16_t__   S16
 16-bit signed fixed point type
#define DSP32_PI_DIV_4   DSP32_Q(CST_PI/4.)
 PI/4 definition for the 32-bit fixed point type.
#define dsp32_t__   S32
 32-bit signed fixed point type
#define FALSE   0
 Boolean FALSE constant.
#define TRUE   1
 Boolean TRUE constant.
Convertion macro from a float to a Q Formated value
Note:
These macros limit the number in its range


#define DSP16_Q(fnum)   ((dsp16_t__) DSP_Q(DSP16_QA, DSP16_QB, fnum))
 Convert a float into a 16-bit signed fixed-point type.
#define DSP32_Q(fnum)   ((dsp32_t__) DSP_Q(DSP32_QA, DSP32_QB, fnum))
 Convert a float into a 32-bit signed fixed-point type.
#define DSP_Q(a, b, fnum)
 Convert a float into a signed fixed-point typed Qa.b.
Q Format definition for the 16-bit type
Note:
The 16-bit functions are optimized to work with a Q1.15 format:
Resolution: 0.00003
Range: [-1.; 0.99997]


#define DSP16_QA   1
 number of integer bits
#define DSP16_QB   15
 number of fractional bits
Q Format definition for the 32-bit type
Note:
The 32-bit functions are optimized to work with a Q1.31 format:
Resolution: 0.00000000047
Range: [-1.; 0.99999999953]


#define DSP32_QA   1
 number of integer bits
#define DSP32_QB   31
 number of fractional bits
Limit values in floating-point format of a signed fixed-point number typed Qa.b
#define DSP_FP_MAX(a, b)   (((float) (1 << ((a)-1))) - DSP_FP_RES(a, b))
 Return the maximal value of a fixed-point Qa.b typed number. The result is returned as a floating point number.
#define DSP_FP_MIN(a, b)   (-((float) (1 << ((a)-1))))
 Return the minimal value of a fixed-point Qa.b typed number. The result is returned as a floating point number.
Resolution in floating-point format of a signed fixed-point number typed Qa.b
#define DSP_FP_RES(a, b)   (1./((unsigned) (1 << (b))))
 Return the resolution of a fixed-point Qa.b typed number.
Limit values in fixed-point format of a signed fixed-point number typed Qa.b
#define DSP_Q_MAX(a, b)   ((S32) (((U32) -1) >> (32 - ((a)+(b)-1))))
 Return the maximal value of a fixed-point Qa.b typed number.
#define DSP_Q_MIN(a, b)   ((S32) ((-1) << ((a)+(b)-1)))
 Return the minimal value of a fixed-point Qa.b typed number.

Typedefs

typedef dsp16_t__ dsp16_t
 16-bit signed fixed point type optimized for 32-bit or lower microcontrollers
typedef dsp32_t__ dsp32_t
 32-bit signed fixed point type optimized for 32-bit or lower microcontrollers


Define Documentation

#define A_ALIGNED   __attribute__ ((aligned(4)))

Alignment attribute on 4 bytes for 32-bit or lower microcontroller optimization for GCC compiler.

Definition at line 116 of file dsp_types.h.

#define A_PACKED   __attribute__ ((__packed__))

Packed data attribute for GCC compiler.

Definition at line 118 of file dsp_types.h.


Generated on Fri Feb 19 02:27:59 2010 for AVR32 - Fixed point DSP Library by  doxygen 1.5.5