[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH rc2 12/25] hw/timer: Add limited support for Atmel 16 bit tim
From: |
Thomas Huth |
Subject: |
Re: [PATCH rc2 12/25] hw/timer: Add limited support for Atmel 16 bit timer peripheral |
Date: |
Fri, 24 Jan 2020 09:16:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 24/01/2020 01.51, Philippe Mathieu-Daudé wrote:
> From: Michael Rolnik <address@hidden>
>
> These were designed to facilitate testing but should provide enough
> function to be useful in other contexts. Only a subset of the functions
> of each peripheral is implemented, mainly due to the lack of a standard
> way to handle electrical connections (like GPIO pins).
>
> Signed-off-by: Sarah Harris <address@hidden>
> Message-Id: <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> [rth: Squash info mtree fixes and a file rename from f4bug, which was:]
> Suggested-by: Aleksandar Markovic <address@hidden>
> Signed-off-by: Richard Henderson <address@hidden>
> [PMD: Use qemu_log_mask(LOG_UNIMP), replace goto by return]
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> rc2: Use qemu_log_mask(LOG_UNIMP), replace goto by return (thuth)
> ---
> include/hw/timer/atmel_timer16.h | 94 +++++
> hw/timer/atmel_timer16.c | 605 +++++++++++++++++++++++++++++++
> hw/timer/Kconfig | 3 +
> hw/timer/Makefile.objs | 2 +
> 4 files changed, 704 insertions(+)
> create mode 100644 include/hw/timer/atmel_timer16.h
> create mode 100644 hw/timer/atmel_timer16.c
[...]
> +static void avr_timer16_clksrc_update(AVRTimer16State *t16)
> +{
> + uint16_t divider = 0;
> + switch (CLKSRC(t16)) {
> + case T16_CLKSRC_EXT_FALLING:
> + case T16_CLKSRC_EXT_RISING:
> + qemu_log_mask(LOG_UNIMP, "%s: external clock source unsupported\n",
> + __func__);
> + break;
> + case T16_CLKSRC_STOPPED:
> + break;
> + case T16_CLKSRC_DIV1:
> + divider = 1;
> + break;
> + case T16_CLKSRC_DIV8:
> + divider = 8;
> + break;
> + case T16_CLKSRC_DIV64:
> + divider = 64;
> + break;
> + case T16_CLKSRC_DIV256:
> + divider = 256;
> + break;
> + case T16_CLKSRC_DIV1024:
> + divider = 1024;
> + break;
> + default:
> + break;
> + }
> + if (divider) {
> + t16->freq_hz = t16->cpu_freq_hz / divider;
> + t16->period_ns = NANOSECONDS_PER_SECOND / t16->freq_hz;
> + DB_PRINT("Timer frequency %" PRIu64 " hz, period %" PRIu64 " ns (%f
> s)",
> + t16->freq_hz, t16->period_ns, 1 / (double)t16->freq_hz);
> + }
> + return;
> +}
You can remove the "return;" at the end of the function now, too.
Thomas
- [PATCH rc2 09/25] target/avr: Add instruction translation - CPU main translation function, (continued)
- [PATCH rc2 09/25] target/avr: Add instruction translation - CPU main translation function, Philippe Mathieu-Daudé, 2020/01/23
- [PATCH rc2 10/25] target/avr: Add instruction disassembly function, Philippe Mathieu-Daudé, 2020/01/23
- [PATCH rc2 06/25] target/avr: Add instruction translation - Data Transfer Instructions, Philippe Mathieu-Daudé, 2020/01/23
- [PATCH rc2 11/25] hw/char: Add limited support for Atmel USART peripheral, Philippe Mathieu-Daudé, 2020/01/23
- [PATCH rc2 13/25] hw/misc: Add Atmel power device, Philippe Mathieu-Daudé, 2020/01/23
- [PATCH rc2 14/25] target/avr: Add section about AVR into QEMU documentation, Philippe Mathieu-Daudé, 2020/01/23
- [PATCH rc2 15/25] target/avr: Register AVR support with the rest of QEMU, Philippe Mathieu-Daudé, 2020/01/23
- [PATCH rc2 12/25] hw/timer: Add limited support for Atmel 16 bit timer peripheral, Philippe Mathieu-Daudé, 2020/01/23
- Re: [PATCH rc2 12/25] hw/timer: Add limited support for Atmel 16 bit timer peripheral, Philippe Mathieu-Daudé, 2020/01/24
[PATCH rc2 16/25] target/avr: Add machine none test, Philippe Mathieu-Daudé, 2020/01/23
[PATCH rc2 17/25] target/avr: Update MAINTAINERS file, Philippe Mathieu-Daudé, 2020/01/23