3 Here's my idea on the interface to the traffic cop. Basically I'm
4 thinking about treating it as 4 separate DMA channels, one for each of
5 the four possible "flows". In the interest of simplicity, I think we can
6 assign buffers 0,1 to channel 0; 2,3 to channel 1, etc...
12 2 Gigabit ethernet MAC
22 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
25 TC_DMA_SRC_{0,3} [WR] ("traffic cop DMA source, channel N")
27 Specifies where the writing port adapter writes info the buffer, and
28 the maximum number of lines to write.
31 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 | MBZ | start | end (max) | step |
33 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35 start: starting line number for transfer (32-bit lines)
36 end: maximum number of lines to write
42 Specifies the range of lines that the reading port adapter accesses.
43 The number of lines to be transferred is controlled by the source.
46 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 | MBZ | start | MBZ | step |
48 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
50 start: starting line number tranfer (32-bit lines)
54 TC_DMA_CTRL_{0,3} [WR]
57 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58 | src | dst |A| MBZ | cmd |
59 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61 src: source port number. E.g., 2 = ethernet MAC (the buffer writer)
63 dst: destination port number. E.g., 1 = DSP pipeline (the buffer reader)
65 A: Set if "Host Approval" is required before beginning xfer to dst.
66 Used to allow processor to inspect packet for s/w dispatch. If set,
67 traffic cop sets PENDING_APPROVAL bit (and causes interrupt?) after the
68 2nd line has been written into the buffer. Reader is held off
69 until hosts APPROVES or DROPS the buffer.
74 TC_DMA_CMD_RESET 0 // abort active tranfers now; reset to idle state
75 TC_DMA_CMD_START 1 // begin transfers according to src, dst, A
76 TC_DMA_CMD_STOP 2 // stop transfers at completion of current buffer
77 TC_DMA_CMD_APPROVE_0 3 // host approves xfer on even buffer, continue
78 TC_DMA_CMD_APPROVE_1 4 // host approves xfer on odd buffer, continue
79 TC_DMA_CMD_DROP_0 5 // host naks xfer on even buffer, drop buffer and continue
80 TC_DMA_CMD_DROP_1 6 // host naks xfer on even buffer, drop buffer and continue
83 TC_DMA_STATUS_{0,3} [RD]
86 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
87 | nwritten even | nwritten odd | state? | flags |
88 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
90 nwritten even: number of lines written into even buffer
91 nwritten odd: number of lines written into odd buffer
95 bmTCDS_PENDING_APPROVAL_0 (1 << 0) // pending host approval on even buffer
96 bmTCDS_PENDING_APPROVAL_1 (1 << 1) // pending host approval on odd buffer
97 bmTCDS_WRITE_DONE_0 (1 << 2) // the even buffer write is complete
98 bmTCDS_WRITE_DONE_1 (1 << 3) // the odd buffer write is complete
100 I think the combination of the "host approval" and WRITE_DONE bits
101 will allow us to handle the cases where the host looks and doesn't
102 care, and the case where the host looks, cares, and needs to wait
103 until it sees the whole packet.
105 WRITE_DONE_* should be cleared when the corresponding buffer is
106 selected to be written into (e.g., when swapping buffers, and at init)
107 prior to writing the first line. WRITE_DONE_* is set when the
108 requested number of lines have been written into the buffer.
112 I also want a "global status register" that pulls the 4 flag bits
113 from each of the 4 status registers into a single word. This should
114 allow me to read a single word to figure out what to do.
117 TC_DMA_STATUS_GLOBAL [RD]
119 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
120 | MBZ |flags3 |flags2 |flags1 |flags0 |
121 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
124 I'm sure I've missed something...