?? drvtest.c~
字號:
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include "drv.h"
static int fd = -1;
static int d;
/*
* leddrv application code, the code of Linux application to use driver code
* compile :
* $/usr/local/arm/2.95.3/bin/arm-linux-gcc -o drvtest drvtest.c
* $cp helloworld /tftpboot/examples
* run in target:
* #mount 192.168.1.180:/tftpboot/ /mnt/nfs
* #cd /mnt/nfs/examples
* #insmod drv
* #mknod /dev/drvtest c 100 0
* #./drvtest
*/
int main(int argc, char **argv)
{
int ret;
fd=open("/dev/drvtest",O_RDWR);
if(fd<0)
{
printf("Can't open\n");
return -1;
}
else
{
printf("open OK %x\n", fd);
}
while(1)
{
printf("enter a number:\n");
scanf("%d", &d);
ret = ioctl(fd, IOCTL_SET_MSG, &d);
ret = write(fd, &d, 4);
ret = read(fd, &d, 4);
}
close(fd);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -