XilinxProcessorIPLib/drivers/uartlite/examples/xuartlite_intr_tapp_example.c
int UartLiteIntrExample(INTC *IntcInstancePtr,
			XUartLite *UartLiteInstPtr,
			u16 UartLiteDeviceId,
			u16 UartLiteIntrId)

{
	int Status;
	u32 Index;

	/*
	 * Initialize the UartLite driver so that it's ready to use.
	 */
	Status = XUartLite_Initialize(UartLiteInstPtr, UartLiteDeviceId);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Perform a self-test to ensure that the hardware was built correctly.
	 */
	Status = XUartLite_SelfTest(UartLiteInstPtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Connect the UartLite to the interrupt subsystem such that interrupts
	 * can occur. This function is application specific.
	 */
	Status = UartLiteSetupIntrSystem(IntcInstancePtr,
					 UartLiteInstPtr,
					 UartLiteIntrId);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Setup the handlers for the UartLite that will be called from the
	 * interrupt context when data has been sent and received,
	 * specify a pointer to the UartLite driver instance as the callback
	 * reference so the handlers are able to access the instance data.
	 */
	XUartLite_SetSendHandler(UartLiteInstPtr, UartLiteSendHandler,
							 UartLiteInstPtr);
	XUartLite_SetRecvHandler(UartLiteInstPtr, UartLiteRecvHandler,
							 UartLiteInstPtr);

	/*
	 * Enable the interrupt of the UartLite so that the interrupts
	 * will occur.
	 */
	XUartLite_EnableInterrupt(UartLiteInstPtr);

	/*
	 * Initialize the send buffer bytes with a pattern to send.
	 */
	for (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
		SendBuffer[Index] = Index;
	}

	/*
	 * Send the buffer using the UartLite.
	 */
	XUartLite_Send(UartLiteInstPtr, SendBuffer, TEST_BUFFER_SIZE);

	/*
	 * Wait for the entire buffer to be transmitted,  the function may get
	 * locked up in this loop if the interrupts are not working correctly.
	 */
	while ((TotalSentCount != TEST_BUFFER_SIZE)) {
	}

	UartLiteDisableIntrSystem(IntcInstancePtr, UartLiteIntrId);

	return XST_SUCCESS;
}
/****************************************************************************/
/**
*
* This function does a minimal test on the UartLite device and driver as a
* design example. The purpose of this function is to illustrate how to use
* the XUartLite component.
*
* This function sends data through the UartLite.
*
* This function uses the interrupt driver mode of the UartLite.  The calls to
* the  UartLite driver in the interrupt handlers, should only use the
* non-blocking calls.
*
* @param	IntcInstancePtr is a pointer to the instance of INTC driver.
* @param	UartLiteInstPtr is a pointer to the instance of UartLite driver.
* @param	UartLiteDeviceId is the Device ID of the UartLite Device and
*		is the XPAR_<UARTLITE_instance>_DEVICE_ID value from
*		xparameters.h.
* @param	UartLiteIntrId is the Interrupt ID and is typically
*		XPAR_<INTC_instance>_<UARTLITE_instance>_VEC_ID value from
*		xparameters.h.
*
* @return	XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note		None.
*
* This function contains an infinite loop such that if interrupts are not
* working it may never return.
*
****************************************************************************/
This function does a minimal test on the UartLite device and driver as a
design example. The purpose of this function is to illustrate how to use
the XUartLite component.

This function sends data through the UartLite.

This function uses the interrupt driver mode of the UartLite.  The calls to
the  UartLite driver in the interrupt handlers, should only use the
non-blocking calls.
This function does a minimal test on the UartLite device and driver as a design example . The purpose of this function is to illustrate how to use the XUartLite component . This function sends data through the UartLite . This function uses the interrupt driver mode of the UartLite . The calls to the UartLite driver in the interrupt handlers should only use the non - blocking calls .
int UartLiteIntrExample(INTC *IntcInstancePtr,
			XUartLite *UartLiteInstPtr,
			u16 UartLiteDeviceId,
			u16 UartLiteIntrId)
{
	int Status;
	u32 Index;
	Status = XUartLite_Initialize(UartLiteInstPtr, UartLiteDeviceId);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XUartLite_SelfTest(UartLiteInstPtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = UartLiteSetupIntrSystem(IntcInstancePtr,
					 UartLiteInstPtr,
					 UartLiteIntrId);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XUartLite_SetSendHandler(UartLiteInstPtr, UartLiteSendHandler,
							 UartLiteInstPtr);
	XUartLite_SetRecvHandler(UartLiteInstPtr, UartLiteRecvHandler,
							 UartLiteInstPtr);
	XUartLite_EnableInterrupt(UartLiteInstPtr);
	for (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
		SendBuffer[Index] = Index;
	}
	XUartLite_Send(UartLiteInstPtr, SendBuffer, TEST_BUFFER_SIZE);
	while ((TotalSentCount != TEST_BUFFER_SIZE)) {
	}
	UartLiteDisableIntrSystem(IntcInstancePtr, UartLiteIntrId);
	return XST_SUCCESS;
}
int UartLiteIntrExample ( INTC * IntcInstancePtr , XUartLite * UartLiteInstPtr , u16 UartLiteDeviceId , u16 UartLiteIntrId ) { int Status ; u32 Index ; Status = XUartLite_Initialize ( UartLiteInstPtr , UartLiteDeviceId ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = XUartLite_SelfTest ( UartLiteInstPtr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = UartLiteSetupIntrSystem ( IntcInstancePtr , UartLiteInstPtr , UartLiteIntrId ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XUartLite_SetSendHandler ( UartLiteInstPtr , UartLiteSendHandler , UartLiteInstPtr ) ; XUartLite_SetRecvHandler ( UartLiteInstPtr , UartLiteRecvHandler , UartLiteInstPtr ) ; XUartLite_EnableInterrupt ( UartLiteInstPtr ) ; for ( Index = 0 ; Index < TEST_BUFFER_SIZE ; Index ++ ) { SendBuffer [ Index ] = Index ; } XUartLite_Send ( UartLiteInstPtr , SendBuffer , TEST_BUFFER_SIZE ) ; while ( ( TotalSentCount != TEST_BUFFER_SIZE ) ) { } UartLiteDisableIntrSystem ( IntcInstancePtr , UartLiteIntrId ) ; return XST_SUCCESS ; }
This function does a minimal test on the UartLite device and driver as a
design example.
This function does a minimal test on the UartLite device and driver as a design example .
/*
	 * Initialize the UartLite driver so that it's ready to use.
	 */ /*
	 * Perform a self-test to ensure that the hardware was built correctly.
	 */ /*
	 * Connect the UartLite to the interrupt subsystem such that interrupts
	 * can occur. This function is application specific.
	 */ /*
	 * Setup the handlers for the UartLite that will be called from the
	 * interrupt context when data has been sent and received,
	 * specify a pointer to the UartLite driver instance as the callback
	 * reference so the handlers are able to access the instance data.
	 */ /*
	 * Enable the interrupt of the UartLite so that the interrupts
	 * will occur.
	 */ /*
	 * Initialize the send buffer bytes with a pattern to send.
	 */ /*
	 * Send the buffer using the UartLite.
	 */ /*
	 * Wait for the entire buffer to be transmitted,  the function may get
	 * locked up in this loop if the interrupts are not working correctly.
	 */