summaryrefslogtreecommitdiff
path: root/include/rtl-sdr.h
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2012-03-27 20:53:49 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2012-03-27 20:53:49 +0200
commit001bfb96ef410c24927d04d6b294fe0a2aab4623 (patch)
tree1a920a5e775dbf3df37d77cbf56885491e4efe8c /include/rtl-sdr.h
parent37bb5ca0693d1eff6772db8a9ac0e19d93523dc9 (diff)
add autotools based build system
Diffstat (limited to 'include/rtl-sdr.h')
-rw-r--r--include/rtl-sdr.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/include/rtl-sdr.h b/include/rtl-sdr.h
new file mode 100644
index 0000000..0b22eb1
--- /dev/null
+++ b/include/rtl-sdr.h
@@ -0,0 +1,73 @@
+/*
+ * rtl-sdr, a poor man's SDR using a Realtek RTL2832 based DVB-stick
+ * Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __RTL_SDR_H
+#define __RTL_SDR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef int rtlsdr_dev_t;
+
+/* must be called once before using any other library functions */
+int rtlsdr_init(void);
+
+/* must be called once at application shutdown */
+void rtlsdr_exit(void);
+
+uint32_t rtlsdr_get_device_count(void);
+
+const char *rtlsdr_get_device_name(uint32_t index);
+
+rtlsdr_dev_t *rtlsdr_open(uint32_t index);
+
+int rtlsdr_close(rtlsdr_dev_t *dev);
+
+/* configuration functions */
+
+int rtlsdr_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq);
+
+int rtlsdr_get_center_freq(rtlsdr_dev_t *dev);
+
+int rtlsdr_set_freq_correction(rtlsdr_dev_t *dev, int32_t ppm);
+
+int32_t rtlsdr_get_freq_correction(rtlsdr_dev_t *dev);
+
+/* this will select the baseband filters according to the requested sample rate */
+int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t rate);
+
+int rtlsdr_get_sample_rate(rtlsdr_dev_t *dev);
+
+/* streaming functions */
+
+int rtlsdr_reset_buffer(rtlsdr_dev_t *dev);
+
+int rtlsdr_read_sync(rtlsdr_dev_t *dev, void *buf, uint32_t len, uint32_t *n_read);
+
+typedef void(*rtlsdr_async_read_cb_t)(const char *buf, uint32_t len, void *ctx);
+
+int rtlsdr_async_loop(rtlsdr_dev_t *dev, rtlsdr_async_read_cb_t cb, void *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __RTL_SDR_H */