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

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

?? mouse.asm

?? CY7C63231 mouse 源碼
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
;******************************************************
;
;	file: 		Low Cost Mouse firmware
;	Date: 		10/20/2000
;	Description:This code provides the functionality  
;				for a USB HID compliant mouse.
;	Target:		Cypress CY7C63231
;
; Overview
;  		There are four main tasks: 
;			* USB 
;			* buttons 
;			* optics 
;			* suspend/resume 
;
;   	The system is started in the reset() routine at reset. 
;		This routine initializes the USB variables, the IO ports, 
;		the mouse logic, and the data space. All USB 
;		communication occurs on an interrupt basis.
; USB
;  		Endpoint 0 is used to support Control Transfers and 
;		vendor specific requests.  During enumeration setup
;		commands are sent to endpoint1 to initialize the
;		USB device and to extract configuration information
;		from the device
;
;		Endpoint 1 is used to transfer interrupt data back to
;		the host.  In this case we transfer data from the 
;		button and optics back to the host. 
; Buttons
;		The buttons are read and debounced every millisecond in
;		the main task loop.
; Optics
;		The optics are continuously polled in the main loop.  The
;		quadrature state of the optics tells us which direction
;		the mouse is moving in.  This data is sent back to the
;		host as an offset from the last time the mouse was polled
;		for data by the host.
; Suspend/Resume
;		Every millisecond, the USB is polled for activity.  If no
;		activity occurs for three milliseconds, then it is assumed
;		that the USB is in suspend.  Because this device supports
;		remote wakeup, pressing the buttons or moving the mouse
;		causes the firmware to send resume signalling back to the
;		host to wakeup and resume operation.
;
; Endpoint1 packet definition
;
; Byte  Usage
;  0	Button Data 7-3 Not used, 2=middle, 1=right, 0=left
;  1	horizontal displacement measured via the optics
;  2	vertical displacement measured via the optics
;  3	Wheel displacement 0x01 for forward, 0xFF for backward
;
;
; Port Usage
;
;			 -------------------
;  		X0	| P0[0]		P0[4]	|  Z1	
;  		X1	| P0[1]		P0[5]	|  Z0	
;  		Y0	| P0[2]		P0[6]	|  OPTIC CONTROL	
;  		Y1	| P0[3] 	P0[7]	|  LEFT	
;  	 RIGHT	| P1[0]		P1[1]	|  MIDDLE	
;			| P1[2]		P1[3]	|	
;	GND		| VSS		D+/SCLK	|  D+
;	GND		| VPP		D-/SDATA|  D-	
;	PULLUP	| VREG		VCC		|	+5
;			| XTALIN	XTALOUT	|
;			 -------------------
;
; Revisions:
;			10/20/2000 - Creation 
;
;**********************************************************
;
;		Copyright 2000 Cypress Semiconductor
;	This code is provided by Cypress as a reference.  Cypress 
;	makes no claims or warranties to this firmware's 
;	suitability for any application. 
;
;********************************************************** 

	CPU	63231

	XPAGEON

	INCLUDE	"632xx.inc"
	INCLUDE "USB.inc"


;**************************************
; EP0 IN TRANSACTION STATE MACHINE
EP0_IN_IDLE:				equ	00h
CONTROL_READ_DATA:			equ	02h
NO_DATA_STATUS:				equ	04h
EP0_IN_STALL:				equ	06h

;**************************************
; EP0 NO-DATA CONTROL FLAGS
ADDRESS_CHANGE_PENDING:		equ	00h
NO_CHANGE_PENDING:			equ	02h

;**************************************
; RESPONSE SIZES
DEVICE_STATUS_LENGTH:		equ	2
DEVICE_CONFIG_LENGTH:		equ	1
ENDPOINT_STALL_LENGTH:		equ 2
INTERFACE_STATUS_LENGTH:	equ 2
INTERFACE_ALTERNATE_LENGTH:	equ	1
INTERFACE_PROTOCOL_LENGTH:	equ	1

