I'm trying to read the location 0x22400000 on my TS-7350 to determine
if RS-484 is installed, as per section 5.8 in the manual. My code
below returns 0 for a read at that address however, and the board I
have should have RS485 installed. Can anyone see anything incorrect
in my program or suggest what else could be going wrong?
-----------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
/*
* Simple program to determine if RS485 is installed on a TS-7350.
* See section 5.8 of
ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7300-linux/manuals/ts-7300-manual-rev1.4.pdf
*
*/
int main() {
int ret = EXIT_FAILURE;
int fd = open("/dev/mem", O_RDWR|O_SYNC);
if (fd != -1) {
volatile unsigned char* p = mmap(0, getpagesize(), PROT_READ,
MAP_SHARED, fd, 0x22400000);
if (p != MAP_FAILED) {
printf("register value is 0x%02x\n", *p);
}
else {
perror("mmap failed");
}
close(fd);
ret = EXIT_SUCCESS;
}
else {
perror("open failed");
}
return ret;
}
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|