ni_daq_700.c revision 9a16a92c11e82a0a80b4847343cfb8b5c54ed6b6
1/*
2 *     comedi/drivers/ni_daq_700.c
3 *     Driver for DAQCard-700 DIO only
4 *     copied from 8255
5 *
6 *     COMEDI - Linux Control and Measurement Device Interface
7 *     Copyright (C) 1998 David A. Schleef <ds@schleef.org>
8 *
9 *     This program is free software; you can redistribute it and/or modify
10 *     it under the terms of the GNU General Public License as published by
11 *     the Free Software Foundation; either version 2 of the License, or
12 *     (at your option) any later version.
13 *
14 *     This program is distributed in the hope that it will be useful,
15 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *     GNU General Public License for more details.
18 *
19 *     You should have received a copy of the GNU General Public License
20 *     along with this program; if not, write to the Free Software
21 *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25/*
26Driver: ni_daq_700
27Description: National Instruments PCMCIA DAQCard-700 DIO only
28Author: Fred Brooks <nsaspook@nsaspook.com>,
29  based on ni_daq_dio24 by Daniel Vecino Castel <dvecino@able.es>
30Devices: [National Instruments] PCMCIA DAQ-Card-700 (ni_daq_700)
31Status: works
32Updated: Thu, 21 Feb 2008 12:07:20 +0000
33
34The daqcard-700 appears in Comedi as a single digital I/O subdevice with
3516 channels.  The channel 0 corresponds to the daqcard-700's output
36port, bit 0; channel 8 corresponds to the input port, bit 0.
37
38Direction configuration: channels 0-7 output, 8-15 input (8225 device
39emu as port A output, port B input, port C N/A).
40
41IRQ is assigned but not used.
42*/
43
44#include <linux/interrupt.h>
45#include "../comedidev.h"
46
47#include <linux/ioport.h>
48
49#include <pcmcia/cs_types.h>
50#include <pcmcia/cs.h>
51#include <pcmcia/cistpl.h>
52#include <pcmcia/cisreg.h>
53#include <pcmcia/ds.h>
54
55static struct pcmcia_device *pcmcia_cur_dev = NULL;
56
57#define DIO700_SIZE 8		/*  size of io region used by board */
58
59static int dio700_attach(struct comedi_device *dev,
60			 struct comedi_devconfig *it);
61static int dio700_detach(struct comedi_device *dev);
62
63enum dio700_bustype { pcmcia_bustype };
64
65struct dio700_board {
66	const char *name;
67	int device_id;		/*  device id for pcmcia board */
68	enum dio700_bustype bustype;	/*  PCMCIA */
69	int have_dio;		/*  have daqcard-700 dio */
70	/*  function pointers so we can use inb/outb or readb/writeb */
71	/*  as appropriate */
72	unsigned int (*read_byte) (unsigned int address);
73	void (*write_byte) (unsigned int byte, unsigned int address);
74};
75
76static const struct dio700_board dio700_boards[] = {
77	{
78	 .name = "daqcard-700",
79	  /*  0x10b is manufacturer id, 0x4743 is device id */
80	 .device_id = 0x4743,
81	 .bustype = pcmcia_bustype,
82	 .have_dio = 1,
83	 },
84	{
85	 .name = "ni_daq_700",
86	  /*  0x10b is manufacturer id, 0x4743 is device id */
87	 .device_id = 0x4743,
88	 .bustype = pcmcia_bustype,
89	 .have_dio = 1,
90	 },
91};
92
93/*
94 * Useful for shorthand access to the particular board structure
95 */
96#define thisboard ((const struct dio700_board *)dev->board_ptr)
97
98struct dio700_private {
99
100	int data;		/* number of data points left to be taken */
101};
102
103#define devpriv ((struct dio700_private *)dev->private)
104
105static struct comedi_driver driver_dio700 = {
106	.driver_name = "ni_daq_700",
107	.module = THIS_MODULE,
108	.attach = dio700_attach,
109	.detach = dio700_detach,
110	.num_names = ARRAY_SIZE(dio700_boards),
111	.board_name = &dio700_boards[0].name,
112	.offset = sizeof(struct dio700_board),
113};
114
115/*	the real driver routines	*/
116
117#define _700_SIZE 8
118
119#define _700_DATA 0
120
121#define DIO_W		0x04
122#define DIO_R		0x05
123
124struct subdev_700_struct {
125	unsigned long cb_arg;
126	int (*cb_func) (int, int, int, unsigned long);
127	int have_irq;
128};
129
130#define CALLBACK_ARG	(((struct subdev_700_struct *)s->private)->cb_arg)
131#define CALLBACK_FUNC	(((struct subdev_700_struct *)s->private)->cb_func)
132#define subdevpriv	((struct subdev_700_struct *)s->private)
133
134static void do_config(struct comedi_device *dev, struct comedi_subdevice *s);
135
136void subdev_700_interrupt(struct comedi_device *dev, struct comedi_subdevice *s)
137{
138	short d;
139
140	d = CALLBACK_FUNC(0, _700_DATA, 0, CALLBACK_ARG);
141
142	comedi_buf_put(s->async, d);
143	s->async->events |= COMEDI_CB_EOS;
144
145	comedi_event(dev, s);
146}
147
148static int subdev_700_cb(int dir, int port, int data, unsigned long arg)
149{
150	/* port is always A for output and B for input (8255 emu) */
151	unsigned long iobase = arg;
152
153	if (dir) {
154		outb(data, iobase + DIO_W);
155		return 0;
156	} else {
157		return inb(iobase + DIO_R);
158	}
159}
160
161static int subdev_700_insn(struct comedi_device *dev,
162			   struct comedi_subdevice *s, struct comedi_insn *insn,
163			   unsigned int *data)
164{
165	if (data[0]) {
166		s->state &= ~data[0];
167		s->state |= (data[0] & data[1]);
168
169		if (data[0] & 0xff)
170			CALLBACK_FUNC(1, _700_DATA, s->state & 0xff,
171				      CALLBACK_ARG);
172	}
173
174	data[1] = s->state & 0xff;
175	data[1] |= CALLBACK_FUNC(0, _700_DATA, 0, CALLBACK_ARG) << 8;
176
177	return 2;
178}
179
180static int subdev_700_insn_config(struct comedi_device *dev,
181				  struct comedi_subdevice *s,
182				  struct comedi_insn *insn, unsigned int *data)
183{
184
185	switch (data[0]) {
186	case INSN_CONFIG_DIO_INPUT:
187		break;
188	case INSN_CONFIG_DIO_OUTPUT:
189		break;
190	case INSN_CONFIG_DIO_QUERY:
191		data[1] =
192		    (s->
193		     io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT :
194		    COMEDI_INPUT;
195		return insn->n;
196		break;
197	default:
198		return -EINVAL;
199	}
200
201	return 1;
202}
203
204static void do_config(struct comedi_device *dev, struct comedi_subdevice *s)
205{				/* use powerup defaults */
206	return;
207}
208
209static int subdev_700_cmdtest(struct comedi_device *dev,
210			      struct comedi_subdevice *s,
211			      struct comedi_cmd *cmd)
212{
213	int err = 0;
214	unsigned int tmp;
215
216	/* step 1 */
217
218	tmp = cmd->start_src;
219	cmd->start_src &= TRIG_NOW;
220	if (!cmd->start_src || tmp != cmd->start_src)
221		err++;
222
223	tmp = cmd->scan_begin_src;
224	cmd->scan_begin_src &= TRIG_EXT;
225	if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src)
226		err++;
227
228	tmp = cmd->convert_src;
229	cmd->convert_src &= TRIG_FOLLOW;
230	if (!cmd->convert_src || tmp != cmd->convert_src)
231		err++;
232
233	tmp = cmd->scan_end_src;
234	cmd->scan_end_src &= TRIG_COUNT;
235	if (!cmd->scan_end_src || tmp != cmd->scan_end_src)
236		err++;
237
238	tmp = cmd->stop_src;
239	cmd->stop_src &= TRIG_NONE;
240	if (!cmd->stop_src || tmp != cmd->stop_src)
241		err++;
242
243	if (err)
244		return 1;
245
246	/* step 2 */
247
248	if (err)
249		return 2;
250
251	/* step 3 */
252
253	if (cmd->start_arg != 0) {
254		cmd->start_arg = 0;
255		err++;
256	}
257	if (cmd->scan_begin_arg != 0) {
258		cmd->scan_begin_arg = 0;
259		err++;
260	}
261	if (cmd->convert_arg != 0) {
262		cmd->convert_arg = 0;
263		err++;
264	}
265	if (cmd->scan_end_arg != 1) {
266		cmd->scan_end_arg = 1;
267		err++;
268	}
269	if (cmd->stop_arg != 0) {
270		cmd->stop_arg = 0;
271		err++;
272	}
273
274	if (err)
275		return 3;
276
277	/* step 4 */
278
279	if (err)
280		return 4;
281
282	return 0;
283}
284
285static int subdev_700_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
286{
287	/* FIXME */
288
289	return 0;
290}
291
292static int subdev_700_cancel(struct comedi_device *dev,
293			     struct comedi_subdevice *s)
294{
295	/* FIXME */
296
297	return 0;
298}
299
300int subdev_700_init(struct comedi_device *dev, struct comedi_subdevice *s,
301		    int (*cb) (int, int, int, unsigned long), unsigned long arg)
302{
303	s->type = COMEDI_SUBD_DIO;
304	s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
305	s->n_chan = 16;
306	s->range_table = &range_digital;
307	s->maxdata = 1;
308
309	s->private = kmalloc(sizeof(struct subdev_700_struct), GFP_KERNEL);
310	if (!s->private)
311		return -ENOMEM;
312
313	CALLBACK_ARG = arg;
314	if (cb == NULL)
315		CALLBACK_FUNC = subdev_700_cb;
316	 else
317		CALLBACK_FUNC = cb;
318
319	s->insn_bits = subdev_700_insn;
320	s->insn_config = subdev_700_insn_config;
321
322	s->state = 0;
323	s->io_bits = 0x00ff;
324	do_config(dev, s);
325
326	return 0;
327}
328
329int subdev_700_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
330			int (*cb) (int, int, int, unsigned long),
331			unsigned long arg)
332{
333	int ret;
334
335	ret = subdev_700_init(dev, s, cb, arg);
336	if (ret < 0)
337		return ret;
338
339	s->do_cmdtest = subdev_700_cmdtest;
340	s->do_cmd = subdev_700_cmd;
341	s->cancel = subdev_700_cancel;
342
343	subdevpriv->have_irq = 1;
344
345	return 0;
346}
347
348void subdev_700_cleanup(struct comedi_device *dev, struct comedi_subdevice *s)
349{
350	if (s->private)
351		if (subdevpriv->have_irq)
352
353			kfree(s->private);
354}
355
356EXPORT_SYMBOL(subdev_700_init);
357EXPORT_SYMBOL(subdev_700_init_irq);
358EXPORT_SYMBOL(subdev_700_cleanup);
359EXPORT_SYMBOL(subdev_700_interrupt);
360
361static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it)
362{
363	struct comedi_subdevice *s;
364	unsigned long iobase = 0;
365#ifdef incomplete
366	unsigned int irq = 0;
367#endif
368	struct pcmcia_device *link;
369
370	/* allocate and initialize dev->private */
371	if (alloc_private(dev, sizeof(struct dio700_private)) < 0)
372		return -ENOMEM;
373
374	/*  get base address, irq etc. based on bustype */
375	switch (thisboard->bustype) {
376	case pcmcia_bustype:
377		link = pcmcia_cur_dev;	/* XXX hack */
378		if (!link)
379			return -EIO;
380		iobase = link->io.BasePort1;
381#ifdef incomplete
382		irq = link->irq.AssignedIRQ;
383#endif
384		break;
385	default:
386		printk("bug! couldn't determine board type\n");
387		return -EINVAL;
388		break;
389	}
390	printk("comedi%d: ni_daq_700: %s, io 0x%lx", dev->minor,
391	       thisboard->name, iobase);
392#ifdef incomplete
393	if (irq)
394		printk(", irq %u", irq);
395
396#endif
397
398	printk("\n");
399
400	if (iobase == 0) {
401		printk("io base address is zero!\n");
402		return -EINVAL;
403	}
404
405	dev->iobase = iobase;
406
407#ifdef incomplete
408	/* grab our IRQ */
409	dev->irq = irq;
410#endif
411
412	dev->board_name = thisboard->name;
413
414	if (alloc_subdevices(dev, 1) < 0)
415		return -ENOMEM;
416
417	/* DAQCard-700 dio */
418	s = dev->subdevices + 0;
419	subdev_700_init(dev, s, NULL, dev->iobase);
420
421	return 0;
422};
423
424static int dio700_detach(struct comedi_device *dev)
425{
426	printk("comedi%d: ni_daq_700: cs-remove\n", dev->minor);
427
428	if (dev->subdevices)
429		subdev_700_cleanup(dev, dev->subdevices + 0);
430
431	if (thisboard->bustype != pcmcia_bustype && dev->iobase)
432		release_region(dev->iobase, DIO700_SIZE);
433	if (dev->irq)
434		free_irq(dev->irq, dev);
435
436	return 0;
437};
438
439/* PCMCIA crap -- watch your words, please! */
440
441static void dio700_config(struct pcmcia_device *link);
442static void dio700_release(struct pcmcia_device *link);
443static int dio700_cs_suspend(struct pcmcia_device *p_dev);
444static int dio700_cs_resume(struct pcmcia_device *p_dev);
445
446/*
447   The attach() and detach() entry points are used to create and destroy
448   "instances" of the driver, where each instance represents everything
449   needed to manage one actual PCMCIA card.
450*/
451
452static int dio700_cs_attach(struct pcmcia_device *);
453static void dio700_cs_detach(struct pcmcia_device *);
454
455/*
456   You'll also need to prototype all the functions that will actually
457   be used to talk to your device.  See 'memory_cs' for a good example
458   of a fully self-sufficient driver; the other drivers rely more or
459   less on other parts of the kernel.
460*/
461
462/*
463   The dev_info variable is the "key" that is used to match up this
464   device driver with appropriate cards, through the card configuration
465   database.
466*/
467
468static const dev_info_t dev_info = "ni_daq_700";
469
470struct local_info_t {
471	struct pcmcia_device *link;
472	dev_node_t node;
473	int stop;
474	struct bus_operations *bus;
475};
476
477/*======================================================================
478
479    dio700_cs_attach() creates an "instance" of the driver, allocating
480    local data structures for one device.  The device is registered
481    with Card Services.
482
483    The dev_link structure is initialized, but we don't actually
484    configure the card at this point -- we wait until we receive a
485    card insertion event.
486
487======================================================================*/
488
489static int dio700_cs_attach(struct pcmcia_device *link)
490{
491	struct local_info_t *local;
492
493	printk(KERN_INFO "ni_daq_700:  cs-attach\n");
494
495	dev_dbg(&link->dev, "dio700_cs_attach()\n");
496
497	/* Allocate space for private device-specific data */
498	local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL);
499	if (!local)
500		return -ENOMEM;
501	local->link = link;
502	link->priv = local;
503
504	/* Interrupt setup */
505	link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
506	link->irq.Handler = NULL;
507
508	/*
509	   General socket configuration defaults can go here.  In this
510	   client, we assume very little, and rely on the CIS for almost
511	   everything.  In most clients, many details (i.e., number, sizes,
512	   and attributes of IO windows) are fixed by the nature of the
513	   device, and can be hard-wired here.
514	 */
515	link->conf.Attributes = 0;
516	link->conf.IntType = INT_MEMORY_AND_IO;
517
518	pcmcia_cur_dev = link;
519
520	dio700_config(link);
521
522	return 0;
523}				/* dio700_cs_attach */
524
525/*======================================================================
526
527    This deletes a driver "instance".  The device is de-registered
528    with Card Services.  If it has been released, all local data
529    structures are freed.  Otherwise, the structures will be freed
530    when the device is released.
531
532======================================================================*/
533
534static void dio700_cs_detach(struct pcmcia_device *link)
535{
536
537	printk(KERN_INFO "ni_daq_700: cs-detach!\n");
538
539	dev_dbg(&link->dev, "dio700_cs_detach\n");
540
541	if (link->dev_node) {
542		((struct local_info_t *)link->priv)->stop = 1;
543		dio700_release(link);
544	}
545
546	/* This points to the parent struct local_info_t struct */
547	if (link->priv)
548		kfree(link->priv);
549
550}				/* dio700_cs_detach */
551
552/*======================================================================
553
554    dio700_config() is scheduled to run after a CARD_INSERTION event
555    is received, to configure the PCMCIA socket, and to make the
556    device available to the system.
557
558======================================================================*/
559
560static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
561				cistpl_cftable_entry_t *cfg,
562				cistpl_cftable_entry_t *dflt,
563				unsigned int vcc,
564				void *priv_data)
565{
566	win_req_t *req = priv_data;
567	memreq_t map;
568
569	if (cfg->index == 0)
570		return -ENODEV;
571
572	/* Does this card need audio output? */
573	if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
574		p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
575		p_dev->conf.Status = CCSR_AUDIO_ENA;
576	}
577
578	/* Do we need to allocate an interrupt? */
579	if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
580		p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
581
582	/* IO window settings */
583	p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
584	if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
585		cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
586		p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
587		if (!(io->flags & CISTPL_IO_8BIT))
588			p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
589		if (!(io->flags & CISTPL_IO_16BIT))
590			p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
591		p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
592		p_dev->io.BasePort1 = io->win[0].base;
593		p_dev->io.NumPorts1 = io->win[0].len;
594		if (io->nwin > 1) {
595			p_dev->io.Attributes2 = p_dev->io.Attributes1;
596			p_dev->io.BasePort2 = io->win[1].base;
597			p_dev->io.NumPorts2 = io->win[1].len;
598		}
599		/* This reserves IO space but doesn't actually enable it */
600		if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
601			return -ENODEV;
602	}
603
604	if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
605		cistpl_mem_t *mem =
606			(cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
607		req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM;
608		req->Attributes |= WIN_ENABLE;
609		req->Base = mem->win[0].host_addr;
610		req->Size = mem->win[0].len;
611		if (req->Size < 0x1000)
612			req->Size = 0x1000;
613		req->AccessSpeed = 0;
614		if (pcmcia_request_window(p_dev, req, &p_dev->win))
615			return -ENODEV;
616		map.Page = 0;
617		map.CardOffset = mem->win[0].card_addr;
618		if (pcmcia_map_mem_page(p_dev, p_dev->win, &map))
619			return -ENODEV;
620	}
621	/* If we got this far, we're cool! */
622	return 0;
623}
624
625static void dio700_config(struct pcmcia_device *link)
626{
627	struct local_info_t *dev = link->priv;
628	win_req_t req;
629	int ret;
630
631	printk(KERN_INFO "ni_daq_700:  cs-config\n");
632
633	dev_dbg(&link->dev, "dio700_config\n");
634
635	ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req);
636	if (ret) {
637		dev_warn(&link->dev, "no configuration found\n");
638		goto failed;
639	}
640
641	/*
642	   Allocate an interrupt line.  Note that this does not assign a
643	   handler to the interrupt, unless the 'Handler' member of the
644	   irq structure is initialized.
645	 */
646	if (link->conf.Attributes & CONF_ENABLE_IRQ) {
647		ret = pcmcia_request_irq(link, &link->irq);
648		if (ret)
649			goto failed;
650	}
651
652	/*
653	   This actually configures the PCMCIA socket -- setting up
654	   the I/O windows and the interrupt mapping, and putting the
655	   card and host interface into "Memory and IO" mode.
656	 */
657	ret = pcmcia_request_configuration(link, &link->conf);
658	if (ret != 0)
659		goto failed;
660
661	/*
662	   At this point, the dev_node_t structure(s) need to be
663	   initialized and arranged in a linked list at link->dev.
664	 */
665	sprintf(dev->node.dev_name, "ni_daq_700");
666	dev->node.major = dev->node.minor = 0;
667	link->dev_node = &dev->node;
668
669	/* Finally, report what we've done */
670	printk(KERN_INFO "%s: index 0x%02x",
671	       dev->node.dev_name, link->conf.ConfigIndex);
672	if (link->conf.Attributes & CONF_ENABLE_IRQ)
673		printk(", irq %d", link->irq.AssignedIRQ);
674	if (link->io.NumPorts1)
675		printk(", io 0x%04x-0x%04x", link->io.BasePort1,
676		       link->io.BasePort1 + link->io.NumPorts1 - 1);
677	if (link->io.NumPorts2)
678		printk(" & 0x%04x-0x%04x", link->io.BasePort2,
679		       link->io.BasePort2 + link->io.NumPorts2 - 1);
680	if (link->win)
681		printk(", mem 0x%06lx-0x%06lx", req.Base,
682		       req.Base + req.Size - 1);
683	printk("\n");
684
685	return;
686
687failed:
688	printk(KERN_INFO "ni_daq_700 cs failed");
689	dio700_release(link);
690
691}				/* dio700_config */
692
693static void dio700_release(struct pcmcia_device *link)
694{
695	dev_dbg(&link->dev, "dio700_release\n");
696
697	pcmcia_disable_device(link);
698}				/* dio700_release */
699
700/*======================================================================
701
702    The card status event handler.  Mostly, this schedules other
703    stuff to run after an event is received.
704
705    When a CARD_REMOVAL event is received, we immediately set a
706    private flag to block future accesses to this device.  All the
707    functions that actually access the device should check this flag
708    to make sure the card is still present.
709
710======================================================================*/
711
712static int dio700_cs_suspend(struct pcmcia_device *link)
713{
714	struct local_info_t *local = link->priv;
715
716	/* Mark the device as stopped, to block IO until later */
717	local->stop = 1;
718	return 0;
719}				/* dio700_cs_suspend */
720
721static int dio700_cs_resume(struct pcmcia_device *link)
722{
723	struct local_info_t *local = link->priv;
724
725	local->stop = 0;
726	return 0;
727}				/* dio700_cs_resume */
728
729/*====================================================================*/
730
731static struct pcmcia_device_id dio700_cs_ids[] = {
732	/* N.B. These IDs should match those in dio700_boards */
733	PCMCIA_DEVICE_MANF_CARD(0x010b, 0x4743),	/* daqcard-700 */
734	PCMCIA_DEVICE_NULL
735};
736
737MODULE_LICENSE("GPL");
738MODULE_DEVICE_TABLE(pcmcia, dio700_cs_ids);
739
740struct pcmcia_driver dio700_cs_driver = {
741	.probe = dio700_cs_attach,
742	.remove = dio700_cs_detach,
743	.suspend = dio700_cs_suspend,
744	.resume = dio700_cs_resume,
745	.id_table = dio700_cs_ids,
746	.owner = THIS_MODULE,
747	.drv = {
748		.name = dev_info,
749		},
750};
751
752static int __init init_dio700_cs(void)
753{
754	pcmcia_register_driver(&dio700_cs_driver);
755	return 0;
756}
757
758static void __exit exit_dio700_cs(void)
759{
760	pr_debug("ni_daq_700: unloading\n");
761	pcmcia_unregister_driver(&dio700_cs_driver);
762}
763
764int __init init_module(void)
765{
766	int ret;
767
768	ret = init_dio700_cs();
769	if (ret < 0)
770		return ret;
771
772	return comedi_driver_register(&driver_dio700);
773}
774
775void __exit cleanup_module(void)
776{
777	exit_dio700_cs();
778	comedi_driver_unregister(&driver_dio700);
779}
780