Hi I'm working with this code in order to control relay switch, (the TS-Relay8 Board) on a TS7800,
#include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <time.h> #include <ctype.h> #include <sys/mman.h> #include <fcntl.h> #define RELAYBASE 0xEE000140 int main() { volatile unsigned int *PBDR; unsigned char state; unsigned char *start; int fd = open("/dev/mem", O_RDWR|O_SYNC); start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, RELAYBASE); PBDR = (unsigned int *)(start + 0x02); state = *PBDR; printf("Result: %x\n",state); return 0; }
Can be compiled, but return Segmentation Faults when it runs. Instead, with the shell I can do peek16 0xEE000142 with no problem. Any ideas please?
Todo el espacio y cuidado que merecen tus fotos digitales lo tienes en Windows Live Fotos. ¡Pruébalo!
__._,_.___
__,_._,___
|
|