From ddec2e353f2eddad578001d7da64dedea945bb60 Mon Sep 17 00:00:00 2001 From: root <root@abpc10765.cern.ch> Date: Thu, 31 May 2012 14:54:23 +0200 Subject: [PATCH] spec-vuart: wait until TX is ready before transmitting a byte --- tools/spec-vuart.c | 1 + tools/wb_uart.h | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/spec-vuart.c b/tools/spec-vuart.c index 9dfc771..ae998b2 100644 --- a/tools/spec-vuart.c +++ b/tools/spec-vuart.c @@ -26,6 +26,7 @@ int vc_rx(void *ptr) void vc_tx(void *ptr, int c) { + while( *(int *)(ptr + UART_REG_SR) & UART_SR_RX_RDY); *(int *)(ptr + UART_REG_HOST_TDR) = UART_HOST_TDR_DATA_W(c); } diff --git a/tools/wb_uart.h b/tools/wb_uart.h index 80c103a..c5801ef 100644 --- a/tools/wb_uart.h +++ b/tools/wb_uart.h @@ -85,6 +85,7 @@ #define UART_HOST_RDR_COUNT_W(value) WBGEN2_GEN_WRITE(value, 9, 16) #define UART_HOST_RDR_COUNT_R(reg) WBGEN2_GEN_READ(reg, 9, 16) +#define UART_REG_SR 0x0 #define UART_REG_HOST_TDR 0x10 #define UART_REG_HOST_RDR 0x14 -- GitLab