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

📄 gfd_usb_init.c

📁 最近在國外網站抓到的作業系統 以Arm為基礎去開發的
💻 C
字号:
/**************************************************************************************
 *
 *  (c) 2004 ASIC,all rights reserved
 *         
 *           
 *	This source code and any compilation or derivative thereof 
 *is proprietary information and is confidential in nature.
 *	Under no circumstance is this software to be exposed or placed
 *under an open source License of any type without expressed
 *written permission of ASIC.  
 *
 *filename:	main.c          
 *history:
 *
 *    Version         Date            Author            Comments
 *------------------------------------------------------------------------------------    
 *     1.0          2004.9.24           lmq             Initial Creation
 *     
 **************************************************************************************/
#include "HA_TypeDef.h"
#include "hardware_reg.h"
#include "hardware.h"
#include "itron.h"
#include "Lmalloc.h"
/*-------------------------------------------------------------------*
 *				extern function definitions 
 *-------------------------------------------------------------------*/
extern  ER usb_RMW_reg(U32 reg, U32 val);
U32 *bulkindatebuf;
U32 *bulkoutdatebuf;
 
 
 
/*-------------------------------------------------------------------*
 *				local function definitions
 *-------------------------------------------------------------------*/
int init_usb( void )
{
	int i;

	/* malloc for buffer */
	bulkindatebuf = (U32 *)(0x1fff3000);
	bulkoutdatebuf = (U32 *)(0x1fff4000);
			
	/*usb initialization*/
	usb_RMW_reg((U32)USB_EP0OUTSTAT, 0x02);
	usb_RMW_reg((U32)USB_EP1OUTSTAT, 0x02);
	usb_RMW_reg((U32)USB_EP1INSTAT, 0x02);
	usb_RMW_reg((U32)USB_EP2OUTSTAT, 0x02);
	usb_RMW_reg((U32)USB_EP2INSTAT, 0x02);
	usb_write_reg((U32)USB_INTR,0);
	usb_write_reg((U32)USB_INTRMASK, 0x122);
	usb_write_reg((U32)USB_EP0OUTMAXPKTSIZE, 0x8);
	usb_write_reg((U32)USB_EP1OUTMAXPKTSIZE, 0x40);
	usb_write_reg((U32)USB_EP1INMAXPKTSIZRE, 0x40);
	usb_write_reg((U32)USB_EP2OUTMAXPKTSIZE, 0x40);
	usb_write_reg((U32)USB_EP2INMAXPKTSIZE, 0x40);
	usb_write_reg((U32)USB_EP1OUTBMATTR, 0x02);
	usb_write_reg((U32)USB_EP2INBMATTR, 0x02);
	usb_write_reg((U32)USB_BMATTRIBUTES, 0xe0);
	*(RP)USB_RECEIVETYPE = 0X1;
	irq_enable(INT_USB);
	unmask_irq(INT_USB);
	irq_enable(INT_DMA);
	unmask_irq(INT_DMA);
}

⌨️ 快捷键说明

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