;**************************************
; INTERFACE CONSTANTS

LEFT_BUTTON_PORT:			equ	port0
LEFT_BUTTON:				equ	80h
RIGHT_BUTTON_PORT:			equ	port1
RIGHT_BUTTON:				equ	01h
MIDDLE_BUTTON_PORT:			equ	port1
MIDDLE_BUTTON:				equ	02h

HID_LEFT_MOUSE_BUTTON:		equ	01h
HID_RIGHT_MOUSE_BUTTON:		equ	02h
HID_MIDDLE_MOUSE_BUTTON:	equ	04h

X_OPTICS_PORT:				equ	port0
X0:							equ	01h
X1:							equ	02h

Y_OPTICS_PORT:				equ	port0
Y0:							equ	04h
Y1:							equ	08h

Z_OPTICS_PORT:				equ port0
Z0:							equ	20h
Z1:							equ	10h

OPTIC_CONTROL_PORT:			equ	port0
OPTIC_CONTROL:				equ	40h

; button debounce time
BUTTON_DEBOUNCE:			equ 15

;**************************************
; BUTTON STATE MACHINE
NO_BUTTON_DATA_PENDING:		equ	00h
BUTTON_DATA_PENDING:		equ	02h

;**************************************
; OPTICS STATE MACHINE
NO_OPTIC_DATA_PENDING:		equ	00h
OPTIC_DATA_PENDING:			equ	02h

;**************************************
; EVENT STATE MACHINE
NO_EVENT_PENDING:			equ	00h
EVENT_PENDING:				equ	02h

;**************************************
; TRANSACTION TYPES
TRANS_NONE:					equ	00h
TRANS_CONTROL_READ:			equ	02h
TRANS_CONTROL_WRITE:		equ	04h
TRANS_NO_DATA_CONTROL:		equ	06h


;**************************************
; DATA MEMORY VARIABLES
suspend_count:				equ	20h			; usb suspend counter
ep1_data_toggle:			equ	21h			; endpoint 1 data toggle
ep0_data_toggle: 			equ	22h			; endpoint 0 data toggle
data_start:					equ	23h			; ROM table address, start of data
data_count:					equ	24h			; data count to return to host
maximum_data_count:			equ	25h			; maximum size of data to return to host
ep0_in_machine:				equ	26h			; endpoint 0 IN state machine
ep0_in_flag:				equ	27h			; endpoint 0 flag for no-data control
configuration:				equ	28h			; configured/not configured state
remote_wakeup:				equ	29h			; remote wakeup on/off
ep1_stall:					equ	2Ah			; endpoint 1 stall on/off
idle:						equ	2Bh			; HID idle timer
protocol:					equ	2Ch			; mouse protocol boot/report
debounce_count:				equ	2Dh			; debounce counters for buttons
optic_status:				equ	2Eh			; current optic status
current_button_state:		equ	2Fh			; current button status 
x_state:					equ	30h			; current optics x state
y_state:					equ	31h			; current optics y state
button_machine:				equ	32h			; buttons/optics state machine
temp:						equ	33h			; temporary register
event_machine:				equ	34h			; state machine for sending data back to host
pending_data:				equ	35h			; data pending during no-data control
last_button_state:			equ	36h			; last read value of buttons
x_current_state:			equ	37h			; y-axis current state
y_current_state:			equ	38h			; x-axis current state
z_current_state:			equ	39h			; z-axis current state
x_last_state:				equ	3Ah			; last read y-axis optics
y_last_state:				equ	3Bh			; last read x-axis optics
z_last_state:				equ	3Ch			; last read z-axis optics
int_temp:					equ	3Dh			; interrupt routine temp variable
idle_timer:					equ	3Eh			; HID idle timer
idle_prescaler:				equ	3Fh			; HID idle prescale (4ms)
ep0_transtype:				equ	40h			; Endpoint 0 transaction type
wakeup_timer:				equ	41h			; wakeup timer minimum count

