[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 03/22] cuda: convert ADB autopoll timer from ns to ms
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 03/22] cuda: convert ADB autopoll timer from ns to ms |
Date: |
Sun, 14 Jun 2020 18:50:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 6/14/20 4:28 PM, Mark Cave-Ayland wrote:
> This is in preparation for consolidating all of the ADB autopoll management
> in one place.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/misc/macio/cuda.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index e0cc0aac5d..a407f2abc8 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -208,8 +208,9 @@ static void cuda_adb_poll(void *opaque)
> obuf[1] = 0x40; /* polled data */
> cuda_send_packet_to_host(s, obuf, olen + 2);
> }
> - timer_mod(s->adb_poll_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> - (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms)));
> +
> + timer_mod(s->adb_poll_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
> + s->autopoll_rate_ms);
> }
>
> /* description of commands */
> @@ -236,8 +237,8 @@ static bool cuda_cmd_autopoll(CUDAState *s,
> s->autopoll = autopoll;
> if (autopoll) {
> timer_mod(s->adb_poll_timer,
> - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> - (NANOSECONDS_PER_SECOND / (1000 /
> s->autopoll_rate_ms)));
> + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
> + s->autopoll_rate_ms);
> } else {
> timer_del(s->adb_poll_timer);
> }
> @@ -262,8 +263,8 @@ static bool cuda_cmd_set_autorate(CUDAState *s,
> s->autopoll_rate_ms = in_data[0];
> if (s->autopoll) {
> timer_mod(s->adb_poll_timer,
> - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> - (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms)));
> + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
> + s->autopoll_rate_ms);
> }
> return true;
> }
> @@ -539,7 +540,7 @@ static void cuda_realize(DeviceState *dev, Error **errp)
> s->sr_delay_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_set_sr_int, s);
> s->sr_delay_ns = 20 * SCALE_US;
>
> - s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
> + s->adb_poll_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
> s->adb_poll_mask = 0xffff;
> s->autopoll_rate_ms = 20;
> }
>
- [PATCH 00/22] ADB: fix autopoll issues and rework mac_via state machine, Mark Cave-Ayland, 2020/06/14
- [PATCH 01/22] adb: coding style update to fix checkpatch errors, Mark Cave-Ayland, 2020/06/14
- [PATCH 02/22] adb: fix adb-mouse read length and revert disable-reg3-direct-writes workaround, Mark Cave-Ayland, 2020/06/14
- [PATCH 03/22] cuda: convert ADB autopoll timer from ns to ms, Mark Cave-Ayland, 2020/06/14
- Re: [PATCH 03/22] cuda: convert ADB autopoll timer from ns to ms,
Philippe Mathieu-Daudé <=
- [PATCH 04/22] pmu: fix duplicate autopoll mask variable, Mark Cave-Ayland, 2020/06/14
- [PATCH 05/22] pmu: honour autopoll_rate_ms when rearming the ADB autopoll timer, Mark Cave-Ayland, 2020/06/14
- [PATCH 06/22] adb: introduce realize/unrealize and VMStateDescription for ADB bus, Mark Cave-Ayland, 2020/06/14
- [PATCH 07/22] adb: create autopoll variables directly within ADBBusState, Mark Cave-Ayland, 2020/06/14
- [PATCH 08/22] cuda: convert to use ADBBusState internal autopoll variables, Mark Cave-Ayland, 2020/06/14
- [PATCH 09/22] pmu: convert to use ADBBusState internal autopoll variables, Mark Cave-Ayland, 2020/06/14
- [PATCH 10/22] mac_via: convert to use ADBBusState internal autopoll variables, Mark Cave-Ayland, 2020/06/14
- [PATCH 11/22] adb: introduce new ADBDeviceHasData method to ADBDeviceClass, Mark Cave-Ayland, 2020/06/14
- [PATCH 12/22] adb: keep track of devices with pending data, Mark Cave-Ayland, 2020/06/14