Skip to content

Commit afcff44

Browse files
author
Andre Beckus
committed
Update timer and clock calls to reflect changes in QEMU
1 parent 5130033 commit afcff44

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

hw/char/stm32_uart.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static void stm32_uart_tx_complete(Stm32Uart *s)
232232
/* Start transmitting a character. */
233233
static void stm32_uart_start_tx(Stm32Uart *s, uint32_t value)
234234
{
235-
uint64_t curr_time = qemu_get_clock_ns(vm_clock);
235+
uint64_t curr_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
236236
uint8_t ch = value; //This will truncate the ninth bit
237237

238238
/* Reset the Transmission Complete flag to indicate a transmit is in
@@ -252,7 +252,7 @@ static void stm32_uart_start_tx(Stm32Uart *s, uint32_t value)
252252
stm32_uart_tx_complete(s);
253253
#else
254254
/* Otherwise, start the transmit delay timer. */
255-
qemu_mod_timer(s->tx_timer, curr_time + s->ns_per_char);
255+
timer_mod(s->tx_timer, curr_time + s->ns_per_char);
256256
#endif
257257
}
258258

@@ -406,7 +406,7 @@ static void stm32_uart_event(void *opaque, int event)
406406
static void stm32_uart_receive(void *opaque, const uint8_t *buf, int size)
407407
{
408408
Stm32Uart *s = (Stm32Uart *)opaque;
409-
uint64_t curr_time = qemu_get_clock_ns(vm_clock);
409+
uint64_t curr_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
410410

411411
assert(size > 0);
412412

@@ -434,7 +434,7 @@ static void stm32_uart_receive(void *opaque, const uint8_t *buf, int size)
434434
#else
435435
/* Indicate the module is receiving and start the delay. */
436436
s->receiving = true;
437-
qemu_mod_timer(s->rx_timer, curr_time + s->ns_per_char);
437+
timer_mod(s->rx_timer, curr_time + s->ns_per_char);
438438
#endif
439439
}
440440

@@ -751,9 +751,11 @@ static int stm32_uart_init(SysBusDevice *dev)
751751
sysbus_init_irq(dev, &s->irq);
752752

753753
s->rx_timer =
754-
qemu_new_timer_ns(vm_clock,(QEMUTimerCB *)stm32_uart_rx_timer_expire, s);
754+
timer_new_ns(QEMU_CLOCK_VIRTUAL,
755+
(QEMUTimerCB *)stm32_uart_rx_timer_expire, s);
755756
s->tx_timer =
756-
qemu_new_timer_ns(vm_clock,(QEMUTimerCB *)stm32_uart_tx_timer_expire, s);
757+
timer_new_ns(QEMU_CLOCK_VIRTUAL,
758+
(QEMUTimerCB *)stm32_uart_tx_timer_expire, s);
757759

758760
/* Register handlers to handle updates to the USART's peripheral clock. */
759761
clk_irq =

0 commit comments

Comments
 (0)