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

📄 usb_std.lis

📁 Cypress cy7c63318 鼠标开发板的源代码
💻 LIS
📖 第 1 页 / 共 5 页
字号:
                ENDIF
                IF (USB_CB_SRC_d2h_std_ifc_04 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ifc_04
 0000           USB_CB_d2h_std_ifc_04:
                ENDIF
                IF (USB_CB_SRC_d2h_std_ifc_05 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ifc_05
 0000           USB_CB_d2h_std_ifc_05:
                ENDIF
                IF (USB_CB_SRC_d2h_std_ifc_06 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ifc_06
                USB_CB_d2h_std_ifc_06:
                ENDIF
                IF (USB_CB_SRC_d2h_std_ifc_07 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ifc_07
 0000           USB_CB_d2h_std_ifc_07:
                ENDIF
                IF (USB_CB_SRC_d2h_std_ifc_08 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ifc_08
 0000           USB_CB_d2h_std_ifc_08:
                ENDIF
                IF (USB_CB_SRC_d2h_std_ifc_09 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ifc_09
 0000           USB_CB_d2h_std_ifc_09:
                ENDIF
                IF (USB_CB_SRC_d2h_std_ifc_10 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ifc_10
                USB_CB_d2h_std_ifc_10:
                ENDIF
                
                ; d2h_std_ifc
                IF (USB_CB_SRC_h2d_std_ifc_00 & USB_NOT_SUPPORTED)
                export  USB_CB_h2d_std_ifc_00
 0000           USB_CB_h2d_std_ifc_00:
                ENDIF
                
                ; d2h_std_ep
                IF (USB_CB_SRC_d2h_std_ep_00 & USB_NOT_SUPPORTED)
                export  USB_CB_d2h_std_ep_00
                USB_CB_d2h_std_ep_00:
                ENDIF
                
                ; h2d_std_ep
                IF (USB_CB_SRC_h2d_std_ep_00 & USB_NOT_SUPPORTED)
                export  USB_CB_h2d_std_ep_00
 0000           USB_CB_h2d_std_ep_00:
                ENDIF
                IF (USB_CB_SRC_h2d_std_ep_01 & USB_NOT_SUPPORTED)
                export  USB_CB_h2d_std_ep_01
                USB_CB_h2d_std_ep_01:
                ENDIF
                IF (USB_CB_SRC_h2d_std_ep_02 & USB_NOT_SUPPORTED)
                export  USB_CB_h2d_std_ep_02
 0000           USB_CB_h2d_std_ep_02:
                ENDIF
                IF (USB_CB_SRC_h2d_std_ep_03 & USB_NOT_SUPPORTED)
                export  USB_CB_h2d_std_ep_03
                USB_CB_h2d_std_ep_03:
                ENDIF
                
                export  USB_Not_Supported
                export _USB_Not_Supported
 0000           USB_Not_Supported:
 0000           _USB_Not_Supported:
 0000 5000         MOV    A, 0                         ; Count 0
 0002 5703         MOV    X, USB_MODE_STALL_IN_OUT     ; Stall the request
 0004 7D0000       LJMP   USB_EP0_UPD_MODE_EXIT
 0007           ;-----------------------------------------------------------------------------
 0007           ;  FUNCTION NAME: USB_CB_d2h_std_dev_00
 0007           ;
 0007           ;  DESCRIPTION:   Get Device Status
 0007           ;
 0007           ;****************************************************************
 0007           ; STANDARD DEVICE IN REQUEST: Get_Device_Status
 0007           ;****************************************************************
 0007           ;
 0007           ; bmRequestType  : (IN | STANDARD | DEVICE)       = 80h     
 0007           ; bRequest       : GET_STATUS                     = 00h    
 0007           ; wValue         : RESERVED                       = 0000h  
 0007           ; wIndex         : RESERVED                       = 0000h
 0007           ; wLength        : SIZEOF_ENDPOINT_STATUS         = 0002h  
 0007           ; 
 0007           ; The GET_DEVICE_STATUS request returns the current device status.
 0007           ;
 0007           ;****************************************************************
 0007           ;-----------------------------------------------------------------------------
 0007           ;
 0007           ;  ARGUMENTS:
 0007           ;
 0007           ;  RETURNS:
 0007           ;
 0007           ;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
 0007           ;
 0007           ;  THEORY of OPERATION or PROCEDURE:
 0007           ;
 0007           ;-----------------------------------------------------------------------------
                IF (USB_CB_SRC_d2h_std_dev_00 & USB_UM_SUPPLIED)
 0007           .LITERAL
 0007           GetStatusTransferDescrTable:
 0007 00            DB      ((1) - 1)                 ; Number of table entries - 1
 0008 01            DB  USB_DS_RAM                             ; Data source (USB_DS_*)
 0009 0002          DW  2                             ; Transfer size
 000B 0000          DW  USB_TransferBuffer                             ; Data source address
 000D 0000          DW  NULL_PTR                             ; Transfer Completion Status Block Address
 000F DE            DB  0xde                           ; Reserved 
 0010           .ENDLITERAL
                export  USB_CB_d2h_std_dev_00
 0010           USB_CB_d2h_std_dev_00:
 0010 550000        MOV     [USB_t2], 0                ; Use the UM temp var--Selector
 0013           
 0013 550100        MOV     [USB_TransferBuffer+1], 0  ; Use the UM Transfer Buffer
 0016 5F0000        MOV     [USB_TransferBuffer], [USB_DeviceStatus]
 0019           
 0019 5007          MOV     A,>GetStatusTransferDescrTable  ; Get the ROM Address MSB
 001B 5707          MOV     X,<GetStatusTransferDescrTable  ; Get the ROM Address LSB
 001D 8267          JMP     USB_GetTableEntry_Local_Std
                ENDIF
                ;-----------------------------------------------------------------------------
                ; FUNCTION NAME: USB_CB_d2h_std_dev_06
                ;
                ; DESCRIPTION:   Get Device Descriptor
                ;
                ;****************************************************************
                ; STANDARD DEVICE IN REQUEST: Get_Device_Descriptor
                ;****************************************************************
                ;
                ; bmRequestType  : (IN | STANDARD | DEVICE)       = 80h
                ; bRequest       : GET_DESCRIPTOR                 = 06h    
                ; wValue         : DESCRIPTOR TYPE | INDEX        = xxxxh  
                ; wIndex         : ZERO or LANG_ID                = xxxxh
                ; wLength        : SIZEOF_DESCRIPTOR              = --xxh  
                ; 
                ; The GET_DEVICE_DESCRIPTOR returns the specified descriptor if 
                ; the descriptor exists. 
                ; 
                ; The upper byte of wValue contains the descriptor type and 
                ; the lower byte contains the descriptor index. wIndex 
                ; contains either 0000h or the Language ID. wLength contains 
                ; the descriptor length. The actual descriptor information is 
                ; transferred in subsequent data packets. 
                ;
                ;****************************************************************
                ;
                ;-----------------------------------------------------------------------------
                ;
                ;  ARGUMENTS:
                ;
                ;  RETURNS:
                ;
                ;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
                ;
                ;  THEORY of OPERATION or PROCEDURE:
                ;
                ;-----------------------------------------------------------------------------
                IF (USB_CB_SRC_d2h_std_dev_06 & USB_UM_SUPPLIED)
                export  USB_CB_d2h_std_dev_06
 001F           USB_CB_d2h_std_dev_06:
 001F           ;-----------------------------------------------------------------------------
 001F           ; Dispatch to the proper handler
 001F           ;-----------------------------------------------------------------------------
 001F 5D53          MOV     A, REG[USB_EP0DATA+wValueHi] ; Get the descrptor type
 0021 64            ASL     A                          ; Make it into a offset
 0022 3908          CMP     A, GET_DESCR_DISPATCH_SIZE         ; Validity check
 0024 DFDB          JNC     USB_Not_Supported
 0026           
 0026 E001          JACC    GET_DESCR_DISPATCH
 0028           
 0028           GET_DESCR_DISPATCH:
 0028 8FD7          JMP     USB_Not_Supported          ; Invalid
 002A 8028          JMP     USB_SendDeviceDescr        ; Device Descriptor
 002C 8003          JMP     USB_SendConfigDescr        ; Configuration Descriptor
                IF  USB_bNumStringDescrs               ; Number of String Descriptor defined with the Wizard
 002E 8034          JMP     USB_SendStringDescr        ; String Descriptor
                ELSE
                    JMP     USB_Not_Supported          ; Not supported if we don't have
                                                            ; any String Descriptor
                ENDIF
 0030           GET_DESCR_DISPATCH_END:
 0008           GET_DESCR_DISPATCH_SIZE: EQU (GET_DESCR_DISPATCH_END - GET_DESCR_DISPATCH)     
 0030           ;-----------------------------------------------------------------------------
 0030           ; Configuration Descriptor Handler
 0030           ;-----------------------------------------------------------------------------
 0030           USB_SendConfigDescr:
 0030 9000          CALL    USB_GET_DEVICE_TABLE_ENTRY
 0032 4B            SWAP    A, X
 0033 0102          ADD     A, 2                       ; We want the pointer to the descriptor table (second entry)
 0035 4B            SWAP    A, X
 0036 0900          ADC     A, 0                       ; Don't forget the carry
 0038 550000        MOV    [USB_t2], USB_t1            ; Set up the destination  
 003B 9000          CALL    USB_GETWORD                ; Get the pointer
 003D               
 003D 5100          MOV     A, [USB_t1]                ; Pointer MSB
 003F 5801          MOV     X, [USB_t1+1]              ; Pointer LSB
 0041               
 0041 08            PUSH    A                          ; Save the MSB
 0042               
 0042 5D52          MOV     A, REG[USB_EP0DATA+wValueLo]  ; Get the descrptor index
 0044 5300          MOV     [USB_t2], A                ; Use the UM temp var--Selector
 0046 18            POP     A                          ; Need the MSB for the range check
 0047 08            PUSH    A                          ; Save the MSB for after the range check
 0048 28            ROMX                               ; First entry is the table size (only a byte)
 0049 3A00          CMP     A, [USB_t2]                ; Range check
 004B D004          JNC     .range_ok
 004D               
 004D 18            POP     A                          ; Fix the stack
 004E 8FB1          JMP    USB_Not_Supported
 0050           
 0050           .range_ok:
 0050 18            POP     A                          ; Get the MSB back
 0051 8233          JMP     USB_GetTableEntry_Local_Std
 0053           ;-----------------------------------------------------------------------------
 0053           ; Device Descriptor Handler
 0053           ;-----------------------------------------------------------------------------
 0053           USB_SendDeviceDescr:
 0053 5F0000        MOV     [USB_t2], [USB_bCurrentDevice]  ; Use the UM temp var--Selector
 0056 5000          MOV     A,>USB_DEVICE_DESCR_TABLE  ; Get the ROM Address MSB
 0058 5700          MOV     X,<USB_DEVICE_DESCR_TABLE  ; Get the ROM Address LSB
 005A 28            ROMX                               ; First entry is the table size (only a byte)
 005B 3A00          CMP     A, [USB_t2]    

⌨️ 快捷键说明

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