1#include <linux/module.h> 2#include <linux/pci.h> 3 4#include <asm/i387.h> 5 6#include "../comedidev.h" 7#include "comedi_fc.h" 8#include "amcc_s5933.h" 9 10#include "addi-data/addi_common.h" 11 12static void fpu_begin(void) 13{ 14 kernel_fpu_begin(); 15} 16 17static void fpu_end(void) 18{ 19 kernel_fpu_end(); 20} 21 22#include "addi-data/addi_eeprom.c" 23#include "addi-data/hwdrv_apci3200.c" 24#include "addi-data/addi_common.c" 25 26enum apci3200_boardid { 27 BOARD_APCI3200, 28 BOARD_APCI3300, 29}; 30 31static const struct addi_board apci3200_boardtypes[] = { 32 [BOARD_APCI3200] = { 33 .pc_DriverName = "apci3200", 34 .i_IorangeBase1 = 256, 35 .i_PCIEeprom = 1, 36 .pc_EepromChip = "S5920", 37 .i_NbrAiChannel = 16, 38 .i_NbrAiChannelDiff = 8, 39 .i_AiChannelList = 16, 40 .i_AiMaxdata = 0x3ffff, 41 .pr_AiRangelist = &range_apci3200_ai, 42 .i_NbrDiChannel = 4, 43 .i_NbrDoChannel = 4, 44 .ui_MinAcquisitiontimeNs = 10000, 45 .ui_MinDelaytimeNs = 100000, 46 .interrupt = apci3200_interrupt, 47 .reset = apci3200_reset, 48 .ai_config = apci3200_ai_config, 49 .ai_read = apci3200_ai_read, 50 .ai_write = apci3200_ai_write, 51 .ai_bits = apci3200_ai_bits_test, 52 .ai_cmdtest = apci3200_ai_cmdtest, 53 .ai_cmd = apci3200_ai_cmd, 54 .ai_cancel = apci3200_cancel, 55 .di_bits = apci3200_di_insn_bits, 56 .do_bits = apci3200_do_insn_bits, 57 }, 58 [BOARD_APCI3300] = { 59 .pc_DriverName = "apci3300", 60 .i_IorangeBase1 = 256, 61 .i_PCIEeprom = 1, 62 .pc_EepromChip = "S5920", 63 .i_NbrAiChannelDiff = 8, 64 .i_AiChannelList = 8, 65 .i_AiMaxdata = 0x3ffff, 66 .pr_AiRangelist = &range_apci3300_ai, 67 .i_NbrDiChannel = 4, 68 .i_NbrDoChannel = 4, 69 .ui_MinAcquisitiontimeNs = 10000, 70 .ui_MinDelaytimeNs = 100000, 71 .interrupt = apci3200_interrupt, 72 .reset = apci3200_reset, 73 .ai_config = apci3200_ai_config, 74 .ai_read = apci3200_ai_read, 75 .ai_write = apci3200_ai_write, 76 .ai_bits = apci3200_ai_bits_test, 77 .ai_cmdtest = apci3200_ai_cmdtest, 78 .ai_cmd = apci3200_ai_cmd, 79 .ai_cancel = apci3200_cancel, 80 .di_bits = apci3200_di_insn_bits, 81 .do_bits = apci3200_do_insn_bits, 82 }, 83}; 84 85static int apci3200_auto_attach(struct comedi_device *dev, 86 unsigned long context) 87{ 88 const struct addi_board *board = NULL; 89 90 if (context < ARRAY_SIZE(apci3200_boardtypes)) 91 board = &apci3200_boardtypes[context]; 92 if (!board) 93 return -ENODEV; 94 dev->board_ptr = board; 95 96 return addi_auto_attach(dev, context); 97} 98 99static struct comedi_driver apci3200_driver = { 100 .driver_name = "addi_apci_3200", 101 .module = THIS_MODULE, 102 .auto_attach = apci3200_auto_attach, 103 .detach = i_ADDI_Detach, 104}; 105 106static int apci3200_pci_probe(struct pci_dev *dev, 107 const struct pci_device_id *id) 108{ 109 return comedi_pci_auto_config(dev, &apci3200_driver, id->driver_data); 110} 111 112static const struct pci_device_id apci3200_pci_table[] = { 113 { PCI_VDEVICE(ADDIDATA, 0x3000), BOARD_APCI3200 }, 114 { PCI_VDEVICE(ADDIDATA, 0x3007), BOARD_APCI3300 }, 115 { 0 } 116}; 117MODULE_DEVICE_TABLE(pci, apci3200_pci_table); 118 119static struct pci_driver apci3200_pci_driver = { 120 .name = "addi_apci_3200", 121 .id_table = apci3200_pci_table, 122 .probe = apci3200_pci_probe, 123 .remove = comedi_pci_auto_unconfig, 124}; 125module_comedi_pci_driver(apci3200_driver, apci3200_pci_driver); 126