[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/8] hw/audio/es1370: reset current sample counter
From: |
marcandre . lureau |
Subject: |
[PULL 1/8] hw/audio/es1370: reset current sample counter |
Date: |
Wed, 11 Oct 2023 10:30:54 +0400 |
From: Volker Rümelin <vr_qemu@t-online.de>
Reset the current sample counter when writing the Channel Sample
Count Register. The Linux ens1370 driver and the AROS sb128
driver expect the current sample counter counts down from sample
count to 0 after a write to the Channel Sample Count Register.
Currently the current sample counter starts from 0 after a reset
or the last count when the counter was stopped.
The current sample counter is used to raise an interrupt whenever
a complete buffer was transferred. When the counter starts with a
value lower than the reload value, the interrupt triggeres before
the buffer was completly transferred. This may lead to corrupted
audio streams.
Tested-by: Rene Engel <ReneEngel80@emailn.de>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <20230917065813.6692-1-vr_qemu@t-online.de>
---
hw/audio/es1370.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 90f73d4c23..0567721eb7 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -502,7 +502,7 @@ static void es1370_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
case ES1370_REG_DAC2_SCOUNT:
case ES1370_REG_ADC_SCOUNT:
d += (addr - ES1370_REG_DAC1_SCOUNT) >> 2;
- d->scount = (val & 0xffff) | (d->scount & ~0xffff);
+ d->scount = (val & 0xffff) << 16 | (val & 0xffff);
ldebug ("chan %td CURR_SAMP_CT %d, SAMP_CT %d\n",
d - &s->chan[0], val >> 16, (val & 0xffff));
break;
--
2.41.0
- [PULL 0/8] Audio patches, marcandre . lureau, 2023/10/11
- [PULL 1/8] hw/audio/es1370: reset current sample counter,
marcandre . lureau <=
- [PULL 2/8] hw/audio/es1370: replace bit-rotted code with tracepoints, marcandre . lureau, 2023/10/11
- [PULL 3/8] hw/audio/es1370: remove unused dolog macro, marcandre . lureau, 2023/10/11
- [PULL 4/8] hw/audio/es1370: remove #ifdef ES1370_DEBUG to avoid bit rot, marcandre . lureau, 2023/10/11
- [PULL 8/8] hw/audio/es1370: trace lost interrupts, marcandre . lureau, 2023/10/11
- [PULL 5/8] hw/audio/es1370: remove #ifdef ES1370_VERBOSE to avoid bit rot, marcandre . lureau, 2023/10/11
- [PULL 7/8] hw/audio/es1370: change variable type and name, marcandre . lureau, 2023/10/11
- [PULL 6/8] hw/audio/es1370: block structure coding style fixes, marcandre . lureau, 2023/10/11
- Re: [PULL 0/8] Audio patches, Stefan Hajnoczi, 2023/10/11