?? usb_cls_hid.lis
字號:
001B ;
001B ; bmRequestType : (IN | STANDARD | INTERFACE) = 81h
001B ; bRequest : GET_DESCRIPTOR = 06h
001B ; wValue : DESCRIPTOR TYPE | INDEX = xxxxh
001B ; wIndex : INTERFACE = --xxh
001B ; wLength : DESCRIPTOR_LENGTH = --xxh
001B ;
001B ; The GET_INTERFACE_DESCRIPTOR request returns the specified
001B ; descriptor if the descriptor exists.
001B ;
001B ; The upper byte of request_value contains the descriptor type and
001B ; the lower byte contains the descriptor index. request_index
001B ; contains either 0000h or the Language ID. request_length contains
001B ; the descriptor length. The actual descriptor information is
001B ; transferred in subsequent data packets.
001B ;
001B ; USB defines only a DEVICE recipient but the HID spec added
001B ; support for the INTERFACE recipient.
001B ;
001B ; Get Descriptor from an HID interface returns either HID,
001B ; REPORT, or PHYSICAL descriptors.
001B ;
001B ;****************************************************************
IF (USB_CB_SRC_d2h_std_ifc_06 & USB_UM_SUPPLIED)
export USB_CB_d2h_std_ifc_06
001B USB_CB_d2h_std_ifc_06:
001B 912A CALL USB_GetInterfaceLookupTable ; Point the the interface lookup table
001D 08 PUSH A ; Save the MSB
001E 5D53 MOV A, REG[USB_EP0DATA+wValueHi] ; Get descriptor type
0020 3921 CMP A, DESCR_TYPE_HID_CLASS ; HID Class descriptor?
0022 A00E JZ .send_hid_class_descr
0024 3922 CMP A, DESCR_TYPE_HID_REPORT ; HID Report descriptor?
0026 A004 JZ .send_hid_report_descr
0028 ; Jump or flow here if the request is not supported
0028 .not_supported:
0028 18 POP A ; Restore the stack
0029 8175 JMP USB_Not_Supported_Local_Hid
002B ; Jump here to send the HID Report Descriptor
002B .send_hid_report_descr:
002B 18 POP A ; Restore the interface lookup table MSB
002C 4B SWAP A, X ; Add the offset
002D 0102 ADD A, 2 ; Point to the right table entry
002F 8005 JMP .finish
0031 ; Jump here to send the HID Class Descriptor
0031 .send_hid_class_descr:
0031 18 POP A ; Restore the interface lookup table MSB
0032 4B SWAP A, X ; Add the offset
0033 0104 ADD A, 4 ; Point to the right table entry
0035 ; Jump or flow here with A:X Pointing to the
0035 .finish:
0035 4B SWAP A, X ; Back where they belong
0036 0900 ADC A, 0 ; Don't forget the carry
0038 550000 MOV [USB_t2],USB_t1 ; Set the GETWORD destination
003B 7C0000 LCALL USB_GETWORD ; Get the pointer to the transfer descriptor table
003E ; ITempW has the address
003E ; Get the interface number
003E 5D54 MOV A, REG[USB_EP0DATA+wIndexLo] ; Get the interface number
0040 5300 MOV [USB_t2], A ; Save it for the call to LOOKUP
0042 5100 MOV A, [USB_t1] ; Get the transfer descriptor ROM Address MSB
0044 5801 MOV X, [USB_t1+1] ; Get the transfer descriptor ROM Address LSB
0046
0046 815B JMP USB_GetTableEntry_Local_Hid
ENDIF
;-----------------------------------------------------------------------------
; FUNCTION NAME: USB_CB_d2h_cls_ifc_01
;
; DESCRIPTION: Get Report
;
;****************************************************************
; HID CLASS INTERFACE IN REQUEST: Get_Report
;****************************************************************
;
; bmRequestType : (IN | CLASS | INTERFACE) = A1h
; bRequest : GET_REPORT = 01h
; wValue : REPORT TYPE | REPORT ID = xxxxh
; wIndex : INTERFACE = --xxh
; wLength : REPORT LENGTH = --xxh
;
; The GET_REPORT request allows the host to receive a report from
; a specific interface via the control pipe.
;
;****************************************************************
;-----------------------------------------------------------------------------
;
; 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_cls_ifc_01 & USB_UM_SUPPLIED)
export USB_CB_d2h_cls_ifc_01
0048 USB_CB_d2h_cls_ifc_01:
0048
0048 9091 CALL Find_Report
004A 4B SWAP A, X ; LSB non-zero?
004B B006 JNZ .ok ; Exit on non-zero
004D 4B SWAP A, X ; MSB zero
004E A150 JZ USB_Not_Supported_Local_Hid ; Jump to the null pointer handler
0050 8002 JMP .exit
0052 .ok:
0052 4B SWAP A, X ; Put them back
0053 .exit:
0053
0053 814E JMP USB_GetTableEntry_Local_Hid
0055
ENDIF
;-----------------------------------------------------------------------------
; FUNCTION NAME: USB_CB_d2h_cls_ifc_02
;
; DESCRIPTION: Get Idle
;
;****************************************************************
; HID CLASS INTERFACE IN REQUEST: Get_Idle
;****************************************************************
;
; bmRequestType : (OUT | CLASS | INTERFACE) = A1h
; bRequest : GET_IDLE = 02h
; wValue : REPORT ID = 00xxh
; wIndex : INTERFACE = --xxh
; wLength : Report Size = 0001h
;
; The GET_IDLE request reads the current idle rate for a given
; input report on a specific interface.
;
;****************************************************************
;-----------------------------------------------------------------------------
;
; 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_cls_ifc_02 & USB_UM_SUPPLIED)
0055 .LITERAL
0055 GetSetIdleTable:
0055 00 DB ((1h) - 1) ; Number of table entries - 1
0056 01 DB USB_DS_RAM ; Data source (USB_DS_*)
0057 0001 DW 1 ; Transfer size
0059 0000 DW USB_IdleReload ; Data source address
005B 0000 DW NULL_PTR ; Transfer Completion Status Block Address
005D DE DB 0xde ; Reserved
005E 01 DB USB_DS_RAM ; Data source (USB_DS_*)
005F 0001 DW 1 ; Transfer size
0061 0001 DW USB_IdleReload+1 ; Data source address
0063 0000 DW NULL_PTR ; Transfer Completion Status Block Address
0065 DE DB 0xde ; Reserved
0066 .ENDLITERAL
export USB_CB_d2h_cls_ifc_02
0066 USB_CB_d2h_cls_ifc_02:
0066 5D52 MOV A, REG[USB_EP0DATA+wValueLo] ; Get the report number
0068 3900 CMP A, 0 ; We don't support report by report idle
006A B134 JNZ USB_Not_Supported_Local_Hid
006C
006C 5D54 MOV A, REG[USB_EP0DATA+wIndexLo] ; Get the interface number
006E 3901 CMP A, 1h ; We don't support report by report idle
0070 D12E JNC USB_Not_Supported_Local_Hid
0072
0072 5300 MOV [USB_t2], A ; Use the UM temp var--Selector
0074 5055 MOV A,>GetSetIdleTable ; Get the ROM Address MSB
0076 5755 MOV X,<GetSetIdleTable ; Get the ROM Address LSB
0078
0078 8129 JMP USB_GetTableEntry_Local_Hid
ENDIF
;-----------------------------------------------------------------------------
; FUNCTION NAME: USB_CB_d2h_cls_ifc_03
;
; DESCRIPTION: Get Protocol
;
;****************************************************************
; HID CLASS INTERFACE IN REQUEST: Get_Protocol
;****************************************************************
;
; bmRequestType : (OUT | CLASS | INTERFACE) = A1h
; bRequest : GET_PROTOCOL = 03h
; wValue : RESERVED = 0000h
; wIndex : INTERFACE = --xxh
; wLength : SIZEOF_INTERFACE_PROTOCOL = 0001h
;
; The GET_PROTOCOL request reads which protocol is currently
; active.
;
;****************************************************************
;-----------------------------------------------------------------------------
;
; 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_cls_ifc_03 & USB_UM_SUPPLIED)
007A .LITERAL
007A GetProtocolTable:
007A 01 DB ((2) - 1) ; Number of table entries - 1
007B 00 DB USB_DS_ROM ; Data source (USB_DS_*)
007C 0001 DW 1 ; Transfer s
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -