www.pudn.com > leddrv_irq.rar > test.c
#include#include #include #define CMD_TC_PERIOD 0 #define CMD_LED_ON 1 #define CMD_LED_OFF 2 #define CMD_INT_ON 3 #define CMD_INT_OFF 4 int main(int argc, char **argv) { int fd; int period; if((fd=open("/dev/led",O_RDWR))==-1) { perror("open error"); exit(1); } ioctl(fd,CMD_INT_OFF); period=atoi(argv[1]); ioctl(fd,CMD_TC_PERIOD,&period); ioctl(fd,CMD_INT_ON); while(1) { ioctl(fd,CMD_LED_OFF); } close(fd); return 0; }