;**********************************************************
; Interrupt vector table

ORG 00h			

jmp	Main									; Reset vector		

jmp	Bus_reset								; USB reset / PS2 interrupt

jmp	Error									; 128us interrupt

jmp	1ms_timer								; 1.024ms interrupt

jmp	Endpoint0								; Endpoint 0 interrupt

jmp	Endpoint1								; Endpoint 1 interrupt

jmp	Error									; Reserved

jmp	Error									; Reserved

jmp	Error									; Reserved

jmp	Error									; Reserved

jmp	Error									; GPIO interrupt vector

jmp	Wakeup									; Wake-up interrupt vector 


;**********************************************************
; Program listing

ORG  1Ah
Error: halt

;**********************************************************
;
;	Interrupt handler: Main
;	Purpose: The program jumps to this routine when
;		 the microcontroller has a power on reset.
;
;**********************************************************

Main:

	;**********************************
	; set wakeup timer interval and disable XTALOUT 
	mov		A, WAKEUP_ADJUST2 | WAKEUP_ADJUST0 | PRECISION_CLK | INTERNAL_CLK 
	iowr	clock_config

	;**********************************
	; setup data memory stack pointer
	mov		A, 20h
	swap	A, dsp		

	;**********************************
	; clear variables
	mov		A, 00h		
	mov		[ep0_in_machine], A
	mov		[configuration], A
	mov		[ep1_stall], A
	mov		[idle], A
	mov		[suspend_count], A
	mov		[debounce_count], A
	mov		[x_state], A
	mov		[y_state], A
	mov		[ep1_dmabuff0], A
	mov		[ep1_dmabuff1], A
	mov		[ep1_dmabuff2], A
	mov		[ep1_dmabuff3], A
	mov		[button_machine], A
	mov		[x_last_state], A
	mov		[y_last_state], A
	mov		[z_last_state], A
	mov		[int_temp], A
	mov		[idle_timer], A
	mov		[idle_prescaler], A
	mov		[event_machine], A
	mov		[ep0_transtype], A
	mov		[current_button_state], A
	mov		[last_button_state], A
	mov		[wakeup_timer], A

	mov		A, HID_REPORT
	mov		[protocol], A

	mov		A, SET
	mov		[remote_wakeup], A

	
	;**********************************
	; set port I/O configuration
	; *** NOTE - this is configured for the particular
	; hardware you are dealing with.  You will need to change
	; this section for the particular hardware you are working
	; on

	mov		A, LEFT_BUTTON
	iowr	port0

	mov		A, RIGHT_BUTTON | MIDDLE_BUTTON
	iowr	port1

	mov		A, OPTIC_CONTROL							; set button pins in resistive mode 
	iowr	port0_mode0
	mov		A, LEFT_BUTTON | OPTIC_CONTROL 
	iowr	port0_mode1

	mov		A, 00h									; remember that we have to drive
	iowr	port1_mode0								; unused pins to meet suspend current
	mov		A, (RIGHT_BUTTON | MIDDLE_BUTTON | FCh )
	iowr	port1_mode1


	;**********************************
	; enable USB address for endpoint 0
	mov		A, ADDRESS_ENABLE
	iowr	usb_address

	;**********************************
	; enable global interrupts
	mov		A, (1MS_INT | USB_RESET_INT)
	iowr 	global_int

	mov 	A, EP0_INT			
	iowr 	endpoint_int

	ei

	;**********************************
	; enable USB pullup resistor
	mov		A, VREG_ENABLE  
	iowr	usb_status


task_loop:

	;**********************************
	; main loop watchdog clear
	iowr watchdog


