首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > C# > linux设备驱动程序简单示例

linux设备驱动程序简单示例

  • 资源大小:63.63 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: linux driver

资 源 简 介

以一个hello word程序为例,展示最简单的linux设备驱动程序。hello.c#include #include MODULE_LICENSE("Dual BSD/GPL");static int hello_init(void){    printk(KERN_ERR "hello world! ");    return 0;}static void hello_exit(void){    printk(KERN_ERR "goodbye cruel world ");}module_init(hello_init);module_exit(hello_exit);hello.h:无makefile:ifneq ($(KERNELRELEASE),)obj-m := hello.oelseKERNELDIR ?= /root/rpmbuild/BUILD/kernel-3.10.0-693.21.1.el7/linux-3.10.0-693.21.1.el7.x86_64PWD := $(shell pwd)default:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesendif

文 件 列 表

hello
makefile
.hello.ko.cmd
.hello.mod.o.cmd
.hello.o.cmd
.tmp_versions
hello.mod
hello.c
hello.h
hello.ko
hello.mod.c
hello.mod.o
hello.o
Module.symvers
modules.order
.tmp_versions
VIP VIP
0.174688s