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

📄 hub.inc

📁 用cy7c66113开发的HUB
💻 INC
字号:
;------------------------------------------------------------------------
; HUB.INC
;------------------------------------------------------------------------
; INCLUDE file for HUB.ASM
;------------------------------------------------------------------------

INVALID_TYPE:           EQU FFh     ; invalid bmRequestType (table delimiter)
INVALID_REQUEST:        EQU FFh     ; invalid bRequest      (table delimiter)
INVALID_FEATURE:        EQU FFh     ; invalid feature selector

;------------------------------------------------------------------------
; SETUP PACKET definitions
;------------------------------------------------------------------------
; Standard Device Requests (default pipe, EP0)
; protocol --> [bmRequestType][bRequest][wValue][wIndex][wLength][..Data..]
;------------------------------------------------------------------------
; [bmRequestType]
; Standard Request Types ([1] pg 174)
;------------------------------------------------------------------------
; Host to Device                -- applicable bRequest codes --
ST_IN_0:                EQU 00h     ; Device specific
                                    ; CLEAR_FEATURE, SET_ADDRESS, SET_CONFIGURATION
                                    ; SET_DESCRIPTOR, SET_FEATURE
ST_IN_1:                EQU 01h     ; Interface specific
                                    ; CLEAR_FEATURE, SET_FEATURE, SET_INTERFACE
ST_IN_2:                EQU 02h     ; Endpoint specific
                                    ; CLEAR_FEATURE, SET_FEATURE
; Device to Host
ST_OUT_0:               EQU 80h     ; Device specific
                                    ; GET_CONFIGURATION, GET_DESCRIPTOR, GET_STATUS
ST_OUT_1:               EQU 81h     ; Interface specific
                                    ; GET_INTERFACE, GET_STATUS
ST_OUT_2:               EQU 82h     ; Endpoint specific
                                    ; GET_STATUS, SYNC_FRAME
