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

📄 usbhostomap.c

📁 有关于USB的一些主机端驱动
💻 C
字号:
/******************************************************************************/
/*                                                                 									          */
/* This is proprietary information, not to be published -- TI INTERNAL DATA  				   */
/* Copyright (C) 2003, Beijing DigiPro Information Technology Co., Ltd.                                */
/* All Rights Reserved.        				   										   */
/*                                                                           								   */
/* The driver for OMAP USB Function									              .         */
/*                                                                            								   */
/* Author: Changming HUANG		                                              					   */
/* Created: February 10, 2003                                                    						   */
/******************************************************************************/

//#include "usbfunc.h"
#include "usb-ohci.h"

//#include "usbhost.h"
extern struct omap_dev omap_hc_dev;
extern int ohci_omap_probe(struct omap_dev *dev);
extern void hc_interrupt ( void * __ohci);
extern void rh_int_timer_do ();

/*define the interrupt number*/
#define USB_GEN_INT			32+20
#define USB_ISO_INT			32+29
#define USB_NON_ISO_INT	32+30

/*define the interrupt enable*/
#define USB_SOF_ENABLE		1
#define USB_EpNRx_ENABLE	1
#define USB_EpNTx_ENABLE	1
#define USB_DSChg_ENABLE	1
#define USB_Ep0_ENABLE		1

#define USB_SOF_DISABLE		0
#define USB_EpNRx_DISABLE	0
#define USB_EpNTx_DISABLE	0
#define USB_DSChg_DISABLE	0
#define USB_Ep0_DISABLE		0


#define MAX_NUMLOG 32

//static char gfEndofTransfer = 0;

/* LOG DEVSTAT */
/*
unsigned short	gLogDEVSTAT[MAX_NUMLOG];
unsigned long		gIndexDEVSTAT=0;

unsigned short	gLogIRQSRC[MAX_NUMLOG];
unsigned short	gIndexIRQSRC=0;

unsigned short lunflags;
int bulkstatus;
unsigned short irq_src[1000];
int irq_num=0;
*/
/*application buffers to store the data from host to be sent back to host*/
unsigned short Buffer1[33];
extern volatile unsigned long rdTime ;

void USBInterrupt(void){

     hc_interrupt((&omap_hc_dev)->ohci);

     return ;
}


//static void OMAP_usb_interrupt(int irq,void *dev_id,struct pt_regs *regs){
#define IRQ_USB1 38
void usbtest(){
//	unsigned short temp_value;
//	int i;
	writel(0x0000EAEF,0xfffe100c);//set to OMAP1510 mode
	/*the following codes are added by Changming HUANG */

	hc_clk_init();		//host controller clock init
	hc_lbclk_init();		//Local Bus clock initi,
	lb_mmu_init();		//Local Bus MMU init
	set_fpga_usb();		//set the usb mode and enable
	usb_func_mux_config();//configure the USB FUNC_MUX_CTRL registers

	usb_hub_init();
/* Interrupt from i2c mapped on irq of the interrupt handler 2 */
	INTH2_InitLevel(IRQ_USB1,0,0,1); 

/* Valid the interrupt */
	INTH2_EnableOneIT(IRQ_USB1,0);

	ohci_omap_probe(&omap_hc_dev);	

	do{	
		rh_int_timer_do();
	}while(0);

	INTH2_DisableOneIT(IRQ_USB1);
    //   printf("USB1 Interrupt handler masked \n ");

//ENDINT:
}

⌨️ 快捷键说明

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