[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/5] hw/char/avr_usart: Trace baudrate changes
From: |
Richard Henderson |
Subject: |
Re: [PATCH 5/5] hw/char/avr_usart: Trace baudrate changes |
Date: |
Fri, 14 Aug 2020 10:33:20 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 8/14/20 9:39 AM, Philippe Mathieu-Daudé wrote:
> +static void avr_usart_update_baudrate(AVRUsartState *s)
> +{
> + unsigned baudrate = (clock_get_hz(s->clkin) / USART_CLOCK_DIVISOR)
> + / (((s->brrh << 8) | s->brrl) + 1);
> +
> + trace_avr_usart_update_baudrate((s->brrh << 8) | s->brrl, baudrate);
Would you pull that brrh|brrl expression out and give it a name?
I do wonder if one division would be better, e.g.
baudrate = clock_get_hz / (DIVISOR * (regval + 1))
r~
- [PATCH 0/5] hw/avr: Start using the Clock API, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 1/5] hw/avr/atmega: Introduce the I/O clock, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 2/5] hw/timer/avr_timer16: Use the Clock API, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 3/5] hw/char/avr_usart: Restrict register definitions to source, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 4/5] hw/char/avr_usart: Use the Clock API, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 5/5] hw/char/avr_usart: Trace baudrate changes, Philippe Mathieu-Daudé, 2020/08/14
- Re: [PATCH 5/5] hw/char/avr_usart: Trace baudrate changes,
Richard Henderson <=
- Re: [PATCH 0/5] hw/avr: Start using the Clock API, Michael Rolnik, 2020/08/26