1 /****************************************************************************/
2 /*  Low-level receiver interface code.                                      */
3 /*  Copyright (C) 2000 WiNRADiO Communications.                             */
4 /*                                                                          */
5 /*  This program is free software; you can redistribute it and/or modify    */
6 /*  it under the terms of the GNU General Public License as published by    */
7 /*  the Free Software Foundation; Version 2, June 1991.                     */
8 /*                                                                          */
9 /*  This program is distributed in the hope that it will be useful, but     */
10 /*  WITHOUT ANY WARRANTY; without even the implied warranty of              */
11 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       */
12 /*  General Public License for more details.                                */
13 /*                                                                          */
14 /*  You should have received a copy of the GNU General Public License       */
15 /*  along with this program; if not, write to the Free Software             */
16 /*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,  */
17 /*  USA.                                                                    */
18 /****************************************************************************/
19 
20 #ifndef _WRAPI_H_
21 #define _WRAPI_H_
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*  WiNRADiO Information Features (capabilities) */
28 
29 #define RIF_USVERSION   0x00000001  /*  set if hardware is US version */
30 #define RIF_DSP			0x00000002	/*  set if DSP is present */
31 #define RIF_LSBUSB		0x00000004	/*  set if receiver as CW/LSB/USB instead of SSB */
32 #define RIF_CWIFSHIFT	0x00000008	/*  set if receiver uses IFShift in CW (not BFOOffset) */
33 #define RIF_AGC			0x00000100	/*  set if receiver supports AGC on/off */
34 #define	RIF_IFGAIN		0x00000200	/*  set if receiver has manual IF gain control */
35 
36 /*  WiNRADiO Modes */
37 
38 #define RMD_CW	0
39 #define RMD_AM	1
40 #define RMD_FMN	2
41 #define RMD_FMW	3
42 #define RMD_LSB	4
43 #define RMD_USB	5
44 #define RMD_FMM 6			/*  50kHz FM */
45 #define RMD_FM6 7			/*  6kHz FMN */
46 
47 /*  WiNRADiO Hardware Versions */
48 
49 #define RHV_1000a	0x0100		/*  older WR-1000 series	 */
50 #define RHV_1000b	0x010a		/*  current WR-1000 series */
51 #define RHV_1500	0x0132
52 #define RHV_1550	0x0137		/*  new WR-1550 receiver */
53 #define RHV_3000	0x0200		/*  Spectrum Monitor series */
54 #define RHV_3100	0x020a
55 #define RHV_3150	0x020f		/*  new WR-3150 receiver */
56 #define RHV_3200	0x0214
57 #define RHV_3500	0x0232
58 #define RHV_3700	0x0246
59 #define RHV_2000	0x0300
60 
61 /*  frequency x10 multiplier (ie. 2-20 GHz maximum support) */
62 
63 #define RFQ_X10		0x80000000L
64 
65 /*  WiNRADiO Hardware Interfaces */
66 
67 #define RHI_ISA		0
68 #define RHI_SERIAL	1
69 
70 #ifndef FALSE
71 #define FALSE		0
72 #endif
73 
74 #ifndef TRUE
75 #define TRUE		1
76 #endif
77 
78 typedef unsigned long       DWORD;
79 typedef int                 BOOL;
80 typedef unsigned int		UINT;
81 typedef unsigned char       BYTE;
82 typedef unsigned short      WORD;
83 typedef float               FLOAT;
84 typedef FLOAT               *PFLOAT;
85 typedef BOOL				*PBOOL;
86 typedef BOOL             *LPBOOL;
87 typedef BYTE				*PBYTE;
88 typedef BYTE             *LPBYTE;
89 typedef int					*PINT;
90 typedef int              *LPINT;
91 typedef UINT				*PUINT;
92 typedef UINT             *LPUINT;
93 typedef WORD				*PWORD;
94 typedef WORD             *LPWORD;
95 typedef long             *LPLONG;
96 typedef DWORD				*PDWORD;
97 typedef DWORD            *LPDWORD;
98 typedef void             *LPVOID;
99 
100 typedef int *MODELIST;
101 typedef  MODELIST *LPMODELIST;
102 
103 typedef struct _RADIOINFO
104 {
105 	DWORD       dwSize;				/*  size of structure (must be set before calling GetRadioDeviceInfo) */
106 	DWORD       dwFeatures;			/*  bit flags for extra features (RIF_XXX) */
107 	WORD        wAPIVer;			/*  driver version */
108 	WORD        wHWVer;				/*  hardware version (RHV_XXX) */
109 	DWORD       dwMinFreq;			/*  minimum frequency receiver can tune to */
110 	DWORD       dwMaxFreq;			/*  maximum frequency receiver can tune to */
111     int         iFreqRes;			/*  resolution of receiver in Hz  */
112     int         iNumModes;			/*  number of modes that can be set  */
113     int         iMaxVolume;			/*  maximum volume level  */
114     int         iMaxBFO;			/*  maximum BFO offset range (+/- in Hz)  */
115     int         iMaxFMScanRate;		/*  maximum scan rate for FM scanning/sweeping */
116     int         iMaxAMScanRate;		/*  maximum scan rate for AM scanning/sweeping */
117     int         iHWInterface;		/*  physical interface radio is connected to (RHI_XXX) */
118 	int			iDeviceNum;			/*  logical radio device number	 */
119     int         iNumSources;        /*  number of selectable audio sources */
120 	int         iMaxIFShift;        /*  maximum IF shift */
121 	DWORD       dwWaveFormats;      /*  bit array of supported rec/play formats (RWF_XXX) */
122 	int			iDSPSources;		/*  number of selectable DSP input sources */
123 	LPMODELIST  lpSupportedModes;   /*  list of available modes (length specified by iNumModes) */
124 	DWORD		dwMaxFreqkHz;		/*  same as dwMaxFreq, but in kHz */
125 	char		szDeviceName[64];	/*  not used in DOSRADIO */
126 	int			iMaxIFGain;			/*  the maximum manual IF gain level */
127 	char descr[80]; /* Description (PB) */
128 } RADIOINFO, *PRADIOINFO,  *LPRADIOINFO;
129 
130 int OpenRadioDevice(WORD);
131 BOOL CloseRadioDevice(int);
132 int GetRadioDeviceInfo(int, LPRADIOINFO);
133 
134 int GetSignalStrength(int);
135 
136 BOOL SetFrequency(int, DWORD);
137 BOOL SetMode(int, int);
138 BOOL SetVolume(int, int);
139 BOOL SetAtten(int, BOOL);
140 BOOL SetMute(int, BOOL);
141 BOOL SetPower(int, BOOL);
142 BOOL SetBFOOffset(int, int);
143 BOOL SetIFShift(int, int);
144 BOOL SetAGC(int, BOOL);
145 BOOL SetIFGain(int, int);
146 
147 DWORD GetFrequency(int);
148 int GetMode(int);
149 int GetMaxVolume(int);
150 int GetVolume(int);
151 BOOL GetAtten(int);
152 BOOL GetMute(int);
153 BOOL GetPower(int);
154 int GetBFOOffset(int);
155 int GetIFShift(int);
156 BOOL GetAGC(int);
157 int GetMaxIFGain(int);
158 int GetIFGain(int);
159 char *GetDescr(int);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #ifdef __KERNEL__
166 /* Hooks called when rescheduling */
167 extern void (*yield_hook)();
168 extern void (*reenter_hook)();
169 #endif
170 
171 #endif
172