sangeeta m
unread,Nov 21, 2012, 8:41:14 AM11/21/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I'm new to PCI-e drivers working on Xilinx ML605 Virtex-6 FPGA board. The PCIe End Point (32-bit) of the FPGA has been enabled: Bar0, 1 MB. I want to accomplish a simple read/ write operation to the BAR0 location (note: I'm not using DMA). I have registered as a char device and can read all configuration space registers. I'm following the Xilinx XAPP1022 Memory endpoint test given by Xilinx.
Please could you suggest a way to read and write into memory location with offset say 0x04 from BAR 0 base location. I used ioremap and wrote into gBaseVirt (virtual address) using memcpy (to write into bar0 base address). My read and write functions in driver part are as follows:
Write module:
ssize_t XPCIe_Write(struct file *filp, const char *buf, size_t count,
loff_t *f_pos)
{
memcpy((char *)gBaseVirt, buf, count);
printk(KERN_INFO "\n\n***write module***\n");
printk("%s: XPCIe_Write: %d bytes have been written...@ address 0x%x ",
gDrvrName, count, gBaseVirt);
return (0);
}
Read module:
ssize_t XPCIe_Read(struct file *filp, char *buf, size_t count, loff_t
*f_pos)
{
memcpy(buf, (char *)gBaseVirt, count);
printk(KERN_INFO "\n***Read module***");
printk(KERN_INFO "%s: XPCIe_Read: %d bytes have been read... from
address 0x%x\n", gDrvrName, count, gBaseVirt);
return (0);
}
gBaseVirt is a pointer to kernel address after mapping bar0.
Please advice if this is correct. If not, please suggest another way to do so.