Re: howto provide io memory to PCI card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eike,

A followup on the pci_alloc_consistent. Once the hardware has deposited data into the buffer, how do I copy out of that buffer into a user space buffer? memcpy_fromio? Do I need to ioremap it, first? something like;

    void __iomem *hwbuf = ioremap( outmem );
    memcpy_fromio( userbuf, hwbuf, size );

maybe?

--CB

I would have done it like this:

void __iomem *mem;
void *outmem;
dma_addr_t outmem_phys;

// enable device (managed mode)
pcim_enable_device(pdev);
// claim BARs
pci_request_regions(pdev, DRIVER_NAME);
// map BAR0, full size
mem = pcim_iomap(pdev, 0, 0);
// get memory that is usable by DMA
outmem = pci_alloc_consistent(pdev, PAGE_SIZE, &outmem_phys);
// tell board about it
memcpy_toio(dest + 4, &outmem_phys, sizeof(outmem_phys));

Greetings,

Eike

-
This message is intended only for the addressee and may contain information that is company confidential or privileged. Any technical data in this message may be exported only in accordance with the U.S. International Traffic in Arms Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 CFR Parts 730-774). Unauthorized use is strictly prohibited and may be unlawful. If you are not the intended recipient, or the person responsible for delivering to the intended recipient, you should not read, copy, disclose or otherwise use this message. If you have received this email in error, please delete it, and advise the sender immediately. - --
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux