All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5769] SH4: Switch serial emulation to qemu_irq
Date: Fri, 21 Nov 2008 21:06:51 +0000	[thread overview]
Message-ID: <E1L3dDH-0000YW-Mk@cvs.savannah.gnu.org> (raw)

Revision: 5769
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5769
Author:   aurel32
Date:     2008-11-21 21:06:51 +0000 (Fri, 21 Nov 2008)

Log Message:
-----------
SH4: Switch serial emulation to qemu_irq

This patches makes SH serial emulation use qemu_irq in its interface.

        * hw/sh.h (sh_serial_init): Take qemu_irq, not intc_source.
        * hw/sh7750.c (sh7750_init): Adjust.
        * hw/sh_intc.c (sh_intc_set_irq): Don't assert or deassert
        irq more than once.
        * hw/sh_serial.c (sh_serial_state): Use qemu_irq, not intc_source.
        (sh_serial_clear_fifo, sh_serial_ioport_write)
        (sh_serial_receive_byte): Adjust.
        (sh_serial_init): Take qemu_irq, not intc_source.

(Vladimir Prus)

Modified Paths:
--------------
    trunk/hw/sh.h
    trunk/hw/sh7750.c
    trunk/hw/sh_intc.c
    trunk/hw/sh_serial.c

Modified: trunk/hw/sh.h
===================================================================
--- trunk/hw/sh.h	2008-11-21 21:06:42 UTC (rev 5768)
+++ trunk/hw/sh.h	2008-11-21 21:06:51 UTC (rev 5769)
@@ -36,11 +36,11 @@
 #define SH_SERIAL_FEAT_SCIF (1 << 0)
 void sh_serial_init (target_phys_addr_t base, int feat,
 		     uint32_t freq, CharDriverState *chr,
-		     struct intc_source *eri_source,
-		     struct intc_source *rxi_source,
-		     struct intc_source *txi_source,
-		     struct intc_source *tei_source,
-		     struct intc_source *bri_source);
+		     qemu_irq eri_source,
+		     qemu_irq rxi_source,
+		     qemu_irq txi_source,
+		     qemu_irq tei_source,
+		     qemu_irq bri_source);
 
 /* tc58128.c */
 int tc58128_init(struct SH7750State *s, const char *zone1, const char *zone2);

Modified: trunk/hw/sh7750.c
===================================================================
--- trunk/hw/sh7750.c	2008-11-21 21:06:42 UTC (rev 5768)
+++ trunk/hw/sh7750.c	2008-11-21 21:06:51 UTC (rev 5769)
@@ -662,18 +662,18 @@
     cpu->intc_handle = &s->intc;
 
     sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0],
-		   sh_intc_source(&s->intc, SCI1_ERI),
-		   sh_intc_source(&s->intc, SCI1_RXI),
-		   sh_intc_source(&s->intc, SCI1_TXI),
-		   sh_intc_source(&s->intc, SCI1_TEI),
+		   s->intc.irqs[SCI1_ERI],
+		   s->intc.irqs[SCI1_RXI],
+		   s->intc.irqs[SCI1_TXI],
+		   s->intc.irqs[SCI1_TEI],
 		   NULL);
     sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF,
 		   s->periph_freq, serial_hds[1],
-		   sh_intc_source(&s->intc, SCIF_ERI),
-		   sh_intc_source(&s->intc, SCIF_RXI),
-		   sh_intc_source(&s->intc, SCIF_TXI),
+		   s->intc.irqs[SCIF_ERI],
+		   s->intc.irqs[SCIF_RXI],
+		   s->intc.irqs[SCIF_TXI],
 		   NULL,
