static int pci9118_attach(comedi_device *dev,comedi_devconfig *it);
static int pci9118_detach(comedi_device *dev);
static int pci9118_recognize(char *name);
-
-comedi_driver driver_pci9118={
- driver_name: "adl_pci9118",
- module: THIS_MODULE,
- attach: pci9118_attach,
- detach: pci9118_detach,
- recognize: pci9118_recognize,
-};
+static void pci9118_register_boards(void);
typedef struct {
char *name; // driver name
#define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype))
+comedi_driver driver_pci9118={
+ driver_name: "adl_pci9118",
+ module: THIS_MODULE,
+ attach: pci9118_attach,
+ detach: pci9118_detach,
+ recognize: pci9118_recognize,
+ register_boards: pci9118_register_boards,
+ num_names: n_boardtypes,
+};
+
typedef struct{
int iobase_a; // base+size for AMCC chip
int iosize_a;
unsigned int ai1234_n_chan;// how many channels is measured
unsigned int *ai1234_chanlist;// actaul chanlist
unsigned int ai1234_timer1;
- unsigned int ai1234_timer2;
+ unsigned int ai1234_timer2;
unsigned int ai1234_flags;
unsigned int ai1234_data_len;
sampl_t *ai1234_data;
#define devpriv ((pci9118_private *)dev->private)
#define this_board (boardtypes+dev->board)
-/*
+/*
==============================================================================
*/
j=0;
devpriv->ai1234_act_scan++;
if (devpriv->ai1234_flags & TRIG_WAKE_EOS)
- comedi_eos(dev,s);
+ comedi_eos(dev,s);
}
}
s->async->cur_chan=j;
comedi_error(dev,"AMCC IRQ - MASTER DMA ABORT!");
if (int_amcc&TARGET_ABORT_INT)
comedi_error(dev,"AMCC IRQ - TARGET DMA ABORT!");
-
+
if (devpriv->ai_do) {
if (int_amcc&WRITE_TC_INT)
devpriv->ai1234_timer2=divisor1*devpriv->i8254_osc_base;
devpriv->ai1234_timer1=divisor1*divisor2*devpriv->i8254_osc_base;
break;
- case 4:
+ case 4:
if (devpriv->ai1234_timer2<this_board->ai_ns_min) devpriv->ai1234_timer2=this_board->ai_ns_min;
i8253_cascade_ns_to_timer(devpriv->i8254_osc_base,&divisor1,&divisor2,&devpriv->ai1234_timer2,TRIG_ROUND_NEAREST);
devpriv->ai4_divisor1=divisor1;
}
devpriv->dmabuf_use_size[0]=dmalen0;
- devpriv->dmabuf_use_size[1]=dmalen1;
+ devpriv->dmabuf_use_size[1]=dmalen1;
outl(devpriv->dmabuf_hw[0], devpriv->iobase_a+AMCC_OP_REG_MWAR);
outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a+AMCC_OP_REG_MWTC);
- outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR);
+ outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR);
outl(inl(devpriv->iobase_a+AMCC_OP_REG_MCSR)|RESET_A2P_FLAGS|A2P_HI_PRIORITY|EN_A2P_TRANSFERS, devpriv->iobase_a+AMCC_OP_REG_MCSR);
switch (mode) {
/*
==============================================================================
*/
-static int pci9118_ai_mode1(comedi_device * dev, comedi_subdevice * s, comedi_trig * it)
+static int pci9118_ai_mode1(comedi_device * dev, comedi_subdevice * s, comedi_trig * it)
{
return pci9118_ai_mode1234(1, dev, s, it);
}
#ifdef PCL9118_PARANOIDCHECK
unsigned int data,m=0;
#endif
-
+
devpriv->AdControlReg=AdControl_Int & 0xff;
devpriv->AdFunctionReg=AdFunction_PDTrg|AdFunction_PETrg;
outl(devpriv->AdFunctionReg,dev->iobase+PCI9118_ADFUNC);// positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop
if (!check_and_setup_channel_list(dev,s,it->n_chan, it->chanlist, 0)) return -EINVAL;
outl(0,dev->iobase+PCI9118_DELFIFO); // flush FIFO
-
+
if (it->n==0) it->n=1;
for (i=0; i<(it->n_chan*it->n); i++) {
==============================================================================
*/
static int pci9118_di_mode0(comedi_device * dev, comedi_subdevice * s, comedi_trig * it)
-{
+{
unsigned int data;
int chan;
int i;
}
}
-/*
+/*
==============================================================================
*/
int pci9118_exttrg_add(comedi_device * dev, unsigned char source)
inl(dev->iobase+PCI9118_INTSRC); // flush INT requests
devpriv->AdControlReg=AdControl_Int;
outl(devpriv->AdControlReg,dev->iobase+PCI9118_ADCNTRL);// bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA
-
+
devpriv->cnt0_users=0;
devpriv->exttrg_users=0;
}
}
-
+
if (alloc_amcc_card(card)!=0) {
rt_printk(" - Can't allocate card!\n");
return -EIO;
dev->iobase=iobase_9;
dev->iosize=boardtypes[board].iorange_9118;
request_region(dev->iobase, dev->iosize, "ADLink PCI-9118");
-
+
dev->board_name = boardtypes[board].name;
if((ret=alloc_private(dev,sizeof(pci9118_private)))<0)
release_region(devpriv->iobase_a,devpriv->iosize_a);
if (devpriv->allocated)
free_amcc_card(devpriv->amcc);
- if (devpriv->dmabuf_virt[0])
+ if (devpriv->dmabuf_virt[0])
free_pages(devpriv->dmabuf_virt[0],devpriv->dmabuf_pages[0]);
- if (devpriv->dmabuf_virt[1])
+ if (devpriv->dmabuf_virt[1])
free_pages(devpriv->dmabuf_virt[1],devpriv->dmabuf_pages[1]);
}
-
+
if(dev->irq){
free_irq(dev->irq,dev);
}
return 0;
}
-/*
+/*
==============================================================================
*/
-static int pci9118_recognize(char *name)
+static int pci9118_recognize(char *name)
{
- int i;
+ int i;
- for (i = 0; i < n_boardtypes; i++) {
+ for (i = 0; i < n_boardtypes; i++) {
if (!strcmp(boardtypes[i].name, name)) {
return i;
}
return -1;
}
+void pci9118_register_boards(void)
+{
+ int i;
+
+ for (i = 0; i < driver_pci9118.num_names; i++) {
+ driver_pci9118.board_name[i] = boardtypes[i].name;
+ driver_pci9118.board_id[i] = i;
+ }
+}
#ifdef MODULE
-/*
+/*
==============================================================================
*/
int init_module(void)
{
+ int ret;
+
+ ret = comedi_driver_register(&driver_pci9118);
+ if(ret < 0);
+ return ret;
+
amcc_init();
- comedi_driver_register(&driver_pci9118);
-
- return 0;
+
+ return ret;
}
-/*
+/*
==============================================================================
*/
void cleanup_module(void)
amcc_cleanup();
}
-/*
+/*
==============================================================================
*/