From 890c3dcba764925a99b60c05b73365d3c3678435 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 29 Nov 2012 23:05:14 +1100 Subject: [PATCH] megax4/uart: implement u2x (double uart transmission speed) --- simavr/cores/sim_megax4.h | 2 ++ simavr/sim/avr_uart.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/simavr/cores/sim_megax4.h b/simavr/cores/sim_megax4.h index 4b6c463..5ff74fe 100644 --- a/simavr/cores/sim_megax4.h +++ b/simavr/cores/sim_megax4.h @@ -119,6 +119,7 @@ const struct mcu_t SIM_CORENAME = { .name = '0', .r_udr = UDR0, + .u2x = AVR_IO_REGBIT(UCSR0A, U2X0), .txen = AVR_IO_REGBIT(UCSR0B, TXEN0), .rxen = AVR_IO_REGBIT(UCSR0B, RXEN0), .ucsz = AVR_IO_REGBITS(UCSR0C, UCSZ00, 0x3), // 2 bits @@ -150,6 +151,7 @@ const struct mcu_t SIM_CORENAME = { .name = '1', .r_udr = UDR1, + .u2x = AVR_IO_REGBIT(UCSR1A, U2X1), .txen = AVR_IO_REGBIT(UCSR1B, TXEN1), .rxen = AVR_IO_REGBIT(UCSR1B, RXEN1), .ucsz = AVR_IO_REGBITS(UCSR1C, UCSZ10, 0x3), // 2 bits diff --git a/simavr/sim/avr_uart.c b/simavr/sim/avr_uart.c index 9911787..c42edaf 100644 --- a/simavr/sim/avr_uart.c +++ b/simavr/sim/avr_uart.c @@ -192,9 +192,8 @@ static void avr_uart_write(struct avr_t * avr, avr_io_addr_t addr, uint8_t v, vo //uint8_t udre = avr_regbit_get(avr, p->udrc.raised); uint8_t txc = avr_regbit_get(avr, p->txc.raised); - // no need to write this value in here, only the - // interrupt flags need clearing! - // avr_core_watch_write(avr, addr, v); + // required for u2x (double uart transmission speed) + avr_core_watch_write(avr, addr, v); //avr_clear_interrupt_if(avr, &p->udrc, udre); avr_clear_interrupt_if(avr, &p->txc, txc); -- 2.39.5