⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo.h

📁 《linux驱动程序设计从入门到精通》一书中所有的程序代码含驱动和相应的应用程序
💻 H
字号:
#ifndef _DEMO_H_#define _DEMO_H_#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later *//******************************************************** * Macros to help debugging ********************************************************/#undef PDEBUG             /* undef it, just in case */#ifdef DEMO_DEBUG#ifdef __KERNEL__#    define PDEBUG(fmt, args...) printk( KERN_DEBUG "DEMO: " fmt, ## args)#else//usr space#    define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)#endif#else#  define PDEBUG(fmt, args...) /* not debugging: nothing */#endif#undef PDEBUGG#define PDEBUGG(fmt, args...) /* nothing: it's a placeholder *///设备号#define DEMO_MAJOR 224#define DEMO_MINOR 0#define COMMAND1 1#define COMMAND2 2//设备结构struct DEMO_dev {	struct semaphore sem;     /* mutual exclusion semaphore     */	struct cdev cdev;	  /* Char device structure		*/};//函数申明ssize_t DEMO_read(struct file *filp, char __user *buf, size_t count,                   loff_t *f_pos);ssize_t DEMO_write(struct file *filp, const char __user *buf, size_t count,                    loff_t *f_pos);loff_t  DEMO_llseek(struct file *filp, loff_t off, int whence);int     DEMO_ioctl(struct inode *inode, struct file *filp,                    unsigned int cmd, unsigned long arg);#endif /* _DEMO_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -