Skip to content

Commit cf77807

Browse files
committed
Add explanation of the DMA transfer logic
1 parent db25429 commit cf77807

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

cartrom/DMA.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The DMA transfer code takes advantage of these implementation details of the
2+
FT245 chip and host driver:
3+
4+
* The driver will send the data in as few USB transfers as possible, and
5+
* The chip's OUT endpoint is 64 bytes.
6+
7+
This means that when the chip signals that the receive FIFO is not full, it is
8+
guaranteed to contain at least min(64, remaining_bytes) of data.
9+
10+
Trying to implement DMA for transfers in the opposite direction (Saturn to
11+
host) runs into the following issues:
12+
13+
* The Saturn is not able to synchronize to USB bus events, and
14+
* Although the chip's IN endpoint is also 64 bytes, the transfer has a 62-byte
15+
payload. The remaining two bytes are used for status flags.
16+
17+
This means that the only thing that can be safely assumed about the state of
18+
the chip's send FIFO is that:
19+
20+
* If it was full, and
21+
* It becomes no longer full,
22+
23+
then the FIFO has space for at least 62 bytes.

0 commit comments

Comments
 (0)