OK, no problem.
The xs code is as follows:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <rtl-sdr.h>
typedef rtlsdr_dev_t * SDR__RTLSDR;
MODULE = SDR::RTLSDR PACKAGE = SDR::RTLSDR
PROTOTYPES: DISABLE
const char *
rtlsdr_get_device_name(index)
uint32_t index
int
rtlsdr_get_device_usb_strings( index, manufact, product, serial)
uint32_t index
char *manufact
char *product
char *serial
int
rtlsdr_get_index_by_serial(serial)
const char *serial
int
rtlsdr_open(dev, index)
SDR::RTLSDR **dev
uint32_t index
int
rtlsdr_close(dev)
SDR::RTLSDR *dev
int
rtlsdr_set_xtal_freq(dev, rtl_freq, tuner_freq)
SDR::RTLSDR *dev
uint32_t rtl_freq
uint32_t *tuner_freq
int
rtlsdr_get_xtal_freq(dev, rtl_freq, tuner_freq)
SDR::RTLSDR *dev
uint32_t *rtl_freq
uint32_t *tuner_freq
int
rtlsdr_get_usb_strings(dev, manufact, product, serial)
SDR::RTLSDR *dev
char *manufact
char *product
char *serial
int
rtlsdr_write_eeprom(dev, data, offset, len)
RTLSDRDevice_T *dev
uint8_t *data
uint8_t offset
uint16_t len
int
rtlsdr_read_eeprom(dev, data, offset, len)
SDR::RTLSDR *dev
uint8_t *data
uint8_t offset
uint16_t len
int
rtlsdr_set_center_freq(dev, freq)
SDR::RTLSDR *dev
uint32_t freq
uint32_t
rtlsdr_get_center_freq(dev)
SDR::RTLSDR *dev
int
rtlsdr_set_freq_correction(dev, ppm)
SDR::RTLSDR *dev
int ppm
int
rtlsdr_get_freq_correction(dev)
SDR::RTLSDR *dev
int
rtlsdr_get_tuner_gains( dev, gains )
SDR::RTLSDR *dev
int *gains
int
rtlsdr_set_tuner_gain(dev, gain)
SDR::RTLSDR *dev
int gain
int
rtlsdr_set_tuner_bandwidth(dev, bw)
SDR::RTLSDR *dev
uint32_t bw
int
rtlsdr_get_tuner_gain(dev)
SDR::RTLSDR *dev
int
rtlsdr_set_tuner_if_gain(dev, stage, gain)
SDR::RTLSDR *dev
int stage
int gain
int
rtlsdr_set_tuner_gain_mode(dev, manual)
SDR::RTLSDR *dev
int manual
int
rtlsdr_set_sample_rate(dev, rate)
SDR::RTLSDR *dev
uint32_t rate
uint32_t
rtlsdr_get_sample_rate(dev)
SDR::RTLSDR *dev
int
rtlsdr_set_testmode(dev, on)
SDR::RTLSDR *dev
int on
int
rtlsdr_set_agc_mode(dev, on)
SDR::RTLSDR *dev
int on
int
rtlsdr_set_direct_sampling(dev, on)
SDR::RTLSDR *dev
int on
int
rtlsdr_set_offset_tuning(dev, on)
SDR::RTLSDR *dev
int on
int
rtlsdr_get_offset_tuning(dev)
SDR::RTLSDR *dev
int
rtlsdr_reset_bufferrtl(dev)
SDR::RTLSDR *dev
int
rtlsdr_read_sync(dev,buf,len, n_read);
SDR::RTLSDR *dev
void *buf
int len
int *n_read
while the TYMAP file is:
TYPEMAP
RTLSDRDevice_T * T_PTROBJ
SDR::RTLSDR T_PTROBJ
const char * T_PV
int * T_PV
char * T_PV
unsigned long int T_U_LONG
uint8_t T_U_SHORT
uint8_t * T_U_SHORT
uint16_t T_U_SHORT
uint32_t * T_U_SHORT
uint32_t T_U_SHORT
the library code is:
#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 tun
+er IC.
*
* Usually both ICs use the same clock. Changing the clock may make se
+nse if
* you are applying an external clock to the tuner or to compensate th
+e
* frequency (and samplerate) error caused by the original (cheap) cry
+stal.
*
* NOTE: Call this function only if you fully understand the implicati
+ons.
*
* \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_fr
+eq,
uint32_t tuner_freq);
(this is only the first part, think that I need only the rtlsdr_open function, the other function before it works and return the correct output.
Regards
Edoardo M. |