Specifications
Comedi
144 / 148
volatile unsigned int buf_write_alloc_count; /
*
byte count for writer (allocated for ←-
writing)
*
/
volatile unsigned int buf_read_count; /
*
byte count for reader (read completed)
*
/
unsigned int buf_write_ptr; /
*
buffer marker for writer
*
/
unsigned int buf_read_ptr; /
*
buffer marker for reader
*
/
unsigned int cur_chan; /
*
useless channel marker for interrupt
*
/
/
*
number of bytes that have been received for current scan
*
/
unsigned int scan_progress;
/
*
keeps track of where we are in chanlist as for munging
*
/
unsigned int munge_chan;
unsigned int events; /
*
events that have occurred
*
/
comedi_cmd cmd;
// callback stuff
unsigned int cb_mask;
int (
*
cb_func)(unsigned int flags,void
*
);
void
*
cb_arg;
int (
*
inttrig)(comedi_device
*
dev,comedi_subdevice
*
s,unsigned int x);
};
6.2.1.5 comedi_driver
struct comedi_driver_struct{
struct comedi_driver_struct
*
next;
char
*
driver_name;
struct module
*
module;
int (
*
attach)(comedi_device
*
,comedi_devconfig
*
);
int (
*
detach)(comedi_device
*
);
/
*
number of elements in board_name and board_id arrays
*
/
unsigned int num_names;
void
*
board_name;
/
*
offset in bytes from one board name pointer to the next
*
/
int offset;
};
6.2.2 Generic driver support functions
The directory comedi contains a large set of support functions. Some of the most important ones are given below.
From comedi/comedi_fops.c, functions to handle the hardware events (which also runs the registered callback function),
to get data in and out of the software data buffer, and to parse the incoming functional requests:
void comedi_event(comedi_device
*
dev,comedi_subdevice
*
s,unsigned int mask);
int comedi_buf_put(comedi_async
*
async, sampl_t x);
int comedi_buf_get(comedi_async
*
async, sampl_t
*
x);
static int parse_insn(comedi_device
*
dev,comedi_insn
*
insn,lsampl_t
*
data,void
*
file);
The file comedi/kcomedilib/kcomedilib_main.c provides functions to register a callback, to poll an ongoing data
acquisition, and to print an error message: