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

📄 usb.c

📁 一个linux下的usb接口源代码
💻 C
字号:
/************************************************************文档类型: 原代码 项目编号: 文档编号: 修订版本: v1.0生成日期: 2001.8.15文档作者: 何雄伦审    核: ************************************************************相关文档: ucdimm上的键盘连接 文档编号      说明 ************************************************************修订说明修订版本	v1.1	修订说明 重写了select函数************************************************************//*#include <linux/kernel.h>#include <asm/MC68VZ328.h>#include <asm/segment.h>#include <linux/types.h>#include <linux/fs.h>#include <linux/mm.h>#include <linux/errno.h>#include <linux/sched.h>#include <linux/tqueue.h>#include <linux/interrupt.h>#include "usb.h"*/#include "DataType.h"CONTROL_XFER 	ControlData;EPPFLAGS	bEPPflags;D12FLAGS	bD12flags;UCHAR Allbuffer[0x10000L];unsigned 	long Buffer_Length;unsigned 	char* Buffer_Pointer;unsigned 	char Id;UCHAR CBWBuf[31];UCHAR CSWBuf[13];/*unsigned int usb_major = 94;static int usb_read(struct inode *node, struct file *fp,		    short *buf, int count){//	printk("usb driver read was called\n");	return 0;	}static int usb_open(struct inode *node, struct file *fp){//	printk("usb driver open was called\n");	return 0;}static void usb_close(struct inode *node, struct file *fp){//		printk("usb driver close was called\n");}static int usb_write(struct inode *node, struct file *fp,		    const char *buf, int count){//	printk("usb driver write was called\n");	return 0;}static int usb_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, unsigned long arg){	if (cmd == 0x0A)	{		Usb_Main();	}	return 0;}struct file_operations usb_fops = {	NULL,	usb_read,	usb_write,	NULL,	NULL,	usb_ioctl,	NULL,	usb_open,	usb_close,	NULL,	NULL,	NULL,	NULL};*//************************************************************函数原型: void init_mykey()功    能: Do all the initialize work,include registe device,	 initialize the SPI,request interrupt.输入参数: No input argument.返 回 值: No return value.************************************************************//*void InitUSB(){	int result;	result = register_chrdev(usb_major, "USB", &usb_fops);	if (result<0)	{		printk("USB: can't get major number\n");		return;	}	//requset USB Interrupt IRQ3	if (request_irq(18|0x10000000, usb_isr, SA_SHIRQ,		"USBhandler", NULL))	{		printk("USB Cannot request irq\n");	}	//Init USB hardware	usb_initialize();	printk("initialize usb hardware complate\n");}*/

⌨️ 快捷键说明

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