
Cypress CY3640 USB Starter Kit
User’s Guide
Cypress Semiconductor Ver 0.993
Page 26
; USBEventEP0SetupSetConfig()
; @func End point zero event SETUP to Set Configuration.
; @devnote Runs in interrupt enabled context.
; 1
; set enumerated (gbSysEnumerated) state,
; enable GPIO (and EP1, if appropriate)
; Enable P0 and P1
; 0
; Reset enumerated (gbSysEnumerated) state,
; Turn off LED
; Reset variables
; Disable GPIO and EP1
; Disable dallas chip and P0 and P1
;********************************************************
USBEventEP0SetupSetConfig:
; Enumerated !
mov a,01h
mov [gbSysEnumerated],a
; Initialize thermometer
call ThermInitialize
; Enable button interrupt on port 1.
; Actually, this has already been done in main().
mov a,04h
iowr SysPort1IntEnable
; enable all appropriate irq's
mov a,SysIntTimer1024us | SysIntGPIO | SysIntUSBEndP0
mov [gbSysInterruptMask],a
; Send ACK
call USBSendACK
jmp USBEventEP0End
;//$PAGE
;********************************************************
; USBEventEP0SetupGetDescriptor()
; @func End point zero event SETUP to Get Descriptor.
; @devnote Runs in interrupt enabled context.
;********************************************************
USBEventEP0SetupGetDescriptor:
; Get descriptor type
mov a,[USBRqstWordValueHi]
USBEventEP0SetupGetDescriptorDevice:
; Device Descriptor?
cmp a,USBDescriptorTypeDevice
jnz USBEventEP0SetupGetDescriptorConfig ; No
; Remember this
inc [gbUSBValidRqsts]
;*********************************************
; Get Device Descriptor Event
;*********************************************
; Descriptor pointer
mov a,(USBDeviceDescription -USBSendROMBufferBase)
mov [gbUSBSendBuffer],a
; Descriptor size
mov a,12h ;[USBDeviceDescription]
mov [gbUSBSendBytes],a
; Check request size field
call USBSendDescriptorCheckLength
; Send buffer
call USBSendROMBuffer