qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@ece.ualberta.ca>
To: qemu-devel@nongnu.org
Cc: Logan Gunthorpe <logang@ece.ualberta.ca>
Subject: [Qemu-devel] [PATCH 2/3] Fixes two bugs with the Stelaris ADC.
Date: Sun, 12 Jul 2009 23:10:20 -0600	[thread overview]
Message-ID: <1247461821-20621-3-git-send-email-logang@ece.ualberta.ca> (raw)
In-Reply-To: <1247461821-20621-1-git-send-email-logang@ece.ualberta.ca>

- 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

  parent reply	other threads:[~2009-07-13  5:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13  5:10 [Qemu-devel] [PATCH 0/3] Small patches related to Stelaris/ARMv7 support Logan Gunthorpe
2009-07-13  5:10 ` [Qemu-devel] [PATCH 1/3] Minor bugfixes/improvements to arm_gic Logan Gunthorpe
2009-07-13  5:10 ` Logan Gunthorpe [this message]
2009-07-13  5:10 ` [Qemu-devel] [PATCH 3/3] Stelaris 16-bit timer mode Logan Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247461821-20621-3-git-send-email-logang@ece.ualberta.ca \
    --to=logang@ece.ualberta.ca \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).