User manual
...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 260
www.energymicro.com
Figure 15.12. Normal Bulk/Control OUT/SETUP and Bulk/Control IN Transactions in Slave Mode
A
C
K
HostApplication DeviceAHB USB
O
U
T
D
A
T
A
0
M
P
S
1
MPS
1
MPS
write_tx_fifo
(ch_1)
init_reg(ch_1)
set_ch_en
(ch_2)
init_reg(ch_2)
write_tx_fifo
(ch_1)
set_ch_en
(ch_2)
ch_2
ch_2
ch_1
ch_1
De- allocate
(ch_1)
I
N
ch_2
ch_2
ch_2
ch_1
A
C
K
O
U
T
set_ch_en
(ch_2)
4
1
6
A
C
K
D
A
T
A
0
I
N
A
C
K
read_rx_sts
read_rx_fifo
1
MPS
set_ch_en
(ch_2)
1
MPS
read_rx_stsre
ad_rx_fifo
read_rx_sts
Disable
(ch_2)
1
2
3
4
5
6
7
De- allocate
(ch_2)
ch_2
2
3
5
7
8
9
12
13
read_rx_sts
10
11
D
A
T
A
1
M
P
S
D
A
T
A
1
RXFLVL int errupt
XFERCOMPL interrupt
RXFLVL int errupt
RXFLVL int errupt
XFERCOMPL interrupt
RXFLVL int errupt
CHHLTD int errupt
Non-Periodic Reque st
Queue
Assume that this queue can
hold 4 entries.
15.4.3.6.4.2 Handling Interrupts
The channel-specific interrupt service routine for bulk and control OUT/SETUP transactions in Slave
mode is shown in the following code samples.
Interrupt Service Routine for Bulk/Control OUT/SETUP Transactions in Slave Mode
Bulk/Control OUT/SETUP
Unmask (NAK/XACTERR/STALL/XFERCOMPL)
if (XFERCOMPL)
{
Reset Error Count
Mask ACK
De-allocate Channel
}
else if (STALL)