亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? combi.c

?? 低成本USB轉(zhuǎn)PS/2接口的設(shè)計(jì)
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
		return;
	}
    XmtBuff.bLength = 1;								//set length of protocol
    XmtBuff.p=&DeviceStatus.bProtocol;					//aim XmtBuff at it
    USB_control_read();									//initiate transfer
}


/*
**
** FUNCTION:		GetConfiguration
**
** PURPOSE:			Implements the Get Configuration command
**
** PARAMETERS:		none
**
** DESCRIPTION:	 
**					This routine is entered whenever a Get Configuration Request is received.
**					
*/

void GetConfiguration(void)
{
 	if (ENDPOINT_A0_FIFO[USB_bmRequestType] != DEVICE_TO_HOST | STANDARD | DEVICE)
	{
		SET_EP0_MODE(USB_MODE_STALL_IN_OUT);
		return;
	}
	XmtBuff.bLength = 1;								//configuration is 1-byte long
    XmtBuff.p=&DeviceStatus.bConfiguration;				//point at it
    USB_control_read();									//initiate transfer
}


/*
**
** FUNCTION:		USB_Stall_In_Out
**
** PURPOSE:			sets the SIE mode to stall IN/OUT packets on endpoint 0
**
** PARAMETERS:		none
**
** DESCRIPTION:	 
**					
**					
*/

void USB_Stall_In_Out(void)
{
    SET_EP0_MODE(USB_MODE_STALL_IN_OUT);
}



#pragma memory ORG @ 0x880

const void (* StandardFunctionTable[])(void)= 
{
   GetStatus,ClearFeature,USB_Stall_In_Out,SetFeature,
   USB_Stall_In_Out,SetAddress,GetDescriptor,USB_Stall_In_Out,
   GetConfiguration,SetConfiguration,GetStatus
};
/*
** define a lookup table of function pointers to class requests
*/
const void (* ClassFunctionTable[])(void)= 
{
  USB_Stall_In_Out, GetReport, GetIdle,GetProtocol,
  USB_Stall_In_Out, USB_Stall_In_Out, USB_Stall_In_Out,USB_Stall_In_Out,
  USB_Stall_In_Out, USB_Stall_In_Out, SetIdle,SetProtocol
};


/*
**
** FUNCTION:		HandleSetup
**
** PURPOSE:			Services Setup packets 
**
** PARAMETERS:		none
**
** DESCRIPTION:	 
**					This routine is entered whenever an SETUP packet has come in on endpoint 0.
**					it performss some preliminary validation on the packet, then
**					parses the packet and calls the appropriate routine to handle the packet.
**					
*/

void HandleSetup(void)

{
	EP_A0_MODE = USB_MODE_NAK_IN_OUT;						//unlock mode register
	/*
	** Setups are always 10 bytes, with DATAVALID = 1 and DATATOGGLE = 0
	*/
	if ( (EP_A0_COUNTER & (DATAVALID | DATATOGGLE | COUNT_MASK)) ==
		  (DATAVALID | 10))
	{
		if (ENDPOINT_A0_FIFO[USB_bmRequestType] & CLASS)
		{	
								
			if (ENDPOINT_A0_FIFO[USB_bRequest] <= USB_SET_PROTOCOL)				//class request, use class table
			{
				(*ClassFunctionTable[ENDPOINT_A0_FIFO[USB_bRequest]])();
				return;
			}
		}
		else
		{
			if (ENDPOINT_A0_FIFO[USB_bRequest] <= USB_GET_INTERFACE)			//standard request, use standard table
			{
				(*StandardFunctionTable[ENDPOINT_A0_FIFO[USB_bRequest]])();
				return;
			}
		}
	}
	SET_EP0_MODE(USB_MODE_STALL_IN_OUT);										//invalid request, stall
}


//**************************************************************************************8
//PS2 routines

/*
**
** FUNCTION:		ps2main
**
** PURPOSE:			main processing loop for PS/2 
**
** PARAMETERS:		none
**
** DESCRIPTION:	 
**					ps2main spins in an infinite loop waiting for an event that needs servicing.
*/

void ps2main(void)
{

	char bInputByte;			//storage for byte received from host
    ReInitialize();				//reinitialize all ps2 variables to default states
    SetDefault();				//set the host-settable parameters to the default states
	EI();						//enable interrupts
	ps2BAT();					//send the BAT code
	/*
	** only now can we enable the 128 usec interrupt, which will start filling the optics queue
	** with data.  ProcessOptics must be called at regular intervals from this point on, to prevent
	** the optics queue from overflowing.
	*/
	GLOBAL_INTERRUPT = MILLISECOND_ENABLE | MICROSECOND_ENABLE;
	while (1)
	{
		RESET_COP();									//always tickle watchdog
		ProcessOptics();								//empty optics queue
		bInputByte = GetByte();							//see if host has sent us anything
		if (!(CC.C))									//if carry is clear, a byte indeed arrived)
		{
			ProcessCommand(bInputByte);					//so go handle it
			continue;
		}
		if (Ps2Xmt.bXmtLen)								//anything to send?
		{
			PutNextByte();								//send a byte.
			continue;
		}

		if (MsecStatus.b1msFlags & ONE_MSEC_FLAG)		//1 msec expired?
		{	
			MsecStatus.b1msFlags &= ~ONE_MSEC_FLAG;
			Ps2MouseTask();								//do mouse stuff
   		}
	}
}


/*
**
** FUNCTION:		Ps2MouseTask
**
** PURPOSE:			handles ps2 mouse data packet management 
**
** PARAMETERS:		none
**
** DESCRIPTION:	 
**					
*/

void Ps2MouseTask(void)
{
	if (!(MsecStatus.b1msCounter & 3))						//4 msec expired?
		Mouse.bChange |= DebounceButtons();					//yes, debounce switches
	if (!--bIntervalCount)									//if the mouse interval counter has expired,
	{
		ResetInterval();									//reset the interval
		if (MouseParms.bStream && MouseParms.bEnabled)

			SendMouseData();								//if the mouse is enabled and in stream mode, send a packet
	}
}


/*
**
** FUNCTION:		Reinitialize
**
** PURPOSE:			Reinitializes ps2 variables to their default states  
**
** PARAMETERS:		none
**
** DESCRIPTION:	 
**					
*/

void ReInitialize(void)
{
	DI();											//disable ints
	USB_STATUS = (PS2_PULLUP_MASK | PS2_INTERRUPT_MODE_MASK |FORCE_NEG_OPEN_POS_OPEN);
	RESET_COP();									//reset watchdog
	ClearRam();
	OpticsQueue.headP = bOpticsArray;
	OpticsQueue.tailP = bOpticsArray;
	PROCESSOR_STATUS &= ~(WATCHDOG_RESET_MASK		            //clear source of reset
		| POWER_ON_RESET_MASK | USB_BUS_RESET_MASK);
	USB_DEVICE_A = 0;											//reset device address
	EP_A0_MODE = USB_MODE_DISABLE;								//disable endpoints from responding
	EP_A1_MODE = USB_MODE_DISABLE;
	EP_A2_MODE = USB_MODE_DISABLE;
	GLOBAL_INTERRUPT = MILLISECOND_ENABLE;						//enable only 1msec interrupt
	return;
}


/*
**
** FUNCTION:		ResetInterval
**
** PURPOSE:			Resets the mouse report interval
**
** PARAMETERS:		none
**
** DESCRIPTION:		This routine resets the mouse's report interval to the value last
**					sent by the host.  The report interval is counted down in the main loop
**					to provide a time base for sending mouse data packets.
**					
*/

void ResetInterval(void)
{
	bIntervalCount = MouseParms.bReportInterval;
}


/*
**
** FUNCTION:	GetByte		
**
** PURPOSE:		tries to get a byte from the host	
**	
** PARAMETERS:		
**
** DESCRIPTION:	GetByte checks to see if the host is requesting-to-send data, and if so,
**				clocks in a data byte from the host.  It returns the received byte 
**				and implicitly sets the carry to 0 if the reception occurred without errors.
**				GetByte turns off the 1msec interrupt during ps2 clocking so as not to
**				impose the potential for clock jitter due to that interrupt.
**					
**					
*/

char GetByte (void)
{
    char dummy;
	if (HOST_RTS)	                        				//host not requesting to send
	{
		GLOBAL_INTERRUPT = MICROSECOND_ENABLE;				//shut off msec interrupt
		dummy = ps2_receive();								//get data. ps2_receive sets the carry
															//to 1 if there was a problem in reception.
															
		GLOBAL_INTERRUPT = MILLISECOND_ENABLE | MICROSECOND_ENABLE;
		return(dummy);										//return data (and carry bit too)
	}
	CC.C = 1;												//couldn't get data, so set carry to one and exit
	return(0);
}


/*
**
** FUNCTION: ps2BAT		
**
** PURPOSE:	 delays for 500 msec, then sends the AA 00 initialization string	
**	
** PARAMETERS: none		
**
** DESCRIPTION:	 
**					
**					
*/

void ps2BAT(void)
{
	while (bBatDelay--)									//count down number of msec in bBatDelay
	{
		while (!(MsecStatus.b1msFlags & ONE_MSEC_FLAG))	//eat up a msec
			RESET_COP();
		MsecStatus.b1msFlags &= ~ONE_MSEC_FLAG;
	}
	Ps2Xmt.bMsgBuff[0] = 0xAA;							//send AA 00 to host
	Ps2Xmt.bMsgBuff[1] = 00;
	Ps2Xmt.bMsgLen = 2;
	Ps2Xmt.bXmtLen = 2;
}


/*
**
** FUNCTION:	PutNextByte		
**
** PURPOSE:		attempts to send  the next byte in the transmit queue to the host
**	
** PARAMETERS:  none		
**
** DESCRIPTION:	This routine sends the next byte  of the message buffer to the host.
**					
**					
*/

void PutNextByte(void)
{
	if (HOST_RTS || HOST_INHIBIT)								//host is requesting to send data, quit
		return;
	GLOBAL_INTERRUPT = MICROSECOND_ENABLE;
	ps2_send(Ps2Xmt.bMsgBuff[Ps2Xmt.bMsgLen-Ps2Xmt.bXmtLen]);							//send the byte
	GLOBAL_INTERRUPT = MILLISECOND_ENABLE | MICROSECOND_ENABLE;
	if (!CC.C)
		Ps2Xmt.bXmtLen--;
}


/*
**
** FUNCTION:	Put	
**
** PURPOSE:		sends a byte to the host
**	
** PARAMETERS:	data -- byte to send	
**
** DESCRIPTION:	Put attempts to send a byte to the host. It is called to send an ACK, ERROR, or RESEND
**				to the host. In accordance with the IBM spec, these responses are not held for retransmission
**				in the event that the  host requests to send a byte before we can send the response itself.
**				Thus, this routine waits for host inhibit to go away, then sends the byte.  If the host
**				requests-to-send before this happens, it simply returns without sending the byte.
**					
**					
*/

void Put(char data)
{
	if(HOST_RTS)
		return;

	while (!HOST_RTS)
	{
		//we could sit in this loop for a long time, if the host is inhibiting us.  This is ok.
		//the 128 us interrupt is running and the optics queue might overflow, but that will
		//be fixed up upon return to the main loop (see code in ProcessOptics).  This is harmless --
		//the mouse is supposed to be disabled by the host prior to executing commands, so
		//we aren't required to be accumulating samples at this point, anyway.
		if (!HOST_INHIBIT)
		{
			GLOBAL_INTERRUPT = MICROSECOND_ENABLE;
			ps2_send(data);							//send the byte
			GLOBAL_INTERRUPT = MILLISECOND_ENABLE | MICROSECOND_ENABLE;
			return;									//ps2_send will set carry for us
		}
		RESET_COP();
	}
}


/*
**
** FUNCTION:	Reset		
**
** PURPOSE:		executes a reset 	
**	
** PARAMETERS:		
**
** DESCRIPTION:	 Reset simply gets into a loop waiting for the watchdog to perform a reset.
**					
**					
*/

