qemu-devel
[Top][All Lists]
Advanced

[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~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]