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

📄 usbint.c

📁 utisoftware c code for linux,机卡分离方案。
💻 C
字号:
#include "defusr.h"
#include  "macusr.h"
#include  "libassp.h"
#include  "extern.h"
#include <asm/irq.h>
//#include <linux/interrupt.h>
//#include "stsys.h"


/*""FUNC COMMENT""*************************************************************
 *-----------------------------------------------------------------------------
 * Function		: USB interrupt
 *-----------------------------------------------------------------------------
 * Declaration	: void usbint(void)
 *-----------------------------------------------------------------------------
 * Argument		: void
 *-----------------------------------------------------------------------------
 * Return		: void
 *-----------------------------------------------------------------------------
 * Note			:
 *-----------------------------------------------------------------------------
 *""FUNC COMMENT END""********************************************************/
void usbint(int irq, void * meaningless, struct pt_regs * nonenone)				// transfer data
{
	U16	intsts0, intsts1;
	U16	intenb0, intenb1;
	U16	brdysts, nrdysts, bempsts;
	U16	brdyenb, nrdyenb, bempenb;
	extern int intcount;
/*	USBWR(D1FIFOSEL,DCLRM|MBW_8|PIPE1);
	USBWR(D1FIFOSEL,DCLRM|MBW_8|PIPE2); */
	/** MULTI_INT_ENABLE(); **/
	disable_irq( USB_INT_LEVEL );
	intcount ++;
#if PCUT_MODE == PCUT_USE
	if( PcutMode == YES ) {
		delay_1ms();								/* wait 2.5ms */
		delay_1ms();
		delay_1ms();
	}
#endif
	USBRD(INTSTS0, intsts0);
	USBRD(INTSTS1, intsts1);
	USBRD(INTENB0, intenb0);
	USBRD(INTENB1, intenb1);

	if( (intsts1 & intenb1 & (BCHG|SIGN|SACK)) ) {
		if( (intsts1 & BCHG) && (intenb1 & BCHGE) ) {
			USB_CLR_STS(INTSTS1, BCHG);				/* Status Clear */
			USB_CLR_PAT(INTENB1, BCHGE);			/* disable */
			BchgFlg = YES;
		}
		else if( (intsts1 & SACK) && (intenb1 & SACKE) ) {
		/**USB_CLR_STS(INTSTS1, SACK);	**/			/* Status Clear */
		}
		else if( (intsts1 & SIGN) && (intenb1 & SIGNE) ) {
		/** USB_CLR_STS(INTSTS1, SIGN);	**/			/* Status Clear */
		}
	}
	else if( (intsts0 & intenb0 & (BEMP|NRDY|BRDY)) ) {
		USBRD(BRDYSTS, brdysts);
		USBRD(NRDYSTS, nrdysts);
		USBRD(BEMPSTS, bempsts);
		USBRD(BRDYENB, brdyenb);
		USBRD(NRDYENB, nrdyenb);
		USBRD(BEMPENB, bempenb);

		/* Processing whithout PIPE0 data */
		if( (intsts0 & BRDY) && (intenb0 & BRDYE) && (brdysts & brdyenb) ) {
			INTR_int(brdysts, brdyenb);
		}
		else if( (intsts0 & BEMP) && (intenb0 & BEMPE) && (bempsts & bempenb) ) {
			BEMP_int(bempsts, bempenb);
		}
		else if( (intsts0 & NRDY) && (intenb0 & NRDYE) && (nrdysts & nrdyenb) ) {
			INTN_int(nrdysts, nrdyenb); 
		}
	}
	enable_irq( USB_INT_LEVEL );
}

⌨️ 快捷键说明

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