- 1、本文档共33页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
USB驱动程序源代码
项目报告7
USB驱动程序源代码 作者:罗仕波
头文件go7007sb.h
/*
*go7007sb.h - this file includes all relative header files that
*will be used in go7007sb vedio usb interface driver, and it
*also defines all relative driver private data structures and
*its io control commands.
*/
#ifndef _GO7007SB_H
#define _GO7007SB_H
#include linux/module.h
#include linux/kernel.h
#include linux/errno.h
#include asm/uaccess.h
#include linux/init.h
#include linux/slab.h
#include linux/delay.h
#include linux/ioctl.h
#include linux/sched.h
#include linux/smp_lock.h
#include linux/fs.h
#include linux/devfs_fs_kernel.h
//#define DEBUG
#define DRIVER_VERSION 1.0.0
#define DRIVER_DESC USB GO7007SB Driver
#include linux/usb.h
MODULE_AUTHOR(Luo Shibo);
MODULE_DESCRIPTION(DRIVER_DESC DRIVER_VERSION);
MODULE_LICENSE(GPL);
/*
*io control commands definition,these commands will be
*used to control the device in function iocntl_go7007sb
*/
#define GO7007SB_IOC_MAGIC U //command magic number
#define GO7007SB_IOC_RESET _IO(GO7007SB_IOC_MAGIC,0) //software reset the device
#define GO7007SB_IOC_SHUTDOWN _IO(GO7007SB_IOC_MAGIC,1) //shutdown the device
#define GO7007SB_IOC_PAUSE _IO(GO7007SB_IOC_MAGIC,2) //pause compression
#define GO7007SB_IOC_RESUME _IO(GO7007SB_IOC_MAGIC,3) //resume from pause status
#define GO7007SB_IOC_GETSTATE _IOR(GO7007SB_IOC_MAGIC,4,unsigned int)//get state of dev
/*
*go7007sb device file number,the major of all USB devices have been defined as 180,
*we just need to define minors here,currently,we accept only 4 devices
*their minors start from 64,so minors:64,65,66,67 should be ok.
*/
#ifdef __KERNEL__ /*__KERNEL__*/
#define GO7007SB_MAX_MNR 4
#define GO7007SB_BASE_MNR 64
#define USB_GO7007SB_MINOR(inode) MINOR((inode)-i_rdev)-GO7007SB_BASE_MNR
/*
*go7007sb video interface number
*/
#define GO7007SB_VIDEO_IFNUM 0
/*
*endpoints definition
*/
#define GO7007SB_MAX_EP_NUM 4 //maximum endpoint number
#define GO7007SB_EP_BULK_IN 1 //in endpoint for stream
#define GO7007SB_E
文档评论(0)