From: bsekisser Date: Wed, 20 Nov 2013 16:37:49 +0000 (-0500) Subject: avr_uart.c: fix to prevent overwriting readonly flags when setting u2x. X-Git-Tag: v1.2~55^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=a29ada2d37fed04f6c4f568d99f3538f29fbc8f5;p=sx%2Fsimavr.git avr_uart.c: fix to prevent overwriting readonly flags when setting u2x. modified: simavr/sim/avr_uart.c --- diff --git a/simavr/sim/avr_uart.c b/simavr/sim/avr_uart.c index 149d8b9..9eff694 100644 --- a/simavr/sim/avr_uart.c +++ b/simavr/sim/avr_uart.c @@ -192,8 +192,11 @@ 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); - // required for u2x (double uart transmission speed) - avr_core_watch_write(avr, addr, v); + // setting u2x (double uart transmission speed) may also involve + // overwriting read only flags, therefore set u2x explicitly. + if(addr == p->u2x.reg) { + avr_regbit_setto_raw(avr, p->u2x, v); + } //avr_clear_interrupt_if(avr, &p->udrc, udre); avr_clear_interrupt_if(avr, &p->txc, txc);