Adlinks PCI 7256 Latching relay and Isolated DI Card: Problem with auto config during boot.

33 views
Skip to first unread message

Vamsi Krishna A

unread,
May 5, 2020, 5:29:08 AM5/5/20
to Comedi: Linux Control and Measurement Device Interface
Hii
I downloaded the comedi-master and comedilib files from the comedi.org website
 I tried to write driver for Adlinks PCI- 7256 Card using  Mr Ian Abbott's code for Adlinks PCI-7250 as a guide.
iam able to build and successfully install the driver based on my 32 bit Ubuntu 16.04LTS system thanks to the Hardware_Driver_HOWTO file
However after boot i find that the communication with the card is not happening from the application.
lsmod shows the driver as loaded.
lspci shows the card as unclassified.
dmesg output has some messages regarding adl_pci7256 but iam not able to make any sense out of that.

i tried with manual configuaration by creating the  comedi.conf file inthe /etc/modprobe.d and then after next boot using the comedi_config command. But this causes the program to hang.

Iam also using a Adlinks PCI 7432 card which does not have any issues and is working fine. So am i mssing any step here

Thanks in advance
 Vamsi

Ps: Iam attaching the following files :
   adlink_pci7256.c
   log during boot 202020505.txt : This file contains the outputs for dmesg, lsmod and lspci commands
log during boot 20200505
adl_pci7256.c

Vamsi Krishna A

unread,
May 8, 2020, 12:37:16 PM5/8/20
to Comedi: Linux Control and Measurement Device Interface
k t
 Here's an update...

i understood that there is something called staging directory and the Adlinks PCI 7432 card was working becoz the adlinks 7x3x driver which is in the staging directory was getting loaded.
Now coming back to Adlinks PCI-7256, i downloaded (or so i think) snapshot of crom git and ewent through build procedure. But the auto config issue still persists.

Can somebody suggest a way, how to use add on cards other than those supported by drivers  in staging directory.

Der Alte

unread,
Nov 12, 2020, 8:39:22 AM11/12/20
to Comedi: Linux Control and Measurement Device Interface
Hi Vamsi,

Ian recently explained to me that CoMeDI in the kernel tree is somewhat different from the Github-CoMeDI.
Especially the PCI Plug and Play Mechanism is more advanced in the kernel tree version:
Kernel tree CoMeDI:   low level drivers have *_auto_attach() handler which is registered by probe().
                                    low level Isa Drivers use *_attach() handler which is exported.
Github CoMeDI: low level drivers have *_attach() handler and PnP is "emulated". Ian knows more.
He wrote some info on that in the other group converstion where I added ISRs in 2 of the DigIO drivers :
adl_pci7x3x.c  and adv_pci_dio.c .

What wonders me a bit on your config is which comedi_pci.ko and comedi.ko will be loaded in your machine.
Both of your CoMeDI variants should bring their own modules.

As you have the kernels CoMeDI modules configured and activated for your adl_pci7x3x.ko, that stuff will likely win at boot time. But I guess, it is not compatible with your adl_pci7256.ko modified from the Github style CoMeDI variant.

You could try to learn from the lower (?) lines adl_pci7x3x.c, where the adl_pci7x3x_pci_probe(), adl_pci7x3x_auto_attach() and the published stuff for module probing lives. See below.

Another important point is that the PCI  device ID in your new driver
#define PCI_DEVICE_ID_PCI7256 0x7256
is really correct and matches the "lspci -nn" data.
But Adlink really just seems to use the Board type as hex value...


File end of adl_pci7x3x.c:

static struct comedi_driver adl_pci7x3x_driver = {
    .driver_name    = "adl_pci7x3x",
    .module        = THIS_MODULE,
    .auto_attach    = adl_pci7x3x_auto_attach,
    .detach        = comedi_pci_detach,
};

static int adl_pci7x3x_pci_probe(struct pci_dev *dev,
                 const struct pci_device_id *id)
{
    return comedi_pci_auto_config(dev, &adl_pci7x3x_driver,
                      id->driver_data);
}

static const struct pci_device_id adl_pci7x3x_pci_table[] = {
    { PCI_VDEVICE(ADLINK, 0x7230), BOARD_PCI7230 },
    { PCI_VDEVICE(ADLINK, 0x7233), BOARD_PCI7233 },
    { PCI_VDEVICE(ADLINK, 0x7234), BOARD_PCI7234 },
    { PCI_VDEVICE(ADLINK, 0x7432), BOARD_PCI7432 },
    { PCI_VDEVICE(ADLINK, 0x7433), BOARD_PCI7433 },
    { PCI_VDEVICE(ADLINK, 0x7434), BOARD_PCI7434 },
    { 0 }
};
MODULE_DEVICE_TABLE(pci, adl_pci7x3x_pci_table);

static struct pci_driver adl_pci7x3x_pci_driver = {
    .name        = "adl_pci7x3x",
    .id_table    = adl_pci7x3x_pci_table,
    .probe        = adl_pci7x3x_pci_probe,
    .remove        = comedi_pci_auto_unconfig,
};
module_comedi_pci_driver(adl_pci7x3x_driver, adl_pci7x3x_pci_driver);

MODULE_DESCRIPTION("ADLINK PCI-723x/743x Isolated Digital I/O boards");
...
MODULE_LICENSE("GPL");


Ciao, Bernd
Reply all
Reply to author
Forward
0 new messages