Commit | Line | Data |
---|---|---|
ef2ccffb DS |
1 | /* |
2 | comedi/drivers/ni_6527.c | |
3 | driver for National Instruments PCI-6527 | |
4 | ||
5 | COMEDI - Linux Control and Measurement Device Interface | |
6 | Copyright (C) 1999,2002,2003 David A. Schleef <ds@schleef.org> | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | ||
22 | */ | |
23 | /* | |
24 | Driver: ni_6527 | |
25 | Description: National Instruments 6527 | |
26 | Author: ds | |
27 | Status: works | |
28 | Devices: [National Instruments] PCI-6527 (ni6527), PXI-6527 | |
29 | Updated: Sat, 25 Jan 2003 13:24:40 -0800 | |
30 | ||
31 | ||
32 | */ | |
33 | ||
34 | /* | |
35 | Manuals (available from ftp://ftp.natinst.com/support/manuals) | |
36 | ||
37 | 370106b.pdf 6527 Register Level Programmer Manual | |
38 | ||
39 | */ | |
40 | ||
41 | #define DEBUG 1 | |
42 | #define DEBUG_FLAGS | |
43 | ||
25436dc9 | 44 | #include <linux/interrupt.h> |
ef2ccffb DS |
45 | #include "../comedidev.h" |
46 | ||
47 | #include "mite.h" | |
48 | ||
49 | #define NI6527_DIO_SIZE 4096 | |
50 | #define NI6527_MITE_SIZE 4096 | |
51 | ||
52 | #define Port_Register(x) (0x00+(x)) | |
53 | #define ID_Register 0x06 | |
54 | ||
55 | #define Clear_Register 0x07 | |
56 | #define ClrEdge 0x08 | |
57 | #define ClrOverflow 0x04 | |
58 | #define ClrFilter 0x02 | |
59 | #define ClrInterval 0x01 | |
60 | ||
61 | #define Filter_Interval(x) (0x08+(x)) | |
62 | #define Filter_Enable(x) (0x0c+(x)) | |
63 | ||
64 | #define Change_Status 0x14 | |
65 | #define MasterInterruptStatus 0x04 | |
66 | #define Overflow 0x02 | |
67 | #define EdgeStatus 0x01 | |
68 | ||
69 | #define Master_Interrupt_Control 0x15 | |
70 | #define FallingEdgeIntEnable 0x10 | |
71 | #define RisingEdgeIntEnable 0x08 | |
72 | #define MasterInterruptEnable 0x04 | |
73 | #define OverflowIntEnable 0x02 | |
74 | #define EdgeIntEnable 0x01 | |
75 | ||
76 | #define Rising_Edge_Detection_Enable(x) (0x018+(x)) | |
77 | #define Falling_Edge_Detection_Enable(x) (0x020+(x)) | |
78 | ||
0a85b6f0 MT |
79 | static int ni6527_attach(struct comedi_device *dev, |
80 | struct comedi_devconfig *it); | |
da91b269 | 81 | static int ni6527_detach(struct comedi_device *dev); |
139dfbdf | 82 | static struct comedi_driver driver_ni6527 = { |
68c3dbff BP |
83 | .driver_name = "ni6527", |
84 | .module = THIS_MODULE, | |
85 | .attach = ni6527_attach, | |
86 | .detach = ni6527_detach, | |
ef2ccffb DS |
87 | }; |
88 | ||
16d38ca3 BP |
89 | struct ni6527_board { |
90 | ||
ef2ccffb DS |
91 | int dev_id; |
92 | const char *name; | |
16d38ca3 BP |
93 | }; |
94 | ||
95 | static const struct ni6527_board ni6527_boards[] = { | |
ef2ccffb | 96 | { |
0a85b6f0 MT |
97 | .dev_id = 0x2b20, |
98 | .name = "pci-6527", | |
99 | }, | |
ef2ccffb | 100 | { |
0a85b6f0 MT |
101 | .dev_id = 0x2b10, |
102 | .name = "pxi-6527", | |
103 | }, | |
ef2ccffb DS |
104 | }; |
105 | ||
b6ac1613 | 106 | #define n_ni6527_boards ARRAY_SIZE(ni6527_boards) |
16d38ca3 | 107 | #define this_board ((const struct ni6527_board *)dev->board_ptr) |
ef2ccffb DS |
108 | |
109 | static DEFINE_PCI_DEVICE_TABLE(ni6527_pci_table) = { | |
4e40cee9 GKH |
110 | {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b10)}, |
111 | {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b20)}, | |
112 | {0} | |
ef2ccffb DS |
113 | }; |
114 | ||
115 | MODULE_DEVICE_TABLE(pci, ni6527_pci_table); | |
116 | ||
f4c6b319 | 117 | struct ni6527_private { |
ef2ccffb DS |
118 | struct mite_struct *mite; |
119 | unsigned int filter_interval; | |
120 | unsigned int filter_enable; | |
f4c6b319 BP |
121 | }; |
122 | ||
123 | #define devpriv ((struct ni6527_private *)dev->private) | |
ef2ccffb | 124 | |
da91b269 | 125 | static int ni6527_find_device(struct comedi_device *dev, int bus, int slot); |
ef2ccffb | 126 | |
0a85b6f0 MT |
127 | static int ni6527_di_insn_config(struct comedi_device *dev, |
128 | struct comedi_subdevice *s, | |
129 | struct comedi_insn *insn, unsigned int *data) | |
ef2ccffb DS |
130 | { |
131 | int chan = CR_CHAN(insn->chanspec); | |
132 | unsigned int interval; | |
133 | ||
134 | if (insn->n != 2) | |
135 | return -EINVAL; | |
136 | ||
137 | if (data[0] != INSN_CONFIG_FILTER) | |
138 | return -EINVAL; | |
139 | ||
140 | if (data[1]) { | |
141 | interval = (data[1] + 100) / 200; | |
142 | data[1] = interval * 200; | |
143 | ||
144 | if (interval != devpriv->filter_interval) { | |
145 | writeb(interval & 0xff, | |
0a85b6f0 | 146 | devpriv->mite->daq_io_addr + Filter_Interval(0)); |
ef2ccffb | 147 | writeb((interval >> 8) & 0xff, |
0a85b6f0 | 148 | devpriv->mite->daq_io_addr + Filter_Interval(1)); |
ef2ccffb | 149 | writeb((interval >> 16) & 0x0f, |
0a85b6f0 | 150 | devpriv->mite->daq_io_addr + Filter_Interval(2)); |
ef2ccffb DS |
151 | |
152 | writeb(ClrInterval, | |
0a85b6f0 | 153 | devpriv->mite->daq_io_addr + Clear_Register); |
ef2ccffb DS |
154 | |
155 | devpriv->filter_interval = interval; | |
156 | } | |
157 | ||
158 | devpriv->filter_enable |= 1 << chan; | |
159 | } else { | |
160 | devpriv->filter_enable &= ~(1 << chan); | |
161 | } | |
162 | ||
163 | writeb(devpriv->filter_enable, | |
0a85b6f0 | 164 | devpriv->mite->daq_io_addr + Filter_Enable(0)); |
ef2ccffb | 165 | writeb(devpriv->filter_enable >> 8, |
0a85b6f0 | 166 | devpriv->mite->daq_io_addr + Filter_Enable(1)); |
ef2ccffb | 167 | writeb(devpriv->filter_enable >> 16, |
0a85b6f0 | 168 | devpriv->mite->daq_io_addr + Filter_Enable(2)); |
ef2ccffb DS |
169 | |
170 | return 2; | |
171 | } | |
172 | ||
0a85b6f0 MT |
173 | static int ni6527_di_insn_bits(struct comedi_device *dev, |
174 | struct comedi_subdevice *s, | |
175 | struct comedi_insn *insn, unsigned int *data) | |
ef2ccffb DS |
176 | { |
177 | if (insn->n != 2) | |
178 | return -EINVAL; | |
179 | ||
180 | data[1] = readb(devpriv->mite->daq_io_addr + Port_Register(0)); | |
181 | data[1] |= readb(devpriv->mite->daq_io_addr + Port_Register(1)) << 8; | |
182 | data[1] |= readb(devpriv->mite->daq_io_addr + Port_Register(2)) << 16; | |
183 | ||
184 | return 2; | |
185 | } | |
186 | ||
0a85b6f0 MT |
187 | static int ni6527_do_insn_bits(struct comedi_device *dev, |
188 | struct comedi_subdevice *s, | |
189 | struct comedi_insn *insn, unsigned int *data) | |
ef2ccffb DS |
190 | { |
191 | if (insn->n != 2) | |
192 | return -EINVAL; | |
193 | if (data[0]) { | |
194 | s->state &= ~data[0]; | |
195 | s->state |= (data[0] & data[1]); | |
196 | ||
197 | /* The open relay state on the board cooresponds to 1, | |
198 | * but in Comedi, it is represented by 0. */ | |
199 | if (data[0] & 0x0000ff) { | |
200 | writeb((s->state ^ 0xff), | |
0a85b6f0 | 201 | devpriv->mite->daq_io_addr + Port_Register(3)); |
ef2ccffb DS |
202 | } |
203 | if (data[0] & 0x00ff00) { | |
204 | writeb((s->state >> 8) ^ 0xff, | |
0a85b6f0 | 205 | devpriv->mite->daq_io_addr + Port_Register(4)); |
ef2ccffb DS |
206 | } |
207 | if (data[0] & 0xff0000) { | |
208 | writeb((s->state >> 16) ^ 0xff, | |
0a85b6f0 | 209 | devpriv->mite->daq_io_addr + Port_Register(5)); |
ef2ccffb DS |
210 | } |
211 | } | |
212 | data[1] = s->state; | |
213 | ||
214 | return 2; | |
215 | } | |
216 | ||
70265d24 | 217 | static irqreturn_t ni6527_interrupt(int irq, void *d) |
ef2ccffb | 218 | { |
71b5f4f1 | 219 | struct comedi_device *dev = d; |
34c43922 | 220 | struct comedi_subdevice *s = dev->subdevices + 2; |
ef2ccffb DS |
221 | unsigned int status; |
222 | ||
223 | status = readb(devpriv->mite->daq_io_addr + Change_Status); | |
224 | if ((status & MasterInterruptStatus) == 0) | |
225 | return IRQ_NONE; | |
226 | if ((status & EdgeStatus) == 0) | |
227 | return IRQ_NONE; | |
228 | ||
229 | writeb(ClrEdge | ClrOverflow, | |
0a85b6f0 | 230 | devpriv->mite->daq_io_addr + Clear_Register); |
ef2ccffb DS |
231 | |
232 | comedi_buf_put(s->async, 0); | |
233 | s->async->events |= COMEDI_CB_EOS; | |
234 | comedi_event(dev, s); | |
235 | return IRQ_HANDLED; | |
236 | } | |
237 | ||
0a85b6f0 MT |
238 | static int ni6527_intr_cmdtest(struct comedi_device *dev, |
239 | struct comedi_subdevice *s, | |
240 | struct comedi_cmd *cmd) | |
ef2ccffb DS |
241 | { |
242 | int err = 0; | |
243 | int tmp; | |
244 | ||
245 | /* step 1: make sure trigger sources are trivially valid */ | |
246 | ||
247 | tmp = cmd->start_src; | |
248 | cmd->start_src &= TRIG_NOW; | |
249 | if (!cmd->start_src || tmp != cmd->start_src) | |
250 | err++; | |
251 | ||
252 | tmp = cmd->scan_begin_src; | |
253 | cmd->scan_begin_src &= TRIG_OTHER; | |
254 | if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) | |
255 | err++; | |
256 | ||
257 | tmp = cmd->convert_src; | |
258 | cmd->convert_src &= TRIG_FOLLOW; | |
259 | if (!cmd->convert_src || tmp != cmd->convert_src) | |
260 | err++; | |
261 | ||
262 | tmp = cmd->scan_end_src; | |
263 | cmd->scan_end_src &= TRIG_COUNT; | |
264 | if (!cmd->scan_end_src || tmp != cmd->scan_end_src) | |
265 | err++; | |
266 | ||
267 | tmp = cmd->stop_src; | |
268 | cmd->stop_src &= TRIG_COUNT; | |
269 | if (!cmd->stop_src || tmp != cmd->stop_src) | |
270 | err++; | |
271 | ||
272 | if (err) | |
273 | return 1; | |
274 | ||
a8c5c198 KG |
275 | /* step 2: make sure trigger sources are unique and */ |
276 | /* are mutually compatible */ | |
ef2ccffb DS |
277 | |
278 | if (err) | |
279 | return 2; | |
280 | ||
281 | /* step 3: make sure arguments are trivially compatible */ | |
282 | ||
283 | if (cmd->start_arg != 0) { | |
284 | cmd->start_arg = 0; | |
285 | err++; | |
286 | } | |
287 | if (cmd->scan_begin_arg != 0) { | |
288 | cmd->scan_begin_arg = 0; | |
289 | err++; | |
290 | } | |
291 | if (cmd->convert_arg != 0) { | |
292 | cmd->convert_arg = 0; | |
293 | err++; | |
294 | } | |
295 | ||
296 | if (cmd->scan_end_arg != 1) { | |
297 | cmd->scan_end_arg = 1; | |
298 | err++; | |
299 | } | |
300 | if (cmd->stop_arg != 0) { | |
301 | cmd->stop_arg = 0; | |
302 | err++; | |
303 | } | |
304 | ||
305 | if (err) | |
306 | return 3; | |
307 | ||
308 | /* step 4: fix up any arguments */ | |
309 | ||
310 | if (err) | |
311 | return 4; | |
312 | ||
313 | return 0; | |
314 | } | |
315 | ||
0a85b6f0 MT |
316 | static int ni6527_intr_cmd(struct comedi_device *dev, |
317 | struct comedi_subdevice *s) | |
ef2ccffb | 318 | { |
2696fb57 | 319 | /* struct comedi_cmd *cmd = &s->async->cmd; */ |
ef2ccffb DS |
320 | |
321 | writeb(ClrEdge | ClrOverflow, | |
0a85b6f0 | 322 | devpriv->mite->daq_io_addr + Clear_Register); |
ef2ccffb | 323 | writeb(FallingEdgeIntEnable | RisingEdgeIntEnable | |
0a85b6f0 MT |
324 | MasterInterruptEnable | EdgeIntEnable, |
325 | devpriv->mite->daq_io_addr + Master_Interrupt_Control); | |
ef2ccffb DS |
326 | |
327 | return 0; | |
328 | } | |
329 | ||
0a85b6f0 MT |
330 | static int ni6527_intr_cancel(struct comedi_device *dev, |
331 | struct comedi_subdevice *s) | |
ef2ccffb DS |
332 | { |
333 | writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control); | |
334 | ||
335 | return 0; | |
336 | } | |
337 | ||
0a85b6f0 MT |
338 | static int ni6527_intr_insn_bits(struct comedi_device *dev, |
339 | struct comedi_subdevice *s, | |
340 | struct comedi_insn *insn, unsigned int *data) | |
ef2ccffb DS |
341 | { |
342 | if (insn->n < 1) | |
343 | return -EINVAL; | |
344 | ||
345 | data[1] = 0; | |
346 | return 2; | |
347 | } | |
348 | ||
0a85b6f0 MT |
349 | static int ni6527_intr_insn_config(struct comedi_device *dev, |
350 | struct comedi_subdevice *s, | |
351 | struct comedi_insn *insn, unsigned int *data) | |
ef2ccffb DS |
352 | { |
353 | if (insn->n < 1) | |
354 | return -EINVAL; | |
355 | if (data[0] != INSN_CONFIG_CHANGE_NOTIFY) | |
356 | return -EINVAL; | |
357 | ||
358 | writeb(data[1], | |
0a85b6f0 | 359 | devpriv->mite->daq_io_addr + Rising_Edge_Detection_Enable(0)); |
ef2ccffb | 360 | writeb(data[1] >> 8, |
0a85b6f0 | 361 | devpriv->mite->daq_io_addr + Rising_Edge_Detection_Enable(1)); |
ef2ccffb | 362 | writeb(data[1] >> 16, |
0a85b6f0 | 363 | devpriv->mite->daq_io_addr + Rising_Edge_Detection_Enable(2)); |
ef2ccffb DS |
364 | |
365 | writeb(data[2], | |
0a85b6f0 | 366 | devpriv->mite->daq_io_addr + Falling_Edge_Detection_Enable(0)); |
ef2ccffb | 367 | writeb(data[2] >> 8, |
0a85b6f0 | 368 | devpriv->mite->daq_io_addr + Falling_Edge_Detection_Enable(1)); |
ef2ccffb | 369 | writeb(data[2] >> 16, |
0a85b6f0 | 370 | devpriv->mite->daq_io_addr + Falling_Edge_Detection_Enable(2)); |
ef2ccffb DS |
371 | |
372 | return 2; | |
373 | } | |
374 | ||
da91b269 | 375 | static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it) |
ef2ccffb | 376 | { |
34c43922 | 377 | struct comedi_subdevice *s; |
ef2ccffb DS |
378 | int ret; |
379 | ||
a8c5c198 | 380 | printk(KERN_INFO "comedi%d: ni6527\n", dev->minor); |
ef2ccffb | 381 | |
c3744138 BP |
382 | ret = alloc_private(dev, sizeof(struct ni6527_private)); |
383 | if (ret < 0) | |
ef2ccffb DS |
384 | return ret; |
385 | ||
386 | ret = ni6527_find_device(dev, it->options[0], it->options[1]); | |
387 | if (ret < 0) | |
388 | return ret; | |
389 | ||
390 | ret = mite_setup(devpriv->mite); | |
391 | if (ret < 0) { | |
a8c5c198 | 392 | printk(KERN_ERR "comedi: error setting up mite\n"); |
ef2ccffb DS |
393 | return ret; |
394 | } | |
395 | ||
396 | dev->board_name = this_board->name; | |
a8c5c198 KG |
397 | printk(KERN_INFO "comedi board: %s, ID=0x%02x\n", dev->board_name, |
398 | readb(devpriv->mite->daq_io_addr + ID_Register)); | |
ef2ccffb | 399 | |
c3744138 BP |
400 | ret = alloc_subdevices(dev, 3); |
401 | if (ret < 0) | |
ef2ccffb DS |
402 | return ret; |
403 | ||
404 | s = dev->subdevices + 0; | |
405 | s->type = COMEDI_SUBD_DI; | |
406 | s->subdev_flags = SDF_READABLE; | |
407 | s->n_chan = 24; | |
408 | s->range_table = &range_digital; | |
409 | s->maxdata = 1; | |
410 | s->insn_config = ni6527_di_insn_config; | |
411 | s->insn_bits = ni6527_di_insn_bits; | |
412 | ||
413 | s = dev->subdevices + 1; | |
414 | s->type = COMEDI_SUBD_DO; | |
415 | s->subdev_flags = SDF_READABLE | SDF_WRITABLE; | |
416 | s->n_chan = 24; | |
a8c5c198 | 417 | s->range_table = &range_unknown; /* FIXME: actually conductance */ |
ef2ccffb DS |
418 | s->maxdata = 1; |
419 | s->insn_bits = ni6527_do_insn_bits; | |
420 | ||
421 | s = dev->subdevices + 2; | |
422 | dev->read_subdev = s; | |
423 | s->type = COMEDI_SUBD_DI; | |
424 | s->subdev_flags = SDF_READABLE | SDF_CMD_READ; | |
425 | s->n_chan = 1; | |
426 | s->range_table = &range_unknown; | |
427 | s->maxdata = 1; | |
428 | s->do_cmdtest = ni6527_intr_cmdtest; | |
429 | s->do_cmd = ni6527_intr_cmd; | |
430 | s->cancel = ni6527_intr_cancel; | |
431 | s->insn_bits = ni6527_intr_insn_bits; | |
432 | s->insn_config = ni6527_intr_insn_config; | |
433 | ||
434 | writeb(0x00, devpriv->mite->daq_io_addr + Filter_Enable(0)); | |
435 | writeb(0x00, devpriv->mite->daq_io_addr + Filter_Enable(1)); | |
436 | writeb(0x00, devpriv->mite->daq_io_addr + Filter_Enable(2)); | |
437 | ||
438 | writeb(ClrEdge | ClrOverflow | ClrFilter | ClrInterval, | |
0a85b6f0 | 439 | devpriv->mite->daq_io_addr + Clear_Register); |
ef2ccffb DS |
440 | writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control); |
441 | ||
5f74ea14 GKH |
442 | ret = request_irq(mite_irq(devpriv->mite), ni6527_interrupt, |
443 | IRQF_SHARED, "ni6527", dev); | |
a8c5c198 KG |
444 | if (ret < 0) |
445 | printk(KERN_WARNING "comedi i6527 irq not available\n"); | |
446 | else | |
ef2ccffb DS |
447 | dev->irq = mite_irq(devpriv->mite); |
448 | ||
ef2ccffb DS |
449 | return 0; |
450 | } | |
451 | ||
da91b269 | 452 | static int ni6527_detach(struct comedi_device *dev) |
ef2ccffb | 453 | { |
a8c5c198 | 454 | if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr) |
ef2ccffb | 455 | writeb(0x00, |
0a85b6f0 | 456 | devpriv->mite->daq_io_addr + Master_Interrupt_Control); |
ef2ccffb | 457 | |
a8c5c198 | 458 | if (dev->irq) |
5f74ea14 | 459 | free_irq(dev->irq, dev); |
ef2ccffb | 460 | |
a8c5c198 | 461 | if (devpriv && devpriv->mite) |
ef2ccffb | 462 | mite_unsetup(devpriv->mite); |
ef2ccffb DS |
463 | |
464 | return 0; | |
465 | } | |
466 | ||
da91b269 | 467 | static int ni6527_find_device(struct comedi_device *dev, int bus, int slot) |
ef2ccffb DS |
468 | { |
469 | struct mite_struct *mite; | |
470 | int i; | |
471 | ||
472 | for (mite = mite_devices; mite; mite = mite->next) { | |
473 | if (mite->used) | |
474 | continue; | |
475 | if (bus || slot) { | |
476 | if (bus != mite->pcidev->bus->number || | |
0a85b6f0 | 477 | slot != PCI_SLOT(mite->pcidev->devfn)) |
ef2ccffb DS |
478 | continue; |
479 | } | |
480 | for (i = 0; i < n_ni6527_boards; i++) { | |
481 | if (mite_device_id(mite) == ni6527_boards[i].dev_id) { | |
482 | dev->board_ptr = ni6527_boards + i; | |
483 | devpriv->mite = mite; | |
484 | return 0; | |
485 | } | |
486 | } | |
487 | } | |
a8c5c198 | 488 | printk(KERN_ERR "comedi 6527: no device found\n"); |
ef2ccffb DS |
489 | mite_list_devices(); |
490 | return -EIO; | |
491 | } | |
492 | ||
727b286b AT |
493 | static int __devinit driver_ni6527_pci_probe(struct pci_dev *dev, |
494 | const struct pci_device_id *ent) | |
495 | { | |
496 | return comedi_pci_auto_config(dev, driver_ni6527.driver_name); | |
497 | } | |
498 | ||
499 | static void __devexit driver_ni6527_pci_remove(struct pci_dev *dev) | |
500 | { | |
501 | comedi_pci_auto_unconfig(dev); | |
502 | } | |
503 | ||
504 | static struct pci_driver driver_ni6527_pci_driver = { | |
505 | .id_table = ni6527_pci_table, | |
506 | .probe = &driver_ni6527_pci_probe, | |
507 | .remove = __devexit_p(&driver_ni6527_pci_remove) | |
508 | }; | |
509 | ||
510 | static int __init driver_ni6527_init_module(void) | |
511 | { | |
512 | int retval; | |
513 | ||
514 | retval = comedi_driver_register(&driver_ni6527); | |
515 | if (retval < 0) | |
516 | return retval; | |
517 | ||
518 | driver_ni6527_pci_driver.name = (char *)driver_ni6527.driver_name; | |
519 | return pci_register_driver(&driver_ni6527_pci_driver); | |
520 | } | |
521 | ||
522 | static void __exit driver_ni6527_cleanup_module(void) | |
523 | { | |
524 | pci_unregister_driver(&driver_ni6527_pci_driver); | |
525 | comedi_driver_unregister(&driver_ni6527); | |
526 | } | |
527 | ||
528 | module_init(driver_ni6527_init_module); | |
529 | module_exit(driver_ni6527_cleanup_module); |