GNU Radio's ELAD Package
fdm_source_c_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 ELAD .
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_ELAD_FDM_SOURCE_I_IMPL_H
22 #define INCLUDED_ELAD_FDM_SOURCE_I_IMPL_H
23 
24 #define DEFAULT_READLEN 12288
25 #define DEFAULT_BUFFER_MUL 8
26 #define DEFAULT_BUFFER_LEVEL 0.5f
27 #define WAIT_FUDGE (1.2+0.3)
28 
29 #include <cstdlib>
30 
31 #include <elad/fdm_source_c.h>
32 
33 #include <boost/thread.hpp>
34 #include <boost/thread/condition.hpp>
35 #include <boost/thread/recursive_mutex.hpp>
36 
37 #include <dlfcn.h>
38 
39 
40 namespace gr {
41  namespace elad {
42 
44  {
45  private:
46 
47  size_t m_recv_samples_per_packet;
48  uint64_t m_nSamplesReceived;
49  uint32_t m_nOverflows;
50  bool m_bRunning;
51  boost::recursive_mutex d_mutex;
52  boost::thread m_pCaptureThread;
53  uint32_t m_nBufferSize;
54  uint32_t m_nBufferStart;
55  uint32_t m_nBufferItems;
56  boost::condition m_hPacketEvent;
57  uint8_t* m_pUSBBuffer;
58  bool m_bBuffering;
59  uint32_t m_nReadLength;
60  uint32_t m_nBufferMultiplier;
61  bool m_bUseBuffer;
62  float m_fBufferLevel;
63  uint32_t m_nReadPacketCount;
64  uint32_t m_nBufferOverflowCount;
65  uint32_t m_nBufferUnderrunCount;
66  uint32_t m_bytes_per_sample;
67  boost::xtime m_wait_delay, m_wait_next;
68  libusb_device_handle *m_dev_handle;
69  int m_isDuo;
70  int m_isS2;
71  int m_isS1;
72  float m_globalOffset;
73  float m_lpOffset;
74  float m_attOffset;
75  float m_recalc;
76  int m_resampling;
77  float m_rescale;
78 
79 
80  libusb_context *ctx;
81  struct devInfo
82  {
83  libusb_device_handle *deviceHandle;
84  unsigned char deviceSpeed;
85  unsigned short vid;
86  unsigned short pid;
87  char *sn;
88  }myDevInfo;
89 
90  void reset();
91  static void _capture_thread(fdm_source_c_impl *p);
92  void capture_thread();
93 
94  public:
95  fdm_source_c_impl(long LOfreq, int filter, int atten, char *serial, int resampling);
97  void fdm_cb_in( struct libusb_transfer * transfer );
98  bool start();
99  bool stop();
100  void calc_delay(long dSampleRate);
101  int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
102  void set_filter(long freq, int filter, int atten);
103  void set_atten(long freq, int filter, int atten);
104  void set_FREQ( long LOfreq );
105 
106 
107  long d_LOfreq;
108  int d_filter;
109  int d_atten;
110  };
111 
112  } // namespace elad
113 } // namespace gr
114 
115 #endif /* INCLUDED_ELAD_FDM_SOURCE_I_IMPL_H */
116 
void set_filter(long freq, int filter, int atten)
int d_filter
Definition: fdm_source_c_impl.h:108
int d_atten
Definition: fdm_source_c_impl.h:109
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Definition: fdm_source_c_impl.h:43
long d_LOfreq
Definition: fdm_source_c_impl.h:107
void set_FREQ(long LOfreq)
Return a shared_ptr to a new instance of elad::fdm_source_c.
void calc_delay(long dSampleRate)
fdm_source_c_impl(long LOfreq, int filter, int atten, char *serial, int resampling)
Definition: fdm_source_c.h:28
<+description of block+>
Definition: fdm_source_c.h:36
void set_atten(long freq, int filter, int atten)
void fdm_cb_in(struct libusb_transfer *transfer)