1 <section id="driverwriting">
3 Writing a &comedi; driver
7 This Section explains the most important implementations aspects of
8 the &comedi; device drivers. It tries to give the interested device
9 driver writer an overview of the different steps required to write a
13 This Section does <emphasis>not</emphasis> explain all implementation
14 details of the &comedi; software itself: &comedi; has once and for
15 all solved lots of boring but indispensable infrastructural things,
16 such as: timers, management of which drivers
17 are active, memory management for drivers and buffers, wrapping
18 of RTOS-specific interfaces, interrupt handler management, general
19 error handling, the <filename role=directory>/proc</filename>
21 the device driver writers can concentrate on the interesting stuff:
22 implementing their specific interface card's DAQ functionalities.
25 In order to make a decent &comedi; device driver, you must
26 know the answers to the following questions:
32 <link linkend="userkernelhow">communication</link> between user space
33 and kernel space work?
39 What functionality is provided by the
40 <link linkend="comedikernelgeneric">generic</link> kernel-space
41 &comedi; functions, and what must be provided for each
42 <link linkend="boardspecific">specific new driver</link>?
48 How to use <link linkend="drivercallbacks">DMA and interrupts</link>?
54 What are the addresses and meanings of all the card's registers?
57 This information is to be found in the so-called <quote>register level
58 manual</quote> of the card. Without it, coding a device driver is close
59 to hopeless. It is also something that &comedi; (and hence also this
60 handbook) cannot give any support or information for: board
61 manufacturers all use their own design and nomenclature.
68 <section id="userkernelhow">
70 Communication user space-kernel space
74 In user space, you interact with the functions implemented in the
75 <filename role=directory>/usr/src/comedilib</filename> directory. Most
76 of the device driver core of the Comedilib library is found in
77 <filename role=directory>lib</filename> subdirectory.
80 All user-space &comedi;
81 <link linkend="instructions">instructions</link> and
82 <link linkend="commandsstreaming">commands</link>
83 are transmitted to kernel space through a traditional
84 <function>ioctl</function> system call.
85 (See <filename>/usr/src/comedilib/lib/ioctl.c</filename>.)
86 The user space information command is <emphasis>encoded</emphasis> as
87 a number in the <function>ioctl</function> call, and decoded in the
88 kernel space library. There, they are executed by their kernel-space
89 counterparts. This is done in the
90 <filename>/usr/src/comedi/comedi/comedi_fops.c</filename> file: the
91 <function>comedi_ioctl()</function> function processes the results of
92 the <function>ioctl</function> system call, interprets its contents,
93 and then calls the corresponding kernel space
94 <function>do_…_ioctl</function> function(s).
95 For example, a &comedi;
96 <link linkend="instructions">instruction</link> is further processed
97 by the <function>do_insn_ioctl()</function>function. (Which, in turn,
98 uses <function>parse_insn()</function> for further detailed processing.)
101 The data corresponding to instructions and commands is transmitted
102 with the <function>copy_from_user()</function> system call;
103 acquisition data captured by the interface card passes the kernel-user
104 space boundary with the help of a <function>copy_to_user()</function>
110 <section id="comedikernelgeneric">
112 Generic functionality
116 The major include files of the kernel-space part of &comedi; are:
121 <filename>include/linux/comedidev.h</filename>: the
122 header file for kernel-only structures (device, subdevice, async
123 (i.e., buffer/event/interrupt/callback functionality for asynchronous
124 DAQ in a &comedi; command), driver, lrange), variables, inline functions
131 <filename>include/linux/comedi_rt.h</filename>:
132 all the real-time stuff, such as management of ISR in RTAI and
133 RTLinux/Free, and spinlocks for atomic sections.
139 <filename>include/linux/comedilib.h</filename>: the header file for
140 the kernel library of &comedi;.
147 From all the relevant &comedi; device driver code that is found in the
148 <filename role=directory>/usr/src/comedi/comedi</filename> directory
149 (<emphasis>if</emphasis> the &comedi; source has been installed in its
150 normal <filename role=directory>/usr/src/comedi</filename> location),
151 the <emphasis role="strong">generic</emphasis> functionality is
152 contained in two parts:
157 A couple of <filename>C</filename> files contain the <emphasis
158 role="strong">infrastructural support</emphasis>.
159 From these <filename>C</filename> files, it's especially the
160 <filename>comedi_fops.c</filename> file that implements what makes
161 &comedi; into what people want to use it for: a library that has
162 solved 90% of the DAQ device driver efforts, once and for all.
168 For <emphasis role="strong">real-time</emphasis> applications,
169 the subdirectory <filename role=directory>kcomedilib</filename>
170 implements an interface in the kernel that is similar to the &comedi;
171 interface accessible through the
172 <link linkend="functionreference">user-space Comedi library</link>.
175 There are some differences in what is possible and/or needed
176 in kernel space and in user space, so the functionalities offered in
177 <filename role=directory>kcomedilib</filename> are not an exact copy
178 of the user-space library. For example, locking, interrupt handling,
179 real-time execution, callback handling, etc., are only available in
183 Most drivers don't make use (yet) of these real-time functionalities.
191 <section id="driverdatastructures">
197 This Section explains the generic data structures that a device driver
200 typedef struct comedi_lrange_struct <link linkend="comedilrange">comedi_lrange</link>;
201 typedef struct comedi_subdevice_struct <link linkend="comedisubdevice">comedi_subdevice</link>;
202 typedef struct comedi_device_struct <link linkend="comedidevice">comedi_device</link>:
203 typedef struct comedi_async_struct <link linkend="comediasync">comedi_async</link>
204 typedef struct comedi_driver_struct <link linkend="comedidriver">comedi_driver</link>;
207 <filename>/usr/src/comedi/include/linux/comedidev.h</filename>.
208 Most of the fields are filled in by the &comedi; infrastructure, but
209 there are still quite a handful that your driver must provide or use.
210 As for the user-level &comedi;, each of the hierarchical layers has
211 its own data structures: channel (<function>comedi_lrange</function>),
212 subdevice, and device.
215 Note that these kernel-space data structures have similar names as
217 <link linkend="datatypesstructures">user-space equivalents</link>, but
218 they have a different (kernel-side) view on the DAQ problem and a
219 different meaning: they encode the interaction with the
220 <emphasis>hardware</emphasis>, not with the <emphasis>user</emphasis>.
223 However, the <link linkend="ref-type-comedi-insn">comedi_insn</link>
224 and <link linkend="ref-type-comedi-cmd">comedi_cmd</link>
225 data structures are shared between user space and kernel space: this
226 should come as no surprise, since these data structures contain all
227 information that the user-space program must transfer to the
228 kernel-space driver for each acquisition.
231 In addition to these data entities that are also known at the user
232 level (device, sub-device, channel), the device driver level provides
233 two more data structures which the application programmer doesn't get
234 in touch with: the data structure
235 <link linkend="comedidriver">comedi_driver</link>
236 that stores the device driver information that is relevant at the
237 operating system level, and the data structure
238 <link linkend="comediasync">comedi_async</link> that stores the
239 information about all <emphasis>asynchronous</emphasis> activities
240 (interrupts, callbacks and events).
243 <section id="comedilrange">
245 <function>comedi_lrange</function>
248 The channel information is simple, since it contains only the signal
251 struct comedi_lrange_struct{
253 <link linkend="ref-type-comedi-krange">comedi_krange</link> range[GCC_ZERO_LENGTH_ARRAY];
261 <section id="comedisubdevice">
263 <function>comedi_subdevice</function>
266 The subdevice is the smallest &comedi; entity that can be used for
267 <quote>stand-alone</quote> DAQ, so it is no surprise that it is
270 struct comedi_subdevice_struct{
274 int len_chanlist; /* maximum length of channel/gain list */
278 <link linkend="comediasync">comedi_async</link> *async;
282 unsigned int runflags;
286 <link linkend="ref-type-lsampl-t">lsampl_t</link> maxdata; /* if maxdata==0, use list */
287 <link linkend="ref-type-lsampl-t">lsampl_t</link> *maxdata_list; /* list is channel specific */
290 unsigned int *flaglist;
292 <link linkend="comedilrange">comedi_lrange</link> *range_table;
293 <link linkend="comedilrange">comedi_lrange</link> **range_table_list;
295 unsigned int *chanlist; /* driver-owned chanlist (not used) */
297 int (*insn_read)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *,<link linkend="ref-type-comedi-insn">comedi_insn</link> *,<link linkend="ref-type-lsampl-t">lsampl_t</link> *);
298 int (*insn_write)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *,<link linkend="ref-type-comedi-insn">comedi_insn</link> *,<link linkend="ref-type-lsampl-t">lsampl_t</link> *);
299 int (*insn_bits)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *,<link linkend="ref-type-comedi-insn">comedi_insn</link> *,<link linkend="ref-type-lsampl-t">lsampl_t</link> *);
300 int (*insn_config)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *,<link linkend="ref-type-comedi-insn">comedi_insn</link> *,<link linkend="ref-type-lsampl-t">lsampl_t</link> *);
302 int (*do_cmd)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *);
303 int (*do_cmdtest)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *,<link linkend="ref-type-comedi-cmd">comedi_cmd</link> *);
304 int (*poll)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *);
305 int (*cancel)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *);
307 int (*buf_change)(<link linkend="comedidevice">comedi_device</link> *,<link linkend="comedisubdevice">comedi_subdevice</link> *s,unsigned long new_size);
308 void (*munge)(<link linkend="comedidevice">comedi_device</link> *, <link linkend="comedisubdevice">comedi_subdevice</link> *s, void *data, unsigned int num_bytes, unsigned int start_chan_index );
313 The function pointers <function>(*insn_read)</function> …
314 <function>(*cancel)</function> .
315 offer (pointers to) the standardized
316 <link linkend="functionreference">user-visible API</link>
317 that every subdevice should offer; every device driver has to fill
318 in these functions with their board-specific implementations.
319 (Functionality for which &comedi; provides generic functions will, by
320 definition, not show up in the device driver data structures.)
323 The <function>buf_change()</function> and <function>munge()</function>
324 functions offer functionality that is not visible to the user and for
325 which the device driver writer must provide a board-specific
327 <function>buf_change()</function> is called when a change in the
328 data buffer requires handling; <function>munge()</function> transforms
329 different bit-representations of DAQ values, for example from
330 <emphasis>unsigned</emphasis> to <emphasis>2's complement</emphasis>.
335 <section id="comedidevice">
337 <function>comedi_device</function>
341 The last data structure stores the information at the
342 <emphasis>device</emphasis> level:
344 struct comedi_device_struct{
346 <link linkend="comedidriver">comedi_driver</link> *driver;
350 const void *board_ptr;
354 int in_request_module;
357 <link linkend="comedisubdevice">comedi_subdevice</link> *subdevices;
358 int options[COMEDI_NDEVCONFOPTS];
364 <link linkend="comedisubdevice">comedi_subdevice</link> *read_subdev;
365 wait_queue_head_t read_wait;
367 <link linkend="comedisubdevice">comedi_subdevice</link> *write_subdev;
368 wait_queue_head_t write_wait;
370 struct fasync_struct *async_queue;
372 void (*open)(<link linkend="comedidevice">comedi_device</link> *dev);
373 void (*close)(<link linkend="comedidevice">comedi_device</link> *dev);
380 <section id="comediasync">
382 <function>comedi_async</function>
386 The following data structure contains all relevant information:
387 addresses and sizes of buffers, pointers to the actual data, and the
388 information needed for
389 <link linkend="drivercallbacks">event handling</link>:
391 struct comedi_async_struct{
392 void *prealloc_buf; /* pre-allocated buffer */
393 unsigned int prealloc_bufsz; /* buffer size, in bytes */
394 unsigned long *buf_page_list; /* physical address of each page */
395 unsigned int max_bufsize; /* maximum buffer size, bytes */
396 unsigned int mmap_count; /* current number of mmaps of prealloc_buf */
398 volatile unsigned int buf_write_count; /* byte count for writer (write completed) */
399 volatile unsigned int buf_write_alloc_count; /* byte count for writer (allocated for writing) */
400 volatile unsigned int buf_read_count; /* byte count for reader (read completed)*/
402 unsigned int buf_write_ptr; /* buffer marker for writer */
403 unsigned int buf_read_ptr; /* buffer marker for reader */
405 unsigned int cur_chan; /* useless channel marker for interrupt */
406 /* number of bytes that have been received for current scan */
407 unsigned int scan_progress;
408 /* keeps track of where we are in chanlist as for munging */
409 unsigned int munge_chan;
411 unsigned int events; /* events that have occurred */
413 <link linkend="ref-type-comedi-cmd">comedi_cmd</link> cmd;
416 unsigned int cb_mask;
417 int (*cb_func)(unsigned int flags,void *);
420 int (*inttrig)(<link linkend="comedidevice">comedi_device</link> *dev,<link linkend="comedisubdevice">comedi_subdevice</link> *s,unsigned int x);
427 <section id="comedidriver">
429 <function>comedi_driver</function>
434 struct comedi_driver_struct{
435 struct comedi_driver_struct *next;
438 struct module *module;
439 int (*attach)(<link linkend="comedidevice">comedi_device</link> *,comedi_devconfig *);
440 int (*detach)(<link linkend="comedidevice">comedi_device</link> *);
442 /* number of elements in board_name and board_id arrays */
443 unsigned int num_names;
445 /* offset in bytes from one board name pointer to the next */
456 <section id="driversupportfunctions">
458 Generic driver support functions
463 <filename role=directory>comedi</filename> contains a large set of
464 support functions. Some of the most important ones are given below.
467 From <filename>comedi/comedi_fops.c</filename>, functions to handle the
468 hardware events (which also runs the registered callback function), to
469 get data in and out of the software data buffer, and to parse the
470 incoming functional requests:
472 void comedi_event(<link linkend="comedidevice">comedi_device</link> *dev,<link linkend="comedisubdevice">comedi_subdevice</link> *s,unsigned int mask);
474 int comedi_buf_put(<link linkend="comediasync">comedi_async</link> *async, <link linkend="ref-type-sampl-t">sampl_t</link> x);
475 int comedi_buf_get(<link linkend="comediasync">comedi_async</link> *async, <link linkend="ref-type-sampl-t">sampl_t</link> *x);
477 static int parse_insn(<link linkend="comedidevice">comedi_device</link> *dev,<link linkend="ref-type-comedi-insn">comedi_insn</link> *insn,<link linkend="ref-type-lsampl-t">lsampl_t</link> *data,void *file);
479 The file <filename>comedi/kcomedilib/kcomedilib_main.c</filename> provides
480 functions to register a callback, to poll an ongoing data acquisition,
481 and to print an error message:
483 int comedi_register_callback(<link linkend="ref-type-comedi-t">comedi_t</link> *d,unsigned int subdevice, unsigned int mask,int (*cb)(unsigned int,void *),void *arg);
485 int comedi_poll(<link linkend="ref-type-comedi-t">comedi_t</link> *d, unsigned int subdevice);
487 void comedi_perror(const char *message);
489 The file <filename>comedi/rt.c</filename> provides interrupt handling
490 for real-time tasks (one interrupt per <emphasis>device</emphasis>!):
492 int comedi_request_irq(unsigned irq,void (*handler)(int, void *,struct pt_regs *), unsigned long flags,const char *device,<link linkend="comedidevice">comedi_device</link> *dev_id);
493 void comedi_free_irq(unsigned int irq,<link linkend="comedidevice">comedi_device</link> *dev_id)
502 <section id="boardspecific">
504 Board-specific functionality
508 The <filename role=directory>/usr/src/comedi/comedi/drivers</filename>
509 subdirectory contains
510 the <emphasis role="strong">board-specific</emphasis> device driver
511 code. Each new card must get an entry in this directory.
512 <emphasis role="strong">Or</emphasis>
513 extend the functionality of an already existing driver file if the new
514 card is quite similar to that implemented in an already existing
515 driver. For example, many of the National Instruments DAQ cards use
516 the same driver files.
519 To help device driver writers,
520 &comedi; provides the <quote>skeleton</quote> of a new device driver,
521 in the <filename>comedi/drivers/skel.c</filename> file. Before
522 starting to write a new driver, make sure you understand this file,
523 and compare it to what you find in the other already available
524 board-specific files in the same directory.
527 The first thing you notice in <filename>skel.c</filename> is the
528 documentation section: the &comedi; documentation is partially
529 generated automatically, from the information that is given in this
530 section. So, please comply with the structure and the keywords
531 provided as &comedi; standards.
534 The second part of the device driver contains board-specific static
535 data structure and defines: addresses of hardware registers; defines and
536 function prototypes for functionality that is only used inside of the
537 device driver for this board; the encoding of the types and number of
538 available channels; PCI information; etc.
541 Each driver has to register two functions which are called when you
542 load and unload your board's device driver (typically via a kernel
548 In the <quote>attach</quote> function, memory is allocated for the
549 necessary <link linkend="driverdatastructures">data structures</link>,
550 all properties of a device and its subdevices are defined, and filled
551 in in the generic &comedi; data structures. As part of this, pointers
552 to the low level instructions being supported by the subdevice have to
553 be set, which define the basic functionality. In somewhat more detail,
554 the <function>mydriver_attach()</function> function must:
559 check and request the I/O port region, IRQ, DMA, and other hardware
560 resources. It is convenient here if you verify the existence of the
561 hardware and the correctness of the other information given.
562 Sometimes, unfortunately, this cannot be done.
568 allocate memory for the private data structures.
574 initialize the board registers and possible subdevices (timer, DMA, PCI,
575 hardware FIFO, etc.).
581 return 1, indicating success. If there were any errors along the way,
582 you should return the appropriate error number. If an error is
583 returned, the <function>mydriver_detach()</function> function is
584 called. The <function>mydriver_detach()</function> function should
585 check any resources that may have been allocated and release them as
586 necessary. The &comedi; core frees
587 <function>dev->subdevices</function> and
588 <function>dev->private</function>, so this does not need to be done in
589 <function>detach</function>.
595 If the driver has the possibility to offer asynchronous data
596 acquisition, you have to code an interrupt service routine, event
597 handling routines, and/or callback routines.
602 Typically, you will be able to implement most of
603 the above-mentioned functionality by
604 <emphasis>cut-and-paste</emphasis> from already existing drivers. The
605 <function>mydriver_attach()</function> function needs most of your
606 attention, because it must correctly define and allocate the (private
607 and generic) data structures that are needed for this device. That is,
608 each sub-device and each channel must get appropriate data fields, and
609 an appropriate initialization. The good news, of course, is that
610 &comedi; provides the data structures and the defines that fit very
611 well with almost all DAQ functionalities found on interface cards.
612 These can be found in the
613 <link linkend="comedikernelgeneric">header files</link> of the
614 <filename role=directory>/usr/src/comedi/include/linux/</filename>
618 Drivers for digital IOs should implement the following functions:
623 <function>insn_bits()</function>: drivers set this if they have a
624 function that supports reading and writing multiple bits in a digital
625 I/O subdevice at the same time. Most (if not all) of the drivers use
626 this interface instead of insn_read and insn_write for DIO subdevices.
632 <function>insn_config()</function>: implements INSN_CONFIG
633 instructions. Currently used for configuring the direction of digital
634 I/O lines, although will eventually be used for generic configuration
635 of drivers that is outside the scope of the currently defined &comedi;
641 Finally, the device driver writer must implement the
642 <function>read</function> and <function>write</function> functions for
643 the analog channels on the card:
648 <function>insn_read()</function>: acquire the inputs on the board and
649 transfer them to the software buffer of the driver.
655 <function>insn_write()</function>: transfer data from the software
656 buffer to the card, and execute the appropriate output conversions.
661 In some drivers, you want to catch interrupts, and/or want to use the
662 <link linkend="insn-inttrig">INSN_INTTRIG</link> instruction. In this
663 case, you must provide and register these
664 <link linkend="drivercallbacks">callback</link> functions.
667 Implementation of all of the above-mentioned functions requires
668 perfect knowledge about the hardware registers and addresses of the
669 interface card. In general, you can find
670 <emphasis>some</emphasis> inspiration in the already available device
671 drivers, but don't trust that blind
672 <emphasis>cut-and-paste</emphasis> will bring you far…
677 <section id="drivercallbacks">
679 Callbacks, events and interrupts
683 Continuous acquisition is tyically an
684 <emphasis>asynchronous</emphasis> activity: the function call that
685 has set the acquisition in motion has returned before the acquisition
686 has finished (or even started). So, not only the acquired data must be
687 sent back to the user's buffer <quote>in the background</quote>, but
688 various types of asynchronous <emphasis>event handling</emphasis> can
689 be needed during the acquisition:
694 The <emphasis>hardware</emphasis> can generate some error or
701 Normal functional interrupts are generated by the hardware, e.g.,
702 signalling the filling-up of the card's hardware buffer, or the end of
703 an acquisition <link linkend="scan">scan</link>, etc.
709 The device driver writer can register a driver-supplied
710 <quote>callback</quote> function, that is called at the end of each
711 hardware interrupt routine.
717 Another driver-supplied callback function is executed when the user
718 program launches an <link linkend="insn-inttrig">INSN_INTTRIG</link>
719 instruction. This event handling is executed
720 <emphasis>synchronously</emphasis> with the execution of the
721 triggering instruction.
728 The interrupt handlers are registered through the functions mentioned
729 <link linkend="driversupportfunctions">before</link>
730 The event handling is done in the existing &comedi; drivers in
731 statements such as this one:
733 <anchor id="async-events">
734 s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR
736 It fills in the bits corresponding to particular events in the
737 <link linkend="comediasync">comedi_async</link> data structure.
738 The possible event bits are:
743 <anchor id="comedi-cb-eoa">
744 <parameter>COMEDI_CB_EOA</parameter>: execute the callback at the
745 <quote>End Of-Acquisition</quote>.
751 <anchor id="comedi-cb-eos">
752 <parameter>COMEDI_CB_EOS</parameter>: execute the callback at the
753 <quote>End-Of-Scan</quote>.
759 <anchor id="comedi-cb-overflow">
760 <parameter>COMEDI_CB_OVERFLOW</parameter>: execute the callback when a
761 buffer overflow has occurred.
767 <anchor id="comedi-cb-error">
768 <parameter>COMEDI_CB_ERROR</parameter>: execute the callback at the
769 occurrence of an (undetermined) error.
779 <section id="drivercaveats">
781 Device driver caveats
785 A few things to strive for when writing a new driver:
790 Some DAQ cards consist of different <quote>layers</quote> of hardware,
791 which can each be given their own device driver. Examples are:
792 some of the National Instruments cards, that all share the same
793 <emphasis>Mite</emphasis> PCI driver chip; the ubiquitous parallel
794 port, that can be used for simple digital IO acquisitions. If your
795 new card has such a multi-layer design too, please take the effort to
796 provide drivers for each layer separately.
802 Your hardware driver should be functional appropriate to the resources
803 allocated. I.e., if the driver is fully functional when configured
804 with an IRQ and DMA, it should still function moderately well with
805 just an IRQ, or still do minor tasks without IRQ or DMA. Does your
806 driver really require an IRQ to do digital I/O? Maybe someone will
807 want to use your driver <emphasis>just</emphasis> to do digital I/O
808 and has no interrupts available.
814 Drivers are to have absolutely <emphasis role="strong">no</emphasis>
815 global variables, mainly because the existence of global variables
816 immediately negates any possibility of using the driver for two
817 devices. The pointer <function>dev->private</function> should be used
818 to point to a structure containing any additional variables needed by
819 a driver/device combination.
825 Drivers should report errors and warnings via the
826 <function>comedi_error()</function> function.
827 (This is <emphasis>not</emphasis> the same function as the user-space
828 <link linkend="func-ref-comedi-perror">comedi_perror()</link> function.)
837 <section id="integratingdriver">
839 Integrating the driver in the &comedi; library
843 For integrating new drivers in the &comedi;'s source tree the following
844 things have to be done:
849 Choose a senseful name for the source code file. Let's assume here
850 that you call it <quote>mydriver.c</quote>
856 Put your new driver into <quote>comedi/drivers/mydriver.c</quote>.
862 Edit <quote>comedi/Config.in</quote> and add a new
863 <quote>dep_tristate</quote> line (look at the other examples). Invent a
864 senseful name for the driver's variable. For example:
866 dep_tristate 'MYDRIVER' CONFIG_COMEDI_MYDRIVER $CONFIG_COMEDI
873 Add a line to <quote>comedi/drivers/Makefile.in</quote>, using your
874 freshly defined variable, i.e., CONFIG_COMEDI_MYDRIVER.
880 Now <command>make distclean</command>, reconfigure &comedi; with a new
881 <command>make</command>, rebuild and be happy.
884 If you want to have your driver included in the &comedi; distribution
885 (you <emphasis>definitely</emphasis> want to :-) ) send it to David
886 Schleef <address><email>ds@schleef.org</email></address> for
887 review and integration.