summaryrefslogtreecommitdiff
path: root/src/hw/hw.c
blob: 4496a51ac513a231f04c04c7f496e2eee4c176a8 (plain) (blame)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#include "hw.h"

uint32_t hw_get_device_count(void)
{
	uint32_t ret;
	ret = rtlsdr_get_device_count();
	return ret;
}


const char* hw_get_device_name(uint32_t index)
{
	const char *ret;
	ret = rtlsdr_get_device_name( index );
	return ret;
}


int hw_get_device_usb_strings(uint32_t index,
					     char *manufact,
					     char *product,
					     char *serial)
{
	int ret;
	ret = rtlsdr_get_device_usb_strings( index, manufact, product, serial );
	return ret;
}


int hw_get_index_by_serial(const char *serial)
{
	int ret;
	rtlsdr_get_index_by_serial( serial );
	return ret;
}


int hw_open(rtlsdr_dev_t **dev, uint32_t index)
{
	int ret;
	ret = rtlsdr_open( dev, index );
	return ret;
}


int hw_close(rtlsdr_dev_t *dev)
{
	int ret;
	ret = rtlsdr_close( dev );
	return ret;
}


int hw_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq,
				    uint32_t tuner_freq)
{
	int ret;
	ret = rtlsdr_set_xtal_freq( dev, rtl_freq, tuner_freq );
	return ret;
}


int hw_get_xtal_freq(rtlsdr_dev_t *dev, uint32_t *rtl_freq,
				    uint32_t *tuner_freq)
{
	int ret;
	ret = rtlsdr_get_xtal_freq( dev, rtl_freq, tuner_freq );
	return ret;
}


int hw_get_usb_strings(rtlsdr_dev_t *dev, char *manufact,
				      char *product, char *serial)
{
	int ret;
	ret = rtlsdr_get_usb_strings( dev, manufact, product, serial );
	return ret;
}


int hw_write_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
				  uint8_t offset, uint16_t len)
{
	int ret;
	ret = rtlsdr_write_eeprom( dev, data, offset, len );
	return ret;
}


int hw_read_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
				  uint8_t offset, uint16_t len)
{
	int ret;
	ret = rtlsdr_read_eeprom( dev, data, offset, len );
	return ret;
}


int hw_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq)
{
	int ret;
	ret = rtlsdr_set_center_freq( dev, freq );
	return ret;
}


uint32_t hw_get_center_freq(rtlsdr_dev_t *dev)
{
	uint32_t ret;
	ret = rtlsdr_get_center_freq( dev );
	return ret;
}	


int hw_set_freq_correction(rtlsdr_dev_t *dev, int ppm)
{
	int ret;
	ret = rtlsdr_set_freq_correction( dev, ppm );
	return ret;
}


int hw_get_freq_correction(rtlsdr_dev_t *dev)
{
	int ret;
	ret = rtlsdr_get_freq_correction( dev );
	return ret;
}


enum rtlsdr_tuner hw_get_tuner_type(rtlsdr_dev_t *dev)
{
	enum rtlsdr_tuner ret;
	ret = rtlsdr_get_tuner_type( dev );
	return ret;
}


int hw_get_tuner_gains(rtlsdr_dev_t *dev, int *gains)
{
	int ret;
	ret = rtlsdr_get_tuner_gains( dev, gains );
	return ret;
}


int hw_set_tuner_gain(rtlsdr_dev_t *dev, int gain)
{
	int ret;
	ret = rtlsdr_set_tuner_gain( dev, gain );
	return ret;
}


int hw_get_tuner_gain(rtlsdr_dev_t *dev)
{
	int ret;
	ret = rtlsdr_get_tuner_gain( dev );
	return ret;
}


int hw_set_tuner_if_gain(rtlsdr_dev_t *dev, int stage, int gain)
{
	int ret;
	ret = rtlsdr_set_tuner_if_gain( dev, stage, gain );
	return ret;
}


int hw_set_tuner_gain_mode(rtlsdr_dev_t *dev, int manual)
{
	int ret;
	ret = rtlsdr_set_tuner_gain_mode( dev, manual );
	return ret;
}


int hw_set_sample_rate(rtlsdr_dev_t *dev, uint32_t rate)
{
	int ret;
	ret = rtlsdr_set_sample_rate( dev, rate );
	return ret;
}


uint32_t hw_get_sample_rate(rtlsdr_dev_t *dev)
{
	uint32_t ret;
	ret = rtlsdr_get_sample_rate( dev );
	return ret;
}


int hw_set_testmode(rtlsdr_dev_t *dev, int on)
{
	int ret;
	ret = rtlsdr_set_testmode( dev, on );
	return ret;
}


int hw_set_agc_mode(rtlsdr_dev_t *dev, int on)
{
	int ret;
	ret = rtlsdr_set_agc_mode( dev, on );
	return ret;
}


int hw_set_direct_sampling(rtlsdr_dev_t *dev, int on)
{
	int ret;
	ret = rtlsdr_set_direct_sampling( dev, on );
	return ret;
}


int hw_get_direct_sampling(rtlsdr_dev_t *dev)
{
	int ret;
	ret = rtlsdr_get_direct_sampling( dev );
	return ret;
}


int hw_set_offset_tuning(rtlsdr_dev_t *dev, int on)
{
	int ret;
	ret = rtlsdr_set_offset_tuning( dev, on );
	return ret;
}


int hw_get_offset_tuning(rtlsdr_dev_t *dev)
{
	int ret;
	ret = rtlsdr_get_offset_tuning( dev );
	return ret;
}



int hw_reset_buffer(rtlsdr_dev_t *dev)
{
	int ret;
	ret = rtlsdr_reset_buffer( dev );
	return ret;
}


int hw_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read)
{
	int ret;
	ret = rtlsdr_read_sync( dev, buf, len, n_read );
	return ret;
}


int hw_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx)
{
	int ret;
	ret = rtlsdr_wait_async( dev, cb, ctx );
	return ret;
}


int hw_read_async(rtlsdr_dev_t *dev,
				 rtlsdr_read_async_cb_t cb,
				 void *ctx,
				 uint32_t buf_num,
				 uint32_t buf_len)
{
	int ret;
	ret = rtlsdr_read_async( dev, cb, ctx, buf_num, buf_len );
	return ret;
}


int hw_cancel_async(rtlsdr_dev_t *dev)
{
	int ret;
	ret = rtlsdr_cancel_async( dev );
	return ret;
}