Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuXbc-0007P7-RN for qemu-devel@nongnu.org; Fri, 09 May 2008 14:46:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuXba-0007Nr-4l for qemu-devel@nongnu.org; Fri, 09 May 2008 14:46:08 -0400 Received: from [199.232.76.173] (port=53877 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuXbZ-0007No-SH for qemu-devel@nongnu.org; Fri, 09 May 2008 14:46:05 -0400 Received: from savannah.gnu.org ([199.232.41.3]:52962 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JuXbZ-0007vY-E0 for qemu-devel@nongnu.org; Fri, 09 May 2008 14:46:05 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1JuXbY-0004Tb-W8 for qemu-devel@nongnu.org; Fri, 09 May 2008 18:46:05 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1JuXbY-0004TV-PF for qemu-devel@nongnu.org; Fri, 09 May 2008 18:46:04 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Fri, 09 May 2008 18:46:04 +0000 Subject: [Qemu-devel] [4397] SH4 serial controler improvements Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4397 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4397 Author: aurel32 Date: 2008-05-09 18:46:04 +0000 (Fri, 09 May 2008) Log Message: ----------- SH4 serial controler improvements (Shin-ichiro KAWASAKI) Modified Paths: -------------- trunk/hw/sh.h trunk/hw/sh7750.c trunk/hw/sh_serial.c Modified: trunk/hw/sh.h =================================================================== --- trunk/hw/sh.h 2008-05-09 18:45:55 UTC (rev 4396) +++ trunk/hw/sh.h 2008-05-09 18:46:04 UTC (rev 4397) @@ -35,7 +35,12 @@ /* sh_serial.c */ #define SH_SERIAL_FEAT_SCIF (1 << 0) void sh_serial_init (target_phys_addr_t base, int feat, - uint32_t freq, CharDriverState *chr); + 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); /* tc58128.c */ int tc58128_init(struct SH7750State *s, char *zone1, char *zone2); Modified: trunk/hw/sh7750.c =================================================================== --- trunk/hw/sh7750.c 2008-05-09 18:45:55 UTC (rev 4396) +++ trunk/hw/sh7750.c 2008-05-09 18:46:04 UTC (rev 4397) @@ -556,9 +556,19 @@ cpu->intc_handle = &s->intc; - sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0]); + 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), + NULL); sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF, - s->periph_freq, serial_hds[1]); + 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), + NULL, + sh_intc_source(&s->intc, SCIF_BRI)); tmu012_init(0x1fd80000, TMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK, Modified: trunk/hw/sh_serial.c =================================================================== --- trunk/hw/sh_serial.c 2008-05-09 18:45:55 UTC (rev 4396) +++ trunk/hw/sh_serial.c 2008-05-09 18:46:04 UTC (rev 4397) @@ -55,6 +55,12 @@ int flags; CharDriverState *chr; + + struct intc_source *eri; + struct intc_source *rxi; + struct intc_source *txi; + struct intc_source *tei; + struct intc_source *bri; } sh_serial_state; static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val) @@ -74,9 +80,15 @@ s->brr = val; return; case 0x08: /* SCR */ - s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfb : 0xff); + s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfa : 0xff); 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); + } return; case 0x0c: /* FTDR / TDR */ if (s->chr) { @@ -159,6 +171,12 @@ #endif if (s->feat & SH_SERIAL_FEAT_SCIF) { switch(offs) { + case 0x00: /* SMR */ + ret = s->smr; + break; + case 0x08: /* SCR */ + ret = s->scr; + break; case 0x10: /* FSR */ ret = 0; if (s->flags & SH_SERIAL_FLAG_TEND) @@ -278,7 +296,12 @@ }; void sh_serial_init (target_phys_addr_t base, int feat, - uint32_t freq, CharDriverState *chr) + 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) { sh_serial_state *s; int s_io_memory; @@ -314,4 +337,10 @@ if (chr) qemu_chr_add_handlers(chr, sh_serial_can_receive1, sh_serial_receive1, sh_serial_event, s); + + s->eri = eri_source; + s->rxi = rxi_source; + s->txi = txi_source; + s->tei = tei_source; + s->bri = bri_source; }