I have SBC based on ARM920T CPU, i use 6.2.1 QNX
I try use this code for access to internal build-in registers:
#include <errno.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/iofunc.h>
#include <sys/dispatch.h>
#include <sys/mman.h>
#include <hw/inout.h>
#include <semaphore.h>
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
#include <process.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
uintptr_t iobase;
int main(int argc, char *argv[]) {
printf("Begin \r\n");
/* initialize resource manager attributes */
if (ThreadCtl( _NTO_TCTL_IO, NULL )<0)
{
fprintf(stderr, "IO privity Error \r\n");
return EXIT_FAILURE;
} // Take acces to IO ports
iobase=mmap_device_io(4, 0xFFFFF000);
if (iobase<0) {
fprintf(stderr, "error to map device \r\n");
fprintf(stderr, "%s: %d \r\n", __FILE__, __LINE__);
return EXIT_FAILURE;
}
fprintf(stderr, "Try IN32(%x) \r\n",iobase);
in32(iobase);
fprintf(stderr, "Done \r\n");
munmap_device_io(iobase,4);
return EXIT_SUCCESS;
}
BUT I every times receive Memory Fault !
look like this:
Try IN32(1800000)
Process 462872 (check_io) terminated SIGSEGV code=1 fltno=11 ip=001007fc ref=01800000
Memory fault
I think address 0xFFFFF000 is bad for QNX, m.b. this address space are reserved or used by kernel ? or in 6.2.1 we have bag’s in MMU control with ARM CPU.? in mmap_device_io()
Anybody can try access this address on your ARM SBC?
This address space are closed from application, BUT from kernel (interrupt callouts) I can access to this address.
Please Help.
Best Regards!
MT.