1 /******************************************************************************
3 * Copyright (C) 2010 - 2015 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
37 * This header provides operations to manage buffer descriptors in support
38 * of scatter-gather DMA.
40 * The API exported by this header defines abstracted macros that allow the
41 * user to read/write specific BD fields.
43 * <b>Buffer Descriptors</b>
45 * A buffer descriptor (BD) defines a DMA transaction. The macros defined by
46 * this header file allow access to most fields within a BD to tailor a DMA
47 * transaction according to user and hardware requirements. See the hardware
48 * IP DMA spec for more information on BD fields and how they affect transfers.
50 * The XEmacPs_Bd structure defines a BD. The organization of this structure
51 * is driven mainly by the hardware for use in scatter-gather DMA transfers.
55 * Limiting I/O to BDs can improve overall performance of the DMA channel.
58 * MODIFICATION HISTORY:
60 * Ver Who Date Changes
61 * ----- ---- -------- -------------------------------------------------------
62 * 1.00a wsy 01/10/10 First release
63 * 2.1 srt 07/15/14 Add support for Zynq Ultrascale MP GEM specification
65 * 3.0 kvn 02/13/15 Modified code for MISRA-C:2012 compliance.
66 * 3.0 hk 02/20/15 Added support for jumbo frames.
67 * Disable extended mode. Perform all 64 bit changes under
72 * ***************************************************************************
75 #ifndef XEMACPS_BD_H /* prevent circular inclusions */
76 #define XEMACPS_BD_H /* by using protection macros */
82 /***************************** Include Files *********************************/
85 #include "xil_types.h"
86 #include "xil_assert.h"
88 /************************** Constant Definitions *****************************/
90 /**************************** Type Definitions *******************************/
92 /* Minimum BD alignment */
93 #define XEMACPS_DMABD_MINIMUM_ALIGNMENT 64U
95 /* Minimum BD alignment */
96 #define XEMACPS_DMABD_MINIMUM_ALIGNMENT 4U
100 * The XEmacPs_Bd is the type for buffer descriptors (BDs).
102 #define XEMACPS_BD_NUM_WORDS 2U
103 typedef UINTPTR XEmacPs_Bd[XEMACPS_BD_NUM_WORDS];
106 /***************** Macros (Inline Functions) Definitions *********************/
108 /*****************************************************************************/
112 * @param BdPtr is the BD pointer to operate on
118 * void XEmacPs_BdClear(XEmacPs_Bd* BdPtr)
120 *****************************************************************************/
121 #define XEmacPs_BdClear(BdPtr) \
122 memset((BdPtr), 0, sizeof(XEmacPs_Bd))
124 /****************************************************************************/
127 * Read the given Buffer Descriptor word.
129 * @param BaseAddress is the base address of the BD to read
130 * @param Offset is the word offset to be read
132 * @return The 32-bit value of the field
136 * u32 XEmacPs_BdRead(UINTPTR BaseAddress, UINTPTR Offset)
138 *****************************************************************************/
139 #define XEmacPs_BdRead(BaseAddress, Offset) \
140 (*(u32 *)((UINTPTR)((void*)(BaseAddress)) + (u32)(Offset)))
142 /****************************************************************************/
145 * Write the given Buffer Descriptor word.
147 * @param BaseAddress is the base address of the BD to write
148 * @param Offset is the word offset to be written
149 * @param Data is the 32-bit value to write to the field
155 * void XEmacPs_BdWrite(UINTPTR BaseAddress, UINTPTR Offset, UINTPTR Data)
157 *****************************************************************************/
158 #define XEmacPs_BdWrite(BaseAddress, Offset, Data) \
159 (*(u32 *)((UINTPTR)(void*)(BaseAddress) + (u32)(Offset)) = (u32)(Data))
161 /*****************************************************************************/
163 * Set the BD's Address field (word 0).
165 * @param BdPtr is the BD pointer to operate on
166 * @param Addr is the value to write to BD's status field.
171 * void XEmacPs_BdSetAddressTx(XEmacPs_Bd* BdPtr, UINTPTR Addr)
173 *****************************************************************************/
175 #define XEmacPs_BdSetAddressTx(BdPtr, Addr) \
176 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
177 (u32)((Addr) & ULONG64_LO_MASK)); \
178 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_HI_OFFSET, \
179 (u32)(((Addr) & ULONG64_HI_MASK) >> 32U));
181 #define XEmacPs_BdSetAddressTx(BdPtr, Addr) \
182 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, (u32)(Addr))
185 /*****************************************************************************/
187 * Set the BD's Address field (word 0).
189 * @param BdPtr is the BD pointer to operate on
190 * @param Addr is the value to write to BD's status field.
192 * @note : Due to some bits are mixed within recevie BD's address field,
193 * read-modify-write is performed.
196 * void XEmacPs_BdSetAddressRx(XEmacPs_Bd* BdPtr, UINTPTR Addr)
198 *****************************************************************************/
200 #define XEmacPs_BdSetAddressRx(BdPtr, Addr) \
201 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
202 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
203 ~XEMACPS_RXBUF_ADD_MASK) | ((u32)((Addr) & ULONG64_LO_MASK)))); \
204 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_HI_OFFSET, \
205 (u32)(((Addr) & ULONG64_HI_MASK) >> 32U));
207 #define XEmacPs_BdSetAddressRx(BdPtr, Addr) \
208 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
209 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
210 ~XEMACPS_RXBUF_ADD_MASK) | (UINTPTR)(Addr)))
213 /*****************************************************************************/
215 * Set the BD's Status field (word 1).
217 * @param BdPtr is the BD pointer to operate on
218 * @param Data is the value to write to BD's status field.
222 * void XEmacPs_BdSetStatus(XEmacPs_Bd* BdPtr, UINTPTR Data)
224 *****************************************************************************/
225 #define XEmacPs_BdSetStatus(BdPtr, Data) \
226 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
227 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | (Data))
230 /*****************************************************************************/
232 * Retrieve the BD's Packet DMA transfer status word (word 1).
234 * @param BdPtr is the BD pointer to operate on
236 * @return Status word
240 * u32 XEmacPs_BdGetStatus(XEmacPs_Bd* BdPtr)
242 * Due to the BD bit layout differences in transmit and receive. User's
243 * caution is required.
244 *****************************************************************************/
245 #define XEmacPs_BdGetStatus(BdPtr) \
246 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET)
249 /*****************************************************************************/
251 * Get the address (bits 0..31) of the BD's buffer address (word 0)
253 * @param BdPtr is the BD pointer to operate on
257 * UINTPTR XEmacPs_BdGetBufAddr(XEmacPs_Bd* BdPtr)
259 *****************************************************************************/
261 #define XEmacPs_BdGetBufAddr(BdPtr) \
262 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) | \
263 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_HI_OFFSET)) << 32U)
265 #define XEmacPs_BdGetBufAddr(BdPtr) \
266 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET))
269 /*****************************************************************************/
271 * Set transfer length in bytes for the given BD. The length must be set each
272 * time a BD is submitted to hardware.
274 * @param BdPtr is the BD pointer to operate on
275 * @param LenBytes is the number of bytes to transfer.
279 * void XEmacPs_BdSetLength(XEmacPs_Bd* BdPtr, u32 LenBytes)
281 *****************************************************************************/
282 #define XEmacPs_BdSetLength(BdPtr, LenBytes) \
283 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
284 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
285 ~XEMACPS_TXBUF_LEN_MASK) | (LenBytes)))
289 /*****************************************************************************/
291 * Set transfer length in bytes for the given BD. The length must be set each
292 * time a BD is submitted to hardware.
294 * @param BdPtr is the BD pointer to operate on
295 * @param LenBytes is the number of bytes to transfer.
299 * void XEmacPs_BdSetLength(XEmacPs_Bd* BdPtr, u32 LenBytes)
301 *****************************************************************************/
302 #define XEmacPs_BdSetLength(BdPtr, LenBytes) \
303 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
304 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
305 ~XEMACPS_TXBUF_LEN_MASK) | (LenBytes)))
308 /*****************************************************************************/
310 * Retrieve the BD length field.
312 * For Tx channels, the returned value is the same as that written with
313 * XEmacPs_BdSetLength().
315 * For Rx channels, the returned value is the size of the received packet.
317 * @param BdPtr is the BD pointer to operate on
319 * @return Length field processed by hardware or set by
320 * XEmacPs_BdSetLength().
324 * UINTPTR XEmacPs_BdGetLength(XEmacPs_Bd* BdPtr)
325 * XEAMCPS_RXBUF_LEN_MASK is same as XEMACPS_TXBUF_LEN_MASK.
327 *****************************************************************************/
328 #define XEmacPs_BdGetLength(BdPtr) \
329 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
330 XEMACPS_RXBUF_LEN_MASK)
332 /*****************************************************************************/
334 * Retrieve the RX frame size.
336 * The returned value is the size of the received packet.
337 * This API supports jumbo frame sizes if enabled.
339 * @param BdPtr is the BD pointer to operate on
341 * @return Length field processed by hardware or set by
342 * XEmacPs_BdSetLength().
346 * UINTPTR XEmacPs_GetRxFrameSize(XEmacPs* InstancePtr, XEmacPs_Bd* BdPtr)
347 * RxBufMask is dependent on whether jumbo is enabled or not.
349 *****************************************************************************/
350 #define XEmacPs_GetRxFrameSize(InstancePtr, BdPtr) \
351 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
352 (InstancePtr)->RxBufMask)
354 /*****************************************************************************/
356 * Test whether the given BD has been marked as the last BD of a packet.
358 * @param BdPtr is the BD pointer to operate on
360 * @return TRUE if BD represents the "Last" BD of a packet, FALSE otherwise
364 * UINTPTR XEmacPs_BdIsLast(XEmacPs_Bd* BdPtr)
366 *****************************************************************************/
367 #define XEmacPs_BdIsLast(BdPtr) \
368 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
369 XEMACPS_RXBUF_EOF_MASK)!=0U ? TRUE : FALSE)
372 /*****************************************************************************/
374 * Tell the DMA engine that the given transmit BD marks the end of the current
375 * packet to be processed.
377 * @param BdPtr is the BD pointer to operate on
381 * void XEmacPs_BdSetLast(XEmacPs_Bd* BdPtr)
383 *****************************************************************************/
384 #define XEmacPs_BdSetLast(BdPtr) \
385 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
386 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
387 XEMACPS_TXBUF_LAST_MASK))
390 /*****************************************************************************/
392 * Tell the DMA engine that the current packet does not end with the given
395 * @param BdPtr is the BD pointer to operate on
399 * void XEmacPs_BdClearLast(XEmacPs_Bd* BdPtr)
401 *****************************************************************************/
402 #define XEmacPs_BdClearLast(BdPtr) \
403 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
404 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
405 ~XEMACPS_TXBUF_LAST_MASK))
408 /*****************************************************************************/
410 * Set this bit to mark the last descriptor in the receive buffer descriptor
413 * @param BdPtr is the BD pointer to operate on
417 * void XEmacPs_BdSetRxWrap(XEmacPs_Bd* BdPtr)
419 *****************************************************************************/
420 /*#define XEmacPs_BdSetRxWrap(BdPtr) \
421 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
422 XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) | \
423 XEMACPS_RXBUF_WRAP_MASK))
426 /*****************************************************************************/
428 * Determine the wrap bit of the receive BD which indicates end of the
431 * @param BdPtr is the BD pointer to operate on
435 * u8 XEmacPs_BdIsRxWrap(XEmacPs_Bd* BdPtr)
437 *****************************************************************************/
438 #define XEmacPs_BdIsRxWrap(BdPtr) \
439 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
440 XEMACPS_RXBUF_WRAP_MASK)!=0U ? TRUE : FALSE)
443 /*****************************************************************************/
445 * Sets this bit to mark the last descriptor in the transmit buffer
448 * @param BdPtr is the BD pointer to operate on
452 * void XEmacPs_BdSetTxWrap(XEmacPs_Bd* BdPtr)
454 *****************************************************************************/
455 /*#define XEmacPs_BdSetTxWrap(BdPtr) \
456 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
457 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
458 XEMACPS_TXBUF_WRAP_MASK))
461 /*****************************************************************************/
463 * Determine the wrap bit of the transmit BD which indicates end of the
466 * @param BdPtr is the BD pointer to operate on
470 * u8 XEmacPs_BdGetTxWrap(XEmacPs_Bd* BdPtr)
472 *****************************************************************************/
473 #define XEmacPs_BdIsTxWrap(BdPtr) \
474 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
475 XEMACPS_TXBUF_WRAP_MASK)!=0U ? TRUE : FALSE)
478 /*****************************************************************************/
480 * Must clear this bit to enable the MAC to write data to the receive
481 * buffer. Hardware sets this bit once it has successfully written a frame to
482 * memory. Once set, software has to clear the bit before the buffer can be
483 * used again. This macro clear the new bit of the receive BD.
485 * @param BdPtr is the BD pointer to operate on
489 * void XEmacPs_BdClearRxNew(XEmacPs_Bd* BdPtr)
491 *****************************************************************************/
492 #define XEmacPs_BdClearRxNew(BdPtr) \
493 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
494 XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
495 ~XEMACPS_RXBUF_NEW_MASK))
498 /*****************************************************************************/
500 * Determine the new bit of the receive BD.
502 * @param BdPtr is the BD pointer to operate on
506 * UINTPTR XEmacPs_BdIsRxNew(XEmacPs_Bd* BdPtr)
508 *****************************************************************************/
509 #define XEmacPs_BdIsRxNew(BdPtr) \
510 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
511 XEMACPS_RXBUF_NEW_MASK)!=0U ? TRUE : FALSE)
514 /*****************************************************************************/
516 * Software sets this bit to disable the buffer to be read by the hardware.
517 * Hardware sets this bit for the first buffer of a frame once it has been
518 * successfully transmitted. This macro sets this bit of transmit BD to avoid
521 * @param BdPtr is the BD pointer to operate on
525 * void XEmacPs_BdSetTxUsed(XEmacPs_Bd* BdPtr)
527 *****************************************************************************/
528 #define XEmacPs_BdSetTxUsed(BdPtr) \
529 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
530 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
531 XEMACPS_TXBUF_USED_MASK))
534 /*****************************************************************************/
536 * Software clears this bit to enable the buffer to be read by the hardware.
537 * Hardware sets this bit for the first buffer of a frame once it has been
538 * successfully transmitted. This macro clears this bit of transmit BD.
540 * @param BdPtr is the BD pointer to operate on
544 * void XEmacPs_BdClearTxUsed(XEmacPs_Bd* BdPtr)
546 *****************************************************************************/
547 #define XEmacPs_BdClearTxUsed(BdPtr) \
548 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
549 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
550 ~XEMACPS_TXBUF_USED_MASK))
553 /*****************************************************************************/
555 * Determine the used bit of the transmit BD.
557 * @param BdPtr is the BD pointer to operate on
561 * UINTPTR XEmacPs_BdIsTxUsed(XEmacPs_Bd* BdPtr)
563 *****************************************************************************/
564 #define XEmacPs_BdIsTxUsed(BdPtr) \
565 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
566 XEMACPS_TXBUF_USED_MASK)!=0U ? TRUE : FALSE)
569 /*****************************************************************************/
571 * Determine if a frame fails to be transmitted due to too many retries.
573 * @param BdPtr is the BD pointer to operate on
577 * UINTPTR XEmacPs_BdIsTxRetry(XEmacPs_Bd* BdPtr)
579 *****************************************************************************/
580 #define XEmacPs_BdIsTxRetry(BdPtr) \
581 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
582 XEMACPS_TXBUF_RETRY_MASK)!=0U ? TRUE : FALSE)
585 /*****************************************************************************/
587 * Determine if a frame fails to be transmitted due to data can not be
588 * feteched in time or buffers are exhausted.
590 * @param BdPtr is the BD pointer to operate on
594 * UINTPTR XEmacPs_BdIsTxUrun(XEmacPs_Bd* BdPtr)
596 *****************************************************************************/
597 #define XEmacPs_BdIsTxUrun(BdPtr) \
598 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
599 XEMACPS_TXBUF_URUN_MASK)!=0U ? TRUE : FALSE)
602 /*****************************************************************************/
604 * Determine if a frame fails to be transmitted due to buffer is exhausted
607 * @param BdPtr is the BD pointer to operate on
611 * UINTPTR XEmacPs_BdIsTxExh(XEmacPs_Bd* BdPtr)
613 *****************************************************************************/
614 #define XEmacPs_BdIsTxExh(BdPtr) \
615 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
616 XEMACPS_TXBUF_EXH_MASK)!=0U ? TRUE : FALSE)
619 /*****************************************************************************/
621 * Sets this bit, no CRC will be appended to the current frame. This control
622 * bit must be set for the first buffer in a frame and will be ignored for
623 * the subsequent buffers of a frame.
625 * @param BdPtr is the BD pointer to operate on
628 * This bit must be clear when using the transmit checksum generation offload,
629 * otherwise checksum generation and substitution will not occur.
632 * UINTPTR XEmacPs_BdSetTxNoCRC(XEmacPs_Bd* BdPtr)
634 *****************************************************************************/
635 #define XEmacPs_BdSetTxNoCRC(BdPtr) \
636 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
637 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
638 XEMACPS_TXBUF_NOCRC_MASK))
641 /*****************************************************************************/
643 * Clear this bit, CRC will be appended to the current frame. This control
644 * bit must be set for the first buffer in a frame and will be ignored for
645 * the subsequent buffers of a frame.
647 * @param BdPtr is the BD pointer to operate on
650 * This bit must be clear when using the transmit checksum generation offload,
651 * otherwise checksum generation and substitution will not occur.
654 * UINTPTR XEmacPs_BdClearTxNoCRC(XEmacPs_Bd* BdPtr)
656 *****************************************************************************/
657 #define XEmacPs_BdClearTxNoCRC(BdPtr) \
658 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
659 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
660 ~XEMACPS_TXBUF_NOCRC_MASK))
663 /*****************************************************************************/
665 * Determine the broadcast bit of the receive BD.
667 * @param BdPtr is the BD pointer to operate on
671 * UINTPTR XEmacPs_BdIsRxBcast(XEmacPs_Bd* BdPtr)
673 *****************************************************************************/
674 #define XEmacPs_BdIsRxBcast(BdPtr) \
675 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
676 XEMACPS_RXBUF_BCAST_MASK)!=0U ? TRUE : FALSE)
679 /*****************************************************************************/
681 * Determine the multicast hash bit of the receive BD.
683 * @param BdPtr is the BD pointer to operate on
687 * UINTPTR XEmacPs_BdIsRxMultiHash(XEmacPs_Bd* BdPtr)
689 *****************************************************************************/
690 #define XEmacPs_BdIsRxMultiHash(BdPtr) \
691 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
692 XEMACPS_RXBUF_MULTIHASH_MASK)!=0U ? TRUE : FALSE)
695 /*****************************************************************************/
697 * Determine the unicast hash bit of the receive BD.
699 * @param BdPtr is the BD pointer to operate on
703 * UINTPTR XEmacPs_BdIsRxUniHash(XEmacPs_Bd* BdPtr)
705 *****************************************************************************/
706 #define XEmacPs_BdIsRxUniHash(BdPtr) \
707 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
708 XEMACPS_RXBUF_UNIHASH_MASK)!=0U ? TRUE : FALSE)
711 /*****************************************************************************/
713 * Determine if the received frame is a VLAN Tagged frame.
715 * @param BdPtr is the BD pointer to operate on
719 * UINTPTR XEmacPs_BdIsRxVlan(XEmacPs_Bd* BdPtr)
721 *****************************************************************************/
722 #define XEmacPs_BdIsRxVlan(BdPtr) \
723 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
724 XEMACPS_RXBUF_VLAN_MASK)!=0U ? TRUE : FALSE)
727 /*****************************************************************************/
729 * Determine if the received frame has Type ID of 8100h and null VLAN
730 * identifier(Priority tag).
732 * @param BdPtr is the BD pointer to operate on
736 * UINTPTR XEmacPs_BdIsRxPri(XEmacPs_Bd* BdPtr)
738 *****************************************************************************/
739 #define XEmacPs_BdIsRxPri(BdPtr) \
740 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
741 XEMACPS_RXBUF_PRI_MASK)!=0U ? TRUE : FALSE)
744 /*****************************************************************************/
746 * Determine if the received frame's Concatenation Format Indicator (CFI) of
747 * the frames VLANTCI field was set.
749 * @param BdPtr is the BD pointer to operate on
753 * UINTPTR XEmacPs_BdIsRxCFI(XEmacPs_Bd* BdPtr)
755 *****************************************************************************/
756 #define XEmacPs_BdIsRxCFI(BdPtr) \
757 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
758 XEMACPS_RXBUF_CFI_MASK)!=0U ? TRUE : FALSE)
761 /*****************************************************************************/
763 * Determine the End Of Frame (EOF) bit of the receive BD.
765 * @param BdPtr is the BD pointer to operate on
769 * UINTPTR XEmacPs_BdGetRxEOF(XEmacPs_Bd* BdPtr)
771 *****************************************************************************/
772 #define XEmacPs_BdIsRxEOF(BdPtr) \
773 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
774 XEMACPS_RXBUF_EOF_MASK)!=0U ? TRUE : FALSE)
777 /*****************************************************************************/
779 * Determine the Start Of Frame (SOF) bit of the receive BD.
781 * @param BdPtr is the BD pointer to operate on
785 * UINTPTR XEmacPs_BdGetRxSOF(XEmacPs_Bd* BdPtr)
787 *****************************************************************************/
788 #define XEmacPs_BdIsRxSOF(BdPtr) \
789 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
790 XEMACPS_RXBUF_SOF_MASK)!=0U ? TRUE : FALSE)
793 /************************** Function Prototypes ******************************/
799 #endif /* end of protection macro */