Exemplo n.º 1
0
int uart_send(u8* sendBuffer, u8 size){
	if(XUartLite_IsSending(&uart_device))
		return 0;

	int SentCount = XUartLite_Send(&uart_device, sendBuffer, size);

	return SentCount;
}
Exemplo n.º 2
0
/**
*
* This function is the handler which performs processing to receive data from
* the UartLite. It is called from an interrupt context such that the amount of
* processing performed should be minimized.  It is called data is present in
* the receive FIFO of the UartLite such that the data can be retrieved from
* the UartLite. The size of the data present in the FIFO is not known when
* this function is called.
*
* This handler provides an example of how to handle data for the UartLite,
* but is application specific.
*
* @param	CallBackRef contains a callback reference from the driver, in
*		this case it is the instance pointer for the UartLite driver.
* @param	EventData contains the number of bytes sent or received for sent
*		and receive events.
*
* @return	None.
*
* @note		None.
*
****************************************************************************/
void RecvHandler_UART_1(void *CallBackRef, unsigned int EventData)
{
	unsigned int num_of_chars;

	num_of_chars = XUartLite_Recv(&UART_Inst_Ptr_1, RxBuffer_1, BUF_SIZE);

	while(XUartLite_IsSending(&UART_Inst_Ptr_1));
	XUartLite_Send(&UART_Inst_Ptr_1, RxBuffer_1, num_of_chars);
	if(UART_DBG) xil_printf("UART1: Received %d bytes: %02X \r\n",num_of_chars,*RxBuffer_1);
}