; this routine allows the user to map the button pins whereever
; they want, as long as all the buttons remain on the same port.
; in order to change the button ports you must change the mask
; in the pin mask constants above and change the definition of the 
; "button_port."  You must also change the way the port mode
; is initialized in the reset routine.
	mov		A, [button_machine]				; read buttons every millisecond
	jacc	button_machine_jumptable

	button_task:
	mov		A, [current_button_state]		; read button states
 	cmp		A, [last_button_state]
	jz		button_state_same:

	button_state_different:					; if the button state has changed, then
		mov		[last_button_state], A		; reset the debounce timer and set 
		mov		A, 00h						; last button value to the one just read
		mov		[debounce_count], A
		jmp		button_task_done
	
	button_state_same:		
		mov		A, BUTTON_DEBOUNCE - 1		; if at debounce count-1 then send
		cmp		A, [debounce_count]			; new value to host 
		jz		set_button_event

		increment_debounce_counter:			; otherwise increment debounce count
			mov		A, [debounce_count]		; if it's not already at the 
			cmp		A, BUTTON_DEBOUNCE		; BUTTON_DEBOUNCE value
			jz		button_task_done
			inc		[debounce_count]
			jmp		button_task_done

		set_button_event:					; set event pending to signal packet
			inc		[debounce_count]		; needs to be sent to host
			mov		A, EVENT_PENDING
			mov		[event_machine], A

			mov		A, [current_button_state]
			mov		[ep1_dmabuff0], A

			button_task_done:
			mov		A, NO_BUTTON_DATA_PENDING
			mov		[button_machine], A

		no_button_task:


