Linux驱动
wllinux12138
这个作者很懒,什么都没留下…
展开
-
Linux设备树相关结构体
这个结构体用来做驱动和设备的匹配,of_match_device函数可以拿到这个结构体: struct of_device_id { char name[32]; char type[32]; char compatible[128]; #ifdef __KERNEL__ const void *data;//私有数据 #else kernel_ulong_t data; #endif };...原创 2021-01-08 20:34:17 · 271 阅读 · 0 评论 -
读取设备树自定义变量的值
name:name@xxxxxxx { value = <1>;}上面是设备树的一个节点,xxxx代表物理地址。value是自定义的一个值。static int module_probe(struct platform_device *pdev){ struct device_node *np; uint32_t read_value; struct device *dev = &pdev->dev; np = dev->of_node; //读取设备树中原创 2020-12-22 10:16:47 · 351 阅读 · 0 评论 -
Linux内核等待队列相关函数注释
文章目录一、数据结构1.1 等待队列头1.2 等待队列成员二、函数进程等待2.1 wait_event2.1.1 __wait_event:2.1.2 prepare_to_wait_event:2.2 add_wait_queue进程唤醒wake一、数据结构1.1 等待队列头 34struct wait_queue_head { 35 spinlock_t lock; 36 struct list_head head;原创 2020-12-15 20:05:51 · 170 阅读 · 0 评论 -
tasklet使用方法
简单说明tasklet的使用方法://定义tasklet结构体:struct tasklet mytasklet;/*初始化:第一个参数:tasklet结构体的指针第二个参数:函数指针void (*func)(unsigned long)类型第三个参数:传递给func的参数,也就是tasklet_struct结构体里面的unsigned long data*/tasklet_init(&mytasklet,func,0);//调用:mytasklet.data = 1;//给f原创 2020-12-11 10:17:41 · 520 阅读 · 0 评论 -
console_initcall
#define console_initcall(fn) ___define_initcall(fn,, .con_initcall)#define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id) #define ___define_initcall(fn, id, __sec) \ static initcall_t __initcall_##fn##id __used \原创 2020-11-10 10:48:28 · 300 阅读 · 0 评论 -
mini2440-----led驱动实验
本文实现了一个简单的led驱动程序,只是做个实验,了解驱动的编写方法。里面也实现了read,write函数。(1)先裁剪掉官方提供的内核的led驱动,重新编译内核。用到的命令make menuconfig(2)写驱动代码如下,现象:安装驱动的时候点亮4个led。卸载驱动,关闭led。为了测试方便,直接在init函数里面点亮了led。用的是动态映射的方法。#include &l...原创 2018-11-22 21:03:27 · 259 阅读 · 0 评论 -
Linux驱动的调试-打印函数调用堆栈
(1)dump_stack()打印函数调用堆栈#include<linux/init.h>#include<linux/module.h>static int hello_init(){ printk("hello_init\n"); dump_stack(); return 0;}static int hello_exit(){...原创 2019-08-18 16:51:47 · 1453 阅读 · 0 评论