1
2
3
4
5
6
7#include <common.h>
8
9
10
11
12
13
14
15#include <MCD_dma.h>
16
17extern dmaRegs *MCD_dmaBar;
18
19
20
21void MCD_startDmaChainNoEu(int *currBD, short srcIncr, short destIncr,
22 int xferSize, short xferSizeIncr, int *cSave,
23 volatile TaskTableEntry * taskTable, int channel)
24{
25 volatile TaskTableEntry *taskChan = taskTable + channel;
26
27 MCD_SET_VAR(taskChan, 2, (u32) currBD);
28 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr));
29 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr));
30 MCD_SET_VAR(taskChan, 11, (u32) xferSize);
31 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr));
32 MCD_SET_VAR(taskChan, 0, (u32) cSave);
33 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000);
34 MCD_SET_VAR(taskChan, 3, (u32) 0x00000000);
35 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000);
36 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000);
37 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000);
38 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000);
39 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000);
40 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000);
41 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000);
42 MCD_SET_VAR(taskChan, 12, (u32) 0x00000000);
43 MCD_SET_VAR(taskChan, 13, (u32) 0x80000000);
44 MCD_SET_VAR(taskChan, 14, (u32) 0x00000010);
45 MCD_SET_VAR(taskChan, 15, (u32) 0x00000004);
46 MCD_SET_VAR(taskChan, 16, (u32) 0x08000000);
47 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000);
48 MCD_SET_VAR(taskChan, 28, (u32) 0x80000000);
49 MCD_SET_VAR(taskChan, 29, (u32) 0x80000001);
50 MCD_SET_VAR(taskChan, 30, (u32) 0x40000000);
51
52
53 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
54}
55
56
57
58void MCD_startDmaSingleNoEu(char *srcAddr, short srcIncr, char *destAddr,
59 short destIncr, int dmaSize, short xferSizeIncr,
60 int flags, int *currBD, int *cSave,
61 volatile TaskTableEntry * taskTable, int channel)
62{
63 volatile TaskTableEntry *taskChan = taskTable + channel;
64
65 MCD_SET_VAR(taskChan, 7, (u32) srcAddr);
66 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr));
67 MCD_SET_VAR(taskChan, 2, (u32) destAddr);
68 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr));
69 MCD_SET_VAR(taskChan, 3, (u32) dmaSize);
70 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr));
71 MCD_SET_VAR(taskChan, 5, (u32) flags);
72 MCD_SET_VAR(taskChan, 1, (u32) currBD);
73 MCD_SET_VAR(taskChan, 0, (u32) cSave);
74 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000);
75 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000);
76 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000);
77 MCD_SET_VAR(taskChan, 9, (u32) 0x00000004);
78 MCD_SET_VAR(taskChan, 10, (u32) 0x08000000);
79 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000);
80 MCD_SET_VAR(taskChan, 28, (u32) 0x80000001);
81 MCD_SET_VAR(taskChan, 29, (u32) 0x40000000);
82
83
84 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
85}
86
87
88
89void MCD_startDmaChainEu(int *currBD, short srcIncr, short destIncr,
90 int xferSize, short xferSizeIncr, int *cSave,
91 volatile TaskTableEntry * taskTable, int channel)
92{
93 volatile TaskTableEntry *taskChan = taskTable + channel;
94
95 MCD_SET_VAR(taskChan, 3, (u32) currBD);
96 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr));
97 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr));
98 MCD_SET_VAR(taskChan, 12, (u32) xferSize);
99 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr));
100 MCD_SET_VAR(taskChan, 0, (u32) cSave);
101 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000);
102 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000);
103 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000);
104 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000);
105 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000);
106 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000);
107 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000);
108 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000);
109 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000);
110 MCD_SET_VAR(taskChan, 11, (u32) 0x00000000);
111 MCD_SET_VAR(taskChan, 13, (u32) 0x00000000);
112 MCD_SET_VAR(taskChan, 14, (u32) 0x80000000);
113 MCD_SET_VAR(taskChan, 15, (u32) 0x00000010);
114 MCD_SET_VAR(taskChan, 16, (u32) 0x00000001);
115 MCD_SET_VAR(taskChan, 17, (u32) 0x00000004);
116 MCD_SET_VAR(taskChan, 18, (u32) 0x08000000);
117 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000);
118 MCD_SET_VAR(taskChan, 28, (u32) 0x80000000);
119 MCD_SET_VAR(taskChan, 29, (u32) 0xc0000000);
120 MCD_SET_VAR(taskChan, 30, (u32) 0x80000001);
121 MCD_SET_VAR(taskChan, 31, (u32) 0x40000000);
122
123
124 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
125}
126
127
128
129void MCD_startDmaSingleEu(char *srcAddr, short srcIncr, char *destAddr,
130 short destIncr, int dmaSize, short xferSizeIncr,
131 int flags, int *currBD, int *cSave,
132 volatile TaskTableEntry * taskTable, int channel)
133{
134 volatile TaskTableEntry *taskChan = taskTable + channel;
135
136 MCD_SET_VAR(taskChan, 8, (u32) srcAddr);
137 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr));
138 MCD_SET_VAR(taskChan, 3, (u32) destAddr);
139 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr));
140 MCD_SET_VAR(taskChan, 4, (u32) dmaSize);
141 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr));
142 MCD_SET_VAR(taskChan, 6, (u32) flags);
143 MCD_SET_VAR(taskChan, 2, (u32) currBD);
144 MCD_SET_VAR(taskChan, 0, (u32) cSave);
145 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000);
146 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000);
147 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000);
148 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000);
149 MCD_SET_VAR(taskChan, 10, (u32) 0x00000001);
150 MCD_SET_VAR(taskChan, 11, (u32) 0x00000004);
151 MCD_SET_VAR(taskChan, 12, (u32) 0x08000000);
152 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000);
153 MCD_SET_VAR(taskChan, 28, (u32) 0xc0000000);
154 MCD_SET_VAR(taskChan, 29, (u32) 0x80000000);
155 MCD_SET_VAR(taskChan, 30, (u32) 0x80000001);
156 MCD_SET_VAR(taskChan, 31, (u32) 0x40000000);
157
158
159 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
160}
161
162
163
164void MCD_startDmaENetRcv(char *bDBase, char *currBD, char *rcvFifoPtr,
165 volatile TaskTableEntry * taskTable, int channel)
166{
167 volatile TaskTableEntry *taskChan = taskTable + channel;
168
169 MCD_SET_VAR(taskChan, 0, (u32) bDBase);
170 MCD_SET_VAR(taskChan, 3, (u32) currBD);
171 MCD_SET_VAR(taskChan, 6, (u32) rcvFifoPtr);
172 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000);
173 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000);
174 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000);
175 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000);
176 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000);
177 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000);
178 MCD_SET_VAR(taskChan, 9, (u32) 0x0000ffff);
179 MCD_SET_VAR(taskChan, 10, (u32) 0x30000000);
180 MCD_SET_VAR(taskChan, 11, (u32) 0x0fffffff);
181 MCD_SET_VAR(taskChan, 12, (u32) 0x00000008);
182 MCD_SET_VAR(taskChan, 24, (u32) 0x00000000);
183 MCD_SET_VAR(taskChan, 25, (u32) 0x60000000);
184 MCD_SET_VAR(taskChan, 26, (u32) 0x20000004);
185 MCD_SET_VAR(taskChan, 27, (u32) 0x40000000);
186
187
188 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
189}
190
191
192
193void MCD_startDmaENetXmit(char *bDBase, char *currBD, char *xmitFifoPtr,
194 volatile TaskTableEntry * taskTable, int channel)
195{
196 volatile TaskTableEntry *taskChan = taskTable + channel;
197
198 MCD_SET_VAR(taskChan, 0, (u32) bDBase);
199 MCD_SET_VAR(taskChan, 3, (u32) currBD);
200 MCD_SET_VAR(taskChan, 11, (u32) xmitFifoPtr);
201 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000);
202 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000);
203 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000);
204 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000);
205 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000);
206 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000);
207 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000);
208 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000);
209 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000);
210 MCD_SET_VAR(taskChan, 12, (u32) 0x00000000);
211 MCD_SET_VAR(taskChan, 13, (u32) 0x0000ffff);
212 MCD_SET_VAR(taskChan, 14, (u32) 0xffffffff);
213 MCD_SET_VAR(taskChan, 15, (u32) 0x00000004);
214 MCD_SET_VAR(taskChan, 16, (u32) 0x00000008);
215 MCD_SET_VAR(taskChan, 24, (u32) 0x00000000);
216 MCD_SET_VAR(taskChan, 25, (u32) 0x60000000);
217 MCD_SET_VAR(taskChan, 26, (u32) 0x40000000);
218 MCD_SET_VAR(taskChan, 27, (u32) 0xc000fffc);
219 MCD_SET_VAR(taskChan, 28, (u32) 0xe0000004);
220 MCD_SET_VAR(taskChan, 29, (u32) 0x80000000);
221 MCD_SET_VAR(taskChan, 30, (u32) 0x4000ffff);
222 MCD_SET_VAR(taskChan, 31, (u32) 0xe0000001);
223
224
225 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
226}
227