📄 test.c
字号:
#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
static int fd = -1;
int main(void)
{
int i,out;
out = 0xe0;
fd = open("/dev/IO/0",O_RDWR);
if(fd<0)
{
printf("failed to open the device \n");
}
else
printf("successed to open the device \n");
while(1)
{
ioctl(fd , out);
for(i=0;i<5000000;i++);
out=(out<<1) & 0xf0; //注意,这里一定要加“& 0xf0”这一项,因为0xe0<<1后就变成了0x1c0,为了把那个1变成0而只获取有用的四位,所以加“& 0xf0”这一项
// printf("out=%x \n",out);
if(out!=0xe0) out|=0x10;
// printf("out=%x \n",out);
}
close(fd);
printf("end of test \n");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -