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

📄 option.inc

📁 用cy7c66113开发的HUB
💻 INC
字号:
;-------------------------------------------------------------------------
; This file contains the hardware configuration data.
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;   Product specification
;-------------------------------------------------------------------------
;   The CPU directive specifies to the assembler the resources available 
;   within the Microcontroller.
;-------------------------------------------------------------------------
    cpu     66113
;   cpu     65013
    
;------------------------------------------------------------------------
; In the event firmware gets lost in unused ROM space, give it a place to
; go where it can't do any damage. Fill unused ROM with HALT instructions
; and wait for the watch dog to timeout. (00h)
; Halts execution of the processor core until the occurrence of a reset 
; ( Watchdog, POR or USB Bus reset )
;------------------------------------------------------------------------
    FILLROM 00h         

;-------------------------------------------------------------------------
; Program option                                
;-------------------------------------------------------------------------
; Hub only model
;   DEFINE  HubOnly
;   DEFINE  7PortHub    ; Optional for 7 port hub with CY65013

; Hub + USB KB
;   DEFINE  AnyKB       ; Keyboard common routine
;   DEFINE  USBKB       ; USB Keyboard part     

; Hub + PS2 KB
;   DEFINE  AnyKB       ; Keyboard common routine
;   DEFINE  PS2KB       ; PS/2 Keyboard part    

; Combi Keyboard Hub
    DEFINE  AnyKB       ; Keyboard common routine
    DEFINE  CombiKB     ; Combination part
    DEFINE  USBKB       ; USB Keyboard part     
    DEFINE  PS2KB       ; PS/2 Keyboard part   

;------------------------------------------------------------------------;
; PortBitMap is changed by 4PortHub. ( Conditional compile )             ;
; USB Keyboard virtual port is currently the last port of Hub.           ;
;------------------------------------------------------------------------;
    DEFINE  4PortHub                                                     ;
    MAXPORT:		EQU 5                                                ;
    VIRTUALPORT:	EQU	MAXPORT                                          ;
    VIRTUALPORTBIT: EQU 10h             ; 4 port + 1 Keyboard            ;
    KB_PORT:        EQU VIRTUALPORT-1   ; 4 of 0 to 4 (Last port)        ;   
;------------------------------------------------------------------------;
; PortBitMap is changed by 4PortHub. ( Conditional compile )             ;
; USB Keyboard virtual port is currently the last port of Hub.           ;
;------------------------------------------------------------------------;
;   No define                                                            ;
;   MAXPORT:		EQU 3                                                ;
;   VIRTUALPORT:	EQU	MAXPORT                                          ;
;   VIRTUALPORTBIT: EQU 04h             ; 2 port + 1 Keyboard            ;
;   KB_PORT:        EQU VIRTUALPORT-1   ; 2 of 0 to 2 (Last port)        ;
;                                                                        ;
;------------------------------------------------------------------------;

;-------------------------------------------------------------------------
; ESD TEST SOLUTION
;-------------------------------------------------------------------------
    DEFINE ESDTEST

;-------------------------------------------------------------------------
; Keyboard bounce detecting time
;-------------------------------------------------------------------------
DEBOUNCE_PRESS_TIME:	EQU	    05h	; Set debounce time for
						            ; key press equal to 20 ms
						            ; (5 * 4 ms)

DEBOUNCE_RELEASE_TIME:	EQU	    03h	; Set debounce time for
						            ; key release equal to 8 ms
						            ; (2 * 4 ms)

DEBOUNCE_ARRAY_SIZE:    EQU     06h	; 6 keys debounced

;-------------------------------------------------------------------------
; Normal GPIO port configuration
;-------------------------------------------------------------------------
IFDEF   HubOnly
    NORMAL:		        EQU	    77h	; Port3 open drain neg  ; 01b  
				      	            ; Port2 resistive neg   ; 11b
					                ; Port1 open drain neg  ; 01b
					                ; Port0 resistive neg   ; 11b    
ELSE
    NORMAL:	            EQU	    75h	; Port3 open drain neg  ; 01b  
				      	            ; Port2 resistive neg   ; 11b
					                ; Port1 open drain neg  ; 01b
					                ; Port0 open drain neg  ; 01b  
ENDIF					                  
					                    
;-------------------------------------------------------------------------
;the hub-keyboard design uses the upper 4 bits of the DAC port for port power,
;and the lower 4 bits of the DAC port for overcurrent detection
;-------------------------------------------------------------------------
IFDEF   HubOnly
    OC_PORT:                EQU     REG_PORT_0      ; Detection
    MASK_OVERCURRENT_INPUTS:EQU     F0h             ; 
    POWER_PORT:             EQU     REG_PORT_0      ; Port control

    HubPortPower:		    EQU	    REG_PORT_0      ; 
    HubPortOverCurrent:	    EQU	    REG_PORT_0      ; 

ELSE
    OC_PORT:                EQU     REG_DAC_DATA    ; Detection
    MASK_OVERCURRENT_INPUTS:EQU     0Fh             ; DAC0-3 overcurrent FLG's
    POWER_PORT:             EQU     REG_DAC_DATA    ; Port control

    HubPortPower:		    EQU	    REG_DAC_DATA    ; 
    HubPortOverCurrent:	    EQU	    REG_DAC_DATA    ; 

ENDIF

LIMIT_OVERCURRENT:      EQU     20              ; overcurrent debounce limit 20msec
 

;-------------------------------------------------------------------------
; Port 0[7:0], 1[7:0], 2[7:0] 
;-------------------------------------------------------------------------
ScanPort:               EQU     Port2   ; ROW    R7  R6  R5  R4  R3  R2  R1  R0
DrivePort1:             EQU     Port1   ; COLUMN C15 C14 C13 C12 C11 C10 C9  C8
DrivePort0:             EQU     Port0   ; COLUMN C7  C6  C5  C4  C3  C2  C1  C0  

;-------------------------------------------------------------------------
; Port 3[6:0]
;-------------------------------------------------------------------------
;(NOTE) All ports are open drain mode.
;-------------------------------------------------------------------------
LEDPort:                EQU     Port3   
P3_LED_MASK:		    EQU	    07h      
    SCROLL_LOCK_LED:    EQU     04h         
    CAPS_LOCK_LED:      EQU     02h     
    NUM_LOCK_LED:     	EQU	    01h      
    
PCTLPort:		    	EQU		Port3    
    VSW_ENBL_BIT:       EQU     10h                             

PS2_PORT:		    	EQU		Port3
PS2_MASK:               EQU     PS2_DATA_BIT+PS2_CLOCK_BIT+PS2_CONNECT
    PS2_DATA_BIT:		EQU		40h    
    PS2_CLOCK_BIT:		EQU		20h
    PS2_CONNECT:        EQU     08h   
    
;-------------------------------------------------------------------------
; Which Keyboard?
;-------------------------------------------------------------------------
PS2_KEYBOARD:   equ 0               
USB_KEYBOARD:   equ 1

⌨️ 快捷键说明

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