求大神指导,AT91SAM9G45的PWM驱动,整了一天了,还没有找到问题的关键
头文件:
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #include <termios.h> #include <errno.h> #include <fcntl.h> #include <sys/ioctl.h> #include "at91_pwm.h" #define DEV_PWM0 "/dev/mypwm" int main(int argc, void *argv[]) { int fd0 = -1; int i; at91_pwm_arg arg; #if 1 //PWM0 Test printf (" AT91 PWM0 Test ...\n"); fd0 = open(DEV_PWM0, O_RDWR); if (fd0 == 0) { printf("open pwm device error! %d\n", fd0); return -1; } arg.pwm_freq = 1000; arg.pwm_duty = 50; arg.pwm_pulse = 1; ioctl(fd0, 2, &arg);printf("---->2<----ioctl pwm device error! %d\n"); ioctl(fd0, 0, 1); printf("---->0<----ioctl pwm device error! %d\n"); for (i=0; i<3; i++) { sleep(1); } ioctl(fd0, 1, 0); printf("---->1<----ioctl pwm device error! %d\n"); close(fd0); #endif //PWM0 }- 1楼heqiuya3天前 14:22
- 没有人回帖,好冷啊.~求大神指导.