;------------------------------------------------------------------------
; [bRequest]
; Standard Requests  ([1] pg 175)
; Hub Class Requests ([2] pg 262)
;------------------------------------------------------------------------
GET_STATUS:             EQU 00h     ; STD and Hub
CLEAR_FEATURE:          EQU 01h     ; STD and Hub
GET_STATE:              EQU 02h     ;         Hub only (optional for hub's)
SET_FEATURE:            EQU 03h     ; STD and Hub
SET_ADDRESS:            EQU 05h     ; STD         only
GET_DESCRIPTOR:         EQU 06h     ; STD and Hub
SET_DESCRIPTOR:         EQU 07h     ; STD and Hub
GET_CONFIGURATION:      EQU 08h     ; STD         only
SET_CONFIGURATION:      EQU 09h     ; STD         only
GET_INTERFACE:          EQU 0Ah     ; STD         only (optional for hub's)
SET_INTERFACE:          EQU 0Bh     ; STD         only (optional for hub's)
SYNCH_FRAME:            EQU 0Ch     ; STD         only (optional for hub's)

;------------------------------------------------------------------------
; [wValue]
; Descriptor Types ([1] pg 175)
;------------------------------------------------------------------------
DT_HUB_OLD:             EQU 00h     ; [USB spec Rev. 1.0] 
DT_DEVICE:              EQU 01h
DT_CONFIGURATION:       EQU 02h
DT_STRING:              EQU 03h
STRING:                 EQU DT_STRING
DT_INTERFACE:           EQU 04h
DT_ENDPOINT:            EQU 05h
DT_HUB:                 EQU 29h     ; (always 0x29 for Hub Descriptor)
                                    ; [USB spec Rev. 1.1 , Table 11-8]
STRING_LANGUAGE:        EQU   0
STRING_MANUFACTURER:    EQU   1
STRING_PRODUCT:         EQU   2
STRING_SERIAL:          EQU   3
STRING_CONFIGURATION:   EQU   4
STRING_INTERFACE:       EQU   5 

HUB_CLASSCODE:              EQU 09h

;------------------------------------------------------------------------
; [wValue]
; Feature Selectors ([1] pg 175)
;------------------------------------------------------------------------
; Standard Feature Selector
;-------------------------------------------------------------------------
; Feature Selector      Recipient   Value
;-------------------------------------------------------------------------
; DEVICE_REMOTE_WAKEUP  Device      1 
; ENDPOINT_HALT         Endpoint    0
;-------------------------------------------------------------------------
ENDPOINT_STALL:         EQU 00h     ; endpoint recipient
DEVICE_REMOTE_WAKEUP:   EQU 01h     ; device recipient

; [wIndex]LSB mask for endpoint
MASK_ENDPOINT:          EQU 00000001b

endpoint_stall:         equ ENDPOINT_STALL
device_remote_wakeup:   equ DEVICE_REMOTE_WAKEUP

ENDPOINT_HALT:		    EQU	ENDPOINT_STALL

;------------------------------------------------------------------------
; Hub-Class Specific Requests (default pipe, EP0)
; protocol --> [bmRequestType][bRequest][wValue][wIndex][wLength][..Data..]
;------------------------------------------------------------------------
; [bmRequestType]
; Hub-Specific Request Types ([2] Table 11-10, pg 261)
;------------------------------------------------------------------------
; Host to Hub                       -- applicable Hub Class Requests (bRequest) --
; ClearHubFeature, SetHubDescriptor and SetHubFeature
HT_IN_0:                EQU 20h     ;
                                    ; CLEAR_FEATURE,  SET_DESCRIPTOR, SET_FEATURE
; ClearPortFeature and SetPortFeature
HT_IN_1:                EQU 23h     ; CLEAR_FEATURE,  SET_FEATURE
; Hub to Host
; GetHubDescriptor and GetHubStatus
HT_OUT_0:               EQU A0h     ; GET_DESCRIPTOR, GET_STATUS
; GetBusState and GetPortStatus
HT_OUT_1:               EQU A3h     ; GET_STATE,      GET_STATUS

;------------------------------------------------------------------------
; Hub Class Feature Selectors ([2] Table 11-12)
; [wValue]
; Hub features
;------------------------------------------------------------------------
C_HUB_LOCAL_POWER:      EQU 0
C_HUB_OVER_CURRENT:     EQU 1
;------------------------------------------------------------------------
; Port features
PORT_CONNECTION:        EQU 0
PORT_ENABLE:            EQU 1
PORT_SUSPEND:           EQU 2
PORT_OVER_CURRENT:      EQU 3
PORT_RESET:             EQU 4
PORT_POWER:             EQU 8
PORT_LOW_SPEED:         EQU 9
C_PORT_CONNECTION:      EQU 16
C_PORT_ENABLE:          EQU 17
C_PORT_SUSPEND:         EQU 18
C_PORT_OVER_CURRENT:    EQU 19
C_PORT_RESET:           EQU 20

;------------------------------------------------------------------------

;------------------------------------------------------------------------
; Hub Ports Suspend Register 0x4D (read/write)
;-------------------------------------------------------------------------
MASK_DEVICE_REMOTE_WAKEUP:  EQU 10000000b

;-------------------------------------------------------------------------
; Device status (high byte) {6'b000000, DEVICE_REMOTE_WAKEUP, SELF_POWERED}
;-------------------------------------------------------------------------
MASK_REMOTE_WAKEUP:         EQU 00000010b   ; bmAttributes bitmasks
MASK_BUS_POWERED:           EQU 00000000b
MASK_SELF_POWERED:          EQU 00000001b
MASK_DEVICE_STATUS:         EQU 00000011b   ; JUK v1.66-1

;-------------------------------------------------------------------------
; bmAttributes Configuration characteristics
; 7 Bus Powered
; 6 Self Powered
; 5 Remote Wakeup
;-------------------------------------------------------------------------


⌨️ 快捷键说明

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