XilinxProcessorIPLib/drivers/uartps/examples/xuartps_hello_world_example.c
int UartPsHelloWorldExample(u16 DeviceId)
{
	u8 HelloWorld[] = "Hello World";
	int SentCount = 0;
	int Status;
	XUartPs_Config *Config;

	/*
	 * Initialize the UART driver so that it's ready to use
	 * Look up the configuration in the config table and then initialize it.
	 */
	Config = XUartPs_LookupConfig(DeviceId);
	if (NULL == Config) {
		return XST_FAILURE;
	}

	Status = XUartPs_CfgInitialize(&Uart_Ps, Config, Config->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	XUartPs_SetBaudRate(&Uart_Ps, 115200);

	while (SentCount < (sizeof(HelloWorld) - 1)) {
		/* Transmit the data */
		SentCount += XUartPs_Send(&Uart_Ps,
					   &HelloWorld[SentCount], 1);
	}

	return SentCount;
}
/****************************************************************************/
/**
*
* This function sends 'Hello World' to an external terminal in polled mode.
* The purpose of this function is to illustrate how to use the XUartPs driver.
*
*
* @param	DeviceId is the unique ID for the device from hardware build.
*
* @return
*		- XST_FAILURE if the UART driver could not be initialized
*		  successfully.
*		- A non-negative number indicating the number of characters
*		  sent.
*
* @note		None.
*
****************************************************************************/
This function sends 'Hello World' to an external terminal in polled mode.
The purpose of this function is to illustrate how to use the XUartPs driver.
This function sends ' Hello World ' to an external terminal in polled mode . The purpose of this function is to illustrate how to use the XUartPs driver .
int UartPsHelloWorldExample(u16 DeviceId)
{
	u8 HelloWorld[] = "Hello World";
	int SentCount = 0;
	int Status;
	XUartPs_Config *Config;
	Config = XUartPs_LookupConfig(DeviceId);
	if (NULL == Config) {
		return XST_FAILURE;
	}
	Status = XUartPs_CfgInitialize(&Uart_Ps, Config, Config->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XUartPs_SetBaudRate(&Uart_Ps, 115200);
	while (SentCount < (sizeof(HelloWorld) - 1)) {
		SentCount += XUartPs_Send(&Uart_Ps,
					   &HelloWorld[SentCount], 1);
	}
	return SentCount;
}
int UartPsHelloWorldExample ( u16 DeviceId ) { u8 HelloWorld [ ] = " " ; int SentCount = 0 ; int Status ; XUartPs_Config * Config ; Config = XUartPs_LookupConfig ( DeviceId ) ; if ( NULL == Config ) { return XST_FAILURE ; } Status = XUartPs_CfgInitialize ( & Uart_Ps , Config , Config -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XUartPs_SetBaudRate ( & Uart_Ps , 115200 ) ; while ( SentCount < ( sizeof ( HelloWorld ) - 1 ) ) { SentCount += XUartPs_Send ( & Uart_Ps , & HelloWorld [ SentCount ] , 1 ) ; } return SentCount ; }
This function sends 'Hello World' to an external terminal in polled mode.
This function sends ' Hello World ' to an external terminal in polled mode .
/*
	 * Initialize the UART driver so that it's ready to use
	 * Look up the configuration in the config table and then initialize it.
	 */ /* Transmit the data */