Paul N. Leonard <paull@ifspurity.com> wrote:
I believe you need to set the privity level during compile to 0 and
you must run as root in order to access IO of any sort.
During compilation, add the flag “-T 0” to your other flags and see
if that helps.
That is how it works under QNX4. The key is making sure you are
running the code as root. Also, you should be making sure you check
the return values of all your function calls and error-ing out on
any failure. You would have gotten an error on your call to ThreadCtrl().
chris
tie wrote:
The following is a small program I make to write I/O port. But it doesn’t
work.
After I compile it with qcc and run it, “Memory Fault(Core Dump)” will
appear.
Can anyone help me?
/* Library for I/O and Thread Control*/
#include <sys/neutrino.h
#include <hw/inout.h
#include <sys/mman.h
#define cfr 0x2e6 /* configulation register */
int
main()
{
ThreadCtl(_NTO_TCTL_IO,0);/* Thread control*/
mmap_device_io(1,cfr); /* Map device I/O */
out8( cfr, 0x80 ); /* Software Reset*/
return(0);
}
Best Regard
Tie Hu
6/11/02
–
Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/