]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac_desc.h
Create directory structure to hold the (not yet created) Keil and IAR demo projects...
[freertos] / Demo / CORTEX_A2F200_IAR_and_Keil / MicroSemi_Code / drivers / mss_ethernet_mac / mss_ethernet_mac_desc.h
1 /***************************************************************************//**\r
2  * @file\r
3  * SmartFusion MSS Ethernet MAC internal defines header file.\r
4  *\r
5  * (c) Copyright 2007 Actel Corporation\r
6  *\r
7  * SVN $Revision: 2299 $\r
8  * SVN $Date: 2010-02-24 21:21:12 +0000 (Wed, 24 Feb 2010) $\r
9  *******************************************************************************/\r
10 #ifndef __MSS_ETHERNET_MAC_DESC_H\r
11 #define __MSS_ETHERNET_MAC_DESC_H       1\r
12 \r
13 #ifdef __cplusplus\r
14 extern "C" {\r
15 #endif \r
16 \r
17 /*******************************************************************************\r
18  * Receive descriptor bits\r
19  */\r
20 \r
21 /***************************************************************************//**\r
22  * Ownership bit.\r
23  * 1 - Core10/100 owns the descriptor. <br>\r
24  * 0 - The host owns the descriptor. <br>\r
25  * Core10/100 will clear this bit when it completes a current frame reception or \r
26  * when the data buffers associated with a given descriptor are already full.\r
27  */\r
28 #define RDES0_OWN   0x80000000UL\r
29 \r
30 /***************************************************************************//**\r
31  * Filtering fail.\r
32  * When set, indicates that a received frame did not pass the address recognition process.\r
33  * This bit is valid only for the last descriptor of the frame (RDES0.8 set), when the CSR6.30 (receive all) bit\r
34  * is set and the frame is at least 64 bytes long.\r
35  */\r
36 #define RDES0_FF    0x40000000UL\r
37 \r
38 /***************************************************************************//**\r
39  * Frame length.\r
40  * Indicates the length, in bytes, of the data transferred into a host memory for a given frame\r
41  * This bit is valid only when RDES0.8 (last descriptor) is set and RDES0.14 (descriptor error) is cleared.\r
42  */\r
43 #define RDES0_FL_MASK   0x00003FFFUL\r
44 #define RDES0_FL_OFFSET 16\r
45 \r
46 /***************************************************************************//**\r
47  * Error summary.\r
48  * This bit is a logical OR of the following bits:\r
49  * RDES0.1 - CRC error\r
50  * RDES0.6 - Collision seen\r
51  * RDES0.7 - Frame too long\r
52  * RDES0.11 - Runt frame\r
53  * RDES0.14 - Descriptor error\r
54  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
55  */\r
56 #define RDES0_ES    0x00008000UL\r
57 \r
58 /***************************************************************************//**\r
59  * Descriptor error.\r
60  * Set by Core10/100 when no receive buffer was available when trying to store the received data.\r
61  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
62  */\r
63 #define RDES0_DE    0x00004000UL\r
64 \r
65 /***************************************************************************//**\r
66  * Runt frame.\r
67  * When set, indicates that the frame is damaged by a collision or by a premature termination before the end\r
68  * of a collision window.\r
69  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
70  */\r
71 #define RDES0_RF    0x00000800UL\r
72 \r
73 /***************************************************************************//**\r
74  * Multicast frame.\r
75  * When set, indicates that the frame has a multicast address.\r
76  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
77  */\r
78 #define RDES0_MF    0x00000400UL\r
79 \r
80 /***************************************************************************//**\r
81  * First descriptor.\r
82  * When set, indicates that this is the first descriptor of a frame.\r
83  */\r
84 #define RDES0_FS    0x00000200UL\r
85 \r
86 /***************************************************************************//**\r
87  * Last descriptor.\r
88  * When set, indicates that this is the last descriptor of a frame.\r
89  */\r
90 #define RDES0_LS    0x00000100UL\r
91 \r
92 /***************************************************************************//**\r
93  * Frame too long.\r
94  * When set, indicates that a current frame is longer than maximum size of 1,518 bytes, as specified by 802.3.\r
95  * TL (frame too long) in the receive descriptor has been set when the received frame is longer than\r
96  * 1,518 bytes. This flag is valid in all receive descriptors when multiple descriptors are used for one frame.\r
97  */\r
98 #define RDES0_TL    0x00000080UL\r
99 \r
100 /***************************************************************************//**\r
101  * Collision seen.\r
102  * When set, indicates that a late collision was seen (collision after 64 bytes following SFD).\r
103  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
104  */\r
105 #define RDES0_CS    0x00000040UL\r
106 \r
107 /***************************************************************************//**\r
108  * Frame type.\r
109  * When set, indicates that the frame has a length field larger than 1,500 (Ethernet-type frame). When\r
110  * cleared, indicates an 802.3-type frame.\r
111  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
112  * Additionally, FT is invalid for runt frames shorter than 14 bytes.\r
113  */\r
114 #define RDES0_FT    0x00000020UL\r
115 \r
116 /***************************************************************************//**\r
117  * Report on MII error.\r
118  * When set, indicates that an error has been detected by a physical layer chip connected through the MII\r
119  * interface.\r
120  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
121  */\r
122 #define RDES0_RE    0x00000008UL\r
123 \r
124 /***************************************************************************//**\r
125  * Dribbling bit.\r
126  * When set, indicates that the frame was not byte-aligned.\r
127  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
128  */\r
129 #define RDES0_DB    0x00000004UL\r
130 \r
131 /***************************************************************************//**\r
132  * CRC error.\r
133  * When set, indicates that a CRC error has occurred in the received frame.\r
134  * This bit is valid only when RDES0.8 (last descriptor) is set.\r
135  * Additionally, CE is not valid when the received frame is a runt frame.\r
136  */\r
137 #define RDES0_CE    0x00000002UL\r
138 \r
139 /***************************************************************************//**\r
140  * This bit is reset for frames with a legal length.\r
141  */\r
142 #define RDES0_ZERO  0x00000001UL\r
143 \r
144 /***************************************************************************//**\r
145  * Receive end of ring.\r
146  * When set, indicates that this is the last descriptor in the receive descriptor ring. Core10/100 returns to the\r
147  * first descriptor in the ring, as specified by CSR3 (start of receive list address).\r
148  */\r
149 #define RDES1_RER   0x02000000UL\r
150 \r
151 /***************************************************************************//**\r
152  * Second address chained.\r
153  * When set, indicates that the second buffer's address points to the next descriptor and not to the data buffer.\r
154  * Note that RER takes precedence over RCH.\r
155  */\r
156 #define RDES1_RCH   0x01000000UL\r
157 \r
158 /***************************************************************************//**\r
159  * Buffer 2 size.\r
160  * Indicates the size, in bytes, of memory space used by the second data buffer. This number must be a\r
161  * multiple of four. If it is 0, Core10/100 ignores the second data buffer and fetches the next data descriptor.\r
162  * This number is valid only when RDES1.24 (second address chained) is cleared.\r
163  */\r
164 #define RDES1_RBS2_MASK         0x7FF\r
165 #define RDES1_RBS2_OFFSET       11\r
166 \r
167 /***************************************************************************//**\r
168  * Buffer 1 size\r
169  * Indicates the size, in bytes, of memory space used by the first data buffer. This number must be a multiple of\r
170  * four. If it is 0, Core10/100 ignores the first data buffer and uses the second data buffer.\r
171  */\r
172 #define RDES1_RBS1_MASK         0x7FF\r
173 #define RDES1_RBS1_OFFSET       0\r
174 \r
175 \r
176 /*******************************************************************************\r
177  * Transmit descriptor bits\r
178  */\r
179 \r
180 /***************************************************************************//**\r
181  * Ownership bit.\r
182  * 1 - Core10/100 owns the descriptor.\r
183  * 0 - The host owns the descriptor.\r
184  * Core10/100 will clear this bit when it completes a current frame transmission or when the data buffers\r
185  * associated with a given descriptor are empty.\r
186  */\r
187 #define TDES0_OWN     0x80000000uL\r
188 \r
189 /***************************************************************************//**\r
190  * Error summary.\r
191  * This bit is a logical OR of the following bits:\r
192  * TDES0.1 - Underflow error\r
193  * TDES0.8 - Excessive collision error\r
194  * TDES0.9 - Late collision\r
195  * TDES0.10 - No carrier\r
196  * TDES0.11 - Loss of carrier\r
197  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
198  */\r
199 #define TDES0_ES      ((uint32_t)1 << 15)\r
200 \r
201 /***************************************************************************//**\r
202  * Loss of carrier.\r
203  * When set, indicates a loss of the carrier during a transmission.\r
204  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
205  */\r
206 #define TDES0_LO      ((uint32_t)1 << 11)\r
207 \r
208 /***************************************************************************//**\r
209  * No carrier.\r
210  * When set, indicates that the carrier was not asserted by an external transceiver during the transmission.\r
211  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
212  */\r
213 #define TDES0_NC      ((uint32_t)1 << 10)\r
214 \r
215 /***************************************************************************//**\r
216  * Late collision.\r
217  * When set, indicates that a collision was detected after transmitting 64 bytes.\r
218  * This bit is not valid when TDES0.1 (underflow error) is set.\r
219  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
220  */\r
221 #define TDES0_LC      ((uint32_t)1 << 9)\r
222 \r
223 /***************************************************************************//**\r
224  * Excessive collisions.\r
225  * When set, indicates that the transmission was aborted after 16 retries.\r
226  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
227  */\r
228 #define TDES0_EC      ((uint32_t)1 << 8)\r
229 \r
230 /***************************************************************************//**\r
231  * Collision count.\r
232  * This field indicates the number of collisions that occurred before the end of a frame transmission.\r
233  * This value is not valid when TDES0.8 (excessive collisions bit) is set.\r
234  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
235  */\r
236 #define TDES0_CC_MASK   0xFu\r
237 #define TDES0_CC_OFFSET 3u\r
238 \r
239 /***************************************************************************//**\r
240  * Underflow error.\r
241  * When set, indicates that the FIFO was empty during the frame transmission.\r
242  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
243  */\r
244 #define TDES0_UF      ((uint32_t)1 << 1)\r
245 \r
246 /***************************************************************************//**\r
247  * Deferred.\r
248  * When set, indicates that the frame was deferred before transmission. Deferring occurs if the carrier is detected\r
249  * when the transmission is ready to start.\r
250  * This bit is valid only when TDES1.30 (last descriptor) is set.\r
251  */\r
252 #define TDES0_DE      (1)\r
253 \r
254 /***************************************************************************//**\r
255  * Interrupt on completion.\r
256  * Setting this flag instructs Core10/100 to set CSR5.0 (transmit interrupt) immediately after processing a\r
257  * current frame.\r
258  * This bit is valid when TDES1.30 (last descriptor) is set or for a setup packet.\r
259  */\r
260 #define TDES1_IC      ((uint32_t)1 << 31)\r
261 \r
262 /***************************************************************************//**\r
263  * Last descriptor.\r
264  * When set, indicates the last descriptor of the frame.\r
265  */\r
266 #define TDES1_LS      ((uint32_t)1 << 30)\r
267 \r
268 /***************************************************************************//**\r
269  * First descriptor.\r
270  * When set, indicates the first descriptor of the frame.\r
271  */\r
272 #define TDES1_FS      ((uint32_t)1 << 29)\r
273 \r
274 /***************************************************************************//**\r
275  * Filtering type.\r
276  * This bit, together with TDES0.22 (FT0), controls a current filtering mode.\r
277  * This bit is valid only for the setup frames.\r
278  */\r
279 #define TDES1_FT1     ((uint32_t)1 << 28)\r
280 \r
281 /***************************************************************************//**\r
282  * Setup packet.\r
283  * When set, indicates that this is a setup frame descriptor.\r
284  */\r
285 #define TDES1_SET     ((uint32_t)1 << 27)\r
286 \r
287 /***************************************************************************//**\r
288  * Add CRC disable.\r
289  * When set, Core10/100 does not append the CRC value at the end of the frame. The exception is when the\r
290  * frame is shorter than 64 bytes and automatic byte padding is enabled. In that case, the CRC field is added,\r
291  * despite the state of the AC flag.\r
292  */\r
293 #define TDES1_AC      ((uint32_t)1 << 26)\r
294 \r
295 /***************************************************************************//**\r
296  * Transmit end of ring.\r
297  * When set, indicates the last descriptor in the descriptor ring.\r
298  */\r
299 #define TDES1_TER     ((uint32_t)1 << 25)\r
300 \r
301 /***************************************************************************//**\r
302  * Second address chained.\r
303  * When set, indicates that the second descriptor's address points to the next descriptor and not to the data\r
304  * buffer.\r
305  * This bit is valid only when TDES1.25 (transmit end of ring) is reset.\r
306  */\r
307 #define TDES1_TCH     ((uint32_t)1 << 24)\r
308 \r
309 /***************************************************************************//**\r
310  * Disabled padding.\r
311  * When set, automatic byte padding is disabled. Core10/100 normally appends the PAD field after the INFO\r
312  * field when the size of an actual frame is less than 64 bytes. After padding bytes, the CRC field is also\r
313  * inserted, despite the state of the AC flag. When DPD is set, no padding bytes are appended.\r
314  */\r
315 #define TDES1_DPD     ((uint32_t)1 << 23)\r
316 \r
317 /***************************************************************************//**\r
318  * Filtering type.\r
319  * This bit, together with TDES0.28 (FT1), controls the current filtering mode.\r
320  * This bit is valid only when the TDES1.27 (SET) bit is set.\r
321  */\r
322 #define TDES1_FT0     ((uint32_t)1 << 22)\r
323 \r
324 /***************************************************************************//**\r
325  * Buffer 2 size.\r
326  * Indicates the size, in bytes, of memory space used by the second data buffer. If it is zero, Core10/100 ignores\r
327  * the second data buffer and fetches the next data descriptor.\r
328  * This bit is valid only when TDES1.24 (second address chained) is cleared.\r
329  */\r
330 #define TDES1_TBS2_MASK         0x7FF\r
331 #define TDES1_TBS2_OFFSET       11u\r
332 \r
333 /***************************************************************************//**\r
334  * Buffer 1 size.\r
335  * Indicates the size, in bytes, of memory space used by the first data buffer. If it is 0, Core10/100 ignores the\r
336  * first data buffer and uses the second data buffer.\r
337  */\r
338 #define TDES1_TBS1_MASK         0x7FF\r
339 #define TDES1_TBS1_OFFSET       0u\r
340 \r
341 #ifdef __cplusplus\r
342 }\r
343 #endif\r
344 \r
345 #endif  /* __MSS_ETHERNET_MAC_DESC_H */\r
346 \r