]> git.rkrishnan.org Git - dttsp.git/blob - jDttSP/sdrexport.h
Minor fix to keyb, added hash function to banal.h, added aux input ports with settabl...
[dttsp.git] / jDttSP / sdrexport.h
1 /* sdrexport.h
2
3 This file is part of a program that implements a Software-Defined Radio.
4
5 Copyright (C) 2004 by Frank Brickle, AB2KT and Bob McGwier, N4HY
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21 The authors can be reached by email at
22
23 ab2kt@arrl.net
24 or
25 rwmcgwier@comcast.net
26
27 or by paper mail at
28
29 The DTTS Microwave Society
30 6 Kathleen Place
31 Bridgewater, NJ 08807
32 */  
33   
34 #ifndef _sdrexport_h
35 #define _sdrexport_h
36   
37 #include <common.h>
38
39 //------------------------------------------------------------------------
40 // max no. simultaneous receivers
41 #define MAXRX (4)
42 //------------------------------------------------------------------------
43 /* modulation types, modes */ 
44 typedef enum _sdrmode {
45   LSB,                          //  0
46   USB,                          //  1
47   DSB,                          //  2
48   CWL,                          //  3
49   CWU,                          //  4
50   FMN,                          //  5
51   AM,                           //  6
52   PSK,                          //  7
53   SPEC,                         //  8
54   RTTY,                         //  9
55   SAM,                          // 10
56   DRM                           // 11
57 } SDRMODE;
58
59 typedef enum _trxmode { RX, TX } TRXMODE;
60
61 //========================================================================
62 /* RX/TX both */ 
63 //------------------------------------------------------------------------
64 extern struct _uni {
65   REAL samplerate;
66   int buflen;
67
68   struct {
69     SDRMODE sdr;
70     TRXMODE trx;
71   } mode;
72
73   struct {
74     BOOLEAN flag;
75     struct {
76       char *path;
77       size_t size;
78       Chan c;
79     } chan;
80     REAL val, avgval;
81     METERTYPE type;
82   } meter;
83
84   struct {
85     BOOLEAN flag;
86     struct {
87       char *path;
88       size_t size;
89       Chan c;
90     } chan;
91     splitfld splt;
92   } update;
93
94   struct {
95     char *path;
96     int bits;
97   } wisdom;
98
99   struct {
100     BOOLEAN act[MAXRX];
101     int lis, nac, nrx;
102   } multirx;
103
104   struct {
105     REAL rx, tx;
106   } mix;
107
108   long tick;
109   
110 } uni;
111
112 //------------------------------------------------------------------------
113 /* RX */ 
114 //------------------------------------------------------------------------
115
116 extern struct _rx {
117   struct {
118     CXB i, o;
119   } buf;
120   IQ iqfix;
121   struct {
122     REAL freq, phase;
123     OSC gen;
124   } osc;
125   struct {
126     ComplexFIR coef;
127     FiltOvSv ovsv;
128     COMPLEX *save;
129   } filt;
130   struct {
131     REAL thresh;
132     NB gen;
133     BOOLEAN flag;
134   } nb;
135   struct {
136     REAL thresh;
137     NB gen;
138     BOOLEAN flag;
139   } nb_sdrom;
140   struct {
141     LMSR gen;
142     BOOLEAN flag;
143   } anr, anf;
144   struct {
145     DIGITALAGC gen;
146     BOOLEAN flag;
147   } agc;
148   struct { AMD gen; } am;
149   struct { FMD gen; } fm;
150   struct {
151     BOOLEAN flag;
152     SpotToneGen gen;
153   } spot;
154   struct {
155     struct {
156       REAL val;
157       BOOLEAN flag;
158     } pre, post;
159   } scl;
160   struct {
161     REAL thresh, power;
162     BOOLEAN flag, running, set;
163     int num;
164   } squelch;
165   SDRMODE mode;
166   struct { BOOLEAN flag; } bin;
167   REAL norm;
168   COMPLEX azim;
169   long tick;
170 } rx[MAXRX];
171
172 //------------------------------------------------------------------------
173 /* TX */ 
174 //------------------------------------------------------------------------
175 extern struct _tx {
176   struct {
177     CXB i, o;
178   } buf;
179   IQ iqfix;
180   struct {
181     REAL freq, phase;
182     OSC gen;
183   } osc;
184   struct {
185     ComplexFIR coef;
186     FiltOvSv ovsv;
187     COMPLEX *save;
188   } filt;
189   struct {
190     ComplexFIR coef;
191     FiltOvSv ovsv;
192     CXB in, out;
193   } fm;
194   struct {
195     DIGITALAGC gen;
196     BOOLEAN flag;
197   } agc;
198   struct {
199     SpeechProc gen;
200     BOOLEAN flag;
201   } spr;
202   struct {
203     COMPLEX dc;
204     struct {
205       REAL val;
206       BOOLEAN flag;
207     } pre, post;
208   } scl;
209   SDRMODE mode;
210   long tick;
211   REAL norm;
212 } tx;
213
214 //------------------------------------------------------------------------
215
216 typedef enum _runmode {
217   RUN_MUTE, RUN_PASS, RUN_PLAY, RUN_SWCH 
218 } RUNMODE;
219
220 extern struct _top {
221   pid_t pid;
222   uid_t uid;
223   
224   struct timeval start_tv;
225
226   BOOLEAN running, verbose;
227   RUNMODE state;
228   
229   // audio io
230   struct {
231     struct {
232       float *l, *r;
233     } aux, buf;
234     struct {
235       unsigned int frames, bytes;
236     } size;
237   } hold;
238   struct {
239     char *path;
240     int fd;
241     FILE *fp;
242     char buff[4096];
243   } parm;
244   
245   struct {
246     char name[256];
247     jack_client_t *client;
248     struct {
249       struct {
250         jack_port_t *l, *r;
251       } i, o;
252     } port;
253
254     // input only
255     struct {
256       struct {
257         jack_port_t *l, *r;
258       } i;
259     } auxp;
260
261     struct {
262       struct {
263         jack_ringbuffer_t *l, *r;
264       } i, o;
265     } ring;
266
267     struct {
268       struct {
269         jack_ringbuffer_t *l, *r;
270       } i, o;
271     } auxr;
272
273     jack_nframes_t size;
274     struct {
275       int cb;
276       struct {
277         int i, o;
278       } rb;
279       int xr;
280     } blow;
281   } jack;
282
283   // update io
284   // multiprocessing & synchronization
285   struct {
286     struct {
287       pthread_t id;
288     } trx, upd, mon;
289   } thrd;
290   struct {
291     struct {
292       sem_t sem;
293     } buf, upd, mon;
294   } sync;
295   
296   // TRX switching
297   struct {
298     struct {
299       int want, have;
300     } bfct;
301     struct {
302       TRXMODE next;
303     } trx;
304     struct {
305       RUNMODE last;
306     } run;
307     int fade, tail;
308   } swch;
309 } top;
310
311 #endif