?? myusb.lis
字號:
0027 ;
0027 ; ARGUMENTS:
0027 ;
0027 ; RETURNS:
0027 ;
0027 ; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
0027 ;
0027 ; THEORY of OPERATION or PROCEDURE:
0027 ;
0027 ;-----------------------------------------------------------------------------
0027 .SECTION
0027 myUSB_Stop:
0027 _myUSB_Stop:
0027 550000 MOV [myUSB_bCurrentDevice], 0 ; The app selects the desired device
002A
002A 550000 MOV [myUSB_TransferType], USB_TRANS_STATE_IDLE ; Transaction Idle State
002D 550000 MOV [myUSB_Configuration], 0 ; Unconfigured
0030 550000 MOV [myUSB_DeviceStatus], 0 ; Clear the device status
0033 550400 MOV [myUSB_bActivity], 0 ; Clear the activity flag
0036 624000 MOV REG[myUSB_ADDR], 0 ; Clear the addfress and Address 0
0039 41747F AND REG[myUSB_USBXCR], ~USB_PULLUP_ENABLE ; Release D-
003C 41E1E0 and reg[INT_MSK1], ~(INT_MSK1_USB_ACTIVITY | INT_MSK1_USB_BUS_RESET | INT_MSK1_USB_EP0 | INT_MSK1_USB_EP1 | INT_MSK1_USB_EP2) ; disable specified interrupt enable bit
003F
003F 7F RET
0040 .ENDSECTION
0040 ;-----------------------------------------------------------------------------
0040 ; FUNCTION NAME: myUSB_bCheckActivity
0040 ;
0040 ; DESCRIPTION:
0040 ;
0040 ;-----------------------------------------------------------------------------
0040 ;
0040 ; ARGUMENTS:
0040 ;
0040 ; RETURNS:
0040 ;
0040 ; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
0040 ;
0040 ; THEORY of OPERATION or PROCEDURE:
0040 ;
0040 ; The activity interrupt sets a RAM flag indicating activity and disables the
0040 ; interrupt. Disabling the interrupt keeps the bus activity from creating too
0040 ; many interrupts. bCheckActivity checks and clears the flag, the enables
0040 ; interrupts for the next interval.
0040 ;
0040 ;-----------------------------------------------------------------------------
0040 .SECTION
0040 myUSB_bCheckActivity:
0040 _myUSB_bCheckActivity:
0040 5104 MOV A, [myUSB_bActivity] ; Activity?
0042 3901 CMP A, 1 ;
0044 A002 JZ .active ; Jump on Activity
0046 ; Flow here on no activity
0046 7F RET
0047 ; Jump here if activity was detected
0047 .active:
0047 550400 MOV [myUSB_bActivity], 0 ; Clear the activity flag for next time
004A 43E110 or reg[INT_MSK1], INT_MSK1_USB_ACTIVITY ; enable specified interrupt enable bit
004D 7F RET
004E .ENDSECTION
004E ;-----------------------------------------------------------------------------
004E ; FUNCTION NAME: myUSB_bGetConfiguration
004E ;
004E ; DESCRIPTION: Returns the current configuration number
004E ;
004E ;-----------------------------------------------------------------------------
004E ;
004E ; ARGUMENTS: None
004E ;
004E ; RETURNS: A contains the current configuration number
004E ;
004E ; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
004E ;
004E ; THEORY of OPERATION or PROCEDURE:
004E ;
004E ;-----------------------------------------------------------------------------
004E .SECTION
004E myUSB_bGetConfiguration:
004E _myUSB_bGetConfiguration:
004E 5100 MOV A,[myUSB_Configuration]
0050 7F RET
0051 .ENDSECTION
0051 ;-----------------------------------------------------------------------------
0051 ; FUNCTION NAME: myUSB_bGetEPState
0051 ;
0051 ; DESCRIPTION: Returns the current endpoint state
0051 ;
0051 ;-----------------------------------------------------------------------------
0051 ;
0051 ; ARGUMENTS: A: Endpoint Number
0051 ;
0051 ; RETURNS: A: NO_EVENT_ALLOWED
0051 ; EVENT_PENDING
0051 ; NO_EVENT_PENDING
0051 ;
0051 ; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
0051 ;
0051 ; THEORY of OPERATION or PROCEDURE:
0051 ;
0051 ;-----------------------------------------------------------------------------
0051 .SECTION
0051 myUSB_bGetEPState:
0051 _myUSB_bGetEPState:
0051 3903 CMP A, (USB_MAX_EP_NUMBER + 1) ; Range check
0053 D006 JNC .invalid_ep ; Bail out
0055 ; Flow here to enable an endpoint
0055 5C MOV X, A ; Endpoint number is the index
0056 5200 MOV A, [X+myUSB_EndpointAPIStatus]; Get the state
0058 8003 JMP .exit ; Go to the common exit
005A ; Jump here for an invalid endpoint
005A .invalid_ep:
005A 5000 MOV A, 0 ; Return 0 for an invalid ep
005C ; Jump or flow here for a common exit
005C .exit:
005C 7F RET ; All done
005D .ENDSECTION
005D ;-----------------------------------------------------------------------------
005D ; FUNCTION NAME: myUSB_bRWUEnabled
005D ;
005D ; DESCRIPTION: Returns 1 if Remote Wake Up is enabled, otherwise 0
005D ;
005D ;-----------------------------------------------------------------------------
005D ;
005D ; ARGUMENTS: None
005D ;
005D ; RETURNS: A: 1--Remote Wake Up Enabled
005D ; 0--Remote Wake Up Disabled
005D ;
005D ; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
005D ;
005D ; THEORY of OPERATION or PROCEDURE:
005D ;
005D ;-----------------------------------------------------------------------------
005D .SECTION
005D myUSB_bRWUEnabled:
005D _myUSB_bRWUEnabled:
005D 470002 TST [myUSB_DeviceStatus], USB_DEVICE_STATUS_REMOTE_WAKEUP
0060 B005 JNZ .enabled ; Jump if enabled
0062 ; Flow here if RWU is disabled
0062 5000 MOV A, 0 ; Return disabled
0064 8003 JMP .exit ; Go to the common exit
0066 ; Jump when RWU is enabled
0066 .enabled:
0066 5001 MOV A, 1 ; Return enabled
0068 ; Jump or flow here for a common exit
0068 .exit:
0068 7F RET ; All done
0069 .ENDSECTION
0069 ;-----------------------------------------------------------------------------
0069 ; FUNCTION NAME: myUSB_bGetEPCount
0069 ;
0069 ; DESCRIPTION:
0069 ;
0069 ;-----------------------------------------------------------------------------
0069 ;
0069 ; ARGUMENTS:
0069 ;
0069 ; RETURNS:
0069 ;
0069 ; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
0069 ;
0069 ; THEORY of OPERATION or PROCEDURE:
0069 ;
0069 ;-----------------------------------------------------------------------------
0069 .SECTION
0069 myUSB_bGetEPCount:
0069 _myUSB_bGetEPCount:
0069 3903 CMP A, (USB_MAX_EP_NUMBER + 1) ; Range check
006B D00A JNC .invalid_ep ; Bail out
006D ; Flow here to get the endpoint count
006D 5C MOV X, A ; Endpoint number is the index
006E 5E41 MOV A, REG[X+EP0CNT] ; Here is the count
0070 211F AND A, 0x1F ; Mask off the count
0072 1102 SUB A, 2 ; Ours includes the two byte checksum
0074 8003 JMP .exit ; Go to the common exit
0076 ; Jump here for an invalid endpoint
0076 .invalid_ep:
0076 5000 MOV A, 0 ; Return 0 for an invalid ep
0078 ; Jump or flow here for a common exit
0078 .exit:
0078 7F RET
0079 .ENDSECTION
0079 ;-----------------------------------------------------------------------------
0079 ; FUNCTION NAME: myUSB_LoadEP
0079 ;
0079 ; DESCRIPTION: This function loads the specified endpoint buffer
0079 ; with the number of bytes previously set in the count
0079 ; register.
0079 ;
0079 ;-----------------------------------------------------------------------------
0079 ;
0079 ; ARGUMENTS: A:X Pointer to the ram buffer containing the data to transfer
0079 ; myUSB_APIEPNumber loaded with the endpoint number
0079 ; myUSB_APICount loaded with the number of bytes to load
0079 ;
0079 ; RETURNS: NONE
0079 ;
0079 ; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
0079 ;
0079 ; THEORY of OPERATION or PROCEDURE:
0079 ;
0079 ;-----------------------------------------------------------------------------
0079 .SECTION
0079 myUSB_XLoadEP:
0079 _myUSB_XLoadEP:
0079 ; extern void myUSB_LoadEP(BYTE, BYTE*);
0079 3C0203 CMP [myUSB_APIEPNumber], (USB_MAX_EP_NUMBER + 1) ; Range check
007C D02C JNC .exit ; Bail out
007E ; Flow here to get the endpoint count
007E 5A00 MOV [myUSB_APITemp], X ; Use this temp as the MVI pointer
0080
0080 5102 MOV A, [myUSB_APIEPNumber] ; Get the endpoint number
0082 F026 INDEX EPREGPTR ; Get the address of the endpoint data register array
0084 5C MOV X, A
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -