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 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. 25*/ 26/* 27Driver: das08_cs 28Description: DAS-08 PCMCIA boards 29Author: Warren Jasper, ds, Frank Hess 30Devices: [ComputerBoards] PCM-DAS08 (pcm-das08) 31Status: works 32 33This is the PCMCIA-specific support split off from the 34das08 driver. 35 36Options (for pcm-das08): 37 NONE 38 39Command support does not exist, but could be added for this board. 40*/ 41 42#include <linux/module.h> 43 44#include "../comedidev.h" 45 46#include <pcmcia/cistpl.h> 47#include <pcmcia/ds.h> 48 49#include "das08.h" 50 51static const struct das08_board_struct das08_cs_boards[] = { 52 { 53 .name = "pcm-das08", 54 .ai_nbits = 12, 55 .ai_pg = das08_bipolar5, 56 .ai_encoding = das08_pcm_encode12, 57 .di_nchan = 3, 58 .do_nchan = 3, 59 .iosize = 16, 60 }, 61}; 62 63static int das08_cs_auto_attach(struct comedi_device *dev, 64 unsigned long context) 65{ 66 struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); 67 struct das08_private_struct *devpriv; 68 unsigned long iobase; 69 int ret; 70 71 /* The das08 driver needs the board_ptr */ 72 dev->board_ptr = &das08_cs_boards[0]; 73 74 link->config_flags |= CONF_AUTO_SET_IO; 75 ret = comedi_pcmcia_enable(dev, NULL); 76 if (ret) 77 return ret; 78 iobase = link->resource[0]->start; 79 80 devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); 81 if (!devpriv) 82 return -ENOMEM; 83 84 return das08_common_attach(dev, iobase); 85} 86 87static struct comedi_driver driver_das08_cs = { 88 .driver_name = "das08_cs", 89 .module = THIS_MODULE, 90 .auto_attach = das08_cs_auto_attach, 91 .detach = comedi_pcmcia_disable, 92}; 93 94static int das08_pcmcia_attach(struct pcmcia_device *link) 95{ 96 return comedi_pcmcia_auto_config(link, &driver_das08_cs); 97} 98 99static const struct pcmcia_device_id das08_cs_id_table[] = { 100 PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4001), 101 PCMCIA_DEVICE_NULL 102}; 103MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); 104 105static struct pcmcia_driver das08_cs_driver = { 106 .name = "pcm-das08", 107 .owner = THIS_MODULE, 108 .id_table = das08_cs_id_table, 109 .probe = das08_pcmcia_attach, 110 .remove = comedi_pcmcia_auto_unconfig, 111}; 112module_comedi_pcmcia_driver(driver_das08_cs, das08_cs_driver); 113 114MODULE_AUTHOR("David A. Schleef <ds@schleef.org>, " 115 "Frank Mori Hess <fmhess@users.sourceforge.net>"); 116MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); 117MODULE_LICENSE("GPL"); 118