Remove copies of headers etc that were only needed by Windows builds.
This commit is contained in:
parent
63303b4d07
commit
4cc0094781
1368
pthreads/pthread.h
1368
pthreads/pthread.h
File diff suppressed because it is too large
Load diff
183
pthreads/sched.h
183
pthreads/sched.h
|
@ -1,183 +0,0 @@
|
||||||
/*
|
|
||||||
* Module: sched.h
|
|
||||||
*
|
|
||||||
* Purpose:
|
|
||||||
* Provides an implementation of POSIX realtime extensions
|
|
||||||
* as defined in
|
|
||||||
*
|
|
||||||
* POSIX 1003.1b-1993 (POSIX.1b)
|
|
||||||
*
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Pthreads-win32 - POSIX Threads Library for Win32
|
|
||||||
* Copyright(C) 1998 John E. Bossom
|
|
||||||
* Copyright(C) 1999,2005 Pthreads-win32 contributors
|
|
||||||
*
|
|
||||||
* Contact Email: rpj@callisto.canberra.edu.au
|
|
||||||
*
|
|
||||||
* The current list of contributors is contained
|
|
||||||
* in the file CONTRIBUTORS included with the source
|
|
||||||
* code distribution. The list can also be seen at the
|
|
||||||
* following World Wide Web location:
|
|
||||||
* http://sources.redhat.com/pthreads-win32/contributors.html
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library 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
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library in the file COPYING.LIB;
|
|
||||||
* if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
||||||
*/
|
|
||||||
#if !defined(_SCHED_H)
|
|
||||||
#define _SCHED_H
|
|
||||||
|
|
||||||
#undef PTW32_SCHED_LEVEL
|
|
||||||
|
|
||||||
#if defined(_POSIX_SOURCE)
|
|
||||||
#define PTW32_SCHED_LEVEL 0
|
|
||||||
/* Early POSIX */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
|
|
||||||
#undef PTW32_SCHED_LEVEL
|
|
||||||
#define PTW32_SCHED_LEVEL 1
|
|
||||||
/* Include 1b, 1c and 1d */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(INCLUDE_NP)
|
|
||||||
#undef PTW32_SCHED_LEVEL
|
|
||||||
#define PTW32_SCHED_LEVEL 2
|
|
||||||
/* Include Non-Portable extensions */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PTW32_SCHED_LEVEL_MAX 3
|
|
||||||
|
|
||||||
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_SCHED_LEVEL)
|
|
||||||
#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX
|
|
||||||
/* Include everything */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__declspec)
|
|
||||||
# error Please upgrade your GNU compiler to one that supports __declspec.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When building the library, you should define PTW32_BUILD so that
|
|
||||||
* the variables/functions are exported correctly. When using the library,
|
|
||||||
* do NOT define PTW32_BUILD, and then the variables/functions will
|
|
||||||
* be imported correctly.
|
|
||||||
*/
|
|
||||||
#if !defined(PTW32_STATIC_LIB)
|
|
||||||
# if defined(PTW32_BUILD)
|
|
||||||
# define PTW32_DLLPORT __declspec (dllexport)
|
|
||||||
# else
|
|
||||||
# define PTW32_DLLPORT __declspec (dllimport)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define PTW32_DLLPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a duplicate of what is in the autoconf config.h,
|
|
||||||
* which is only used when building the pthread-win32 libraries.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(PTW32_CONFIG_H)
|
|
||||||
# if defined(WINCE)
|
|
||||||
# define NEED_ERRNO
|
|
||||||
# define NEED_SEM
|
|
||||||
# endif
|
|
||||||
# if defined(__MINGW64__)
|
|
||||||
# define HAVE_STRUCT_TIMESPEC
|
|
||||||
# define HAVE_MODE_T
|
|
||||||
# elif defined(_UWIN) || defined(__MINGW32__)
|
|
||||||
# define HAVE_MODE_T
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
|
|
||||||
#if defined(NEED_ERRNO)
|
|
||||||
#include "need_errno.h"
|
|
||||||
#else
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
#endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */
|
|
||||||
|
|
||||||
#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN)
|
|
||||||
# if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
|
|
||||||
/* For pid_t */
|
|
||||||
# include <sys/types.h>
|
|
||||||
/* Required by Unix 98 */
|
|
||||||
# include <time.h>
|
|
||||||
# else
|
|
||||||
typedef int pid_t;
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
typedef int pid_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Thread scheduling policies */
|
|
||||||
|
|
||||||
enum {
|
|
||||||
SCHED_OTHER = 0,
|
|
||||||
SCHED_FIFO,
|
|
||||||
SCHED_RR,
|
|
||||||
SCHED_MIN = SCHED_OTHER,
|
|
||||||
SCHED_MAX = SCHED_RR
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sched_param {
|
|
||||||
int sched_priority;
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sched_yield (void);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Note that this macro returns ENOTSUP rather than
|
|
||||||
* ENOSYS as might be expected. However, returning ENOSYS
|
|
||||||
* should mean that sched_get_priority_{min,max} are
|
|
||||||
* not implemented as well as sched_rr_get_interval.
|
|
||||||
* This is not the case, since we just don't support
|
|
||||||
* round-robin scheduling. Therefore I have chosen to
|
|
||||||
* return the same value as sched_setscheduler when
|
|
||||||
* SCHED_RR is passed to it.
|
|
||||||
*/
|
|
||||||
#define sched_rr_get_interval(_pid, _interval) \
|
|
||||||
( errno = ENOTSUP, (int) -1 )
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
} /* End of extern "C" */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#undef PTW32_SCHED_LEVEL
|
|
||||||
#undef PTW32_SCHED_LEVEL_MAX
|
|
||||||
|
|
||||||
#endif /* !_SCHED_H */
|
|
||||||
|
|
|
@ -1,169 +0,0 @@
|
||||||
/*
|
|
||||||
* Module: semaphore.h
|
|
||||||
*
|
|
||||||
* Purpose:
|
|
||||||
* Semaphores aren't actually part of the PThreads standard.
|
|
||||||
* They are defined by the POSIX Standard:
|
|
||||||
*
|
|
||||||
* POSIX 1003.1b-1993 (POSIX.1b)
|
|
||||||
*
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Pthreads-win32 - POSIX Threads Library for Win32
|
|
||||||
* Copyright(C) 1998 John E. Bossom
|
|
||||||
* Copyright(C) 1999,2005 Pthreads-win32 contributors
|
|
||||||
*
|
|
||||||
* Contact Email: rpj@callisto.canberra.edu.au
|
|
||||||
*
|
|
||||||
* The current list of contributors is contained
|
|
||||||
* in the file CONTRIBUTORS included with the source
|
|
||||||
* code distribution. The list can also be seen at the
|
|
||||||
* following World Wide Web location:
|
|
||||||
* http://sources.redhat.com/pthreads-win32/contributors.html
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library 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
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library in the file COPYING.LIB;
|
|
||||||
* if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
||||||
*/
|
|
||||||
#if !defined( SEMAPHORE_H )
|
|
||||||
#define SEMAPHORE_H
|
|
||||||
|
|
||||||
#undef PTW32_SEMAPHORE_LEVEL
|
|
||||||
|
|
||||||
#if defined(_POSIX_SOURCE)
|
|
||||||
#define PTW32_SEMAPHORE_LEVEL 0
|
|
||||||
/* Early POSIX */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
|
|
||||||
#undef PTW32_SEMAPHORE_LEVEL
|
|
||||||
#define PTW32_SEMAPHORE_LEVEL 1
|
|
||||||
/* Include 1b, 1c and 1d */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(INCLUDE_NP)
|
|
||||||
#undef PTW32_SEMAPHORE_LEVEL
|
|
||||||
#define PTW32_SEMAPHORE_LEVEL 2
|
|
||||||
/* Include Non-Portable extensions */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PTW32_SEMAPHORE_LEVEL_MAX 3
|
|
||||||
|
|
||||||
#if !defined(PTW32_SEMAPHORE_LEVEL)
|
|
||||||
#define PTW32_SEMAPHORE_LEVEL PTW32_SEMAPHORE_LEVEL_MAX
|
|
||||||
/* Include everything */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && ! defined (__declspec)
|
|
||||||
# error Please upgrade your GNU compiler to one that supports __declspec.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When building the library, you should define PTW32_BUILD so that
|
|
||||||
* the variables/functions are exported correctly. When using the library,
|
|
||||||
* do NOT define PTW32_BUILD, and then the variables/functions will
|
|
||||||
* be imported correctly.
|
|
||||||
*/
|
|
||||||
#if !defined(PTW32_STATIC_LIB)
|
|
||||||
# if defined(PTW32_BUILD)
|
|
||||||
# define PTW32_DLLPORT __declspec (dllexport)
|
|
||||||
# else
|
|
||||||
# define PTW32_DLLPORT __declspec (dllimport)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define PTW32_DLLPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a duplicate of what is in the autoconf config.h,
|
|
||||||
* which is only used when building the pthread-win32 libraries.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(PTW32_CONFIG_H)
|
|
||||||
# if defined(WINCE)
|
|
||||||
# define NEED_ERRNO
|
|
||||||
# define NEED_SEM
|
|
||||||
# endif
|
|
||||||
# if defined(__MINGW64__)
|
|
||||||
# define HAVE_STRUCT_TIMESPEC
|
|
||||||
# define HAVE_MODE_T
|
|
||||||
# elif defined(_UWIN) || defined(__MINGW32__)
|
|
||||||
# define HAVE_MODE_T
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX
|
|
||||||
#if defined(NEED_ERRNO)
|
|
||||||
#include "need_errno.h"
|
|
||||||
#else
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
#endif /* PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX */
|
|
||||||
|
|
||||||
#define _POSIX_SEMAPHORES
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#if !defined(HAVE_MODE_T)
|
|
||||||
typedef unsigned int mode_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct sem_t_ * sem_t;
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
|
|
||||||
int pshared,
|
|
||||||
unsigned int value);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
|
|
||||||
const struct timespec * abstime);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
|
|
||||||
int count);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_open (const char * name,
|
|
||||||
int oflag,
|
|
||||||
mode_t mode,
|
|
||||||
unsigned int value);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
|
|
||||||
|
|
||||||
PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
|
|
||||||
int * sval);
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
} /* End of extern "C" */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#undef PTW32_SEMAPHORE_LEVEL
|
|
||||||
#undef PTW32_SEMAPHORE_LEVEL_MAX
|
|
||||||
|
|
||||||
#endif /* !SEMAPHORE_H */
|
|
366
rtlsdr/rtl-sdr.h
366
rtlsdr/rtl-sdr.h
|
@ -1,366 +0,0 @@
|
||||||
/*
|
|
||||||
* rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
|
|
||||||
* Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
|
|
||||||
* Copyright (C) 2012 by Dimitri Stolnikov <horiz0n@gmx.net>
|
|
||||||
*
|
|
||||||
* 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>
|
|
||||||
#include "rtl-sdr_export.h"
|
|
||||||
|
|
||||||
typedef struct rtlsdr_dev rtlsdr_dev_t;
|
|
||||||
|
|
||||||
RTLSDR_API uint32_t rtlsdr_get_device_count(void);
|
|
||||||
|
|
||||||
RTLSDR_API const char* rtlsdr_get_device_name(uint32_t index);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get USB device strings.
|
|
||||||
*
|
|
||||||
* NOTE: The string arguments must provide space for up to 256 bytes.
|
|
||||||
*
|
|
||||||
* \param index the device index
|
|
||||||
* \param manufact manufacturer name, may be NULL
|
|
||||||
* \param product product name, may be NULL
|
|
||||||
* \param serial serial number, may be NULL
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_device_usb_strings(uint32_t index,
|
|
||||||
char *manufact,
|
|
||||||
char *product,
|
|
||||||
char *serial);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get device index by USB serial string descriptor.
|
|
||||||
*
|
|
||||||
* \param serial serial string of the device
|
|
||||||
* \return device index of first device where the name matched
|
|
||||||
* \return -1 if name is NULL
|
|
||||||
* \return -2 if no devices were found at all
|
|
||||||
* \return -3 if devices were found, but none with matching name
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_index_by_serial(const char *serial);
|
|
||||||
|
|
||||||
RTLSDR_API int rtlsdr_open(rtlsdr_dev_t **dev, uint32_t index);
|
|
||||||
|
|
||||||
RTLSDR_API int rtlsdr_close(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
/* configuration functions */
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Set crystal oscillator frequencies used for the RTL2832 and the tuner IC.
|
|
||||||
*
|
|
||||||
* Usually both ICs use the same clock. Changing the clock may make sense if
|
|
||||||
* you are applying an external clock to the tuner or to compensate the
|
|
||||||
* frequency (and samplerate) error caused by the original (cheap) crystal.
|
|
||||||
*
|
|
||||||
* NOTE: Call this function only if you fully understand the implications.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param rtl_freq frequency value used to clock the RTL2832 in Hz
|
|
||||||
* \param tuner_freq frequency value used to clock the tuner IC in Hz
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq,
|
|
||||||
uint32_t tuner_freq);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get crystal oscillator frequencies used for the RTL2832 and the tuner IC.
|
|
||||||
*
|
|
||||||
* Usually both ICs use the same clock.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param rtl_freq frequency value used to clock the RTL2832 in Hz
|
|
||||||
* \param tuner_freq frequency value used to clock the tuner IC in Hz
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_xtal_freq(rtlsdr_dev_t *dev, uint32_t *rtl_freq,
|
|
||||||
uint32_t *tuner_freq);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get USB device strings.
|
|
||||||
*
|
|
||||||
* NOTE: The string arguments must provide space for up to 256 bytes.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param manufact manufacturer name, may be NULL
|
|
||||||
* \param product product name, may be NULL
|
|
||||||
* \param serial serial number, may be NULL
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_usb_strings(rtlsdr_dev_t *dev, char *manufact,
|
|
||||||
char *product, char *serial);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Write the device EEPROM
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param data buffer of data to be written
|
|
||||||
* \param offset address where the data should be written
|
|
||||||
* \param len length of the data
|
|
||||||
* \return 0 on success
|
|
||||||
* \return -1 if device handle is invalid
|
|
||||||
* \return -2 if EEPROM size is exceeded
|
|
||||||
* \return -3 if no EEPROM was found
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTLSDR_API int rtlsdr_write_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
|
|
||||||
uint8_t offset, uint16_t len);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Read the device EEPROM
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param data buffer where the data should be written
|
|
||||||
* \param offset address where the data should be read from
|
|
||||||
* \param len length of the data
|
|
||||||
* \return 0 on success
|
|
||||||
* \return -1 if device handle is invalid
|
|
||||||
* \return -2 if EEPROM size is exceeded
|
|
||||||
* \return -3 if no EEPROM was found
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTLSDR_API int rtlsdr_read_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
|
|
||||||
uint8_t offset, uint16_t len);
|
|
||||||
|
|
||||||
RTLSDR_API int rtlsdr_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get actual frequency the device is tuned to.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return 0 on error, frequency in Hz otherwise
|
|
||||||
*/
|
|
||||||
RTLSDR_API uint32_t rtlsdr_get_center_freq(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Set the frequency correction value for the device.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param ppm correction value in parts per million (ppm)
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_freq_correction(rtlsdr_dev_t *dev, int ppm);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get actual frequency correction value of the device.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return correction value in parts per million (ppm)
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_freq_correction(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
enum rtlsdr_tuner {
|
|
||||||
RTLSDR_TUNER_UNKNOWN = 0,
|
|
||||||
RTLSDR_TUNER_E4000,
|
|
||||||
RTLSDR_TUNER_FC0012,
|
|
||||||
RTLSDR_TUNER_FC0013,
|
|
||||||
RTLSDR_TUNER_FC2580,
|
|
||||||
RTLSDR_TUNER_R820T
|
|
||||||
};
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get the tuner type.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise
|
|
||||||
*/
|
|
||||||
RTLSDR_API enum rtlsdr_tuner rtlsdr_get_tuner_type(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get a list of gains supported by the tuner.
|
|
||||||
*
|
|
||||||
* NOTE: The gains argument must be preallocated by the caller. If NULL is
|
|
||||||
* being given instead, the number of available gain values will be returned.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param gains array of gain values. In tenths of a dB, 115 means 11.5 dB.
|
|
||||||
* \return <= 0 on error, number of available (returned) gain values otherwise
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_tuner_gains(rtlsdr_dev_t *dev, int *gains);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Set the gain for the device.
|
|
||||||
* Manual gain mode must be enabled for this to work.
|
|
||||||
*
|
|
||||||
* Valid gain values (in tenths of a dB) for the E4000 tuner:
|
|
||||||
* -10, 15, 40, 65, 90, 115, 140, 165, 190,
|
|
||||||
* 215, 240, 290, 340, 420, 430, 450, 470, 490
|
|
||||||
*
|
|
||||||
* Valid gain values may be queried with \ref rtlsdr_get_tuner_gains function.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param gain in tenths of a dB, 115 means 11.5 dB.
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_tuner_gain(rtlsdr_dev_t *dev, int gain);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get actual gain the device is configured to.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return 0 on error, gain in tenths of a dB, 115 means 11.5 dB.
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_tuner_gain(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Set the intermediate frequency gain for the device.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param stage intermediate frequency gain stage number (1 to 6 for E4000)
|
|
||||||
* \param gain in tenths of a dB, -30 means -3.0 dB.
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_tuner_if_gain(rtlsdr_dev_t *dev, int stage, int gain);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Set the gain mode (automatic/manual) for the device.
|
|
||||||
* Manual gain mode must be enabled for the gain setter function to work.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param manual gain mode, 1 means manual gain mode shall be enabled.
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_tuner_gain_mode(rtlsdr_dev_t *dev, int manual);
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get actual sample rate the device is configured to.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return 0 on error, sample rate in Hz otherwise
|
|
||||||
*/
|
|
||||||
RTLSDR_API uint32_t rtlsdr_get_sample_rate(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Enable test mode that returns an 8 bit counter instead of the samples.
|
|
||||||
* The counter is generated inside the RTL2832.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param test mode, 1 means enabled, 0 disabled
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_testmode(rtlsdr_dev_t *dev, int on);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Enable or disable the internal digital AGC of the RTL2832.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param digital AGC mode, 1 means enabled, 0 disabled
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_agc_mode(rtlsdr_dev_t *dev, int on);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Enable or disable the direct sampling mode. When enabled, the IF mode
|
|
||||||
* of the RTL2832 is activated, and rtlsdr_set_center_freq() will control
|
|
||||||
* the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz
|
|
||||||
* (xtal frequency of the RTL2832).
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param on 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_direct_sampling(rtlsdr_dev_t *dev, int on);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get state of the direct sampling mode
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return -1 on error, 0 means disabled, 1 I-ADC input enabled
|
|
||||||
* 2 Q-ADC input enabled
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_direct_sampling(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Enable or disable offset tuning for zero-IF tuners, which allows to avoid
|
|
||||||
* problems caused by the DC offset of the ADCs and 1/f noise.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param on 0 means disabled, 1 enabled
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_set_offset_tuning(rtlsdr_dev_t *dev, int on);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get state of the offset tuning mode
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return -1 on error, 0 means disabled, 1 enabled
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_get_offset_tuning(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
/* streaming functions */
|
|
||||||
|
|
||||||
RTLSDR_API int rtlsdr_reset_buffer(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
RTLSDR_API int rtlsdr_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read);
|
|
||||||
|
|
||||||
typedef void(*rtlsdr_read_async_cb_t)(unsigned char *buf, uint32_t len, void *ctx);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Read samples from the device asynchronously. This function will block until
|
|
||||||
* it is being canceled using rtlsdr_cancel_async()
|
|
||||||
*
|
|
||||||
* NOTE: This function is deprecated and is subject for removal.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param cb callback function to return received samples
|
|
||||||
* \param ctx user specific context to pass via the callback function
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Read samples from the device asynchronously. This function will block until
|
|
||||||
* it is being canceled using rtlsdr_cancel_async()
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \param cb callback function to return received samples
|
|
||||||
* \param ctx user specific context to pass via the callback function
|
|
||||||
* \param buf_num optional buffer count, buf_num * buf_len = overall buffer size
|
|
||||||
* set to 0 for default buffer count (32)
|
|
||||||
* \param buf_len optional buffer length, must be multiple of 512,
|
|
||||||
* set to 0 for default buffer length (16 * 32 * 512)
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_read_async(rtlsdr_dev_t *dev,
|
|
||||||
rtlsdr_read_async_cb_t cb,
|
|
||||||
void *ctx,
|
|
||||||
uint32_t buf_num,
|
|
||||||
uint32_t buf_len);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Cancel all pending asynchronous operations on the device.
|
|
||||||
*
|
|
||||||
* \param dev the device handle given by rtlsdr_open()
|
|
||||||
* \return 0 on success
|
|
||||||
*/
|
|
||||||
RTLSDR_API int rtlsdr_cancel_async(rtlsdr_dev_t *dev);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __RTL_SDR_H */
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
|
|
||||||
* Copyright (C) 2012 by Hoernchen <la@tfc-server.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 RTLSDR_EXPORT_H
|
|
||||||
#define RTLSDR_EXPORT_H
|
|
||||||
|
|
||||||
#if defined __GNUC__
|
|
||||||
# if __GNUC__ >= 4
|
|
||||||
# define __SDR_EXPORT __attribute__((visibility("default")))
|
|
||||||
# define __SDR_IMPORT __attribute__((visibility("default")))
|
|
||||||
# else
|
|
||||||
# define __SDR_EXPORT
|
|
||||||
# define __SDR_IMPORT
|
|
||||||
# endif
|
|
||||||
#elif _MSC_VER
|
|
||||||
# define __SDR_EXPORT __declspec(dllexport)
|
|
||||||
# define __SDR_IMPORT __declspec(dllimport)
|
|
||||||
#else
|
|
||||||
# define __SDR_EXPORT
|
|
||||||
# define __SDR_IMPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef rtlsdr_STATIC
|
|
||||||
# ifdef rtlsdr_EXPORTS
|
|
||||||
# define RTLSDR_API __SDR_EXPORT
|
|
||||||
# else
|
|
||||||
# define RTLSDR_API __SDR_IMPORT
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
#define RTLSDR_API
|
|
||||||
#endif
|
|
||||||
#endif /* RTLSDR_EXPORT_H */
|
|
Loading…
Reference in a new issue