working doc on usrp2 traffic cop design
[debian/gnuradio] / usrp / doc / traffic-cop-dma
1 Matt,
2
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...
7
8 port assignments
9 -----------------
10   0   SERDES
11   1   DSP pipeline
12   2   Gigabit ethernet MAC
13   3   RAM
14
15
16 registers
17 ---------
18
19   MBZ == Must Be Zero
20
21      3                   2                   1
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 
23
24
25 TC_DMA_SRC_{0,3} [WR] ("traffic cop DMA source, channel N")
26
27   Specifies where the writing port adapter writes info the buffer, and
28   the maximum number of lines to write.
29
30        5             9                  9                9  
31   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32   |   MBZ   |      start      |     end (max)   |       step      |
33   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34
35   start: starting line number for transfer (32-bit lines)
36   end:   maximum number of lines to write
37   step:  normally 1.
38
39
40 TC_DMA_DST_{0,3} [WR]
41
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.
44
45        5             9                  9                9  
46   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47   |   MBZ   |      start      |        MBZ      |       step      |
48   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49
50   start: starting line number tranfer (32-bit lines)
51   step:  normally 1.
52
53
54 TC_DMA_CTRL_{0,3} [WR]
55
56       4       4    1                  19                      4
57   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58   |  src  |  dst  |A|                 MBZ                 |  cmd  |
59   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60
61   src:  source port number.  E.g., 2 = ethernet MAC (the buffer writer)
62
63   dst:  destination port number.  E.g., 1 = DSP pipeline (the buffer reader)
64
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.
70
71
72   cmd:  command
73
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
81
82
83 TC_DMA_STATUS_{0,3} [RD]
84
85            10                  10
86   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
87   |    nwritten even  |   nwritten odd    |     state?    | flags |
88   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
89
90   nwritten even:  number of lines written into even buffer
91   nwritten odd:   number of lines written into odd buffer
92
93   flag bits:
94
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
99
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.
104
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.
109
110
111
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.
115
116
117 TC_DMA_STATUS_GLOBAL [RD]
118
119   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
120   |              MBZ              |flags3 |flags2 |flags1 |flags0 |
121   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
122
123
124 I'm sure I've missed something...
125
126 What do you think?
127
128 Eric