demo.h
来自「arm+linux下can控制器驱动,已经在arm9上调试通过」· C头文件 代码 · 共 52 行
H
52 行
#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//#define NULL 0#define SA_INTERRUPT 0//�ṹstruct DEMO_dev { struct semaphore sem; /* mutual exclusion semaphore */ struct cdev cdev; /* Char device structure */ wait_queue_head_t wq; };//���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 + =
减小字号Ctrl + -
显示快捷键?