* [Xenomai-help] RTDM : Obtaining PCI base address
@ 2010-08-18 18:24 Ramon
2010-08-18 19:03 ` Paul
0 siblings, 1 reply; 2+ messages in thread
From: Ramon @ 2010-08-18 18:24 UTC (permalink / raw)
To: xenomai
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Xenomai-help] RTDM : Obtaining PCI base address
2010-08-18 18:24 [Xenomai-help] RTDM : Obtaining PCI base address Ramon
@ 2010-08-18 19:03 ` Paul
0 siblings, 0 replies; 2+ messages in thread
From: Paul @ 2010-08-18 19:03 UTC (permalink / raw)
To: xenomai, ramoncostacastello
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-18 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 18:24 [Xenomai-help] RTDM : Obtaining PCI base address Ramon
2010-08-18 19:03 ` Paul
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.