uart.c
来自「fft的工业级的EP9315的开发板的所有驱动程序」· C语言 代码 · 共 34 行
C
34 行
/****************************************Copyright (c)**************************************************
** 研 发 部
** http://www.FFTChina.com
**-----------------------------------------文件信息-----------------------------------------------------
**文 件 名: cantest.c
**创 建 人:
**最后修改日期: 2005年6月30日
**描 述:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
#include "stdio.h"
#include "stdlib.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "fcntl.h"
static const char wrbuf[]="Welcome to use FFT-9315 developement board!\nThis is the uart0 test application program in linux!\n";
int main(void)
{
int fd1,i;
fd1=open("/dev/ttyS0", O_RDWR);
if(fd1==-1) {
perror("open");
exit(EXIT_FAILURE);
}
write(fd1,wrbuf,sizeof(wrbuf));
if(close(fd1)<0) {
perror("close");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?