Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Re^2: help with XS pointers by Bpl
in thread help with XS pointers by Bpl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-16 23:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found