XilinxProcessorIPLib/drivers/uartns550/src/xuartns550.c
unsigned int XUartNs550_Send(XUartNs550 *InstancePtr, u8 *BufferPtr,
					unsigned int NumBytes)
{
	unsigned int BytesSent;
	u32 IerRegister;

	/*
	 * Assert validates the input arguments
	 */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(BufferPtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(((signed)NumBytes) >= 0);

	/*
	 * Enter a critical region by disabling the UART transmit interrupts to
	 * allow this call to stop a previous operation that may be interrupt
	 * driven, only stop the transmit interrupt since this critical region
	 * is not really exited in the normal manner
	 */
	IerRegister = XUartNs550_ReadReg(InstancePtr->BaseAddress,
						XUN_IER_OFFSET);
	XUartNs550_WriteReg(InstancePtr->BaseAddress, XUN_IER_OFFSET,
				IerRegister & ~XUN_IER_TX_EMPTY);

	/*
	 * Setup the specified buffer to be sent by setting the instance
	 * variables so it can be sent with polled or interrupt mode
	 */
	InstancePtr->SendBuffer.RequestedBytes = NumBytes;
	InstancePtr->SendBuffer.RemainingBytes = NumBytes;
	InstancePtr->SendBuffer.NextBytePtr = BufferPtr;

	/*
	 * Send the buffer using the UART and return the number of bytes sent
	 */

	BytesSent = XUartNs550_SendBuffer(InstancePtr);

	/*
	 * The critical region is not exited in this function because of the way
	 * the transmit interrupts work.  The other function called enables the
	 * tranmit interrupt such that this function can't restore a value to
	 * the interrupt enable register and does not need to exit the critical
	 * region
	 */
	return BytesSent;
}
/****************************************************************************/
/**
*
* This functions sends the specified buffer of data using the UART in either
* polled or interrupt driven modes. This function is non-blocking such that it
* will return before the data has been sent by the UART. If the UART is busy
* sending data, it will return and indicate zero bytes were sent.
*
* In a polled mode, this function will only send as much data as the UART can
* buffer, either in the transmitter or in the FIFO if present and enabled. The
* application may need to call it repeatedly to send a buffer.
*
* In interrupt mode, this function will start sending the specified buffer and
* then the interrupt handler of the driver will continue sending data until the
* buffer has been sent. A callback function, as specified by the application,
* will be called to indicate the completion of sending the buffer.
*
* @param	InstancePtr is a pointer to the XUartNs550 instance.
* @param	BufferPtr is pointer to a buffer of data to be sent.
* @param	NumBytes contains the number of bytes to be sent. A value of
*		zero will stop a previous send operation that is in progress
*		in interrupt mode. Any data that was already put into the
*		transmit FIFO will be sent.
*
* @return	The number of bytes actually sent.
*
* @note
*
* The number of bytes is not asserted so that this function may be called with
* a value of zero to stop an operation that is already in progress.
* <br><br>
* This function and the XUartNs550_SetOptions() function modify shared data
* such that there may be a need for mutual exclusion in a multithreaded
* environment and if XUartNs550_SetOptions() if called from a handler.
*
*****************************************************************************/
This functions sends the specified buffer of data using the UART in either
polled or interrupt driven modes. This function is non-blocking such that it
will return before the data has been sent by the UART. If the UART is busy
sending data, it will return and indicate zero bytes were sent.

In a polled mode, this function will only send as much data as the UART can
buffer, either in the transmitter or in the FIFO if present and enabled. The
application may need to call it repeatedly to send a buffer.

In interrupt mode, this function will start sending the specified buffer and
then the interrupt handler of the driver will continue sending data until the
buffer has been sent. A callback function, as specified by the application,
will be called to indicate the completion of sending the buffer.
This functions sends the specified buffer of data using the UART in either polled or interrupt driven modes . This function is non - blocking such that it will return before the data has been sent by the UART . If the UART is busy sending data it will return and indicate zero bytes were sent . In a polled mode this function will only send as much data as the UART can buffer either in the transmitter or in the FIFO if present and enabled . The application may need to call it repeatedly to send a buffer . In interrupt mode this function will start sending the specified buffer and then the interrupt handler of the driver will continue sending data until the buffer has been sent . A callback function as specified by the application will be called to indicate the completion of sending the buffer .
unsigned int XUartNs550_Send(XUartNs550 *InstancePtr, u8 *BufferPtr,
					unsigned int NumBytes)
{
	unsigned int BytesSent;
	u32 IerRegister;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(BufferPtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(((signed)NumBytes) >= 0);
	IerRegister = XUartNs550_ReadReg(InstancePtr->BaseAddress,
						XUN_IER_OFFSET);
	XUartNs550_WriteReg(InstancePtr->BaseAddress, XUN_IER_OFFSET,
				IerRegister & ~XUN_IER_TX_EMPTY);
	InstancePtr->SendBuffer.RequestedBytes = NumBytes;
	InstancePtr->SendBuffer.RemainingBytes = NumBytes;
	InstancePtr->SendBuffer.NextBytePtr = BufferPtr;
	BytesSent = XUartNs550_SendBuffer(InstancePtr);
	return BytesSent;
}
unsigned int XUartNs550_Send ( XUartNs550 * InstancePtr , u8 * BufferPtr , unsigned int NumBytes ) { unsigned int BytesSent ; u32 IerRegister ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( BufferPtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertNonvoid ( ( ( signed ) NumBytes ) >= 0 ) ; IerRegister = XUartNs550_ReadReg ( InstancePtr -> BaseAddress , XUN_IER_OFFSET ) ; XUartNs550_WriteReg ( InstancePtr -> BaseAddress , XUN_IER_OFFSET , IerRegister & ~ XUN_IER_TX_EMPTY ) ; InstancePtr -> SendBuffer . RequestedBytes = NumBytes ; InstancePtr -> SendBuffer . RemainingBytes = NumBytes ; InstancePtr -> SendBuffer . NextBytePtr = BufferPtr ; BytesSent = XUartNs550_SendBuffer ( InstancePtr ) ; return BytesSent ; }
This functions sends the specified buffer of data using the UART in either
polled or interrupt driven modes.
This functions sends the specified buffer of data using the UART in either polled or interrupt driven modes .
/*
	 * Assert validates the input arguments
	 */ /*
	 * Enter a critical region by disabling the UART transmit interrupts to
	 * allow this call to stop a previous operation that may be interrupt
	 * driven, only stop the transmit interrupt since this critical region
	 * is not really exited in the normal manner
	 */ /*
	 * Setup the specified buffer to be sent by setting the instance
	 * variables so it can be sent with polled or interrupt mode
	 */ /*
	 * Send the buffer using the UART and return the number of bytes sent
	 */ /*
	 * The critical region is not exited in this function because of the way
	 * the transmit interrupts work.  The other function called enables the
	 * tranmit interrupt such that this function can't restore a value to
	 * the interrupt enable register and does not need to exit the critical
	 * region
	 */