From: Ian Abbott Date: Wed, 22 Oct 2008 11:54:26 +0000 (+0000) Subject: When configuring via the driver name (or auto-configuring a PCI device), X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=84eca5c69098cf3cab43e949ad08a84a88ba486a;p=comedi.git When configuring via the driver name (or auto-configuring a PCI device), favor the newer '+' models over the older models if they match. --- diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index 67ad9921..e1ea2b49 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -27,9 +27,10 @@ Description: Amplicon PCI230, PCI260 Multifunction I/O boards Author: Allan Willcox , Steve D Sharples , Ian Abbott -Updated: Mon, 03 Dec 2007 17:11:47 +0000 -Devices: [Amplicon] PCI230 (pci230 or amplc_pci230), PCI230+ (pci230+), - PCI260 (pci260 or amplc_pci230), PCI260+ (pci260+) +Updated: Wed, 22 Oct 2008 12:34:49 +0100 +Devices: [Amplicon] PCI230 (pci230 or amplc_pci230), + PCI230+ (pci230+ or amplc_pci230), + PCI260 (pci260 or amplc_pci230), PCI260+ (pci260+ or amplc_pci230) Status: works Configuration options: @@ -39,11 +40,11 @@ Configuration options: will be used. Configuring a "amplc_pci230" will match any supported card and it will -be treated as "pci230" or "pci260". Configuring a "pci230" will match a -PCI230 or PCI230+ card and it will be treated as a PCI230. Configuring -a "pci260" will match a PCI260 or PCI260+ card and it will be treated as -a PCI260. Configuring a "pci230+" will match a PCI230+ card. -Configuring a "pci260+" will match a PCI260+ card. +choose the best match, picking the "+" models if possible. Configuring +a "pci230" will match a PCI230 or PCI230+ card and it will be treated as +a PCI230. Configuring a "pci260" will match a PCI260 or PCI260+ card +and it will be treated as a PCI260. Configuring a "pci230+" will match +a PCI230+ card. Configuring a "pci260+" will match a PCI260+ card. Subdevices: @@ -454,50 +455,46 @@ typedef struct pci230_board_struct { } pci230_board; static const pci230_board pci230_boards[] = { { - name: "pci230", + name: "pci230+", id: PCI_DEVICE_ID_PCI230, ai_chans:16, - ai_bits: 12, + ai_bits: 16, ao_chans:2, ao_bits: 12, have_dio:1, + min_hwver:1, }, { - name: "pci260", + name: "pci260+", id: PCI_DEVICE_ID_PCI260, ai_chans:16, - ai_bits: 12, + ai_bits: 16, ao_chans:0, ao_bits: 0, have_dio:0, + min_hwver:1, }, { - name: "amplc_pci230", /* Legacy name matches any above */ - id: PCI_DEVICE_ID_INVALID, - }, - /* - * The '+' versions of the above models have the same PCI device ID. - * They are backwards compatible with the above models. - */ - { - name: "pci230+", + name: "pci230", id: PCI_DEVICE_ID_PCI230, ai_chans:16, - ai_bits: 16, + ai_bits: 12, ao_chans:2, ao_bits: 12, have_dio:1, - min_hwver:1, }, { - name: "pci260+", + name: "pci260", id: PCI_DEVICE_ID_PCI260, ai_chans:16, - ai_bits: 16, + ai_bits: 12, ao_chans:0, ao_bits: 0, have_dio:0, - min_hwver:1, + }, + { + name: "amplc_pci230", /* Wildcard matches any above */ + id: PCI_DEVICE_ID_INVALID, }, }; @@ -744,6 +741,20 @@ static int pci230_attach(comedi_device * dev, comedi_devconfig * it) * PCI device ID. */ for (i = 0; i < n_pci230_boards; i++) { if (pci_dev->device == pci230_boards[i].id) { + if (pci230_boards[i].min_hwver > 0) { + /* Check for a '+' model. + * First check length of + * registers. */ + if (pci_resource_len(pci_dev, 3) + < 32) { + /* Not a '+' model. */ + continue; + } + /* TODO: temporarily enable the + * PCI device and read the + * hardware version register. + * For now assume it's okay. */ + } /* Change board_ptr to matched board */ dev->board_ptr = &pci230_boards[i]; break;