void Reset(void)
{
     GLOBAL_INTERRUPT = 0;
	while (1);									//death by watchdog
}


/*
**
** FUNCTION:	Resend		
**
** PURPOSE:		Resends the last  transmission from the mouse	
**	
** PARAMETERS:	None	
**
** DESCRIPTION:	A copy of the  last  transmission is always left intact in the message buffer.
**				To resend it , we simply need to reset the message length.
**					
**					
*/

void Resend(void)
{
	Ps2Xmt.bXmtLen = Ps2Xmt.bMsgLen;

}


/*
**
** FUNCTION:	SetDefault	
**
** PURPOSE:		Sets the mouse parameters to the default settings
**	
** PARAMETERS:		
**
** DESCRIPTION:	 
**					
**					
*/

void SetDefault(void)
{
	MouseParms.bReportRate = 100;						//100 reports per second
	MouseParms.bReportInterval = 10;					//is equal to a report every 10 msec
	MouseParms.bScale = SC_1_1;							//1-to-1 scaling
	MouseParms.bStream = 1;								//stream mode on
	MouseParms.bResolution = RES_4MM;					//4 MM resolution
	MouseParms.bEnabled = 0;							//not enabled
	MouseParms.bZmouse = 0;								//z-wheel off.
}


/*
**
** FUNCTION:	Disable		
**
** PURPOSE:		Disables the mouse	
**	
** PARAMETERS:		
**
** DESCRI

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品1区2区3区| 欧洲av一区二区嗯嗯嗯啊| 亚洲色图在线看| 日韩欧美一级二级| 色88888久久久久久影院野外| 蜜臀av一级做a爰片久久| 亚洲欧洲美洲综合色网| 日韩精品专区在线影院观看| 欧美自拍丝袜亚洲| 成人性生交大片免费看视频在线| 亚洲v中文字幕| 中文字幕色av一区二区三区| 精品国产露脸精彩对白| 欧美日韩国产在线播放网站| 99天天综合性| 国产精品 日产精品 欧美精品| 日韩av在线发布| 亚洲精品老司机| 国产精品久久久久精k8| 久久婷婷国产综合精品青草| 91麻豆精品久久久久蜜臀| 色综合天天综合给合国产| 国产成人av自拍| 久久99国产精品麻豆| 丝瓜av网站精品一区二区| 亚洲在线视频网站| 夜夜嗨av一区二区三区四季av| 国产精品对白交换视频 | 高清不卡在线观看| 久久99九九99精品| 免费成人你懂的| 日韩精品乱码av一区二区| 亚洲国产精品嫩草影院| 亚洲精品精品亚洲| 亚洲欧美日韩精品久久久久| 国产精品对白交换视频| 中文字幕制服丝袜一区二区三区 | 国产精品久久久久久久久晋中| 2022国产精品视频| 精品免费日韩av| 日韩免费视频一区| 精品久久久久久无| www国产精品av| 久久久久九九视频| 国产亚洲欧洲997久久综合| 久久久综合视频| 国产精品美女久久久久久久| 欧美激情在线观看视频免费| 国产精品免费av| 亚洲免费观看高清| 亚洲一卡二卡三卡四卡| 五月开心婷婷久久| 久久国产精品99精品国产| 蜜桃av噜噜一区二区三区小说| 另类调教123区| 国产成人精品影视| 91在线观看免费视频| 91高清视频在线| 欧美高清一级片在线| 久久综合色鬼综合色| 国产精品嫩草99a| 亚洲一区二区四区蜜桃| 日韩在线观看一区二区| 久久9热精品视频| 成人一区二区三区视频| 99riav一区二区三区| 9191成人精品久久| 国产性做久久久久久| 亚洲免费高清视频在线| 麻豆91在线播放免费| 国产精品1区2区3区在线观看| 99riav一区二区三区| 欧美一三区三区四区免费在线看 | 亚洲国产一区二区在线播放| 免费不卡在线观看| 粉嫩av亚洲一区二区图片| 色噜噜狠狠色综合欧洲selulu| 欧美精品欧美精品系列| 中文字幕欧美日本乱码一线二线| 亚洲美女视频在线| 日韩av二区在线播放| 成人蜜臀av电影| 9191国产精品| 国产精品久久久久aaaa| 蜜桃av一区二区三区| 91蜜桃视频在线| 日韩你懂的电影在线观看| 亚洲视频在线一区二区| 美女诱惑一区二区| 一本色道a无线码一区v| 精品成人一区二区三区| 依依成人精品视频| 国产suv一区二区三区88区| 欧美男男青年gay1069videost| 国产日产亚洲精品系列| 日韩和欧美的一区| 色综合一区二区| 久久久久久亚洲综合| 日日夜夜免费精品| 91偷拍与自偷拍精品| 久久久久久免费| 日韩综合在线视频| 欧美性欧美巨大黑白大战| 国产三级久久久| 久久精品久久综合| 欧美色欧美亚洲另类二区| 国产精品久久久久9999吃药| 狠狠色丁香久久婷婷综合丁香| 欧美日韩一区在线| 亚洲色图在线视频| 波多野洁衣一区| 久久久久久久久久美女| 青青草国产成人av片免费| 91色九色蝌蚪| 日韩一区中文字幕| 国产宾馆实践打屁股91| 欧美精品一区二区三区在线 | 91丨porny丨蝌蚪视频| 2014亚洲片线观看视频免费| 日韩一区精品视频| 欧美最新大片在线看 | 综合婷婷亚洲小说| 国产传媒久久文化传媒| 精品久久久久久久人人人人传媒 | 精品国产精品一区二区夜夜嗨| 亚洲成人一区二区| 欧美亚洲日本一区| 一区二区三区.www| 色婷婷精品久久二区二区蜜臂av| 国产精品电影一区二区| 成人美女在线视频| 中文字幕制服丝袜成人av| 成人av在线播放网址| 国产日韩高清在线| 成人高清免费观看| 国产精品久久久久久久久久久免费看| 国产v综合v亚洲欧| 国产精品成人免费精品自在线观看| 国产91精品入口| 中文字幕在线不卡一区| 99re视频精品| 一区二区三区中文在线观看| 在线欧美日韩国产| 亚洲一区二区美女| 欧美一区二区人人喊爽| 久久精品国产秦先生| 国产亚洲精品精华液| 懂色av一区二区夜夜嗨| 椎名由奈av一区二区三区| 91国产精品成人| 日韩中文字幕一区二区三区| 欧美成人官网二区| 国产一区二区三区不卡在线观看 | 色久综合一二码| 亚洲小少妇裸体bbw| 91精品在线观看入口| 久久99蜜桃精品| 亚洲国产精品激情在线观看| 99久久精品免费看国产免费软件| 亚洲免费观看高清完整| 69p69国产精品| 粉嫩绯色av一区二区在线观看| 亚洲欧美日韩中文播放 | 国产亚洲欧洲一区高清在线观看| 成人av中文字幕| 亚洲电影视频在线| 精品少妇一区二区三区免费观看| 国产精品原创巨作av| 亚洲女同一区二区| 91精品欧美久久久久久动漫| 国产精品一区二区久久不卡| 亚洲自拍偷拍麻豆| 精品捆绑美女sm三区| 色婷婷一区二区| 美女久久久精品| 亚洲欧美综合在线精品| 欧美一区日韩一区| 懂色av一区二区三区免费看| 午夜精品一区二区三区电影天堂| 亚洲精品在线电影| 91国偷自产一区二区开放时间 | 中文字幕日韩精品一区| 欧美一区二区久久久| 波多野洁衣一区| 久久av资源网| 亚洲一二三四在线| 久久久久高清精品| 欧美乱熟臀69xxxxxx| 91美女片黄在线观看| 成人黄色软件下载| 精品三级av在线| 色综合久久久久综合体| 蜜臀精品久久久久久蜜臀| 中文字幕一区二区三区视频| 91精品国产黑色紧身裤美女| 99久久精品久久久久久清纯| 老司机免费视频一区二区三区| 亚洲免费观看在线观看| 欧美激情中文不卡| 亚洲免费av观看|