![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
嵌入式Linux应用编程
Linux应用编程
_Alon_
I want be a coder!
展开
-
10-多线程编程
1. 创建线程#include <stdio.h>#include <unistd.h>#include <pthread.h>static void *my_thread_func(void *data){ while(1) { printf("my pthread\n"); sleep(4); }}int main(int argc, char **argv){ pthread_t tid; int ret; //creat原创 2021-04-07 23:32:43 · 59 阅读 · 0 评论 -
09-异步通知方式获取输入设备状态
同步方式:应用程序主动去查询驱动设备状态异步方式:驱动设备程序主动通知应用程序#include <linux/input.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/ioctl.h>#include <stdio.h>#include <string.h>#include <unistd原创 2021-04-07 23:15:40 · 73 阅读 · 0 评论 -
08-Poll方式获取输入设备状态
#include <sys/ioctl.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>#include <unistd.h>#include <linux/input.h>#include <string.h>#include <poll.h>int main...原创 2021-04-07 23:03:08 · 125 阅读 · 0 评论 -
07-查询和休眠方式获取输入设备状态
#include <sys/ioctl.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>#include <unistd.h>#include <linux/input.h>#include <string.h>int main(int argc, char **argv){ .原创 2021-04-07 22:48:47 · 100 阅读 · 0 评论 -
06-获取输入设备信息
代码#include <sys/ioctl.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>#include <unistd.h>#include <linux/input.h>char *ev_names[] = { "EV_SYN ", "EV_KEY ", "EV_REL ",原创 2021-04-07 22:38:27 · 212 阅读 · 2 评论 -
05-Frame buffer应用编程
实现在LCD上显示一条线/* 2021-03-26 22:00*/#include <stdio.h>#include <sys/mman.h>#include <linux/fb.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/ioctl.h>#include <string.h>#原创 2021-04-07 21:58:29 · 69 阅读 · 0 评论 -
04-文件IO基本函数使用
#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdio.h>/* ./copy a.txt b.txt argc = 3 argv[0] = "./copy" argv[1] = "a.txt" argv[2] = ...原创 2021-04-06 23:23:44 · 112 阅读 · 0 评论 -
03-Makefile的写法
Makefile的格式:目标:依赖 命令最简单的Makefilehello:hello.c gcc -o hello hello.cclean: rm -f hello$@ : 目标$<: 第一个依赖$^: 所有依赖hello:hello.c gcc -o $@ $<clean: rm -f $@...原创 2021-04-06 23:07:05 · 48 阅读 · 0 评论 -
02-GCC编译器的常用选项
1.指定输出文件 -ogcc -o hello hello.c2. 预处理 -Egcc -E -o hello.i hello.c3. 预处理+编译 -Sgcc -S -o hello.s hello.c4.预处理+编译+汇编 -cgcc -c -o hello.o hello.c5. 将预处理结果打印出来gcc -E hello.c6.将预处理的宏定义打印出来gcc -E -dM hello.c7.将编译警告信息打印出来gcc -...原创 2021-04-06 23:00:23 · 135 阅读 · 0 评论 -
01-最简单的Hello world程序
1. 代码/* 打印人见人爱的Hello world! 也可以打印你自己的Hello xxx (执行时加参数xxx)*/#include <stdio.h>int main(int argc, char **argv){ int i; if(argc >= 2){ printf("Hello, %s!\n",argv[1]); }else{ printf("Hello world!\n"); } return 0;}2. 编译 gcc .原创 2021-04-06 21:49:30 · 292 阅读 · 0 评论