; this routine allows the user to map the optics pins whereever
; they want, as long as all the optics sets remain on the same port.
; in order to change the optic ports you must change the mask
; in the pin mask constants above.  You must also change the way 
;the port mode is initialized in the reset routine.

	optic_task:
		mov		A, 00h						; reset optic values
		mov		[x_current_state], A
		mov		[y_current_state], A
		mov		[z_current_state], A	

		read_x_optics:
			iord	X_OPTICS_PORT
			mov		X, A
			read_x0:
				and		A, X0
				jz		read_x1
				mov		A, 01h
				or		[x_current_state], A
			read_x1:
				mov		A, X
				and		A, X1
				jz		read_y_optics
				mov		A, 02h
				or		[x_current_state], A

		read_y_optics:
			iord	Y_OPTICS_PORT
			mov		X, A
			read_y0:
				and		A, Y0
				jz		read_y1
				mov		A, 01h
				or		[y_current_state], A
			read_y1:
				mov		A, X
				and		A, Y1
				jz		read_z_optics
				mov		A, 02h
				or		[y_current_state], A

		read_z_optics:
			iord	Z_OPTICS_PORT
			mov		X, A
			read_z0:
				and		A, Z0
				jz		read_z1
				mov		A, 01h
				or		[z_current_state], A
			read_z1:
				mov		A, X
				and		A, Z1
				jz		analyze_x_optics
				mov		A, 02h
				or		[z_current_state], A

		analyze_x_optics:
			mov		A, [x_last_state]
			asl		A
			asl		A
			or		A, [x_current_state]
			asl		A
			jacc	x_jumptable				; jump to transition state

			x_increment:
				inc		[ep1_dmabuff1]		; increment mouse cursor change	
				mov		A, EVENT_PENDING	; set event pending to signal data to
				mov		[event_machine], A	; send to the host
				jmp		analyze_y_optics					
			x_decrement:
				dec		[ep1_dmabuff1]		; decrement mouse cursor change
				mov		A, EVENT_PENDING	; set event pending to signal data to
				mov		[event_machine], A	; send to the host

 		analyze_y_optics:
			mov		A, [y_last_state]
			asl		A
			asl		A
			or		A, [y_current_state]
			asl		A
			jacc	y_jumptable				; jump to transition state

			y_increment:
				inc		[ep1_dmabuff2]		; increment mouse cursor change	
				mov		A, EVENT_PENDING	; set event pending to signal data to
				mov		[event_machine], A	; send to the host
				jmp		analyze_z_optics					
			y_decrement:
				dec		[ep1_dmabuff2]		; decrement mouse cursor change
				mov		A, EVENT_PENDING	; set event pending to signal data to
				mov		[event_machine], A	; send to the host

		analyze_z_optics:
			mov		A, [z_last_state]
			asl		A
			asl		A
			or		A, [z_current_state]
			asl		A
			jacc	z_jumptable				; jump to transition state

			z_forward:
				mov		A, 01h
				mov		[ep1_dmabuff3], A	; increment mouse wheel change	
				mov		A, EVENT_PENDING	; set event pending to signal data to
				mov		[event_machine], A	; send to the host
				jmp		optic_task_done					
			z_backward:
				mov		A, FFh
				mov		[ep1_dmabuff3], A	; decrement mouse wheel change
				mov		A, EVENT_PENDING	; set event pending to signal data to
				mov		[event_machine], A	; send to the host
	
	optic_task_done:
		mov		A, [x_current_state]

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲美女区一区| 免费观看91视频大全| 亚洲国产成人av| 国产精品18久久久久久久久| 在线视频中文字幕一区二区| 久久亚洲精华国产精华液| 亚洲成年人影院| 成人av综合一区| 久久天天做天天爱综合色| 午夜精品久久久久久久99樱桃| 成人久久视频在线观看| 欧美精品一区二区三区四区 | 国产成人免费视频网站 | 成人avav影音| 欧美成人一区二区三区片免费| 亚洲永久免费av| 99久久久精品| 国产精品福利av| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 成人不卡免费av| 国产亚洲成aⅴ人片在线观看 | 亚洲成在线观看| 欧美中文字幕不卡| 一区二区三区在线免费播放| 成人av网址在线| 国产精品免费丝袜| 成人黄色777网| 国产精品久久久久婷婷二区次| 国产精品自拍三区| 国产女主播视频一区二区| 国产一区二区毛片| 久久久www成人免费无遮挡大片| 久久精品国产一区二区| 日韩亚洲国产中文字幕欧美| 丝袜亚洲另类欧美综合| 91精品国产综合久久福利软件| 午夜欧美在线一二页| 欧美性高清videossexo| 五月天一区二区三区| 5566中文字幕一区二区电影| 午夜精品一区二区三区免费视频| 欧美日韩国产三级| 蜜臀久久久久久久| 久久久久久一二三区| 成人91在线观看| 依依成人精品视频| 欧美精品粉嫩高潮一区二区| 青青草91视频| 国产精品网站在线播放| 97精品国产露脸对白| 亚洲图片欧美色图| 日韩一区二区在线免费观看| 黑人巨大精品欧美一区| 中文字幕精品一区| 在线亚洲高清视频| 久久国产夜色精品鲁鲁99| 国产亚洲一区二区在线观看| aaa欧美大片| 奇米影视一区二区三区小说| 久久久99久久| 91国模大尺度私拍在线视频| 日韩av中文在线观看| 日本一区二区视频在线| 欧美亚洲高清一区二区三区不卡| 久久精品国产在热久久| 亚洲欧美日韩久久精品| 91精品一区二区三区在线观看| 国产精品综合一区二区| 亚洲精品中文在线影院| 精品粉嫩aⅴ一区二区三区四区| 粉嫩av一区二区三区| 午夜视频在线观看一区二区三区| 26uuu另类欧美亚洲曰本| 一本色道**综合亚洲精品蜜桃冫| 免费人成黄页网站在线一区二区 | 欧美一三区三区四区免费在线看| 国产精品主播直播| 亚洲成人av资源| 国产精品国产自产拍高清av| 欧美一区二区性放荡片| 色综合色综合色综合色综合色综合 | 色综合久久88色综合天天6| 蜜桃91丨九色丨蝌蚪91桃色| 综合久久给合久久狠狠狠97色 | 欧美四级电影网| 国产成人免费xxxxxxxx| 日韩电影在线观看一区| 亚洲欧美韩国综合色| 国产亚洲欧洲997久久综合| 欧美日韩国产另类一区| 99久久夜色精品国产网站| 激情伊人五月天久久综合| 一个色妞综合视频在线观看| 欧美国产日韩一二三区| 日韩欧美国产一区二区在线播放| 99久久国产综合精品女不卡| 国产一区二区在线影院| 天天av天天翘天天综合网色鬼国产| 国产精品久久久久影视| 国产夜色精品一区二区av| 日韩片之四级片| 欧美精品vⅰdeose4hd| 色欲综合视频天天天| a在线播放不卡| 99久久久久久| 99热在这里有精品免费| 丁香啪啪综合成人亚洲小说| 国产尤物一区二区| 加勒比av一区二区| 久久精品国产99久久6| 日本色综合中文字幕| 欧美96一区二区免费视频| 亚洲gay无套男同| 偷拍一区二区三区四区| 亚洲va天堂va国产va久| 婷婷综合久久一区二区三区| 天天做天天摸天天爽国产一区 | 中文字幕一区免费在线观看| 国产日韩欧美高清| 欧美国产97人人爽人人喊| 中文字幕av不卡| 国产精品国产三级国产普通话三级| 中文字幕va一区二区三区| 国产精品久久99| 一区二区三区四区视频精品免费| 亚洲美腿欧美偷拍| 亚洲成av人片在线观看无码| 日本一道高清亚洲日美韩| 日本女人一区二区三区| 国产一区二区精品在线观看| 国产成人av网站| 99在线精品免费| 欧美写真视频网站| 日韩精品一区二区三区蜜臀| 久久久久国产精品麻豆ai换脸| 中文字幕免费观看一区| 亚洲麻豆国产自偷在线| 五月婷婷激情综合| 国产尤物一区二区在线| 91蜜桃视频在线| 日韩欧美中文字幕公布| 国产亚洲欧美日韩在线一区| 亚洲女人的天堂| 免费欧美高清视频| 成人三级在线视频| 91官网在线观看| 欧美不卡一区二区三区四区| 国产精品美女久久久久高潮| 亚洲一二三区视频在线观看| 久国产精品韩国三级视频| 99麻豆久久久国产精品免费| 欧美日本一道本| 国产精品每日更新| 欧美无砖专区一中文字| 国产盗摄视频一区二区三区| 色婷婷激情久久| 久久综合久久综合久久综合| 亚洲女同ⅹxx女同tv| 国产综合色产在线精品| 色综合色狠狠综合色| 2024国产精品| 亚洲国产精品久久不卡毛片 | 日韩三级在线免费观看| 18涩涩午夜精品.www| 久久 天天综合| 欧美色综合久久| 国产精品久久久久7777按摩| 日本欧美大码aⅴ在线播放| 91免费视频观看| 久久美女艺术照精彩视频福利播放| 亚洲午夜视频在线| 成人国产电影网| 久久精品无码一区二区三区| 午夜精品影院在线观看| 色女孩综合影院| 国产精品久久久一本精品| 精品无人区卡一卡二卡三乱码免费卡| 91蝌蚪porny| 国产精品久久久久四虎| 国产精品系列在线观看| 欧美一区二区二区| 亚洲bdsm女犯bdsm网站| 色综合激情久久| 亚洲情趣在线观看| 成人免费精品视频| 国产亚洲欧美中文| 国产高清久久久久| 久久综合九色综合久久久精品综合| 视频一区中文字幕国产| 在线观看视频91| 亚洲综合色噜噜狠狠| 91色九色蝌蚪| 一区二区成人在线| 色婷婷香蕉在线一区二区| 中文字幕佐山爱一区二区免费| 成人免费视频视频| 亚洲欧洲无码一区二区三区| 成人免费视频一区二区| 国产精品国产精品国产专区不蜜 | 国产一区二区看久久|