SN8P2200 Series
USB 1.1 Low-Speed 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 101
Version 1.7
9.5.3 USB ENDPOINT 1 ENABLE REGISTER
The communication with the USB host using endpoint 1, endpoint 1’s FIFO is implemented as 8 bytes of dedicated
RAM. The endponit1 is an interrupt endpoint.
0A2H
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
UE1R UE1E FFS1 UE1DO UE1DI UE1C3 UE1C UE1C1 UE1C0
Read/Write R/W
R
R/W
R/W R/W R/W R/W R/W
After
reset
0 0 0 0 0 0 0 0
Bit [3:0] UE1C [3:0]:
Indicate the number of data bytes in a transaction: For IN transactions, firmware loads the
count with the number of bytes to be transmitted to the host from the endpoint 1 FIFO.
Bit 4
UE1DI:
Indicate endpoint 1 data ready to host (IN token).
0 = Data is ready in EP1 FIFO for USB host drawing out. Firmware set the bit zero to indicate that data is
ready. Hardware will send an ACK to complete the transaction and set the bit to 1 after the IN token
transaction.
1 = Data is not ready in EP1 FIFO for IN token. Hardware will send NAK handshakes response to any IN
token sent to this endpoint. In addition, set this bit and the bit 4 of UPID register will send the STALL
handshake response to any IN token sent to this endpoint.
Bit 5
UE1DO:
Indicate endpoint 1 data ready from host (OUT token).
0 = Data doesn’t finish carrying. Clear the bit by firmware after the FIFO data is already read.
1 = Data carries successfully, and data is ready in EP1 FIFO.
Bit 6
FFS1
: endpoint 1 FIFO selection control bit.
FFS1
UE1DO=1, endpoint OUT data
UE1DI=1, endpoint IN data
0
FIFO 1
FIFO 0
1
FIFO 0
FIFO 1
Bit 7
UE1E:
USB endpoint 1 function enable bit.
0 = disable USB endpoint 1 function.
1 = enable USB endpoint 1 function.
The following examples show how to do the right USB endpoints request routine according to the
flag.
Example: Check the Endpoint 1’s IN request
B0BTS1 UE1R.4
NOP
CALL EP1_FUNCTION
EP1_FUNCTION:
WRITE_EP1:
EP1_WR_RAM_addr_set
#0x8
;SET
Endpoint
1
FIFO
address
EP1_WR_RAM_data
MOUSE_KEY
;Write MOUSE_KEY to FIFO.
EP1_WR_RAM_addr_add
#0x1 ;FIFO
address
+
1
EP1_WR_RAM_data
MOUSE_X_AXIS ;Write
MOUSE_X_AXIS to FIFO.
…
…
MOV
a,
#0x88
;1.keep
enable
ep1
;2.counter = 8 (Send 8 byte)
;3.Ready to transfer (bit4=0), ACK handshake
B0MOV
UE1R,
a
RET