linux 嵌入式驱动程序测试实例
2010-11-26 16:45
316 查看
#include
#include
#include
#include
#include
#include
#include
int main()
{
int fd,i,nwrite,nread;
char *buf = "hello/n";
char read_buf[6] = {0};
fd = open("/dev/fs",O_RDWR);
if( fd <= 0 )
{
perror("open");
exit(1);
}else
printf("open ok!");
nwrite = write(fd,buf,strlen(buf));
if( nwrite < 0 )
{
perror("write");
exit(1);
}
nread = read(fd,read_buf,6);
if( nread < 0 )
{
perror("read");
exit(1);
}
else
printf("read is %s/n",read_buf);
close(fd);
exit(0);
}
//查看结果
// /var/log/messages
#include
#include
#include
#include
#include
#include
int main()
{
int fd,i,nwrite,nread;
char *buf = "hello/n";
char read_buf[6] = {0};
fd = open("/dev/fs",O_RDWR);
if( fd <= 0 )
{
perror("open");
exit(1);
}else
printf("open ok!");
nwrite = write(fd,buf,strlen(buf));
if( nwrite < 0 )
{
perror("write");
exit(1);
}
nread = read(fd,read_buf,6);
if( nread < 0 )
{
perror("read");
exit(1);
}
else
printf("read is %s/n",read_buf);
close(fd);
exit(0);
}
//查看结果
// /var/log/messages
相关文章推荐
- linux 嵌入式驱动程序测试实例
- linux 嵌入式驱动程序实例
- 嵌入式Linux设备驱动开发之:按键驱动程序实例
- linux 嵌入式驱动程序实例
- 基于嵌入式Linux的千兆以太网卡驱动程序设计及测试
- 如何编写Linux设备驱动程序以及测试详细流程(附实例)
- 基于嵌入式Linux的千兆以太网卡驱动程序设计及测试
- 嵌入式Linux之我行——S3C2440上RTC时钟驱动开发实例讲解
- 基于Linux的S3C6410模拟SPI的外围设备驱动程序、Makefile及测试程序的实现
- 在Ubuntu上为Android系统内置C可执行程序测试Linux内核驱动程序
- USB接口WIFI模块在嵌入式Linux下的驱动安装及测试
- 关于嵌入式linux下的驱动程序编译问题
- 基于mini2440的linux驱动程序模块编译测试笔记
- 在Ubuntu上为Android系统内置C可执行程序测试Linux内核驱动程序
- 嵌入式Linux驱动程序开发要点
- 【2】在Ubuntu上为Android系统内置C可执行程序测试Linux内核驱动程序
- Linux 查看系统硬件信息(实例详解) ubuntu的测试环境
- 基于嵌入式Linux系统设备驱动程序的开发
- 嵌入式成长轨迹25 【Linux应用编程强化】【Linux下的C编程 下】【实例:客户端/服务器端程序】
- 嵌入式Linux之我行——S3C2440上LCD驱动(FrameBuffer)实例开发讲解(二)[转]