⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appback.c

📁 个人根据海德汉平面光栅Windows下的程序编写得Linux下的驱动程去源码
💻 C
字号:
#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <sys/time.h>#include <sys/types.h>#include <fcntl.h>#include <unistd.h>#include <sys/ioctl.h>#include <linux/ioctl.h>#include "pciioctl.h"#define BUFSIZE 70#define IOCSTART _IO(int main(int argc,char *argv[]){		int fd;	int choose,ready;	int msg=10;	int ch,letdo,a,c,save,period;	char mode;	int check=1;	letdo=1;	c=0;while(letdo){	ready=1;		if(check)	{		check=0;		/* Open PCI_IK device */		if ((fd = open("/dev/PCI_IK", O_WRONLY))<0) 		{			fprintf(stderr, "Error opening /dev/rtf0\n");			exit(1);		}	}	fprintf(stderr,"set the work mode:r for RUN\ts for stop\te for code set\tg for signal set\tR for reset\t \n");	scanf("%c",&mode);	fprintf(stderr,"mode=%c",mode);	switch(mode)	{		case 'r':			msg=ioctl(fd,IK_IOCSTART,NULL);			break;		case 's':			msg=ioctl(fd,IK_IOCSTOP,NULL);			break;		case 'e':			msg=ioctl(fd,IK_IOCENCODE,0);			break;		case 'g':			msg=ioctl(fd,IK_IOCSIGNAL,0);			break;		case 'R':			msg=ioctl(fd,IK_IOCRESET,NULL);			break;		case 'p':			fprintf(stderr,"input the sampling period (ms)");			scanf("%d",period);			msg=ioctl(fd,IK_IOCSETPERIOD,period);		default:			break;	}		fprintf(stderr,"msg=%d",msg);	}	close(fd);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -