/* Get the value of the packet count threshold for this driver/device. The packet count threshold is used for interrupt coalescing, which reduces the frequency of interrupts from the device to the processor. In this case, the scatter-gather DMA engine only interrupts when the packet count threshold is reached, instead of interrupting for each packet. A packet is a generic term used by the scatter-gather DMA engine, and is equivalent to an Ethernet frame in our case. */
XStatus XEmac_GetPktThreshold(XEmac *InstancePtr, u32 Direction, u8 *ThreshPtr)
/* Get the value of the packet count threshold for this driver/device. The packet count threshold is used for interrupt coalescing, which reduces the frequency of interrupts from the device to the processor. In this case, the scatter-gather DMA engine only interrupts when the packet count threshold is reached, instead of interrupting for each packet. A packet is a generic term used by the scatter-gather DMA engine, and is equivalent to an Ethernet frame in our case. */
XStatus XEmac_GetPktThreshold(XEmac *InstancePtr, u32 Direction, u8 *ThreshPtr)
{
	XASSERT_NONVOID(InstancePtr != NULL);
	XASSERT_NONVOID(Direction == XEM_SEND || Direction == XEM_RECV);
	XASSERT_NONVOID(ThreshPtr != NULL);
	XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
	if (!XEmac_mIsSgDma(InstancePtr)) {
		return XST_NOT_SGDMA;
	}
	switch (Direction) {
	case XEM_SEND:
		*ThreshPtr =
		    XDmaChannel_GetPktThreshold(&InstancePtr->SendChannel);
		break;
	case XEM_RECV:
		*ThreshPtr =
		    XDmaChannel_GetPktThreshold(&InstancePtr->RecvChannel);
		break;
	default:
		return XST_INVALID_PARAM;
	}
	return XST_SUCCESS;
}