Commit | Line | Data |
---|---|---|
0882eaa6 DS |
1 | /* |
2 | comedi/drivers/das08_cs.c | |
3 | DAS08 driver | |
4 | ||
5 | COMEDI - Linux Control and Measurement Device Interface | |
6 | Copyright (C) 2000 David A. Schleef <ds@schleef.org> | |
7 | Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> | |
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 | ||
c332d969 HS |
19 | PCMCIA support code for this driver is adapted from the dummy_cs.c |
20 | driver of the Linux PCMCIA Card Services package. | |
21 | ||
22 | The initial developer of the original code is David A. Hinds | |
23 | <dahinds@users.sourceforge.net>. Portions created by David A. Hinds | |
24 | are Copyright (C) 1999 David A. Hinds. All Rights Reserved. | |
0882eaa6 DS |
25 | */ |
26 | /* | |
27 | Driver: das08_cs | |
28 | Description: DAS-08 PCMCIA boards | |
29 | Author: Warren Jasper, ds, Frank Hess | |
30 | Devices: [ComputerBoards] PCM-DAS08 (pcm-das08) | |
31 | Status: works | |
32 | ||
33 | This is the PCMCIA-specific support split off from the | |
34 | das08 driver. | |
35 | ||
36 | Options (for pcm-das08): | |
d539047c | 37 | NONE |
0882eaa6 DS |
38 | |
39 | Command support does not exist, but could be added for this board. | |
40 | */ | |
41 | ||
0882eaa6 | 42 | #include <linux/delay.h> |
5a0e3ad6 | 43 | #include <linux/slab.h> |
0882eaa6 | 44 | |
33782dd5 HS |
45 | #include "../comedidev.h" |
46 | ||
0882eaa6 DS |
47 | #include <pcmcia/cistpl.h> |
48 | #include <pcmcia/ds.h> | |
49 | ||
8cd98c82 HS |
50 | #include "das08.h" |
51 | ||
383ecb88 IA |
52 | static const struct das08_board_struct das08_cs_boards[] = { |
53 | { | |
8cd98c82 | 54 | .name = "pcm-das08", |
8cd98c82 HS |
55 | .ai_nbits = 12, |
56 | .ai_pg = das08_bipolar5, | |
57 | .ai_encoding = das08_pcm_encode12, | |
58 | .di_nchan = 3, | |
59 | .do_nchan = 3, | |
60 | .iosize = 16, | |
383ecb88 IA |
61 | }, |
62 | }; | |
63 | ||
8cd98c82 HS |
64 | static int das08_cs_auto_attach(struct comedi_device *dev, |
65 | unsigned long context) | |
0882eaa6 | 66 | { |
8cd98c82 HS |
67 | struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); |
68 | struct das08_private_struct *devpriv; | |
69 | unsigned long iobase; | |
55a19b39 | 70 | int ret; |
0882eaa6 | 71 | |
8cd98c82 HS |
72 | /* The das08 driver needs the board_ptr */ |
73 | dev->board_ptr = &das08_cs_boards[0]; | |
74 | ||
95f932ce | 75 | link->config_flags |= CONF_AUTO_SET_IO; |
a3ac9519 | 76 | ret = comedi_pcmcia_enable(dev, NULL); |
55a19b39 | 77 | if (ret) |
8cd98c82 HS |
78 | return ret; |
79 | iobase = link->resource[0]->start; | |
80 | ||
81 | devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL); | |
82 | if (!devpriv) | |
83 | return -ENOMEM; | |
84 | dev->private = devpriv; | |
85 | ||
86 | return das08_common_attach(dev, iobase); | |
87 | } | |
0882eaa6 | 88 | |
8cd98c82 HS |
89 | static void das08_cs_detach(struct comedi_device *dev) |
90 | { | |
8cd98c82 | 91 | das08_common_detach(dev); |
95f932ce | 92 | comedi_pcmcia_disable(dev); |
fb795746 HS |
93 | } |
94 | ||
8cd98c82 HS |
95 | static struct comedi_driver driver_das08_cs = { |
96 | .driver_name = "das08_cs", | |
97 | .module = THIS_MODULE, | |
98 | .auto_attach = das08_cs_auto_attach, | |
99 | .detach = das08_cs_detach, | |
100 | }; | |
101 | ||
102 | static int das08_pcmcia_attach(struct pcmcia_device *link) | |
fb795746 | 103 | { |
8cd98c82 | 104 | return comedi_pcmcia_auto_config(link, &driver_das08_cs); |
c332d969 | 105 | } |
0882eaa6 | 106 | |
2202a5a7 | 107 | static const struct pcmcia_device_id das08_cs_id_table[] = { |
0882eaa6 DS |
108 | PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4001), |
109 | PCMCIA_DEVICE_NULL | |
110 | }; | |
0882eaa6 DS |
111 | MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); |
112 | ||
27fa05bc HS |
113 | static struct pcmcia_driver das08_cs_driver = { |
114 | .name = "pcm-das08", | |
115 | .owner = THIS_MODULE, | |
27fa05bc | 116 | .id_table = das08_cs_id_table, |
8cd98c82 HS |
117 | .probe = das08_pcmcia_attach, |
118 | .remove = comedi_pcmcia_auto_unconfig, | |
0882eaa6 | 119 | }; |
7915ce0e | 120 | module_comedi_pcmcia_driver(driver_das08_cs, das08_cs_driver); |
3a36ad17 HS |
121 | |
122 | MODULE_AUTHOR("David A. Schleef <ds@schleef.org>, " | |
123 | "Frank Mori Hess <fmhess@users.sourceforge.net>"); | |
124 | MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); | |
125 | MODULE_LICENSE("GPL"); |