forked from g0orx/wdsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
channel.h
82 lines (60 loc) · 3.08 KB
/
channel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* channel.h
This file is part of a program that implements a Software-Defined Radio.
Copyright (C) 2013 Warren Pratt, NR0V
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
The author can be reached by email at
warren@wpratt.com
*/
#ifndef _setupchannel_h
#define _setupchannel_h
#include "comm.h"
struct _ch
{
int type;
volatile long run; // when 1, thread loops; when 0, thread terminates
volatile long exchange; // when 1, fexchange() operates; when 0, it just returns
int in_rate; // input samplerate
int out_rate; // output samplerate
int in_size; // input buffsize (complex samples) in a fexchange() operation
int dsp_rate; // sample rate for mainstream dsp processing
int dsp_size; // number complex samples processed per buffer in mainstream dsp processing
int dsp_insize; // size (complex samples) of the output of the r1 (input) buffer
int dsp_outsize; // size (complex samples) of the input of the r2 (output) buffer
int out_size; // output buffsize (complex samples) in a fexchange() operation
CRITICAL_SECTION csDSP; // used to block dsp while parameters are updated or buffers flushed
CRITICAL_SECTION csEXCH; // used to block fexchange() while parameters are updated or buffers flushed
int state; // 0 for channel OFF; 1 for channel ON
double tdelayup;
double tslewup;
double tdelaydown;
double tslewdown;
int bfo; // 'block_for_output', block fexchange until output is available
volatile long flushflag;
struct //io buffers
{
IOB pc, pd, pe, pf; // copies for console calls, dsp, exchange, and flush thread
volatile long ch_upslew;
} iob;
} ch[MAX_CHANNELS];
PORT void OpenChannel (int channel, int in_size, int dsp_size, int input_samplerate, int dsp_rate, int output_samplerate, int type, int state, double tdelayup, double tslewup, double tdelaydown, double tslewdown, int bfo);
PORT void CloseChannel (int channel);
extern void flushChannel (void* p);
PORT void SetType (int channel, int type);
PORT void SetInputBuffsize (int channel, int in_size);
PORT void SetDSPBuffsize (int channel, int dsp_size);
PORT void SetInputSamplerate (int channel, int samplerate);
PORT void SetDSPSamplerate (int channel, int samplerate);
PORT void SetOutputSamplerate (int channel, int samplerate);
PORT void SetAllRates (int channel, int in_rate, int dsp_rate, int out_rate);
PORT int SetChannelState (int channel, int state, int dmode);
#endif