comedi_sink_s.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef INCLUDED_COMEDI_SINK_H
00023 #define INCLUDED_COMEDI_SINK_H
00024
00025 #include <gr_sync_block.h>
00026 #include <string>
00027 #include <comedilib.h>
00028 #include <stdexcept>
00029
00030 class comedi_sink_s;
00031 typedef boost::shared_ptr<comedi_sink_s> comedi_sink_s_sptr;
00032
00039 comedi_sink_s_sptr
00040 comedi_make_sink_s (int sampling_freq,
00041 const std::string dev = "/dev/comedi0");
00042
00050 class comedi_sink_s : public gr_sync_block {
00051 friend comedi_sink_s_sptr
00052 comedi_make_sink_s (int sampling_freq, const std::string device_name);
00053
00054
00055 typedef int (comedi_sink_s::*work_t)(int noutput_items,
00056 gr_vector_const_void_star &input_items,
00057 gr_vector_void_star &output_items);
00058
00059 unsigned int d_sampling_freq;
00060 std::string d_device_name;
00061
00062 comedi_t *d_dev;
00063 int d_subdevice;
00064 int d_n_chan;
00065 void *d_map;
00066 int d_buffer_size;
00067 unsigned d_buf_front;
00068 unsigned d_buf_back;
00069
00070
00071 int d_nunderuns;
00072
00073 void output_error_msg (const char *msg, int err);
00074 void bail (const char *msg, int err) throw (std::runtime_error);
00075
00076 protected:
00077 comedi_sink_s (int sampling_freq, const std::string device_name);
00078
00079 public:
00080 ~comedi_sink_s ();
00081
00082 bool check_topology (int ninputs, int noutputs);
00083
00084 int work (int noutput_items,
00085 gr_vector_const_void_star &input_items,
00086 gr_vector_void_star &output_items);
00087 };
00088
00089 #endif