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

📄 u_intin.c

📁 EPSON USB DEVICE MASS-STORAGE CLASS driver, BULK ONLY on Ram disk
💻 C
字号:
/******************************************************************************
 * File name   : intin.c
 * Module name : Interrupt in transfer module
 * Author	   : Hiromichi.Kondo
 *-----------------------------------------------------------------------------
 * $Id: intin.c,v 1.1 2003/04/16 06:56:37 9551619 Exp $
 *****************************************************************************/
#include "u_ram_data.h"
#include "u_rom_data.h"
#include "u_regNikka.h"
#include "u_value.h"

/*--- Function Prototype ---------------------------------------------------*/
void IntInTransfer(void);
void IntInDataSet(void);
void IntInDataSend(void);

/*****************************************************************************	
 *
 *			: Interrupt IN
 *				: Interrupt IN
 *			: 
 *			: 
 *		: int_in_state			Interrupt IN
 *
 *****************************************************************************/
void (*const int_in_tbl[])() = {
	IntInDataSet,
	IntInDataSend
};

void IntInTransfer(void)
{
	if (int_in_state >= INT_IN_IDLE) {
		/*  */
		panic(3);
	}
	/* int_in_state  */
	int_in_tbl[int_in_state]();

}

/*****************************************************************************	
 *
 *			: Interrupt IN
 *				: FIFO
 *			: 
 *			: 
 *		: protocol_phase		
 *				  int_in_state			Interrupt IN
 *				  bulk_in_state			Bulk IN
 *				: cmd_status			
 *
 *****************************************************************************/
void IntInDataSet(void)
{
	if(protocol_phase != STATUS_PHASE){
		/* 
		 * STALL 
		 */
		rEPnControl_BP.EPrForceSTALL = 1;
		protocol_phase = RESET_WAIT;
		int_in_state   = INT_IN_STALL;
		bulk_in_state  = BULK_IN_STALL;
		bulk_out_state = BULK_OUT_STALL;
	}else{
		/*  */

		rEPaIntStat = rEPaIntStat;		/* EPa */
		rEPbIntStat = rEPbIntStat;		/* EPb */

		int_in_state = INT_IN_DATA_SEND;
		rCPU_JoinWr_BP.JoinEPcWr = 1;
		rEnEPnFIFO_Access_BP.EnEPnFIFO_Wr = 1;
		rEPnFIFOforCPU = 0x00;			/* 0x00 */
		rEPnFIFOforCPU = cmd_status;	/*  */
		rEnEPnFIFO_Access_BP.EnEPnFIFO_Wr = 0;
		rCPU_JoinWr_BP.JoinEPcWr = 0;

		rEPcControl_BP.EnShortPkt = 1;
		rEPcControl_BP.ForceNAK = 0;

		int_in_result = NO_RESULT;
	}
}

/*****************************************************************************
 *
 *			: Interrupt IN
 *				: Interrupt IN
 *			: 
 *			: 
 *		: int_int_result		Interrupt IN
 *				  retry_cnt				
 *				  protocol_phase		
 *				  int_in_state			Interrupt IN
 *				  bulk_in_state			Bulk IN
 *				  bulk_out_state		Bulk OUT
 *
 *****************************************************************************/
void IntInDataSend(void)
{
	if(int_in_result == EPX_IN_ACK){
		/* IN_TranACK */

		int_in_result = NO_RESULT;
		retry_cnt_c = 0;
		protocol_phase = COMMAND_PHASE;
		int_in_state = INT_IN_IDLE;
	}else{
		if(int_in_result == EPX_IN_ERR){
			/* EPxInERR */

			int_in_result = NO_RESULT;
			if( rEPcControl_BP.ForceSTALL == 1 ){
				/* ForceSTALL */
				panic(4);
			}

		}else{
			if( rEPaIntStat_BP.IN_TranNAK || rEPbIntStat_BP.OUT_TranNAK ){
				/* IN_TranNAKOUT_TranNAK */

				rEPaIntStat = 0x08;		/* IN_TranNAK */
				rEPbIntStat = 0x04;		/* OUT_TranNAK */

				retry_cnt_c++;			/* EPc */
				if( retry_cnt_c > MAX_RETRY_CNT ){
					/*  */

					int_in_result = NO_RESULT;
					retry_cnt_c = 0;

					rEPrFIFO_Clr_BP.EPcFIFO_Clr = 1;
					rEPcControl_BP.EnShortPkt = 0;
					rEPcControl_BP.ForceNAK = 1;
					rEPaControl_BP.ForceSTALL = 1;
					rEPbControl_BP.ForceSTALL = 1;
					cmd_status = PHASE_ERROR;

					bulk_in_state  = BULK_IN_STALL;
					bulk_out_state = BULK_OUT_STALL;
					int_in_state   = INT_IN_DATA_SET;
				}
			}
		}
	}
}

⌨️ 快捷键说明

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