source:
rtems-tools/tools/4.11/gdb/lm32/gdb-7.9-lm32uart.diff
@
b6b784c
Last change on this file since b6b784c was bbad85e, checked in by Joel Sherrill <joel.sherrill@…>, on 04/02/15 at 14:52:42 | |
---|---|
|
|
File size: 1.9 KB |
-
sim/lm32/dv-lm32uart.c
diff -ur gdb-7.9.orig/sim/lm32/dv-lm32uart.c gdb-7.9/sim/lm32/dv-lm32uart.c
old new 22 22 #include "hw-main.h" 23 23 #include "sim-assert.h" 24 24 25 #include <stdio.h>26 #include <sys/time.h>27 28 25 struct lm32uart 29 26 { 30 27 unsigned base; /* Base address of this UART. */ … … 38 35 unsigned char lsr; 39 36 unsigned char msr; 40 37 unsigned char div; 38 int saved_count; 39 char saved_byte; 41 40 struct hw_event *event; 42 41 }; 43 42 … … 83 82 static void 84 83 do_uart_tx_event (struct hw *me, void *data) 85 84 { 85 SIM_DESC sd = hw_system (me); 86 86 struct lm32uart *uart = hw_data (me); 87 87 char c; 88 88 … … 115 115 c &= 0x7f; 116 116 break; 117 117 } 118 printf ("%c", c); 118 sim_io_write_stdout (sd, &c, 1); 119 sim_io_flush_stdout (sd); 119 120 } 120 121 121 122 static unsigned … … 200 201 void *dest, 201 202 int space, unsigned_word base, unsigned nr_bytes) 202 203 { 204 SIM_DESC sd = hw_system (me); 203 205 struct lm32uart *uart = hw_data (me); 204 206 int uart_reg; 205 207 int value; … … 214 216 switch (uart_reg) 215 217 { 216 218 case LM32_UART_RBR: 217 value = getchar (); 219 value = uart->saved_byte; 220 --uart->saved_count; 218 221 uart->lsr &= ~LM32_UART_LSR_RX_RDY; 219 222 break; 220 223 case LM32_UART_IER: … … 231 234 break; 232 235 case LM32_UART_LSR: 233 236 /* Check to see if any data waiting in stdin. */ 234 FD_ZERO (&fd); 235 FD_SET (fileno (stdin), &fd); 236 tv.tv_sec = 0; 237 tv.tv_usec = 1; 238 if (select (fileno (stdin) + 1, &fd, NULL, NULL, &tv)) 239 uart->lsr |= LM32_UART_LSR_RX_RDY; 237 if (uart->saved_count <= 0) 238 uart->saved_count = sim_io_poll_read (sd, 0/*STDIN*/, 239 &uart->saved_byte, 1); 240 uart->lsr |= uart->saved_count ? LM32_UART_LSR_RX_RDY : 0; 240 241 value = uart->lsr; 241 242 break; 242 243 case LM32_UART_MSR:
Note: See TracBrowser
for help on using the repository browser.