📄 usbint.asm
字号:
;;*****************************************************************************
;;*****************************************************************************
;; FILENAME: USBCommon.asm
;; @Version@
;; Generated by PSoC Designer ver 4.2 b1013 : 02 September, 2004
;;
;; DESCRIPTION: USBFS User Module software implementation file
;; for the 24090 PSoC family of devices
;;
;; NOTE: User Module APIs conform to the fastcall16 convention for marshalling
;; arguments and observe the associated "Registers are volatile" policy.
;; This means it is the caller's responsibility to preserve any values
;; in the X and A registers that are still needed after the API functions
;; returns. For Large Memory Model devices it is also the caller's
;; responsibility to perserve any value in the CUR_PP, IDX_PP, MVR_PP and
;; MVW_PP registers. Even though some of these registers may not be modified
;; now, there is no guarantee that will remain the case in future releases.
;;-----------------------------------------------------------------------------
;; Copyright (c) Cypress MicroSystems 2002-2004. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************
include "m8c.inc"
include "memory.inc"
include "USB.inc"
;-----------------------------------------------
; include instance specific register definitions
;-----------------------------------------------
;-----------------------------------------------
; Global Symbols
;-----------------------------------------------
;-------------------------------------------------------------------
; Declare the functions global for both assembler and C compiler.
;
; Note that there are two names for each API. First name is
; assembler reference. Name with underscore is name refence for
; C compiler. Calling function in C source code does not require
; the underscore.
;-------------------------------------------------------------------
export USB_EP1_ISR
export _USB_EP1_ISR
export USB_EP2_ISR
export _USB_EP2_ISR
export USB_EP3_ISR
export _USB_EP3_ISR
export USB_EP4_ISR
export _USB_EP4_ISR
export USB_RESET_ISR
export _USB_RESET_ISR
export USB_SOF_ISR
export _USB_SOF_ISR
export USB_WAKEUP_ISR
export _USB_WAKEUP_ISR
;@PSoC_UserCode_INIT@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom declarations below this banner
;---------------------------------------------------
;------------------------
; Includes
;------------------------
;------------------------
; Constant Definitions
;------------------------
;------------------------
; Variable Allocation
;------------------------
AREA InterruptRAM (RAM,REL,CON)
_SOF_Flag:: BLK 1
;---------------------------------------------------
; Insert your custom declarations above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
AREA UserModules (ROM, REL)
USB_EP1_ISR:
_USB_EP1_ISR:
;@PSoC_UserCode_BODY_1@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom code below this banner
;---------------------------------------------------
; NOTE: interrupt service routines must preserve
; the values of the A and X CPU registers.
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
reti
USB_EP2_ISR:
_USB_EP2_ISR:
;@PSoC_UserCode_BODY_2@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom code below this banner
;---------------------------------------------------
; NOTE: interrupt service routines must preserve
; the values of the A and X CPU registers.
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
reti
USB_EP3_ISR:
_USB_EP3_ISR:
;@PSoC_UserCode_BODY_3@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom code below this banner
;---------------------------------------------------
; NOTE: interrupt service routines must preserve
; the values of the A and X CPU registers.
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
reti
USB_EP4_ISR:
_USB_EP4_ISR:
;@PSoC_UserCode_BODY_4@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom code below this banner
;---------------------------------------------------
; NOTE: interrupt service routines must preserve
; the values of the A and X CPU registers.
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
reti
USB_RESET_ISR:
_USB_RESET_ISR:
push X
mov [USB_Configuration], 0
mov [USB_DeviceStatus], 0
mov [USB_InterfaceSetting], 0
mov [USB_EndpointStatus], 0
mov [USB_TransferType], 0
mov [USB_fDataPending], 0
mov reg[USB_EP0MODE], USB_MODE_STALL_IN_OUT ; ACK Setup/Stall IN/OUT
mov reg[USB_EP1MODE], 0
mov reg[USB_EP2MODE], 0
mov reg[USB_EP3MODE], 0
mov reg[USB_EP4MODE], 0
mov X, USB_MAX_EP_NUMBER ; Set up loop to clear all of the endpoint data items
.loop:
mov [X + USB_EPDataToggle], 0 ; Or in the toggle
dec X ; Are we done?
jnz .loop ; Jump to do another endpoint
mov reg[USB_ADDR], USB_ADDR_ENABLE ; Enable Address 0
;@PSoC_UserCode_BODY_5@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom code below this banner
;---------------------------------------------------
; NOTE: interrupt service routines must preserve
; the values of the A and X CPU registers.
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
pop X
reti
USB_SOF_ISR:
_USB_SOF_ISR:
;@PSoC_UserCode_BODY_6@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom code below this banner
;---------------------------------------------------
INC [_SOF_Flag]
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
reti
USB_WAKEUP_ISR:
_USB_WAKEUP_ISR:
;@PSoC_UserCode_BODY_7@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom code below this banner
;---------------------------------------------------
; NOTE: interrupt service routines must preserve
; the values of the A and X CPU registers.
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
reti
; End of File USB.asm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -