当前位置: 首页 > news >正文

linux 下各个头文件的作用[典]

linux 下各个头文件的作用
 

2.6.30.4的头文件的位置和2.6.25.8的不一样,除去内核源码下的include目录外,

在arch/arm/mach-s3c2410/和arch/arm/plat-s3c24xx/目录下都有include目录的。

 

#include <linux/kernel.h>     // printk()

#include <linux/slab.h>      // kmalloc() 

#include <linux/fs.h>        // file_operation,inode_operations,super_operations

#include <linux/errno.h>      // error codes */

#include <linux/types.h>      // size_t等各种系统typedef的数据类型 */

#include <linux/fcntl.h>      // O_ACCMODE */

#include <linux/poll.h>      // COPY_TO_USER */
 

#include <linux/init.h>      // #define module_init(x)    __initcall(x);  
                  // #define module_exit(x)    __exitcall(x); 


#include <linux/miscdevice.h>     // extern int misc_register();  

                                  // 注册miscdevice结构体成员变量设备

                                  // extern int misc_deregister();  

                                  // 注销miscdevice结构体成员变量设备 

  

#include <linux/cdev.h>      // void cdev_init()
                  // struct cdev *cdev_alloc(void);
                  //  void cdev_put(struct cdev *p);
                  //  int cdev_add(struct cdev *, dev_t, unsigned);
                  //  void cdev_del(struct cdev *);
                  //  void cd_forget(struct inode *); 

 

#include <mach/hardware.h>     // 和GPIO口操作相关的函数定义的头文件对应的源文件在

                                   //  /arch/arm/plat-s3c24xx/gpio.c  

                                   //  void s3c2410_gpio_cfgpin(pin,function);
                  // unsigned int s3c2410_gpio_getcfg(pin);
                  // void s3c2410_gpio_pullup(pin,to);
                  // int s3c2410_gpio_getpull(pin);
                  // void s3c2410_gpio_setpin(lin,to);
                  // unsigned int s3c2410_gpio_getpin(pin);
                  // unsigned int s3c2410_modify_misccr(clear,chang)

                  // int s3c2410_gpio_getirq(pin);
                                   //  int s3c2410_gpio_irq2pin(pin);

                    

#include <mach/regs-gpio.h>     // 和GPIO口相关的一些宏定义

                                    //(在arch/arm/mach-s3c2410/mach)

#include <linux/platform_device.h> 

#include <linux/interrupt.h>      // typedef irqreturn_t (*irq_handler_t) 

                                    // (int, void *);
                  // extern void free_irq(unsigned int, void *);

                                    // extern void disable_irq(unsigned int irq);
                  // extern void enable_irq(unsigned int irq);

                                    // 等和中断相关函数的声明 

 

#include <linux/wait.h>         // wake_up_interruptible唤醒 q 指定的注册在等待队列

                                   //上的进/程。该函数不能直接的立即唤醒进程,而是由调

                                   // 度程序转换上下文,调整为可运行状态。

                                   // DECLARE_WAIT_QUEUE_HEAD(button_waitq);声明队列为

                                   // 全局变量 

                                   // wait_event_interruptible该函数修改task的状态

                                   // 为 TASK_INTERRUPTIBLE,意味着改进程将不会继续运

                                   // 行直到被唤醒,然后被添加到等待队列wq中

 

#include <linux/poll.h>       // poll_wait 

#include <asm/uaccess.h>      // copy_to_user和copy_from_user 
#include <asm/io.h>         // __raw_readl  __raw_writel

#include <linux/clk.h>       // struct clk *clk_get

                                    // (struct device *dev, const char *id);
                  // unsigned long clk_get_rate(struct clk *clk);
 

 

#include <plat/clock.h>       // struct clk;结构体的定义(在arch/arm/plat-

                                    // s3c/plat/include/clock.arch中,对应的源文件在

                                    // /arm/plat-s3c/clock.c)

 

#include <linux/device.h>           //包含了device、class 、device_driver等结构的定义

#include <mach/regs-mem.h>     // 和bank相关的寄存器的宏定义 

#include <asm/div64.h>       // Linux内核中64位除法函数do_div 

#include <linux/fb.h>        // struct fb_info 结构体的定义 

#include <mach/fb.h>        // struct s3c2410fb_display

                                    //(在arch/arm/mach-s3c2410/include/mach/fb.h)

 

#include <linux/module.h>      //MODULE_LICENSE("GPL");内核认识的特定许可有, 
                     "GPL"( 适用 GNU 通用公共许可的任何版本 ), 
                     "GPL v2"( 只适用 GPL 版本 2 ), 
                     "GPL and additional rights", 
                     "Dual BSD/GPL", 
                     "Dual MPL/GPL", 
                     "Proprietary".
                除非你的模块明确标识是在内核认识的一个自由许可
                               下,否则就假定它是私有的,内核在模块加载时被"弄污
                               浊"了. 象我们在第 1 章"许可条款"中提到的, 内核开
                               发者不会热心帮助在加载了私有模块后遇到问题的用户.
                MODULE_AUTHOR ( 声明谁编写了模块 ), 
                      MODULE_DESCRIPION( 一个人可读的关于模块做什么的声明 ), 
                               MODULE_VERSION(一个代码修订版本号;看 <linux/module.h> 
                               的注释以便知道创建版本字串使用的惯例), 
                        MODULE_ALIAS ( 模块为人所知的另一个名子 ), 
                          MODULE_DEVICE_TABLE(来告知用户空间, 模块支持那些设备 )

转载于:https://www.cnblogs.com/Ph-one/p/4281349.html

相关文章:

  • android与linux之间的关系
  • linux-android(任务处理)
  • Android系统启动过程[典☆☆☆]
  • linux目录结构
  • make menuconfig错误的解决办法
  • ubuntu下 gedit中文乱码
  • Ubuntu12.04 安装adb
  • Error: Flash Download failed - Cortex-M0
  • ECU
  • 股份简介
  • 电钢琴型号
  • 一只饥饿的老虎
  • kernel command line 参数详解
  • android ramdisk
  • Ubuntu 12.04下安装QQ 2012 Beta3
  • 【干货分享】SpringCloud微服务架构分布式组件如何共享session对象
  • es6(二):字符串的扩展
  • IIS 10 PHP CGI 设置 PHP_INI_SCAN_DIR
  • Java读取Properties文件的六种方法
  • js继承的实现方法
  • Mac 鼠须管 Rime 输入法 安装五笔输入法 教程
  • mysql innodb 索引使用指南
  • node-sass 安装卡在 node scripts/install.js 解决办法
  • Sublime Text 2/3 绑定Eclipse快捷键
  • Vue小说阅读器(仿追书神器)
  • 阿里云前端周刊 - 第 26 期
  • 半理解系列--Promise的进化史
  • 表单中readonly的input等标签,禁止光标进入(focus)的几种方式
  • 基于MaxCompute打造轻盈的人人车移动端数据平台
  • 罗辑思维在全链路压测方面的实践和工作笔记
  • 前端性能优化--懒加载和预加载
  • 为什么要用IPython/Jupyter?
  • 我的面试准备过程--容器(更新中)
  • 我的业余项目总结
  • 我建了一个叫Hello World的项目
  • 小而合理的前端理论:rscss和rsjs
  • 一天一个设计模式之JS实现——适配器模式
  • kubernetes资源对象--ingress
  • 阿里云服务器如何修改远程端口?
  • ​香农与信息论三大定律
  • #QT(一种朴素的计算器实现方法)
  • %3cscript放入php,跟bWAPP学WEB安全(PHP代码)--XSS跨站脚本攻击
  • (a /b)*c的值
  • (c语言)strcpy函数用法
  • (附源码)ssm基于微信小程序的疫苗管理系统 毕业设计 092354
  • (简单有案例)前端实现主题切换、动态换肤的两种简单方式
  • (实战)静默dbca安装创建数据库 --参数说明+举例
  • (转)AS3正则:元子符,元序列,标志,数量表达符
  • (转)visual stdio 书签功能介绍
  • (转载)OpenStack Hacker养成指南
  • (转载)PyTorch代码规范最佳实践和样式指南
  • *setTimeout实现text输入在用户停顿时才调用事件!*
  • .net 4.0发布后不能正常显示图片问题
  • .NET Core 将实体类转换为 SQL(ORM 映射)
  • .Net Core缓存组件(MemoryCache)源码解析