PCI device driver question
- From: "elliotng.ee@xxxxxxxxx" <elliotng.ee@xxxxxxxxx>
- Date: 21 Dec 2006 13:33:58 -0800
Hi everyone,
I am writing a PCI device driver. In the pci device driver, I am able
to do the following:
static int probe(struct pci_dev *dev, const struct pci_device_id *id)
{
char *region0;
u32 bar0;
unsigned int barLen0;
int barNumber0 = 0;
pci_enable_device(dev);
pci_request_region(dev, barNumber0, "driverBAR0");
bar0 = pci_resource_start (dev, barNumber0);
barLen0 = pci_resource_len(dev, barNumber0);
region0 = ioremap_nocache(bar0, barLen0);
writeb('A', region0+0x04);
iounmap(region0);
return 0;
}
Now instead of hard-coding what to write in the memory region, I want
to input a file, read the file, and write the appropriate contents to
the memory region. What are the appropriate steps to do that? It seems
as though that I cannot use the library stdio in pci device drivers. Is
there another library that contains file IO? Or do I need to create a
program in userspace that would read the file, access the pci device
driver, and call a write function?
.
- Follow-Ups:
- Prev by Date: Re: finding the full path of the program which ran.
- Next by Date: disabling sockets for running processes
- Previous by thread: finding the full path of the program which ran.
- Next by thread: Re: PCI device driver question
- Index(es):