A SERVICE OF

logo

Cypress CY3640 USB Starter Kit
User’s Guide
Cypress Semiconductor Ver 0.993
Page 23
ipret SysInterrupt
;//$PAGE
;********************************************************
; SysGPIOEvent()
; @func General purpose port event
; @comm Which pin?
;********************************************************
SysGPIOEvent:
; Save accumulator
push a
; Reset debounce any time we are here
mov a,100
mov [gbButtonDebounce],a
SysGPIOButtonDebouncing:
; Enable interrupts and return
mov a,[gbSysInterruptMask]
ipret SysInterrupt
;*******************************************************************************
;
; This section of code responds to activity on End Point 0 and determines
; what needs to be done.
;
;*******************************************************************************
;//$PAGE
;********************************************************
; USBEndPoint0Event()
; @func End Point zero USB event.
; @comm Default end point.
;********************************************************
USBEndPoint0Event:
; This code checks to see what type of packet was received
; (Setup, Out, or In) and jumps to the correct routine to decode the
; specifics. After the code to which the jump points is through, it jumps
; back to USBEventEP0End.
; Save accumulator
push a
; Is this a SETUP packet?
iord USBEndP0RxStatus
and a,USBEndP0RxSetup ; Check the setup bit
jnz USBEventEP0_SETUP ; Yes it's a setup, branch
; Not a setup, is it an OUT packet?
;iord USBEndP0RxStatus
;and a,USBEndP0RxOut
;jnz USBEventEP0_OUT
; Not an OUT packet, is it an IN packet?
;iord USBEndP0RxStatus
;and a,USBEndP0RxIn
;jnz USBEventEP0_IN
USBEventEP0_IN:
USBEventEP0_OUT:
USBEventEP0End:
; OK. We're done with the packet.
; Let's enable interrupts and return
mov a,[gbSysInterruptMask]
ipret SysInterrupt ; done with EP0 irq service routine
USBEventEP0Stall: