Freescale Semiconductor Microcontrollers User Manual

Page 315

Advertising
background image

HC08 Full Chip Simulation

Configuration Procedure

315

Microcontrollers Debugger Manual

cpx #8 ; all descriptors more than 8 bytes
bne GETREPDESC
ldhx #RDesc_End ; store end location of the descriptor
sthx descendptr
ldhx #REP_Desc ; store pointer to next byte in descriptor

GETDESC_END:
sthx descptr
lda descptr+1 ; add length specified in setup packet
add wLengthL ; and store in tptr
sta tptr+1
lda descptr
adc wLengthH
sta tptr
ldhx tptr ; is calculated pointer >= end of descriptor?
cphx descendptr ; if so then end_pointer = end of descriptor
bge GETDESC_END2 ; else, end_pointer= calculated pointer
sthx descendptr

GETDESC_END2:
ldhx descptr ; get pointer to start of descriptor
aix #8 ; eight bytes sent already
sthx descptr ; store current pointer
mov #$88,UEP0CSR ; SIZE=8 bytes, IN packet data ready
mov #GET_DESC,control ; set flag for control transfer type
bra GETDESC_EXIT

GETDESC_STALL:
jsr FORCE_STALL

GETDESC_EXIT:
rts

****************************************************************
* SETUP_PROC - This procedure handles the SETUP packets that *
* come into the USB peripheral. The only standard *
* device requests handled are SYNC_FRAME, *
* GET_DESCRIPTOR, and vendor-specific requests. *
****************************************************************
SETUP_PROC:
clr control ; clear flag for control transfer
lda UEP0CSR ; check size of SETUP packet
lsra
lsra
lsra
lsra
cmp #8 ; is SIZE=8?
bne SETUP_EXIT ; if not then exit

Advertising