dac_test.c~
来自「S3C2410 DAC驱动程序」· C~ 代码 · 共 32 行
C~
32 行
#include <stdio.h>
#include <stdlib.h> //system
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <sys/ioctl.h>
#define DEVICE_DACTEST "/dev/dac" //设备节点1
int main(void)
{
int i,fd;
fd=open(DEVICE_DACTEST,0);//打开设备
printf("fd= %d\n",fd); //fd=3
if ( fd < 0 )
{
perror( "can not open device" );
exit( 1 );
} printf( "start DAC program\n" ); for(i=0;i<50;i++) { ioctl(fd,1,5*i); ioctl(fd,2,5*i);} close(fd); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?