From: Paul <paul_c@domain.hid>
To: xenomai@xenomai.org, ramoncostacastello@domain.hid
Subject: Re: [Xenomai-help] RTDM : Obtaining PCI base address
Date: Wed, 18 Aug 2010 20:03:20 +0100 [thread overview]
Message-ID: <201008182003.20212.paul_c@domain.hid> (raw)
In-Reply-To: <4C6C256A.3060404@domain.hid>
On Wednesday 18 August 2010, Ramon wrote:
> Hi,
>
> In order to introduce myself to RTDM and driver development in
> Xenomai, I'm trying to develop a simple "driver"
> for an advantech PCI-1711 card.
>
> First thing I need to do is obtaining the PCI base address of the
> card. To do this I used an old code I already have :
>
> struct pci_dev *pcidev;
>
> printk("PCI-1711 DETECT PCI \n");
> pcidev=NULL;
> pcidev =pci_get_device (PCI_VENDOR_, PCI_DEVICE_, pcidev );
> if (pcidev==NULL){
> printk("PCI-1711 CANNOT BE FOUND \n");
> }
> else{
> printk("PCI-1711 LOCATED \n");
> if (pci_enable_device(pcidev)){
> printk("PCI-1711 NOT ENABLED \n");
> return(-EIO);
> }
> else{
> printk("PCI-1711 ENABLED \n");
> }
> PCI_BASE_ADRESS_1711= pci_resource_start(pcidev, 1)&
> PCI_BASE_ADDRESS_MEM_MASK; printk("PCI-1711 DETECT PCI %x
> \n",PCI_BASE_ADRESS_1711); }
>
>
>
> Unfortunatelly PCI_BASE_ADRESS_1711 always takes de 0 value.
>
> Is this type of code already valid in current linux kernels ?
> Could anyone point me to a similar code ?
>
> Thank you in advance
> Ramon
Are you sure you have the right BAR for this card ?
Refering to the Comedi driver, they use pci_resource_start(pcidev, 2) to
obtain the IO base address (without using PCI_BASE_ADDRESS_MEM_MASK).
Regards, Paul.
prev parent reply other threads:[~2010-08-18 19:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 18:24 [Xenomai-help] RTDM : Obtaining PCI base address Ramon
2010-08-18 19:03 ` Paul [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201008182003.20212.paul_c@domain.hid \
--to=paul_c@domain.hid \
--cc=ramoncostacastello@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.