otgisr.c

来自「使用ISP1362芯片的USB_OTG参考设计源代码比较新的版本」· C语言 代码 · 共 151 行

C
151
字号
/*
   //*************************************************************************
   //
   //                  P H I L I P S   P R O P R I E T A R Y
   //
   //           COPYRIGHT (c)   2000 BY PHILIPS SINGAPORE.
   //                     --  ALL RIGHTS RESERVED  --
   //
   // File Name:	OtgISR.C
   // Author:		Zhongwei Wang
   // Created:		Sep. 22, 2001
   // Modified:
   // Revision:		0.1
   //
   //*************************************************************************

*/

/*
**  WASABI-Hot! version 1.2c    (OTG sub-unit)
**
**      ** This code has been made to check/learn                          ** 
**      **                             the ISP1362/ISP1363 functionalities **
**      ** Release 06-Aug-2004                                             **
**
*/

#include <stdio.h>
#include <string.h>
#include <dos.h>

#include		"general.h"w

#ifdef WASABI

#include		"_hc_hw/hc_comm.h"
#include		"_hc_hw/hw_acces.h"

#include 		"_otg/HAL4OTG.h"
#include 		"_otg/OTGSvc.h"


#define		Hal4Hc_RegOutW		write_register16
#undef		Hal4Otg_InW
#define		Hal4Otg_InW			read_register16
#undef		Hal4Hc_RegInW
#define		Hal4Hc_RegInW		read_register16


#define		Hal4Hc_RegOutDW		write_register32


unsigned long	g_otg_interrupt_flag	= 0;

#else


#include "BasicTyp.h"
#include "common.h"
#include "SysCnfg.h"


#include "HAL4Sys.h"
#include "HAL4ISA.h"
#include "HAL4IKit.h"
#include "HAL4D13.h"
#include "HAL4HC.h"

#include "HcISR.h"
#include "HAL4OTG.h"
#include "OTGSVC.h"

#endif




//*************************************************************************
//  Public static data
//*************************************************************************

extern bIRQL;
extern OTG_TCB OtgTcb;

extern unsigned long	gp_debug_test0;

//*************************************************************************
//  ISR Subroutine
//*************************************************************************

void otg_fn_OTG_isr(void)
{
	USHORT wTemp,wTemp2;

	wTemp = Hal4Hc_RegInW(REG_OTG_INTERRUPT);
	wTemp2 = Hal4Hc_RegInW(REG_OTG_STATUS);
	Hal4Hc_RegOutW(REG_OTG_INTERRUPT, wTemp);	//clear interrupt causes

#if 0
//	printf("\n\n>>> OTG Interupt: 0x%x  OTG Status: 0x%x <<<\n\n", wTemp,wTemp2);
#else
	if(wTemp & OTG_IRQ_ID)
	{
		printf(">>> Interupt: OTG ID[%d]\n",wTemp2&OTG_IRQ_ID?1:0);
	}
	if(wTemp & OTG_IRQ_A_VBUS_VLD)
	{
		printf(">>> Interupt: OTG A_VBUS_VLD[%d]\n",wTemp2&OTG_IRQ_A_VBUS_VLD?1:0);
	}
	if(wTemp & OTG_IRQ_B_SESS_END)
	{
		printf(">>> Interupt: OTG B_SESS_END[%d]\n",wTemp2&OTG_IRQ_B_SESS_END?1:0);
	}
	if(wTemp & OTG_IRQ_A_SESS_VLD)
	{
		printf(">>> Interupt: OTG A_SESS_VLD[%d]\n",wTemp2&OTG_IRQ_A_SESS_VLD?1:0);
	}
	if(wTemp & OTG_IRQ_B_SESS_VLD)
	{
		printf(">>> Interupt: OTG B_SESS_VLD[%d]\n",wTemp2&OTG_IRQ_B_SESS_VLD?1:0);
	}
	if(wTemp & OTG_IRQ_RMT_CONN)
	{
		printf(">>> Interupt: OTG RMT_CONN[%d]\n",wTemp2&OTG_IRQ_RMT_CONN?1:0);
	}
	if(wTemp & OTG_IRQ_SUSPND)
	{
		printf(">>> Interupt: OTG BUS_SUSPEND[%d]\n",wTemp2&OTG_IRQ_SUSPND?1:0);
	}
	if(wTemp & OTG_IRQ_RESUME)
	{
		printf(">>> Interupt: OTG BUS_RESUME[%d]\n",wTemp2&OTG_IRQ_RESUME?1:0);
	}
	if(wTemp & OTG_IRQ_SRP_DET)
	{
		printf(">>> Interupt: OTG A_SRP_DET\n");
	}
	if(wTemp & OTG_IRQ_SE0_SRP)
	{
		printf(">>> Interupt: OTG B_SE0_SRP[%d]\n",wTemp2&OTG_IRQ_SE0_SRP?1:0);
	}
	if(wTemp & OTG_IRQ_TMR)
	{
		printf(">>> Interupt: OTG OTG_TMR_TIMEOUT\n");

	}
#endif

}

⌨️ 快捷键说明

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