No data on bus using mmap on ARM9 board

Sep 11, 2008 1 Replies

Hi, there



I am using mmap on S3C2410 ARM9 board to write the data to SRAM, I can get nGCS2 and WE pulse, but there is no data on data bus, the code is listed below.



What could be the problem?



Thanks in advance.



int TestBus() { /*write data to an ADDR */ unsigned char chKey; unsigned int *pBuf = NULL; int mem_fd = 0;



unsigned int GPEDATA = 0; unsigned int gpio_mem = 0;



printf("Bus Test\n");



mem_fd = open("/dev/mem", O_RDWR);



if ( 0 == mem_fd) { perror("open"); return -1; }



gpio_mem = (unsigned long int) mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, 0x10000000);



if (-1 == gpio_mem) { perror("mmap"); close(mem_fd); return -1; }



pBuf = (unsigned int *)gpio_mem;


printf("Write 0xf0f0 to Bus Press q to exit");



pBuf[0] = 0xffffff;



while (1) { scanf("%c", &chKey);



if ('q' == chKey) { break; } pBuf[0] = 0xf0f0; }



close(mem_fd);



return 0; }


Does it change if you are using a "volatile unsigned int *pBuf" here instead?

jbe

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required