kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: osalvador.vilardaga@gmail.com (Oscar Salvador)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Network driver ( dma, iomem.. )
Date: Tue, 5 Aug 2014 17:49:58 +0200	[thread overview]
Message-ID: <20140805154957.GA7095@oscar> (raw)

Hi People!, How are you doing?

I write to you because I'm writing a driver for a Realtek8139D 10/100Mbps, just for fun and for practice my knowledge.
I spent some time reading about PCI specifications, but I have some doubts about that:

1- I/O Port or I/O memory mapping ( RTL8139 has BAR0 for I/O PORT and BAR1 for I/O Memory )

        * I've read about the diferences, and since I understood, the best way to do is with memory mapping. I/O PORT has some limitations like limited instructions can be used. Do you know more about that? More diferences?
        
2- DMA and memory region

        * When I request for the I/O memory region of pci device:

                memr_start = pci_resource_start(dev, IO_MEM);
                memr_end = pci_resource_end(dev, IO_MEM);

        The memr_start is the address for reach the device and send data to him?

        * I've seen that pci_bus_master is supported by RTL8139D:

                pci_set_master(dev);
                pci_read_config_word(dev, 0x4, &is_master);
                pr_info("PCI_BUS_MASTER: %d\n", is_master);

        it returns 111b, so it can be enabled.
        Then I think I should call pci_alloc_consistent() to take a DMA address.
        This DMA address is the address of the BUS (where device is). This should be the address that I have to use for incoming/outgoing data from/to the device?

I'm a little bit stuck in these terms

Could you help me?

Best Regards
Oscar

                 reply	other threads:[~2014-08-05 15:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140805154957.GA7095@oscar \
    --to=osalvador.vilardaga@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).