-		   sh_intc_source(&s->intc, SCIF_BRI));
+		   s->intc.irqs[SCIF_BRI]);
 
     tmu012_init(0x1fd80000,
 		TMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK,

Modified: trunk/hw/sh_intc.c
===================================================================
--- trunk/hw/sh_intc.c	2008-11-21 21:06:42 UTC (rev 5768)
+++ trunk/hw/sh_intc.c	2008-11-21 21:06:51 UTC (rev 5769)
@@ -78,7 +78,10 @@
   struct intc_desc *desc = opaque;
   struct intc_source *source = &(desc->sources[n]);
 
-  sh_intc_toggle_source(source, 0, level ? 1 : -1);  
+  if (level && !source->asserted)
+    sh_intc_toggle_source(source, 0, 1);
+  else if (!level && source->asserted)
+    sh_intc_toggle_source(source, 0, -1);
 }
 
 int sh_intc_get_pending_vector(struct intc_desc *desc, int imask)

Modified: trunk/hw/sh_serial.c
===================================================================
--- trunk/hw/sh_serial.c	2008-11-21 21:06:42 UTC (rev 5768)
+++ trunk/hw/sh_serial.c	2008-11-21 21:06:51 UTC (rev 5769)
@@ -61,11 +61,11 @@
 
     CharDriverState *chr;
 
-    struct intc_source *eri;
-    struct intc_source *rxi;
-    struct intc_source *txi;
-    struct intc_source *tei;
-    struct intc_source *bri;
+    qemu_irq eri;
+    qemu_irq rxi;
+    qemu_irq txi;
+    qemu_irq tei;
+    qemu_irq bri;
 } sh_serial_state;
 
 static void sh_serial_clear_fifo(sh_serial_state * s)
@@ -98,13 +98,10 @@
         if (!(val & (1 << 5)))
             s->flags |= SH_SERIAL_FLAG_TEND;
         if ((s->feat & SH_SERIAL_FEAT_SCIF) && s->txi) {
-            if ((val & (1 << 7)) && !(s->txi->asserted))
-                sh_intc_toggle_source(s->txi, 0, 1);
-            else if (!(val & (1 << 7)) && s->txi->asserted)
-                sh_intc_toggle_source(s->txi, 0, -1);
+	    qemu_set_irq(s->txi, val & (1 << 7));
         }
-        if (!(val & (1 << 6)) && s->rxi->asserted) {
-	    sh_intc_toggle_source(s->rxi, 0, -1);
+        if (!(val & (1 << 6))) {
+	    qemu_set_irq(s->rxi, 0);
         }
         return;
     case 0x0c: /* FTDR / TDR */
@@ -136,8 +133,8 @@
                 s->flags &= ~SH_SERIAL_FLAG_DR;
 
             if (!(val & (1 << 1)) || !(val & (1 << 0))) {
-                if (s->rxi && s->rxi->asserted) {
-                    sh_intc_toggle_source(s->rxi, 0, -1);
+                if (s->rxi) {
+                    qemu_set_irq(s->rxi, 0);
                 }
             }
             return;
@@ -309,7 +306,7 @@
             if (s->rx_cnt >= s->rtrg) {
                 s->flags |= SH_SERIAL_FLAG_RDF;
                 if (s->scr & (1 << 6) && s->rxi) {
-                    sh_intc_toggle_source(s->rxi, 0, 1);
+                    qemu_set_irq(s->rxi, 1);
                 }
             }
         }
@@ -370,11 +367,11 @@
 
 void sh_serial_init (target_phys_addr_t base, int feat,
 		     uint32_t freq, CharDriverState *chr,
-		     struct intc_source *eri_source,
-		     struct intc_source *rxi_source,
-		     struct intc_source *txi_source,
-		     struct intc_source *tei_source,
-		     struct intc_source *bri_source)
+		     qemu_irq eri_source,
+		     qemu_irq rxi_source,
+		     qemu_irq txi_source,
+		     qemu_irq tei_source,
+		     qemu_irq bri_source)
 {
     sh_serial_state *s;
     int s_io_memory;

                 reply	other threads:[~2008-11-21 21:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1L3dDH-0000YW-Mk@cvs.savannah.gnu.org \
    --to=aurelien@aurel32.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.