3 * Copyright 2005 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
22 #ifndef INCLUDED_COMEDI_SOURCE_S_H
23 #define INCLUDED_COMEDI_SOURCE_S_H
25 #include <gr_sync_block.h>
27 #include <comedilib.h>
30 class comedi_source_s;
31 typedef boost::shared_ptr<comedi_source_s> comedi_source_s_sptr;
34 * \brief make a COMEDI source.
36 * \param sampling_freq sampling rate in Hz
37 * \param dev COMEDI device name, e.g., "/dev/comedi0"
40 comedi_make_source_s (int sampling_freq,
41 const std::string dev = "/dev/comedi0");
44 * \brief source using COMEDI
46 * The source has one to many input stream of signed short integers.
48 * Output samples will be in the range [-32768,32767].
50 class comedi_source_s : public gr_sync_block {
51 friend comedi_source_s_sptr
52 comedi_make_source_s (int sampling_freq, const std::string device_name);
54 // typedef for pointer to class work method
55 typedef int (comedi_source_s::*work_t)(int noutput_items,
56 gr_vector_const_void_star &input_items,
57 gr_vector_void_star &output_items);
59 unsigned int d_sampling_freq;
60 std::string d_device_name;
71 int d_noverruns; // count of overruns
73 void output_error_msg (const char *msg, int err);
74 void bail (const char *msg, int err) throw (std::runtime_error);
78 comedi_source_s (int sampling_freq, const std::string device_name);
83 bool check_topology (int ninputs, int noutputs);
85 int work (int noutput_items,
86 gr_vector_const_void_star &input_items,
87 gr_vector_void_star &output_items);
90 #endif /* INCLUDED_COMEDI_SOURCE_S_H */