向PC104板卡的寄存器写数据失败,求救。

#include <stdio.h>
#include <hw/inout.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/neutrino.h>
#include <sys/syspage.h>

//for PC-104 Board Base Address AD采集卡
#define ADT882_AT 0x300

int main()
{
int x, y;

ThreadCtl(_NTO_TCTL_IO, 0);

out8(ADT882_AT+2, 0x01);
out8(ADT882_AT+3, 0x02);

x=in8(ADT882_AT+2);
y=in8(ADT882_AT+3);

printf(“x= %x\n”,x);
printf(“y= %x \n”,y);
}

无论向寄存器ADT882_AT+2和ADT882_AT+3写什么数据,程序最后都只打印:
x=ff
y=ff

(寄存器ADT882_AT+2和ADT882_AT+3是可以写,且可以回读的)

请问问题出在哪里?多谢了!

qnx下地址是不能直接访问的,需要用mmap_device_io()函数将需要访问的地址映射到一个虚地址再用