I am trying to send data from zynq soc 7000 board to pc using uart through a function (driver xuartps.h). within the main program, the code works but calling it from function, output at putty gets overlapped. i tried to debug the code but it looks fine and get output as expected. Need help. thanks
code:
#include "platform.h"
#include "xil_printf.h"
#include<stdlib.h>
#include "xuartps.h"
void uart_output(){
char *p;
char tip[100]="\r\n hi : uart_text_multiple time \0";
u32 transmittedBytes;
u32 totalTransmittedBytes;
u32 status;
u16 byteCnt;
XUartPs_Config *PiUartConfig;
XUartPs PiUart;
byteCnt=0;
PiUartConfig=XUartPs_LookupConfig(XPAR_PS7_UART_0_DEVICE_ID);
status = XUartPs_CfgInitialize(&PiUart,PiUartConfig, PiUartConfig->BaseAddress);
if(status!=XST_SUCCESS)
print("Uart initialization failed...\n\r");
status = XUartPs_SetBaudRate(&PiUart, 115200);
if(status!=XST_SUCCESS)
print("BaudRATE init failed....\n\r");
int o=0;
p =tip;
while(*p != '\0'){
byteCnt+=1;
p++;
}
p =tip;
do{
totalTransmittedBytes=0;
while( totalTransmittedBytes<byteCnt+2){
transmittedBytes = XUartPs_Send(&PiUart, (u8*)&p[totalTransmittedBytes],byteCnt);
totalTransmittedBytes += transmittedBytes;
}
p++;
}while(0<10);
}
int main()
{
init_platform();
uart_output();
uart_output();
cleanup_platform();
return 0;
}