[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] Fixes two bugs with the Stelaris ADC.
From: |
Logan Gunthorpe |
Subject: |
[Qemu-devel] [PATCH 2/3] Fixes two bugs with the Stelaris ADC. |
Date: |
Sun, 12 Jul 2009 23:10:20 -0600 |
- The adc gets double-triggered because the stelaris_adc_trigger function
does not ignore calls when the level is low.
- In the stelaris_adc_fifo_read function there is a slight bug that fails
to set the empty flag when the tail pointer overflows back to zero.
---
hw/stellaris.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/stellaris.c b/hw/stellaris.c
index 5f44bff..4fadeec 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -934,7 +934,7 @@ static uint32_t stellaris_adc_fifo_read(stellaris_adc_state
*s, int n)
} else {
s->fifo[n].state = (s->fifo[n].state & ~0xf) | ((tail + 1) & 0xf);
s->fifo[n].state &= ~STELLARIS_ADC_FIFO_FULL;
- if (tail + 1 == ((s->fifo[n].state >> 4) & 0xf))
+ if (((tail + 1) & 0xf) == ((s->fifo[n].state >> 4) & 0xf))
s->fifo[n].state |= STELLARIS_ADC_FIFO_EMPTY;
}
return s->fifo[n].data[tail];
@@ -976,6 +976,8 @@ static void stellaris_adc_trigger(void *opaque, int irq,
int level)
stellaris_adc_state *s = (stellaris_adc_state *)opaque;
int n;
+ if (!level) return;
+
for (n = 0; n < 4; n++) {
if ((s->actss & (1 << n)) == 0) {
continue;
--
1.5.6.5