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 3, 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., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
22 #ifndef INCLUDED_COMEDI_SINK_H
23 #define INCLUDED_COMEDI_SINK_H
25 #include <gr_sync_block.h>
27 #include <comedilib.h>
31 typedef boost::shared_ptr<comedi_sink_s> comedi_sink_s_sptr;
34 * \brief make an COMEDI sink.
36 * \param sampling_freq sampling rate in Hz
37 * \param dev COMEDI device name, e.g., "/dev/comedi0"
40 comedi_make_sink_s (int sampling_freq,
41 const std::string dev = "/dev/comedi0");
44 * \brief sink using COMEDI
46 * The sink has one input stream of signed short integers.
48 * Input samples must be in the range [-32768,32767].
50 class comedi_sink_s : public gr_sync_block {
51 friend comedi_sink_s_sptr
52 comedi_make_sink_s (int sampling_freq, const std::string dev);
54 // typedef for pointer to class work method
55 typedef int (comedi_sink_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_nunderuns; // count of underruns
73 void output_error_msg (const char *msg, int err);
74 void bail (const char *msg, int err) throw (std::runtime_error);
77 comedi_sink_s (int sampling_freq, const std::string device_name);
82 bool check_topology (int ninputs, int noutputs);
84 int work (int noutput_items,
85 gr_vector_const_void_star &input_items,
86 gr_vector_void_star &output_items);
89 #endif /* INCLUDED_COMEDI_SINK_H */