XilinxProcessorIPLib/drivers/uartlite/src/xuartlite.c
unsigned int XUartLite_Send(XUartLite *InstancePtr, u8 *DataBufferPtr,
				unsigned int NumBytes)
{
	unsigned int BytesSent;
	u32 StatusRegister;

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

	/*
	 * Enter a critical region by disabling the UART interrupts to allow
	 * this call to stop a previous operation that may be interrupt driven.
	 */
	StatusRegister = XUartLite_GetSR(InstancePtr);

	XUartLite_WriteReg(InstancePtr->RegBaseAddress,
				XUL_CONTROL_REG_OFFSET, 0);

	/*
	 * 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 = DataBufferPtr;

	/*
	 * Restore the interrupt enable register to it's previous value such
	 * that the critical region is exited.
	 * This is done here to minimize the amount of time the interrupt is
	 * disabled since there is only one interrupt and the receive could
	 * be filling up while interrupts are blocked.
	 */

	StatusRegister &= XUL_CR_ENABLE_INTR;
	XUartLite_WriteReg(InstancePtr->RegBaseAddress,
				XUL_CONTROL_REG_OFFSET, StatusRegister);

	/*
	 * Send the buffer using the UART and return the number of bytes sent
	 */
	BytesSent = XUartLite_SendBuffer(InstancePtr);

	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 in the FIFO. 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 XUartLite instance.
* @param	DataBufferPtr 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.
*
******************************************************************************/
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 in the FIFO. 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 in the FIFO . 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 XUartLite_Send(XUartLite *InstancePtr, u8 *DataBufferPtr,
				unsigned int NumBytes)
{
	unsigned int BytesSent;
	u32 StatusRegister;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(DataBufferPtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(((signed)NumBytes) >= 0);
	StatusRegister = XUartLite_GetSR(InstancePtr);
	XUartLite_WriteReg(InstancePtr->RegBaseAddress,
				XUL_CONTROL_REG_OFFSET, 0);
	InstancePtr->SendBuffer.RequestedBytes = NumBytes;
	InstancePtr->SendBuffer.RemainingBytes = NumBytes;
	InstancePtr->SendBuffer.NextBytePtr = DataBufferPtr;
	StatusRegister &= XUL_CR_ENABLE_INTR;
	XUartLite_WriteReg(InstancePtr->RegBaseAddress,
				XUL_CONTROL_REG_OFFSET, StatusRegister);
	BytesSent = XUartLite_SendBuffer(InstancePtr);
	return BytesSent;
}
unsigned int XUartLite_Send ( XUartLite * InstancePtr , u8 * DataBufferPtr , unsigned int NumBytes ) { unsigned int BytesSent ; u32 StatusRegister ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( DataBufferPtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertNonvoid ( ( ( signed ) NumBytes ) >= 0 ) ; StatusRegister = XUartLite_GetSR ( InstancePtr ) ; XUartLite_WriteReg ( InstancePtr -> RegBaseAddress , XUL_CONTROL_REG_OFFSET , 0 ) ; InstancePtr -> SendBuffer . RequestedBytes = NumBytes ; InstancePtr -> SendBuffer . RemainingBytes = NumBytes ; InstancePtr -> SendBuffer . NextBytePtr = DataBufferPtr ; StatusRegister &= XUL_CR_ENABLE_INTR ; XUartLite_WriteReg ( InstancePtr -> RegBaseAddress , XUL_CONTROL_REG_OFFSET , StatusRegister ) ; BytesSent = XUartLite_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 interrupts to allow
	 * this call to stop a previous operation that may be interrupt driven.
	 */ /*
	 * Setup the specified buffer to be sent by setting the instance
	 * variables so it can be sent with polled or interrupt mode
	 */ /*
	 * Restore the interrupt enable register to it's previous value such
	 * that the critical region is exited.
	 * This is done here to minimize the amount of time the interrupt is
	 * disabled since there is only one interrupt and the receive could
	 * be filling up while interrupts are blocked.
	 */ /*
	 * Send the buffer using the UART and return the number of bytes sent
	 */