LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2011, 12:06 AM   #1
Sindhu.90g
LQ Newbie
 
Registered: Nov 2011
Posts: 1

Rep: Reputation: Disabled
Writting PCI Driver


HI I am new to Kernel programming my task is to write a pci user space and kernel space module that will work same as the lspci command i used pci_read_config_byte() to access the pci configuration space but it didnt seem to work please suggest me a way to approach this Thanks in advance
 
Old 11-17-2011, 06:11 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,665

Rep: Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710
Code:
static int sis_66_cable_detect(struct ata_port *ap)
{
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        u8 tmp;

        /* Older chips keep cable detect in bits 4/5 of reg 0x48 */
        pci_read_config_byte(pdev, 0x48, &tmp);
        tmp >>= ap->port_no;
        if ((tmp & 0x10) && !sis_short_ata40(pdev))
                return ATA_CBL_PATA40;
        return ATA_CBL_PATA80;
}
Looks like pci_read_config_byte is used in many kernel drivers. The call works so I guess it is your code which is wrong.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux pci driver sha_neb Linux - Kernel 1 07-25-2011 03:06 AM
fpga driver using PCI linux driver Linux_Kid_ Linux - Embedded & Single-board computer 0 06-10-2009 12:53 AM
Trying to write a PCI driver bramsey123 Programming 4 09-02-2007 01:32 AM
pci driver compile - need help dklaming Linux - General 0 05-03-2004 09:34 AM
need help on writting a simple quickbutton driver captainstorm Programming 1 03-02-2004 02:05 PM


All times are GMT -5. The time now is 04:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration