vijay patel wrote:
> 
> Hello ,
>         I want to write a device driver for a PCI card on RTLinux . Any
> expert can tell me is there any functions available to read/write  PCI
> configuration space ?
> if not then How I can know the IRQ and base address assigned to the card ?
> 
> Thanks in advance !
> --Vijay Patel
> 

See /usr/include/linux/pci.h for a list of available 
functions and defines.

Here is some example code from an actual 
driver (LBRegs is set to PCI_BASE_ADDRESS_0):

int Init_PCI(void) {
        
        u32 tmp_addr;
        int err;
        
        if (!pci_present()) {
                printk("<1>No PCI\n");
                return -1;
        }
        
        /* searching for device */
        dev = NULL;
        dev = pci_find_device(PCI_VendorID,PCI_DeviceID,dev);
        if (dev == NULL) {
                printk("<1>PCI Device not found\n");
                return -1;
        }
        
        /* Reading configuration space */
        pci_read_config_dword(dev,LBRegs,&tmp_addr);
        
        /* Computing I/O base address */
        RegBase = (tmp_addr & 0xFFFE);
                
        return 0;
}

Have a nice day,

Iwo
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to