1 // ----------------------------------------------------------------------------
2 // trx.h
3 //
4 // Copyright (C) 2006-2009
5 //		Dave Freese, W1HKJ
6 // Copyright (C) 2008-2009
7 //		Stelios Bounanos, M0GLD
8 //
9 // This file is part of fldigi.  Adapted from code contained in gmfsk source code
10 // distribution.
11 //
12 // Fldigi is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // Fldigi is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with fldigi.  If not, see <http://www.gnu.org/licenses/>.
24 // ----------------------------------------------------------------------------
25 
26 #ifndef	TRX_H
27 #define	TRX_H
28 
29 #include "threads.h"
30 #include "modem.h"
31 #include "sound.h"
32 #include "globals.h"
33 #include "rsid.h"
34 
35 // ----------------------------------------------------------------------------
36 
37 extern	void	trx_start_modem(modem* m, int f = 0);
38 extern	void	trx_start(void);
39 extern	void	trx_close(void);
40 
41 extern	void	trx_transmit_psm(void);
42 extern	void	trx_transmit(void);
43 extern	void	trx_tune(void);
44 extern	void	trx_receive(void);
45 
46 extern	void	trx_reset(void);
47 
48 extern	void	trx_wait_state(void);
49 
50 extern state_t		trx_state;
51 extern modem		*active_modem;
52 extern cRsId		*ReedSolomon;
53 
54 extern	SoundBase 	*RXscard;
55 extern	SoundBase	*TXscard;
56 
57 extern  bool bHistory;
58 extern  bool bHighSpeed;
59 
60 extern bool rx_only;
61 
62 #define TRX_WAIT(s_, code_)			\
63 	do {					\
64 		ENSURE_NOT_THREAD(TRX_TID);	\
65 		code_;				\
66 		while (trx_state != s_)		\
67 			trx_wait_state();	\
68 	} while (0)
69 
70 void trx_xmit_wfall_queue(int samplerate, const double* buf, size_t len);
71 
72 #endif
73