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 /*****************************************************************************/
36 * @addtogroup emacps_v3_1
39 * This header provides operations to manage buffer descriptors in support
40 * of scatter-gather DMA.
42 * The API exported by this header defines abstracted macros that allow the
43 * user to read/write specific BD fields.
45 * <b>Buffer Descriptors</b>
47 * A buffer descriptor (BD) defines a DMA transaction. The macros defined by
48 * this header file allow access to most fields within a BD to tailor a DMA
49 * transaction according to user and hardware requirements. See the hardware
50 * IP DMA spec for more information on BD fields and how they affect transfers.
52 * The XEmacPs_Bd structure defines a BD. The organization of this structure
53 * is driven mainly by the hardware for use in scatter-gather DMA transfers.
57 * Limiting I/O to BDs can improve overall performance of the DMA channel.
60 * MODIFICATION HISTORY:
62 * Ver Who Date Changes
63 * ----- ---- -------- -------------------------------------------------------
64 * 1.00a wsy 01/10/10 First release
65 * 2.1 srt 07/15/14 Add support for Zynq Ultrascale MP GEM specification
67 * 3.0 kvn 02/13/15 Modified code for MISRA-C:2012 compliance.
68 * 3.0 hk 02/20/15 Added support for jumbo frames.
69 * Disable extended mode. Perform all 64 bit changes under
71 * 3.2 hk 11/18/15 Change BD typedef and number of words.
75 * ***************************************************************************
78 #ifndef XEMACPS_BD_H /* prevent circular inclusions */
79 #define XEMACPS_BD_H /* by using protection macros */
85 /***************************** Include Files *********************************/
88 #include "xil_types.h"
89 #include "xil_assert.h"
91 /************************** Constant Definitions *****************************/
93 /**************************** Type Definitions *******************************/
95 /* Minimum BD alignment */
96 #define XEMACPS_DMABD_MINIMUM_ALIGNMENT 64U
97 #define XEMACPS_BD_NUM_WORDS 4U
99 /* Minimum BD alignment */
100 #define XEMACPS_DMABD_MINIMUM_ALIGNMENT 4U
101 #define XEMACPS_BD_NUM_WORDS 2U
105 * The XEmacPs_Bd is the type for buffer descriptors (BDs).
107 typedef u32 XEmacPs_Bd[XEMACPS_BD_NUM_WORDS];
110 /***************** Macros (Inline Functions) Definitions *********************/
112 /*****************************************************************************/
116 * @param BdPtr is the BD pointer to operate on
122 * void XEmacPs_BdClear(XEmacPs_Bd* BdPtr)
124 *****************************************************************************/
125 #define XEmacPs_BdClear(BdPtr) \
126 memset((BdPtr), 0, sizeof(XEmacPs_Bd))
128 /****************************************************************************/
131 * Read the given Buffer Descriptor word.
133 * @param BaseAddress is the base address of the BD to read
134 * @param Offset is the word offset to be read
136 * @return The 32-bit value of the field
140 * u32 XEmacPs_BdRead(UINTPTR BaseAddress, UINTPTR Offset)
142 *****************************************************************************/
143 #define XEmacPs_BdRead(BaseAddress, Offset) \
144 (*(u32 *)((UINTPTR)((void*)(BaseAddress)) + (u32)(Offset)))
146 /****************************************************************************/
149 * Write the given Buffer Descriptor word.
151 * @param BaseAddress is the base address of the BD to write
152 * @param Offset is the word offset to be written
153 * @param Data is the 32-bit value to write to the field
159 * void XEmacPs_BdWrite(UINTPTR BaseAddress, UINTPTR Offset, UINTPTR Data)
161 *****************************************************************************/
162 #define XEmacPs_BdWrite(BaseAddress, Offset, Data) \
163 (*(u32 *)((UINTPTR)(void*)(BaseAddress) + (u32)(Offset)) = (u32)(Data))
165 /*****************************************************************************/
167 * Set the BD's Address field (word 0).
169 * @param BdPtr is the BD pointer to operate on
170 * @param Addr is the value to write to BD's status field.
175 * void XEmacPs_BdSetAddressTx(XEmacPs_Bd* BdPtr, UINTPTR Addr)
177 *****************************************************************************/
179 #define XEmacPs_BdSetAddressTx(BdPtr, Addr) \
180 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
181 (u32)((Addr) & ULONG64_LO_MASK)); \
182 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_HI_OFFSET, \
183 (u32)(((Addr) & ULONG64_HI_MASK) >> 32U));
185 #define XEmacPs_BdSetAddressTx(BdPtr, Addr) \
186 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, (u32)(Addr))
189 /*****************************************************************************/
191 * Set the BD's Address field (word 0).
193 * @param BdPtr is the BD pointer to operate on
194 * @param Addr is the value to write to BD's status field.
196 * @note : Due to some bits are mixed within recevie BD's address field,
197 * read-modify-write is performed.
200 * void XEmacPs_BdSetAddressRx(XEmacPs_Bd* BdPtr, UINTPTR Addr)
202 *****************************************************************************/
204 #define XEmacPs_BdSetAddressRx(BdPtr, Addr) \
205 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
206 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
207 ~XEMACPS_RXBUF_ADD_MASK) | ((u32)((Addr) & ULONG64_LO_MASK)))); \
208 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_HI_OFFSET, \
209 (u32)(((Addr) & ULONG64_HI_MASK) >> 32U));
211 #define XEmacPs_BdSetAddressRx(BdPtr, Addr) \
212 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
213 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
214 ~XEMACPS_RXBUF_ADD_MASK) | (UINTPTR)(Addr)))
217 /*****************************************************************************/
219 * Set the BD's Status field (word 1).
221 * @param BdPtr is the BD pointer to operate on
222 * @param Data is the value to write to BD's status field.
226 * void XEmacPs_BdSetStatus(XEmacPs_Bd* BdPtr, UINTPTR Data)
228 *****************************************************************************/
229 #define XEmacPs_BdSetStatus(BdPtr, Data) \
230 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
231 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | (Data))
234 /*****************************************************************************/
236 * Retrieve the BD's Packet DMA transfer status word (word 1).
238 * @param BdPtr is the BD pointer to operate on
240 * @return Status word
244 * u32 XEmacPs_BdGetStatus(XEmacPs_Bd* BdPtr)
246 * Due to the BD bit layout differences in transmit and receive. User's
247 * caution is required.
248 *****************************************************************************/
249 #define XEmacPs_BdGetStatus(BdPtr) \
250 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET)
253 /*****************************************************************************/
255 * Get the address (bits 0..31) of the BD's buffer address (word 0)
257 * @param BdPtr is the BD pointer to operate on
261 * UINTPTR XEmacPs_BdGetBufAddr(XEmacPs_Bd* BdPtr)
263 *****************************************************************************/
265 #define XEmacPs_BdGetBufAddr(BdPtr) \
266 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) | \
267 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_HI_OFFSET)) << 32U)
269 #define XEmacPs_BdGetBufAddr(BdPtr) \
270 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET))
273 /*****************************************************************************/
275 * Set transfer length in bytes for the given BD. The length must be set each
276 * time a BD is submitted to hardware.
278 * @param BdPtr is the BD pointer to operate on
279 * @param LenBytes is the number of bytes to transfer.
283 * void XEmacPs_BdSetLength(XEmacPs_Bd* BdPtr, u32 LenBytes)
285 *****************************************************************************/
286 #define XEmacPs_BdSetLength(BdPtr, LenBytes) \
287 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
288 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
289 ~XEMACPS_TXBUF_LEN_MASK) | (LenBytes)))
293 /*****************************************************************************/
295 * Set transfer length in bytes for the given BD. The length must be set each
296 * time a BD is submitted to hardware.
298 * @param BdPtr is the BD pointer to operate on
299 * @param LenBytes is the number of bytes to transfer.
303 * void XEmacPs_BdSetLength(XEmacPs_Bd* BdPtr, u32 LenBytes)
305 *****************************************************************************/
306 #define XEmacPs_BdSetLength(BdPtr, LenBytes) \
307 XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
308 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
309 ~XEMACPS_TXBUF_LEN_MASK) | (LenBytes)))
312 /*****************************************************************************/
314 * Retrieve the BD length field.
316 * For Tx channels, the returned value is the same as that written with
317 * XEmacPs_BdSetLength().
319 * For Rx channels, the returned value is the size of the received packet.
321 * @param BdPtr is the BD pointer to operate on
323 * @return Length field processed by hardware or set by
324 * XEmacPs_BdSetLength().
328 * UINTPTR XEmacPs_BdGetLength(XEmacPs_Bd* BdPtr)
329 * XEAMCPS_RXBUF_LEN_MASK is same as XEMACPS_TXBUF_LEN_MASK.
331 *****************************************************************************/
332 #define XEmacPs_BdGetLength(BdPtr) \
333 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
334 XEMACPS_RXBUF_LEN_MASK)
336 /*****************************************************************************/
338 * Retrieve the RX frame size.
340 * The returned value is the size of the received packet.
341 * This API supports jumbo frame sizes if enabled.
343 * @param BdPtr is the BD pointer to operate on
345 * @return Length field processed by hardware or set by
346 * XEmacPs_BdSetLength().
350 * UINTPTR XEmacPs_GetRxFrameSize(XEmacPs* InstancePtr, XEmacPs_Bd* BdPtr)
351 * RxBufMask is dependent on whether jumbo is enabled or not.
353 *****************************************************************************/
354 #define XEmacPs_GetRxFrameSize(InstancePtr, BdPtr) \
355 (XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
356 (InstancePtr)->RxBufMask)
358 /*****************************************************************************/
360 * Test whether the given BD has been marked as the last BD of a packet.
362 * @param BdPtr is the BD pointer to operate on
364 * @return TRUE if BD represents the "Last" BD of a packet, FALSE otherwise
368 * UINTPTR XEmacPs_BdIsLast(XEmacPs_Bd* BdPtr)
370 *****************************************************************************/
371 #define XEmacPs_BdIsLast(BdPtr) \
372 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
373 XEMACPS_RXBUF_EOF_MASK)!=0U ? TRUE : FALSE)
376 /*****************************************************************************/
378 * Tell the DMA engine that the given transmit BD marks the end of the current
379 * packet to be processed.
381 * @param BdPtr is the BD pointer to operate on
385 * void XEmacPs_BdSetLast(XEmacPs_Bd* BdPtr)
387 *****************************************************************************/
388 #define XEmacPs_BdSetLast(BdPtr) \
389 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
390 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
391 XEMACPS_TXBUF_LAST_MASK))
394 /*****************************************************************************/
396 * Tell the DMA engine that the current packet does not end with the given
399 * @param BdPtr is the BD pointer to operate on
403 * void XEmacPs_BdClearLast(XEmacPs_Bd* BdPtr)
405 *****************************************************************************/
406 #define XEmacPs_BdClearLast(BdPtr) \
407 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
408 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
409 ~XEMACPS_TXBUF_LAST_MASK))
412 /*****************************************************************************/
414 * Set this bit to mark the last descriptor in the receive buffer descriptor
417 * @param BdPtr is the BD pointer to operate on
421 * void XEmacPs_BdSetRxWrap(XEmacPs_Bd* BdPtr)
423 *****************************************************************************/
424 /*#define XEmacPs_BdSetRxWrap(BdPtr) \
425 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
426 XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) | \
427 XEMACPS_RXBUF_WRAP_MASK))
430 /*****************************************************************************/
432 * Determine the wrap bit of the receive BD which indicates end of the
435 * @param BdPtr is the BD pointer to operate on
439 * u8 XEmacPs_BdIsRxWrap(XEmacPs_Bd* BdPtr)
441 *****************************************************************************/
442 #define XEmacPs_BdIsRxWrap(BdPtr) \
443 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
444 XEMACPS_RXBUF_WRAP_MASK)!=0U ? TRUE : FALSE)
447 /*****************************************************************************/
449 * Sets this bit to mark the last descriptor in the transmit buffer
452 * @param BdPtr is the BD pointer to operate on
456 * void XEmacPs_BdSetTxWrap(XEmacPs_Bd* BdPtr)
458 *****************************************************************************/
459 /*#define XEmacPs_BdSetTxWrap(BdPtr) \
460 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
461 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
462 XEMACPS_TXBUF_WRAP_MASK))
465 /*****************************************************************************/
467 * Determine the wrap bit of the transmit BD which indicates end of the
470 * @param BdPtr is the BD pointer to operate on
474 * u8 XEmacPs_BdGetTxWrap(XEmacPs_Bd* BdPtr)
476 *****************************************************************************/
477 #define XEmacPs_BdIsTxWrap(BdPtr) \
478 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
479 XEMACPS_TXBUF_WRAP_MASK)!=0U ? TRUE : FALSE)
482 /*****************************************************************************/
484 * Must clear this bit to enable the MAC to write data to the receive
485 * buffer. Hardware sets this bit once it has successfully written a frame to
486 * memory. Once set, software has to clear the bit before the buffer can be
487 * used again. This macro clear the new bit of the receive BD.
489 * @param BdPtr is the BD pointer to operate on
493 * void XEmacPs_BdClearRxNew(XEmacPs_Bd* BdPtr)
495 *****************************************************************************/
496 #define XEmacPs_BdClearRxNew(BdPtr) \
497 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_ADDR_OFFSET, \
498 XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
499 ~XEMACPS_RXBUF_NEW_MASK))
502 /*****************************************************************************/
504 * Determine the new bit of the receive BD.
506 * @param BdPtr is the BD pointer to operate on
510 * UINTPTR XEmacPs_BdIsRxNew(XEmacPs_Bd* BdPtr)
512 *****************************************************************************/
513 #define XEmacPs_BdIsRxNew(BdPtr) \
514 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_ADDR_OFFSET) & \
515 XEMACPS_RXBUF_NEW_MASK)!=0U ? TRUE : FALSE)
518 /*****************************************************************************/
520 * Software sets this bit to disable the buffer to be read by the hardware.
521 * Hardware sets this bit for the first buffer of a frame once it has been
522 * successfully transmitted. This macro sets this bit of transmit BD to avoid
525 * @param BdPtr is the BD pointer to operate on
529 * void XEmacPs_BdSetTxUsed(XEmacPs_Bd* BdPtr)
531 *****************************************************************************/
532 #define XEmacPs_BdSetTxUsed(BdPtr) \
533 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
534 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
535 XEMACPS_TXBUF_USED_MASK))
538 /*****************************************************************************/
540 * Software clears this bit to enable the buffer to be read by the hardware.
541 * Hardware sets this bit for the first buffer of a frame once it has been
542 * successfully transmitted. This macro clears this bit of transmit BD.
544 * @param BdPtr is the BD pointer to operate on
548 * void XEmacPs_BdClearTxUsed(XEmacPs_Bd* BdPtr)
550 *****************************************************************************/
551 #define XEmacPs_BdClearTxUsed(BdPtr) \
552 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
553 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
554 ~XEMACPS_TXBUF_USED_MASK))
557 /*****************************************************************************/
559 * Determine the used bit of the transmit BD.
561 * @param BdPtr is the BD pointer to operate on
565 * UINTPTR XEmacPs_BdIsTxUsed(XEmacPs_Bd* BdPtr)
567 *****************************************************************************/
568 #define XEmacPs_BdIsTxUsed(BdPtr) \
569 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
570 XEMACPS_TXBUF_USED_MASK)!=0U ? TRUE : FALSE)
573 /*****************************************************************************/
575 * Determine if a frame fails to be transmitted due to too many retries.
577 * @param BdPtr is the BD pointer to operate on
581 * UINTPTR XEmacPs_BdIsTxRetry(XEmacPs_Bd* BdPtr)
583 *****************************************************************************/
584 #define XEmacPs_BdIsTxRetry(BdPtr) \
585 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
586 XEMACPS_TXBUF_RETRY_MASK)!=0U ? TRUE : FALSE)
589 /*****************************************************************************/
591 * Determine if a frame fails to be transmitted due to data can not be
592 * feteched in time or buffers are exhausted.
594 * @param BdPtr is the BD pointer to operate on
598 * UINTPTR XEmacPs_BdIsTxUrun(XEmacPs_Bd* BdPtr)
600 *****************************************************************************/
601 #define XEmacPs_BdIsTxUrun(BdPtr) \
602 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
603 XEMACPS_TXBUF_URUN_MASK)!=0U ? TRUE : FALSE)
606 /*****************************************************************************/
608 * Determine if a frame fails to be transmitted due to buffer is exhausted
611 * @param BdPtr is the BD pointer to operate on
615 * UINTPTR XEmacPs_BdIsTxExh(XEmacPs_Bd* BdPtr)
617 *****************************************************************************/
618 #define XEmacPs_BdIsTxExh(BdPtr) \
619 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
620 XEMACPS_TXBUF_EXH_MASK)!=0U ? TRUE : FALSE)
623 /*****************************************************************************/
625 * Sets this bit, no CRC will be appended to the current frame. This control
626 * bit must be set for the first buffer in a frame and will be ignored for
627 * the subsequent buffers of a frame.
629 * @param BdPtr is the BD pointer to operate on
632 * This bit must be clear when using the transmit checksum generation offload,
633 * otherwise checksum generation and substitution will not occur.
636 * UINTPTR XEmacPs_BdSetTxNoCRC(XEmacPs_Bd* BdPtr)
638 *****************************************************************************/
639 #define XEmacPs_BdSetTxNoCRC(BdPtr) \
640 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
641 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) | \
642 XEMACPS_TXBUF_NOCRC_MASK))
645 /*****************************************************************************/
647 * Clear this bit, CRC will be appended to the current frame. This control
648 * bit must be set for the first buffer in a frame and will be ignored for
649 * the subsequent buffers of a frame.
651 * @param BdPtr is the BD pointer to operate on
654 * This bit must be clear when using the transmit checksum generation offload,
655 * otherwise checksum generation and substitution will not occur.
658 * UINTPTR XEmacPs_BdClearTxNoCRC(XEmacPs_Bd* BdPtr)
660 *****************************************************************************/
661 #define XEmacPs_BdClearTxNoCRC(BdPtr) \
662 (XEmacPs_BdWrite((BdPtr), XEMACPS_BD_STAT_OFFSET, \
663 XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
664 ~XEMACPS_TXBUF_NOCRC_MASK))
667 /*****************************************************************************/
669 * Determine the broadcast bit of the receive BD.
671 * @param BdPtr is the BD pointer to operate on
675 * UINTPTR XEmacPs_BdIsRxBcast(XEmacPs_Bd* BdPtr)
677 *****************************************************************************/
678 #define XEmacPs_BdIsRxBcast(BdPtr) \
679 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
680 XEMACPS_RXBUF_BCAST_MASK)!=0U ? TRUE : FALSE)
683 /*****************************************************************************/
685 * Determine the multicast hash bit of the receive BD.
687 * @param BdPtr is the BD pointer to operate on
691 * UINTPTR XEmacPs_BdIsRxMultiHash(XEmacPs_Bd* BdPtr)
693 *****************************************************************************/
694 #define XEmacPs_BdIsRxMultiHash(BdPtr) \
695 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
696 XEMACPS_RXBUF_MULTIHASH_MASK)!=0U ? TRUE : FALSE)
699 /*****************************************************************************/
701 * Determine the unicast hash bit of the receive BD.
703 * @param BdPtr is the BD pointer to operate on
707 * UINTPTR XEmacPs_BdIsRxUniHash(XEmacPs_Bd* BdPtr)
709 *****************************************************************************/
710 #define XEmacPs_BdIsRxUniHash(BdPtr) \
711 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
712 XEMACPS_RXBUF_UNIHASH_MASK)!=0U ? TRUE : FALSE)
715 /*****************************************************************************/
717 * Determine if the received frame is a VLAN Tagged frame.
719 * @param BdPtr is the BD pointer to operate on
723 * UINTPTR XEmacPs_BdIsRxVlan(XEmacPs_Bd* BdPtr)
725 *****************************************************************************/
726 #define XEmacPs_BdIsRxVlan(BdPtr) \
727 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
728 XEMACPS_RXBUF_VLAN_MASK)!=0U ? TRUE : FALSE)
731 /*****************************************************************************/
733 * Determine if the received frame has Type ID of 8100h and null VLAN
734 * identifier(Priority tag).
736 * @param BdPtr is the BD pointer to operate on
740 * UINTPTR XEmacPs_BdIsRxPri(XEmacPs_Bd* BdPtr)
742 *****************************************************************************/
743 #define XEmacPs_BdIsRxPri(BdPtr) \
744 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
745 XEMACPS_RXBUF_PRI_MASK)!=0U ? TRUE : FALSE)
748 /*****************************************************************************/
750 * Determine if the received frame's Concatenation Format Indicator (CFI) of
751 * the frames VLANTCI field was set.
753 * @param BdPtr is the BD pointer to operate on
757 * UINTPTR XEmacPs_BdIsRxCFI(XEmacPs_Bd* BdPtr)
759 *****************************************************************************/
760 #define XEmacPs_BdIsRxCFI(BdPtr) \
761 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
762 XEMACPS_RXBUF_CFI_MASK)!=0U ? TRUE : FALSE)
765 /*****************************************************************************/
767 * Determine the End Of Frame (EOF) bit of the receive BD.
769 * @param BdPtr is the BD pointer to operate on
773 * UINTPTR XEmacPs_BdGetRxEOF(XEmacPs_Bd* BdPtr)
775 *****************************************************************************/
776 #define XEmacPs_BdIsRxEOF(BdPtr) \
777 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
778 XEMACPS_RXBUF_EOF_MASK)!=0U ? TRUE : FALSE)
781 /*****************************************************************************/
783 * Determine the Start Of Frame (SOF) bit of the receive BD.
785 * @param BdPtr is the BD pointer to operate on
789 * UINTPTR XEmacPs_BdGetRxSOF(XEmacPs_Bd* BdPtr)
791 *****************************************************************************/
792 #define XEmacPs_BdIsRxSOF(BdPtr) \
793 ((XEmacPs_BdRead((BdPtr), XEMACPS_BD_STAT_OFFSET) & \
794 XEMACPS_RXBUF_SOF_MASK)!=0U ? TRUE : FALSE)
797 /************************** Function Prototypes ******************************/
803 #endif /* end of protection macro */