rtl-sdr-blog/include/rtl-sdr.h

76 lines
2.3 KiB
C
Raw Normal View History

2012-03-27 19:49:44 +02:00
/*
* rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
2012-03-27 19:49:44 +02:00
* Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
* Copyright (C) 2012 by Dimitri Stolnikov <horiz0n@gmx.net>
2012-03-27 19:49:44 +02:00
*
* 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.
2012-03-27 19:49:44 +02:00
*
* 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>
#include <rtl-sdr_export.h>
2012-03-27 19:49:44 +02:00
typedef struct rtlsdr_dev rtlsdr_dev_t;
2012-03-27 19:49:44 +02:00
RTLSDR_API uint32_t rtlsdr_get_device_count(void);
2012-03-27 19:49:44 +02:00
RTLSDR_API const char* rtlsdr_get_device_name(uint32_t index);
2012-03-27 19:49:44 +02:00
RTLSDR_API int rtlsdr_open(rtlsdr_dev_t **dev, uint32_t index);
2012-03-27 19:49:44 +02:00
RTLSDR_API int rtlsdr_close(rtlsdr_dev_t *dev);
2012-03-27 19:49:44 +02:00
/* configuration functions */
RTLSDR_API int rtlsdr_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq);
2012-03-27 19:49:44 +02:00
RTLSDR_API int rtlsdr_get_center_freq(rtlsdr_dev_t *dev);
2012-03-27 19:49:44 +02:00
RTLSDR_API int rtlsdr_set_freq_correction(rtlsdr_dev_t *dev, int ppm);
2012-03-27 19:49:44 +02:00
RTLSDR_API int rtlsdr_get_freq_correction(rtlsdr_dev_t *dev);
RTLSDR_API int rtlsdr_set_tuner_gain(rtlsdr_dev_t *dev, int gain);
RTLSDR_API int rtlsdr_get_tuner_gain(rtlsdr_dev_t *dev);
2012-03-27 19:49:44 +02:00
/* this will select the baseband filters according to the requested sample rate */
RTLSDR_API int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t rate);
2012-03-27 19:49:44 +02:00
RTLSDR_API int rtlsdr_get_sample_rate(rtlsdr_dev_t *dev);
2012-03-27 19:49:44 +02:00
/* streaming functions */
RTLSDR_API int rtlsdr_reset_buffer(rtlsdr_dev_t *dev);
2012-03-27 19:49:44 +02:00
RTLSDR_API int rtlsdr_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read);
2012-03-27 19:49:44 +02:00
typedef void(*rtlsdr_async_read_cb_t)(const char *buf, uint32_t len, void *ctx);
RTLSDR_API int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_async_read_cb_t cb, void *ctx);
RTLSDR_API int rtlsdr_cancel_async(rtlsdr_dev_t *dev);
2012-03-27 19:49:44 +02:00
#ifdef __cplusplus
}
#endif
#endif /* __RTL_SDR_H */