上一页 1 2 3 4 5 6 ··· 14 下一页

韦东山2440-学习笔记-字符设备驱动

摘要: button字符驱动 #include <linux/module.h> #include <linux/spinlock.h> #include <asm/atomic.h> #include <linux/poll.h> #include <linux/interrupt.h> #include 阅读全文
posted @ 2023-02-21 22:21 开心种树 阅读(44) 评论(0) 推荐(0) 编辑

kernel——platform

摘要: 1. 最简单的示例 #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/device.h> #include <linux/platform_device.h> sta 阅读全文
posted @ 2023-01-05 22:23 开心种树 阅读(52) 评论(0) 推荐(0) 编辑

kernel——kobj

摘要: 设备模型的意义 为了避免驱动开发中对相同功能的重复实现,内核按照面向对象的思想,实现了一套驱动开发通用的函数和对象,称为设备模型。 如下,根据开发驱动的不同,继承不同父类,简化开发。 kobject kobj使用示例 #include <linux/module.h> #include <linux 阅读全文
posted @ 2022-12-26 16:15 开心种树 阅读(356) 评论(0) 推荐(0) 编辑

kernel——debugfs

摘要: 1. 准备 首先在 menuconfig 时开启 debugfs Kernel hacking > Generic Kernel Debugging Instruments > [*] Debug Filesystem Debugfs default access (Access normal) > 阅读全文
posted @ 2022-11-26 19:03 开心种树 阅读(112) 评论(0) 推荐(0) 编辑

kernel——proc

摘要: 1. 简介 proc文件系统:一种和内核交互的接口,最早专用于读写进程信息。 特点: proc文件系统的文件节点只能从内核层创建,且这些节点的 ops 和 设备节点类似,是由创建者定义的。 2. proc文件系统的注册和挂载 start_kernel --vfs_caches_init 挂载root 阅读全文
posted @ 2022-11-25 22:54 开心种树 阅读(367) 评论(0) 推荐(0) 编辑

kernel——文件系统

摘要: 设备端文件系统的格式 所有文件系统都使用如下格式为基础 如minix,适用于小容量环境 如ext2,适用于大容量环境,于是进行了扩展 具体分析设备上的文件系统 以最简单的minix为例 格式化 root@ubuntu:~# mkfs.minix /dev/sdb 704 inodes 2048 bl 阅读全文
posted @ 2022-11-24 14:55 开心种树 阅读(245) 评论(0) 推荐(0) 编辑

c——动态数组

摘要: #include <stdio.h> #include <string.h> typedef struct test_s test_t; struct test_s { int a; int b; char arr[0]; }; int main() { test_t *t; char buf[32 阅读全文
posted @ 2022-11-17 13:17 开心种树 阅读(23) 评论(0) 推荐(0) 编辑

kernel——字符设备驱动

摘要: 字符设备驱动的框架 设备节点:inode,类型为字符设备,记录设备号 设备号:内核确定驱动的唯一编号 cdev:字符驱动对象 框架代码 驱动 #include <linux/module.h> #include <linux/file.h> #include <linux/rtc.h> static 阅读全文
posted @ 2022-11-16 23:32 开心种树 阅读(254) 评论(0) 推荐(0) 编辑

kernel——中断

摘要: 1. 理论 早期的51单片机只有4个中断,中断可以直接发给cpu ARM SoC有GIC,中断发给GIC,GIC发给cpu。 GIC有两个重要部分, 中断仲裁器,根据中断优先级,屏蔽,决定发送哪个中断, cpu接口,由于现在都是多核cpu,所以需要决定发送给哪个cpu 中断分类 SGI:16 sof 阅读全文
posted @ 2022-10-31 17:58 开心种树 阅读(181) 评论(0) 推荐(0) 编辑

kernel——系统调用

摘要: 1. 系统调用的原理 linux借助硬件实现特权态和用户态运行,应用程序只能通过系统调用进入内核态。 方法是使用系统调用指令。 以arm32环境,打印hello world字符串的汇编为例 .text .global _start _start: mov r0, #1 /* stdout */ ad 阅读全文
posted @ 2022-10-24 16:30 开心种树 阅读(148) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 14 下一页