|
Message
From: Robert Lluís Garcia<rlluis@p...>
Date: Tue Dec 6 12:39:32 CET 2005
Subject: [pci] how to use the PCI bridge IP core ?
Hello all,I have a PCI board with an FPGA programmed with the PCI bridge from opencores. I would like set up a communication between the board and the computer. >From a PC running Linux I use lspci and setpci to see that the configuration space of the PCI board is ok. I use setpci to read the Base Address Registers of the configuration space. I have a very simple program in C -see below- to read data from the board. The start address from which I start reading data is that from the Base Address Register.
On the board side I have the following VHDL code to talk to the wishbone bus.
wbm_err_i <= '0'; -- no error wbm_rty_i <= '0'; -- no retry wbm_ack_i <= wbm_stb_o; --instantaneous acknowledgment wbm_dat_i <= "00000000000000000000000000001000"; -- data returned
Now, the data read by the C program is not what I would expect. I would expect to read always the value in wbm_dat_i but it is not like that so something is wrong.
Can anyone tell me what I am doing wrong?
Thanks, Robert
int main() { void *map; int fd; int i = 0; ulong base; ulong length; int *pValue;
base = 0xe1004000; length = 4096;
fd = open("/dev/mem", O_RDWR|O_SYNC);
map = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, base);
if (map == MAP_FAILED) { printf("map failed: %s\n", strerror(errno)); exit(1); }
pValue = ( int *) map;
for( i = 0; i < (length / 4); i ++) { printf("%d %d\n", i, pValue[i]); } } -------------- next part -------------- An HTML attachment was scrubbed... URL: attachment.html
|
 |