dds.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * dds.h
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2003 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025  *
00026  * $Id: dds.h,v 1.5 2006/01/31 05:34:27 steveu Exp $
00027  */
00028 
00029 /*! \file */
00030 
00031 #if !defined(_DDS_H_)
00032 #define _DDS_H_
00033 
00034 #include "complex.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 /*! \brief Find the phase step value to achieve a particular frequency.
00041     \param frequency The desired frequency, in Hertz.
00042     \return The phase rate which while achieve the desired frequency.
00043 */
00044 int32_t dds_phase_step(float frequency);
00045 
00046 /*! \brief Find the scaling factor needed to achieve a specified level in dBm0.
00047     \param level The desired signal level, in dBm0.
00048     \return The scaling factor.
00049 */
00050 int dds_scaling_dbm0(float level);
00051 
00052 int dds_scaling_dbov(float level);
00053 
00054 /*! \brief Find the amplitude for a particular phase.
00055     \param phase The desired phase 32 bit phase.
00056     \return The signal amplitude.
00057 */
00058 int16_t dds_lookup(uint32_t phase);
00059 
00060 /*! \brief Find the amplitude for a particular phase offset from an accumulated phase.
00061     \param phase_acc The accumulated phase.
00062     \param phase_offset The phase offset.
00063     \return The signal amplitude.
00064 */
00065 int16_t dds_offset(uint32_t phase_acc, int32_t phase_offset);
00066 
00067 /*! \brief Generate an integer tone sample.
00068     \param phase_acc A pointer to a phase accumulator value.
00069     \param phase_rate The phase increment to be applied.
00070     \return The signal amplitude, between -32767 and 32767.
00071 */
00072 int16_t dds(uint32_t *phase_acc, int32_t phase_rate);
00073 
00074 /*! \brief Generate an integer tone sample, with modulation.
00075     \param phase_acc A pointer to a phase accumulator value.
00076     \param phase_rate The phase increment to be applied.
00077     \param scale The scaling factor.
00078     \param phase The phase offset.
00079     \return The signal amplitude.
00080 */
00081 int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
00082 
00083 /*! \brief Generate a complex integer tone sample.
00084     \param phase_acc A pointer to a phase accumulator value.
00085     \param phase_rate The phase increment to be applied.
00086     \return The complex signal amplitude, between -32767 and 32767.
00087 */
00088 icomplex_t dds_complex(uint32_t *phase_acc, int32_t phase_rate);
00089 
00090 /*! \brief Generate a complex integer tone sample, with modulation.
00091     \param phase_acc A pointer to a phase accumulator value.
00092     \param phase_rate The phase increment to be applied.
00093     \param scale The scaling factor.
00094     \param phase The phase offset.
00095     \return The complex signal amplitude.
00096 */
00097 icomplex_t dds_complex_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
00098 
00099 int32_t dds_phase_stepf(float frequency);
00100 
00101 float dds_scaling_dbm0f(float level);
00102 
00103 float dds_scaling_dbovf(float level);
00104 
00105 /*! \brief Generate a floating point tone sample.
00106     \param phase_acc A pointer to a phase accumulator value.
00107     \param phase_rate The phase increment to be applied.
00108     \return The signal amplitude, between -32767 and 32767.
00109 */
00110 float ddsf(uint32_t *phase_acc, int32_t phase_rate);
00111 
00112 /*! \brief Generate a floating point tone sample, with modulation.
00113     \param phase_acc A pointer to a phase accumulator value.
00114     \param phase_rate The phase increment to be applied.
00115     \param scale The scaling factor.
00116     \param phase The phase offset.
00117     \return The signal amplitude.
00118 */
00119 float dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
00120 
00121 /*! \brief Generate a complex floating point tone sample.
00122     \param phase_acc A pointer to a phase accumulator value.
00123     \param phase_rate The phase increment to be applied.
00124     \return The complex signal amplitude, between -32767 and 32767.
00125 */
00126 complex_t dds_complexf(uint32_t *phase_acc, int32_t phase_rate);
00127 
00128 /*! \brief Generate a complex floating point tone sample, with modulation.
00129     \param phase_acc A pointer to a phase accumulator value.
00130     \param phase_rate The phase increment to be applied.
00131     \param scale The scaling factor.
00132     \param phase The phase offset.
00133     \return The complex signal amplitude.
00134 */
00135 complex_t dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
00136 
00137 #ifdef __cplusplus
00138 }
00139 #endif
00140 
00141 #endif
00142 /*- End of file ------------------------------------------------------------*/

Generated on Fri Nov 10 09:40:23 2006 for libspandsp by  doxygen 1.5.1