A SERVICE OF

logo

Cypress CY3640 USB Starter Kit
User’s Guide
Cypress Semiconductor Ver 0.993
Page 31
push x
; Initialize
mov x,0h
_USendROMBufferLoop:
; Any more?
mov a,0h
cmp a,[gbUSBSendBytes]
jz _USendROMBufferLoopDone ; No more
dec [gbUSBSendBytes]
; Move bytes to FIFO
mov a,[gbUSBSendBuffer]
index USBSendROMBufferBase
mov [x +USBEndP0FIFO],a
inc x
; Next byte
inc [gbUSBSendBuffer]
jmp _USendROMBufferLoop
_USendROMBufferLoopDone:
; Re-enable reception
mov a,0h
iowr USBEndP0RxStatus
; Toggle sequence
mov a,USBEndP0TxSequence
xor [gbUSBSendSequence],a
; Send bytes
push x
pop a
or a,[gbUSBSendSequence]
or a,USBEndP0TxRespond
iowr USBEndP0TxConfig
; The FIFO is loaded, go and wait untill it's read
call USBSendWaitForComplete
_USendROMBufferEnd:
; Restore and exit
pop x
ret
;//$PAGE
;********************************************************
; USBSendACK()
; func Respond to a "USB Status In" with a zero byte buffer with
; Sequence field set) on end point 0.
; Called by SetAddress and SetConfig commands
;********************************************************
USBSendACK:
; Status response to Status In is to send a zero byte packet
mov a,USBEndP0TxRespond | USBEndP0TxSequence
iowr USBEndP0TxConfig
; Enable interrupts
mov a,[gbSysInterruptMask]
iowr SysInterrupt
; Wait for send complete
jmp USBSendWaitForComplete
;********************************************************
; USBSendWaitForComplete()
; @func Wait for send to complete on end point 0.
;********************************************************