comparison spandsp-0.0.3/spandsp-0.0.3/src/spandsp/dds.h @ 5:f762bf195c4b

import spandsp-0.0.3
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 16:00:21 +0200
parents
children
comparison
equal deleted inserted replaced
4:26cd8f1ef0b1 5:f762bf195c4b
1 /*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * dds.h
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2003 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2, as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 * $Id: dds.h,v 1.9 2006/10/24 13:45:28 steveu Exp $
26 */
27
28 /*! \file */
29
30 #if !defined(_DDS_H_)
31 #define _DDS_H_
32
33 #include "complex.h"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /*! \brief Find the phase rate value to achieve a particular frequency.
40 \param frequency The desired frequency, in Hertz.
41 \return The phase rate which while achieve the desired frequency.
42 */
43 int32_t dds_phase_rate(float frequency);
44
45 float dds_frequency(int32_t phase_rate);
46
47 /*! \brief Find the scaling factor needed to achieve a specified level in dBm0.
48 \param level The desired signal level, in dBm0.
49 \return The scaling factor.
50 */
51 int dds_scaling_dbm0(float level);
52
53 int dds_scaling_dbov(float level);
54
55 /*! \brief Find the amplitude for a particular phase.
56 \param phase The desired phase 32 bit phase.
57 \return The signal amplitude.
58 */
59 int16_t dds_lookup(uint32_t phase);
60
61 /*! \brief Find the amplitude for a particular phase offset from an accumulated phase.
62 \param phase_acc The accumulated phase.
63 \param phase_offset The phase offset.
64 \return The signal amplitude.
65 */
66 int16_t dds_offset(uint32_t phase_acc, int32_t phase_offset);
67
68 /*! \brief Generate an integer tone sample.
69 \param phase_acc A pointer to a phase accumulator value.
70 \param phase_rate The phase increment to be applied.
71 \return The signal amplitude, between -32767 and 32767.
72 */
73 int16_t dds(uint32_t *phase_acc, int32_t phase_rate);
74
75 /*! \brief Generate an integer tone sample, with modulation.
76 \param phase_acc A pointer to a phase accumulator value.
77 \param phase_rate The phase increment to be applied.
78 \param scale The scaling factor.
79 \param phase The phase offset.
80 \return The signal amplitude.
81 */
82 int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
83
84 /*! \brief Generate a complex integer tone sample.
85 \param phase_acc A pointer to a phase accumulator value.
86 \param phase_rate The phase increment to be applied.
87 \return The complex signal amplitude, between -32767 and 32767.
88 */
89 icomplex_t dds_complex(uint32_t *phase_acc, int32_t phase_rate);
90
91 /*! \brief Generate a complex integer tone sample, with modulation.
92 \param phase_acc A pointer to a phase accumulator value.
93 \param phase_rate The phase increment to be applied.
94 \param scale The scaling factor.
95 \param phase The phase offset.
96 \return The complex signal amplitude.
97 */
98 icomplex_t dds_complex_mod(uint32_t *phase_acc, int32_t phase_rate, int scale, int32_t phase);
99
100 int32_t dds_phase_ratef(float frequency);
101
102 float dds_frequencyf(int32_t phase_rate);
103
104 float dds_scaling_dbm0f(float level);
105
106 float dds_scaling_dbovf(float level);
107
108 /*! \brief Generate a floating point tone sample.
109 \param phase_acc A pointer to a phase accumulator value.
110 \param phase_rate The phase increment to be applied.
111 \return The signal amplitude, between -32767 and 32767.
112 */
113 float ddsf(uint32_t *phase_acc, int32_t phase_rate);
114
115 /*! \brief Generate a floating point tone sample, with modulation.
116 \param phase_acc A pointer to a phase accumulator value.
117 \param phase_rate The phase increment to be applied.
118 \param scale The scaling factor.
119 \param phase The phase offset.
120 \return The signal amplitude.
121 */
122 float dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
123
124 /*! \brief Generate a complex floating point tone sample.
125 \param phase_acc A pointer to a phase accumulator value.
126 \param phase_rate The phase increment to be applied.
127 \return The complex signal amplitude, between -32767 and 32767.
128 */
129 complexf_t dds_complexf(uint32_t *phase_acc, int32_t phase_rate);
130
131 /*! \brief Generate a complex floating point tone sample, with modulation.
132 \param phase_acc A pointer to a phase accumulator value.
133 \param phase_rate The phase increment to be applied.
134 \param scale The scaling factor.
135 \param phase The phase offset.
136 \return The complex signal amplitude.
137 */
138 complexf_t dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase);
139
140 #ifdef __cplusplus
141 }
142 #endif
143
144 #endif
145 /*- End of file ------------------------------------------------------------*/

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.