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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? combi.c

?? USB/PS2鼠標驅動
?? C
?? 第 1 頁 / 共 5 頁
字號:
		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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区系列电影| 亚洲卡通欧美制服中文| 国产精品国产三级国产有无不卡| 亚洲精选在线视频| 处破女av一区二区| 日韩女优电影在线观看| 亚洲成人在线免费| 色综合久久久久网| 国产婷婷色一区二区三区| 日韩中文字幕91| 91久久精品网| 亚洲色图在线看| 成人免费视频app| 精品免费日韩av| 美女一区二区在线观看| 欧美高清性hdvideosex| 亚洲精选视频在线| 91亚洲精品久久久蜜桃网站| 久久精品夜色噜噜亚洲aⅴ| 久久69国产一区二区蜜臀| 欧美日韩三级在线| 亚洲一级片在线观看| 91在线视频18| 亚洲日本va在线观看| 成人一区在线观看| 国产精品久久久99| 99国产精品视频免费观看| 国产日韩欧美高清| 国产成人免费视频精品含羞草妖精| 欧美一级片免费看| 日本三级韩国三级欧美三级| 欧美精品久久久久久久多人混战 | 99久久精品国产麻豆演员表| 欧美一区二区观看视频| 日韩精品一区第一页| 欧美色偷偷大香| 午夜不卡av在线| 制服丝袜国产精品| 麻豆成人在线观看| 久久免费看少妇高潮| 国产福利一区二区三区视频在线 | 欧美日韩高清一区二区| 午夜视频久久久久久| 91精品国产高清一区二区三区蜜臀| 婷婷一区二区三区| 欧美电影免费观看高清完整版 | 艳妇臀荡乳欲伦亚洲一区| 91久久久免费一区二区| 亚洲成人在线观看视频| 777午夜精品视频在线播放| 奇米777欧美一区二区| www激情久久| 成人av综合在线| 亚洲一区二区视频在线观看| 69久久99精品久久久久婷婷 | 日韩在线一区二区| 日韩视频在线观看一区二区| 国产精品一区二区三区99| 亚洲人成小说网站色在线 | 99久免费精品视频在线观看| 一区二区三区产品免费精品久久75| 欧美放荡的少妇| 国产专区综合网| 一区二区三区视频在线看| 欧美一级国产精品| av男人天堂一区| 蜜桃视频一区二区| 一区免费观看视频| 欧美一级理论片| 91在线视频在线| 国内成+人亚洲+欧美+综合在线| 亚洲欧美综合网| 日韩欧美资源站| 一本色道**综合亚洲精品蜜桃冫| 另类小说一区二区三区| 中文字幕一区二区三区在线播放| 91精品国产91热久久久做人人| 成人黄色在线视频| 免费观看在线色综合| 亚洲欧美日韩国产成人精品影院| 日韩亚洲欧美一区二区三区| 99视频精品在线| 国产一区福利在线| 亚洲18女电影在线观看| 国产精品视频第一区| 精品伦理精品一区| 欧美视频在线观看一区| 国产精品久久久久桃色tv| 日本精品一区二区三区高清| 日本伊人色综合网| 中文字幕在线观看不卡视频| 日韩精品影音先锋| 欧美性一二三区| 91色视频在线| 成人午夜免费视频| 国产精品一区二区三区四区| 日韩精品福利网| 一区二区三区鲁丝不卡| 国产精品高清亚洲| 久久精品男人的天堂| 精品人在线二区三区| 91精品国产日韩91久久久久久| 日本道在线观看一区二区| 99久精品国产| av欧美精品.com| 成人福利在线看| 国产成人精品亚洲777人妖 | 国产欧美一区二区精品性色 | 在线观看视频一区| 99久久99久久综合| 99麻豆久久久国产精品免费| 国产成人在线电影| 国产成人免费在线视频| 国产福利91精品一区二区三区| 老司机精品视频在线| 久久国产精品72免费观看| 久久精品噜噜噜成人av农村| 日韩精品成人一区二区在线| 日韩av一区二区三区四区| 奇米影视在线99精品| 美女看a上一区| 国产一区二区三区精品视频| 国产一区二区在线视频| 精品一区二区三区在线播放视频| 久久国产尿小便嘘嘘尿| 国产一区福利在线| aaa欧美色吧激情视频| 91久久精品一区二区三区| 欧美欧美欧美欧美| 日韩视频在线永久播放| 国产婷婷色一区二区三区在线| 国产精品电影一区二区三区| 一区二区国产视频| 麻豆一区二区三区| 国产精品一区二区在线看| 99免费精品视频| 欧美在线免费观看视频| 欧美一级二级在线观看| 久久久精品综合| 亚洲欧美aⅴ...| 欧美a一区二区| 懂色av一区二区在线播放| 91丨九色丨黑人外教| 91精品国产一区二区三区| 国产三级精品在线| 依依成人精品视频| 看电视剧不卡顿的网站| 99riav久久精品riav| 欧美日韩亚洲国产综合| 久久蜜臀中文字幕| 亚洲一区二区三区自拍| 国产一区二区0| 欧美午夜宅男影院| 久久久欧美精品sm网站| 一区二区在线看| 韩日欧美一区二区三区| av激情综合网| 精品少妇一区二区三区免费观看| ...xxx性欧美| 国内精品伊人久久久久影院对白| 一本色道久久综合亚洲91| 久久欧美中文字幕| 日精品一区二区三区| 成人午夜大片免费观看| 91精品国产丝袜白色高跟鞋| 亚洲婷婷综合色高清在线| 久久99热这里只有精品| 欧美三电影在线| 国产精品国产三级国产aⅴ入口| 日本欧洲一区二区| 欧美综合欧美视频| 日本一区二区三区dvd视频在线| 亚洲va欧美va国产va天堂影院| 99久久精品免费| 国产日韩欧美不卡| 久久国产三级精品| 91精品国产福利在线观看| 亚洲日本va午夜在线影院| 国产成人在线电影| 精品国产一区二区精华| 日韩av一区二区在线影视| 欧美在线不卡一区| 亚洲三级在线播放| 粗大黑人巨茎大战欧美成人| 久久色在线观看| 国产在线播放一区| 日韩亚洲欧美综合| 日韩1区2区3区| 欧美日韩精品免费| 亚洲va韩国va欧美va精品 | 丰满亚洲少妇av| 久久九九久久九九| 国产精品2024| 久久夜色精品国产噜噜av| 蜜臀va亚洲va欧美va天堂 | 欧美群妇大交群中文字幕| 一区二区三区在线视频观看| 色综合天天综合网国产成人综合天 | 香蕉久久一区二区不卡无毒影院| 日本韩国欧美在线|