
Linux 驱动程序
千雅爸爸
爱生活,爱编程;每天一小步,总有新高度;500mi 勇闯天涯,勇创辉煌
展开
-
c语言指针相关的提纲
c语言指针相关的提纲1:指针 是什么,如何声明和使用指针就是地址,一般是指向变量的头地址星号✳️,声明时候表示是指针,使用的时候表明是对象int *a = c;*a = 1;2: 指针 和 数组只要是可以用数组下标的都是可以用指针的3: 字符数组,这里因为c语言没有string 类型char a[]char a*这两个都是表示的字符数组4: 指针 和 函数两个方面要注意⚠️4.1 实参和形参的区别4.2 结构的使用里面使用指针,比...原创 2020-10-08 08:39:43 · 260 阅读 · 0 评论 -
Linux 系统对中断的处理
1:寄存器的状态保存在栈中2:中断中断,中断谁?中断正在运行的进程或者是线程Linux 中 资源分配的单位是进行,调度的单位是线程3:ARM 芯片 属于精简指令集计算机 RISC ,他所用的指令比较简单对内存只有读写的指令对于数据的运算是在cpu内部实现的使用risc 指令的cpu 复杂度小一点,易于设计4:执行a+b的几个步骤都要保证读取a读取bcpu中计算a+b写入到a的寄存器中步骤中 代码,数据,cpu内部寄存器 都不要被修改,cpu内部寄存器 保存在栈中,保存的这些值,我们称原创 2020-09-07 23:44:16 · 301 阅读 · 0 评论 -
linux pinctrl 子系统和 gpio子系统
GPIO 子系统和Pinctrl 子系统首先介绍Pinctrl之前都是直接操作寄存器,这里相当于通过Pinctrl 进行了一层封装,将引脚的复用和设置都通过Pinctrl 来操作,主要是给GPIO I2C 系统使用的,可以理解为之前的IOMUX 复用控制器Pinctrl 可以分为Pin ctroller 和Client devicePin Controller 只是一个概念和命名,实际上可能并没有,这里需要和GPIO Controller 进行却别,Pin Controller 用来设置引脚工作在G原创 2020-09-07 00:42:32 · 416 阅读 · 0 评论 -
linux 中断处理流程
奶奶带小孩的案例1:1:中断源2:初始化3:中断处理的流程4:中断向量原创 2020-09-03 23:13:07 · 355 阅读 · 0 评论 -
mark
1: EOF Please use " ctrl + d"2: exception:9.c:9:28: warning: implicit declaration of function ‘isdigit’ [-Wimplicit-function-declaration] printf("isdigit(c) = %d",isdigit(c));#include <stdio.h>int main(){ printf("please input char\n");...原创 2020-08-06 00:25:37 · 313 阅读 · 0 评论 -
linux devicetree
1: test# ls /sys/firmware/devicetree fdt2: /sys/firmware/devicetree目录下是以目录结构程现的dtb文件, 根节点对应base目录, 每一个节点对应一个目录, 每一个属性对应一个文件。这些属性的值如果是字符串,可以使用cat命令把它打印出来;对于数值,可以用hexdump把它打印出来。一个单板启动时,u-boot先运行,它的作用是启动内核。U-boot会把内核和设备树文件都读入内存,然后启动内核。在启动内核时会把设备树在内存中.原创 2020-08-04 09:50:21 · 328 阅读 · 0 评论 -
hello Linux module FIrst
#include <linux/module.h>#include <linux/fs.h>#include <linux/errno.h>#include <linux/miscdevice.h>#include <linux/kernel.h>#include <linux/major.h>#include <linux/mutex.h>#include <linux/proc_fs.h>#.原创 2020-07-26 23:05:33 · 279 阅读 · 0 评论 -
Ubuntu Environment setup
1: sudo apt-get install putty2: sudo putty . if not sudo, it will can not connect3: update serial configurationinput "/dev/ttyUSB0" for Serial line to connect toinput 115200 for serial line speedselect "None" for Flow control and Parityinput 8 f原创 2020-07-24 16:29:02 · 355 阅读 · 0 评论 -
linux 驱动第4课 - 文件io
https://ke.qq.com/course/466167?taid=41666036088906151: ls -al/dev 下面显示的第一个字母如果是c 代表的是字符设备,b 代表的是块设备2: 后面的 信息里面,第一个是主设备好,第二个是次设备号root@iZrj9e3565o1e423gw4xgiZ:~# ls -al /devtotal 4drwxr-xr-x 18 root root 3740 Jun 24 02:31 .drwxr-xr-x 25 r..原创 2020-06-30 23:51:59 · 288 阅读 · 0 评论 -
《linux 驱动第3课》Makefile 的使用
makefile 的作用高效的编译,减少不必要的编译,只编译涉及到的文件一个简单的规则:依赖里面有修改了 那么执行下面的命令,千万要记得 前面要有tab而不是空格,这里怎么判断呢 就是判断 taeget的时间和依赖文件的时间对比target :依赖tab:命令test:main.o sub.o gcc -o test main.o sub.o保存为Makefile执行的两个条件 : 依赖比目标新,目标还没有生成执行 直接执行make命令就可以了2: 为.原创 2020-06-29 23:15:14 · 279 阅读 · 0 评论 -
《Linux 驱动 学习 -2》 gcc 编译器学习
https://ke.qq.com/course/466167?taid=4166586429021431https://book.100ask.org/documentation/6-2/6-2.htmlmain.c#include <stdio.h>#include "sub.h"int main(int argc, char *argv[]){ int i; printf("main fun\n"); sub_fun();原创 2020-06-29 00:07:16 · 457 阅读 · 0 评论 -
《Linux 驱动学习 - 1 》hello world 没有那么简单
https://ke.qq.com/course/466167?taid=4166582134054135#include <stdio.h> /* * 执行命令 ./hello kodulf * argc = 2 * argv[0] = ./hello * argv[1] = kodulf **/int main(int argc, char **argv){ if(argc >= 2){ printf(.原创 2020-06-28 08:07:47 · 279 阅读 · 0 评论 -
ubuntu 和linux 上面git clone 的时候内存不足导致失败的最完美解决 index-pack died of signal
warning: redirecting to https://android.googlesource.com/kernel/goldfish.git/ remote: Sending approximately 1.60 GiB ... remote: Counting objects: 119, done remote: Finding sources: 100% (119/119)error: index-pack died of signal 9451266), 563.58 MiB |.原创 2020-06-24 03:06:46 · 2957 阅读 · 0 评论 -
ubuntu 上下载编写
学习的老罗的:https://blog.youkuaiyun.com/Luoshengyang/article/details/65599551: 遇到的第一个问题sudo apt-get installgit-core gnupg 运行失败:ubuntu进行apt-get时候出现Package ssh is not available, but is referred to by another package 错误今天在ubuntu进行ssh安装的时候,出现如下错误。Re...原创 2020-06-24 00:49:00 · 405 阅读 · 0 评论 -
如何编写驱动程序
1:确定主设备好2:定义自己的file_oprations 结构体3: 实现对应的 open/read/write 等函数,填入file_oprations 结构体4: 把file_oprations 结构体告诉内核,注册驱动程序 register_chrdev5: 谁来注册驱动程序呢?得有一个入口函数,安装驱动程序时,就会去调用这个入口函数6: 出口函数,就会去调用这个出口函数7: 其他完善,提供设备信息,自动创建设备节点...原创 2020-06-19 01:16:52 · 1435 阅读 · 0 评论