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

📄 ps2d.lis

📁 Cypress cy7c63318 鼠标开发板的源代码
💻 LIS
📖 第 1 页 / 共 5 页
字号:
 0001           PS2D_IO_CONFIG_TYPE:                   EQU    1
 0000           ;--------------------------------------------------
 0000           ; PS2D Macro 'Functions'
 0000           ;--------------------------------------------------
 0000           ; Device specific actions for DISABLE command (0xF5)
 0000           MACRO DISABLE_DEVICE
 0000           ; Null for mouse  
 0000           MACRO START_TRANSFER
 0000               mov     [PS2D_bTxPktSize], @0                 ; Start the transfer
 0000               mov     [PS2D_bTxPktIndex], 0                 ; 
 0000           CPU_CLOCK:				equ	0h	;CPU Clock value
 0001           CPU_CLOCK_MASK:			equ	1h 	;CPU Clock mask
 0000           CPU_CLOCK_JUST:			equ	0h 	;CPU Clock value justified
 0000           
 0001           CPU_CLOCK_SPEED:		equ	1h	;CPU Clock Speed value
 0003           CPU_CLOCK_SPEED_MASK: 	equ	3h	;CPU Clock Speed mask
 0001           CPU_CLOCK_SPEED_JUST:  	equ	1h	;CPU Clock Speed value justified
 0000           
 0002           TIMER_CLOCK: 			equ	2h	;Timer Clock value
 0003           TIMER_CLOCK_MASK:		equ	3h	;Timer Clock mask
 0002           TIMER_CLOCK_JUST:		equ	2h	;Timer Clock value justified
 0000           
 0000           TIMER_CLOCK_SPEED:		equ	0h	;Timer clock speed value
 000C           TIMER_CLOCK_SPEED_MASK:	equ	ch	;Timer clock speed mask
 0000           TIMER_CLOCK_SPEED_JUST:	equ	0h	;Timer clock speed value justified
 0000           
 0000           CAPT_CLOCK: 			equ	0h	;Capture Clock value
 0030           CAPT_CLOCK_MASK:		equ	30h	;Capture Clock mask
 0000           CAPT_CLOCK_JUST:		equ	0h	;Capture Clock value justified
 0000           
 0002           CAPT_CLOCK_SPEED: 	  	equ	2h	;Capture Clock speed value
 00C0           CAPT_CLOCK_SPEED_MASK:	equ	c0h	;Capture Clock speed mask
 0080           CAPT_CLOCK_SPEED_JUST: 	equ	80h	;Capture Clock speed value justified
 0000           
 0000           CAPT_EDGE: 				equ	0h	;Capture Edge value
 0080           CAPT_EDGE_MASK:			equ	80h	;Capture Edge mask
 0000           CAPT_EDGE_JUST:			equ	0h	;Capture Edge value justified
 0000           
 0000           CAPT_PRESCALE: 		 	equ	0h	;Capture Prescale value
 0070           CAPT_PRESCALE_MASK:		equ	70h	;Capture Prescale mask
 0000           CAPT_PRESCALE_JUST:	 	equ	0h	;Capture Prescale value justified
 0000           
 0000           USB_CLOCK:				equ	0h	;USB Clock source value
 0020           USB_CLOCK_MASK:			equ	20h	;USB Clock source mask
 0000           USB_CLOCK_JUST:			equ	0h	;USB Clock source justified
 0000           
 0000           USB_CLOCK_SPEED:	  	equ	0h	;USB Clock div by 2 value
 0040           USB_CLOCK_SPEED_MASK: 	equ	40h	;USB Clock div by 2 mask
 0000           USB_CLOCK_SPEED_JUST: 	equ	0h	;USB Clock div by 2 justified
 0000           
 0000           CLOCK_OUT:				equ	0h  ;Clock Out value
 0003           CLOCK_OUT_MASK:			equ	3h	;Clock Out mask
 0000           CLOCK_OUT_JUST:			equ	0h 	;Clock Out value justified
 0000           
 0004           LV_DETECT_LEVEL:		equ	4h	;Low V Detect Level value
 0007           LV_DETECT_LEVEL_MASK:	equ	7h	;Low V Detect Level mask
 0004           LV_DETECT_LEVEL_JUST:	equ	4h	;Low V Detect Level value justified
 0000           
 0001           PWR_ON_RESET_LEVEL:   	 	equ	1h	;PowerOn Reset Level value
 0030           PWR_ON_RESET_LEVEL_MASK:	equ	30h	;PowerOn Reset Level mask
 0010           PWR_ON_RESET_LEVEL_JUST:	equ	10h	;PowerOn Reset Level value justified
 0000           
 0000           VREG_ENABLE: 	   		equ	0h  ;VREG Enable value
 0001           VREG_ENABLE_MASK:		equ	1h	;VREG Enable mask
 0000           VREG_ENABLE_JUST:		equ	0h	;VREG Enable value justified
 0000           
 0000           KEEP_ALIVE: 	   		equ	0h	;Keep Alive value
 0002           KEEP_ALIVE_MASK:		equ	2h	;Keep Alive mask
 0000           KEEP_ALIVE_JUST:		equ	0h	;Keep Alive value justified
 0000           
 0000           WATCHDOG_ENABLE: 	   	equ	0h	;Watchdog Enable value
 0000           
 0000           ;-----------------------------------------------
 0000           ;  Global Symbols
 0000           ;-----------------------------------------------
                export  PS2D_Start
                export _PS2D_Start
                export  PS2D_Stop
                export _PS2D_Stop
                
                export  PS2D_IsEnabled
                export _PS2D_IsEnabled
                export  PS2D_SendNextByte
                export _PS2D_SendNextByte
                export  PS2D_GetHostByte
                export _PS2D_GetHostByte
                export  PS2D_SendResponseResend
                export _PS2D_SendResponseResend
                export  PS2D_SendResponseError
                export _PS2D_SendResponseError
                export  PS2D_SendResponseACK
                export _PS2D_SendResponseACK
                export  PS2D_SendResponseByte
                export _PS2D_SendResponseByte
                export  PS2D_AbortTransfer
                export _PS2D_AbortTransfer
                export  PS2D_TransferInProgress
                export _PS2D_TransferInProgress
                export PS2D_BAT
                export _PS2D_BAT
                ;-----------------------------------------------
                ;  Persistent RAM Allocation
                ;-----------------------------------------------
                AREA bss (RAM,REL)
                
                export  PS2D_bIsEnabled
                export _PS2D_bIsEnabled
 0000            PS2D_bIsEnabled:
 0000           _PS2D_bIsEnabled:                       BLK  1
 0001           
                export  PS2D_bMode
                export _PS2D_bMode
 0001            PS2D_bMode:
 0001           _PS2D_bMode:                            BLK  1
 0002           
                export  PS2D_bLastMode
                export _PS2D_bLastMode
 0002            PS2D_bLastMode:
 0002           _PS2D_bLastMode:                        BLK  1
 0003           
                export  PS2D_bTxPktIndex
                export _PS2D_bTxPktIndex
 0003            PS2D_bTxPktIndex:
 0003           _PS2D_bTxPktIndex:                      BLK  1
 0004           
                export  PS2D_bTxPktSize
                export _PS2D_bTxPktSize
 0004            PS2D_bTxPktSize:
 0004           _PS2D_bTxPktSize:                       BLK  1
 0005           
                export  PS2D_aTxBuffer
                export _PS2D_aTxBuffer
 0005            PS2D_aTxBuffer:
 0005           _PS2D_aTxBuffer:                        BLK PS2D_TX_BUFFER_SIZE 
 0009           
                export  PS2D_ErrorCnt
 0009           PS2D_ErrorCnt:                          BLK 1
 000A           
 000A           ;-----------------------------------------------
 000A           ;  Constant Definitions
 000A           ;-----------------------------------------------
 000A           
                IF   PS2D_IO_CONFIG_TYPE
 0001           PS2D_DR:                               EQU    P1DATA
 0001           PS2D_SCLK:                             EQU    0x01 ; PS2 Clock Line
 0002           PS2D_SDATA:                            EQU    0x02 ; PS2 Data Line
 0003           PS2D_MASK:                             EQU    0x03
 0003           PS2D_CLKH_DATAH:                       EQU    0x03
 0001           PS2D_CLKH_DATAL:                       EQU    0x01
 0002           PS2D_CLKL_DATAH:                       EQU    0x02
 0000           PS2D_CLKL_DATAL:                       EQU    0x00
 000A           
 0001           OUTPUT_ENABLE:                         EQU    0x01
 0002           PS2_PULLUP_ENABLE:                     EQU    0x02
 0004           OPEN_DRAIN:                            EQU    0x04
 000A           
                ELSE
                PS2D_SCLK:       equ 0x@_SCLK_MASK                ; PS2 Clock Line
                PS2D_SDATA:      equ 0x@_SDATA_MASK               ; PS2 Data Line
                PS2D_MASK:       equ ((0x@_SCLK_MASK) | (0x@_SDATA_MASK))
                PS2D_CLKH_DATAH: equ ((0x@_SCLK_MASK) | (0x@_SDATA_MASK))    
                PS2D_CLKH_DATAL: equ ((0x@_SCLK_MASK))    
                PS2D_CLKL_DATAH: equ ((0x@_SDATA_MASK))    
                PS2D_CLKL_DATAL: equ 0    
                PS2D_DR:         equ    PRT1DR
                PS2D_DM0:        equ    PRT1DM0
                PS2D_DM1:        equ    PRT1DM1
                PS2D_DM2:        equ    PRT1DM2
                ENDIF
                ;-----------------------------------------------
                ; Macro definitions
                ;-----------------------------------------------
                ;-----------------------------------------------
                ; Precise Delay
                ;-----------------------------------------------
 000A               MACRO DELAY
 000A               push    A
 000A           
 000A           IF (@0)
 000A           ELSE
 000A           PSOC_ERROR  PS2D User Module - Delay value must be greater than zero
 000A           ENDIF
 000A           
 000A           IF CPU_CLOCK_SPEED - OSC_CR0_CPU_24MHz
 000A           IF CPU_CLOCK_SPEED - OSC_CR0_CPU_12MHz
 000A           IF CPU_CLOCK_SPEED - OSC_CR0_CPU_6MHz
 000A           PSOC_ERROR  PS2D User Module - Only supports 6, 12, or 24 Mhz
 000A           ELSE
 000A           
 000A           ; 6 Mhz
 000A               MOV     A, ((@0*2)/3) ; convert uSec to number of delay loops required
 000A               SUB     A, ((((((@1+21)*167)/1000)+1)*2)/3) ; subtract cpu cycles plus current overhead
 000A               
 000A           ENDIF
 000A           ELSE
 000A           
 000A           ; 12 Mhz
 000A               MOV     A, ((@0*4)/7) ; convert uSec to number of delay loops required
 000A               SUB     A, (((((@1+21)*83)/1000)*4)/7) ; subtract cpu cycles plus current overhead
 000A           
 000A           ENDIF
 000A           ELSE
 000A           
 000A           ; 24 Mhz
 000A               MOV     A, ((@0*8)/11) ; convert uSec to number of delay loops required
 000A               SUB     A, (((((@1+21)*42)/1000)*8)/11) ; subtract cpu cycles plus current overhead
 000A           
 000A           ENDIF
 000A           

⌨️ 快捷键说明

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