
APPENDIX
S3C9654/C9658/P9658
19-4
EP1CSR USAGE AND IMPLEMENTATION.
Application:
KS86P/C6104, KS86P/C6504, KS86P/C6408.
Direction:
Endpoint 1 only support IN (Function
→ Host) interrupt transfer.
Contents:
Bit 7
Clear Data Toggle.
Bit 6 - Bit 3
MAX Packet
Bit 2
Flush FIFO
Bit 1
Force Stall
Bit 0
In_Pkt_Rdy
Usage:
(1) Clear Data Toggle.
Write "1" to this flag : Initialize data toggle sequence. Hardware clear this flag after initializing the toggle
sequence.
NOTE: This flag was prepared for accident. Usually not use. Until now I use this flag only for test.
The data toggle start data0 after reset.
(2) Max Packet.
This field use when the user want to limit the max packet. The reset value "1000" so the maximum packet
size is 8 bytes. The MCU can not write more data then this value. This value does not define the sending
data size, it only define the maximum size. If the MCU write only 3 bytes then the function send only three
bytes. USB module have counter which count the number of written data to FIFO.
example 1) NOP; Assume internal counter is "0".
; And MAXP field is "1000".
ld FIFO, data; internal counter become "1".
ld FIFO, data ; internal counter become "2".
ld FIFO, data ; internal counter become "3".
Set in_pkt_rdy ;
; After set in_pkt_rdy the MCU should not
; write data until it is cleared. This scheme can
; Solve the dual access problem.
; Internal counter is 3 so the function send 3 bytes
; to host when the function received IN packet.
example 2) NOP; Assume internal counter is "0".
; And MAXP field is "0100".
ld FIFO, data; internal counter become "1".
ld FIFO, data; internal counter become "2".
ld FIFO, data; internal counter become "3".
ld FIFO, data; internal counter become "4".
ld FIFO, data; internal counter stay "4".
; This instruction does not work because the MAXP
; field is 4.
Set in_pkt_rdy;
; Internal counter is 4 so the function send 4 bytes
; to host when the function received IN packet.