
Cypress CY3640 USB Starter Kit
User’s Guide
Cypress Semiconductor Ver 0.993
Page 25
jz USBEventEP0Stall ; Yes
; Vendor specific commands
USBEventEP0SetupTargetVendorIN_OUT:
; Check request (IN packet OK, OUT packet ERR)
mov a,[USBEndP0FIFO_0]
and a,USBRqstTypeVendor | USBRqstTargetEndPoint | USBRqstTypeDirection
cmp a,USBRqstTypeVendor | USBRqstTargetEndPoint | USBRqstTypeDirection
jz USBEventEP0VendorRqst
; Unsupported request !!!
jmp USBEventEP0Stall ; Oops! We don't support whatever
; request was made.
;//$PAGE
;********************************************************
; USBEventEP0SetupIsSet()
; @func End point event SETUP to set address.
; @devnote Runs in interrupt enabled context.
;********************************************************
USBEventEP0SetupIsSetAddress:
; Set device address?
mov a,[USBRqstMessage]
cmp a,USBRqstSetAddress
jz USBEventEP0SetupSetAddress ; Yes
USBEventEP0SetupIsSetConfig:
; Set device configuration?
mov a,[USBEndP0FIFO_1]
cmp a,USBRqstSetConfiguration
jz USBEventEP0SetupSetConfig ; Yes
; Unsupported set request !!!
jmp USBEventEP0Stall ; No. Stall
;USBEventEP0SetupIsGetDescriptor:
mov a,[USBRqstMessage]
cmp a,USBRqstGetDescriptor
jz USBEventEP0SetupGetDescriptor ; Yes
; Unsupported get request !!!
jmp USBEventEP0Stall ; No
;********************************************************
; USBEventEP0SetupSetAddress()
; @func End point zero event SETUP to set address.
; @devnote Runs in interrupt enabled context.
; @comm
; The status token of the SetAddress is an IN. So, we send status manually.
;********************************************************
USBEventEP0SetupSetAddress:
; Send ACK
call USBSendACK
; Now that we have been acknowleged, we actually set the address.
; This is different from all other commands which execute first
; and then acknowlege (_________________)
; Remember this
inc [gbUSBValidRqsts]
; Set Address
mov a,[USBRqstWordValueLo]
iowr USBDeviceAddress
; Done
jmp USBEventEP0End
;********************************************************