Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/dreamcast/dev don't use tsleep() in interrupt context.



details:   https://anonhg.NetBSD.org/src/rev/327b60dd7482
branches:  trunk
changeset: 451110:327b60dd7482
user:      ryo <ryo%NetBSD.org@localhost>
date:      Mon May 06 17:12:50 2019 +0000

description:
don't use tsleep() in interrupt context.
when the audio starts playing, initialization is performed on the aica arm driver side.

diffstat:

 sys/arch/dreamcast/dev/g2/aica.c                   |    15 +-
 sys/arch/dreamcast/dev/microcode/Makefile          |     4 +-
 sys/arch/dreamcast/dev/microcode/aica_arm.c        |     7 +-
 sys/arch/dreamcast/dev/microcode/aica_arm_locore.S |     3 +-
 sys/arch/dreamcast/dev/microcode/aica_armcode.h    |  1889 +++++++++++--------
 5 files changed, 1111 insertions(+), 807 deletions(-)

diffs (truncated from 2008 to 300 lines):

diff -r b06ea88877a8 -r 327b60dd7482 sys/arch/dreamcast/dev/g2/aica.c
--- a/sys/arch/dreamcast/dev/g2/aica.c  Mon May 06 11:59:46 2019 +0000
+++ b/sys/arch/dreamcast/dev/g2/aica.c  Mon May 06 17:12:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aica.c,v 1.25 2019/03/16 12:09:56 isaki Exp $  */
+/*     $NetBSD: aica.c,v 1.26 2019/05/06 17:12:50 ryo Exp $    */
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo <ryo%misakimix.org@localhost>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.25 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.26 2019/05/06 17:12:50 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -616,8 +616,6 @@
        struct aica_softc *sc;
 
        sc = addr;
-       aica_command(sc, AICA_COMMAND_INIT);
-       tsleep(aica_trigger_output, PWAIT, "aicawait", hz / 20);
 
        sc->sc_buffer_start = sc->sc_buffer = start;
        sc->sc_buffer_end = end;
@@ -627,9 +625,12 @@
        sc->sc_intr = intr;
        sc->sc_intr_arg = arg;
 
-       /* fill buffers in advance */
-       aica_intr(sc);
-       aica_intr(sc);
+       /*
+        * The aica arm side driver uses a double buffer to play sounds.
+        * we need to fill two buffers before playing.
+        */
+       aica_fillbuffer(sc);
+       aica_fillbuffer(sc);
 
        /* ...and start playing */
        aica_play(sc, blksize / sc->sc_channels, sc->sc_channels, sc->sc_rate,
diff -r b06ea88877a8 -r 327b60dd7482 sys/arch/dreamcast/dev/microcode/Makefile
--- a/sys/arch/dreamcast/dev/microcode/Makefile Mon May 06 11:59:46 2019 +0000
+++ b/sys/arch/dreamcast/dev/microcode/Makefile Mon May 06 17:12:50 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2006/03/04 02:00:16 uwe Exp $
+#      $NetBSD: Makefile,v 1.5 2019/05/06 17:12:50 ryo Exp $
 
 S      = ${.CURDIR}/../../../..
 
@@ -6,7 +6,7 @@
 OBJCOPY        = ${TOOLDIR}/bin/arm--netbsdelf-objcopy
 
 CFLAGS = -W -Wall -mlittle-endian
-CFLAGS += -O3 -mcpu=arm7tdmi
+CFLAGS += -O3 -mcpu=arm7
 CFLAGS += -fomit-frame-pointer -funroll-loops -finline-functions
 CFLAGS += -I${S}
 #AFLAGS        = -mcpu=arm7tdmi -mthumb -mthumb-interwork -mapcs-32
diff -r b06ea88877a8 -r 327b60dd7482 sys/arch/dreamcast/dev/microcode/aica_arm.c
--- a/sys/arch/dreamcast/dev/microcode/aica_arm.c       Mon May 06 11:59:46 2019 +0000
+++ b/sys/arch/dreamcast/dev/microcode/aica_arm.c       Mon May 06 17:12:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aica_arm.c,v 1.5 2009/03/18 10:22:27 cegger Exp $      */
+/*     $NetBSD: aica_arm.c,v 1.6 2019/05/06 17:12:50 ryo Exp $ */
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo <ryo%misakimix.org@localhost>
@@ -267,8 +267,13 @@
                        break;
 
                case AICA_COMMAND_PLAY:
+                       aica_stop();
+                       play_state = 0;
+
                        blksize = aicacmd->blocksize;
 
+                       REG_WRITE_4(0x28b4, 0x0020);    /* INT Enable to SH4 */
+
                        CH_WRITE_4(0, 0x00, 0x8000);
                        CH_WRITE_4(1, 0x00, 0x8000);
 
diff -r b06ea88877a8 -r 327b60dd7482 sys/arch/dreamcast/dev/microcode/aica_arm_locore.S
--- a/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S        Mon May 06 11:59:46 2019 +0000
+++ b/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S        Mon May 06 17:12:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aica_arm_locore.S,v 1.2 2005/12/11 12:17:06 christos Exp $     */
+/*     $NetBSD: aica_arm_locore.S,v 1.3 2019/05/06 17:12:50 ryo Exp $  */
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo <ryo%misakimix.org@localhost>
@@ -29,7 +29,6 @@
  */
 
        .text
-       .globl
 
        b       exp_reset
        b       exp_undef
diff -r b06ea88877a8 -r 327b60dd7482 sys/arch/dreamcast/dev/microcode/aica_armcode.h
--- a/sys/arch/dreamcast/dev/microcode/aica_armcode.h   Mon May 06 11:59:46 2019 +0000
+++ b/sys/arch/dreamcast/dev/microcode/aica_armcode.h   Mon May 06 17:12:50 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aica_armcode.h,v 1.3 2005/12/11 12:17:06 christos Exp $ */
+/* $NetBSD: aica_armcode.h,v 1.4 2019/05/06 17:12:50 ryo Exp $ */
 static uint32_t aica_armcode[] = {
  /* 0000 */    0xea000006, 
  /* 0004 */    0xea000010, 
@@ -13,804 +13,1103 @@
  /* 0028 */    0xe3c00080, 
  /* 002c */    0xe3c00040, 
  /* 0030 */    0xe129f000, 
- /* 0034 */    0xeb0000ac, 
+ /* 0034 */    0xeb0001b6, 
  /* 0038 */    0xeafffffe, 
  /* 003c */    0xe24ef004, 
  /* 0040 */    0xe24ef008, 
  /* 0044 */    0xe24ef004, 
  /* 0048 */    0xe1a0f00e, 
  /* 004c */    0xe1a0f00e, 
- /* 0050 */    0xe92d40f0, 
- /* 0054 */    0xe3a01502, 
- /* 0058 */    0xe2812b0a, 
- /* 005c */    0xe3a03000, 
- /* 0060 */    0xe1a04003, 
- /* 0064 */    0xe1a0e001, 
- /* 0068 */    0xe3a06004, 
- /* 006c */    0xe0866001, 
- /* 0070 */    0xe1a0c004, 
- /* 0074 */    0xe3a05010, 
- /* 0078 */    0xe0855001, 
- /* 007c */    0xe3a07024, 
- /* 0080 */    0xe24dd004, 
- /* 0084 */    0xe5823000, 
- /* 0088 */    0xe1a00384, 
- /* 008c */    0xe3a03902, 
- /* 0090 */    0xe780300e, 
- /* 0094 */    0xe780c006, 
- /* 0098 */    0xe3a03008, 
- /* 009c */    0xe2833502, 
- /* 00a0 */    0xe780c003, 
- /* 00a4 */    0xe3a0200c, 
- /* 00a8 */    0xe2822502, 
- /* 00ac */    0xe780c002, 
- /* 00b0 */    0xe3a0101f, 
- /* 00b4 */    0xe7801005, 
- /* 00b8 */    0xe3a03014, 
- /* 00bc */    0xe2833502, 
- /* 00c0 */    0xe7801003, 
- /* 00c4 */    0xe3a02018, 
- /* 00c8 */    0xe2822502, 
- /* 00cc */    0xe780c002, 
- /* 00d0 */    0xe3a0301c, 
- /* 00d4 */    0xe2833502, 
- /* 00d8 */    0xe780c003, 
- /* 00dc */    0xe3a02020, 
- /* 00e0 */    0xe2822502, 
- /* 00e4 */    0xe780c002, 
- /* 00e8 */    0xe2871502, 
- /* 00ec */    0xe780c001, 
- /* 00f0 */    0xe3a03028, 
- /* 00f4 */    0xe2833502, 
- /* 00f8 */    0xe7807003, 
- /* 00fc */    0xe3a0202c, 
- /* 0100 */    0xe2822502, 
- /* 0104 */    0xe780c002, 
- /* 0108 */    0xe3a03030, 
- /* 010c */    0xe2833502, 
- /* 0110 */    0xe780c003, 
- /* 0114 */    0xe3a02034, 
- /* 0118 */    0xe2822502, 
- /* 011c */    0xe780c002, 
- /* 0120 */    0xe3a03038, 
- /* 0124 */    0xe2833502, 
- /* 0128 */    0xe780c003, 
- /* 012c */    0xe3a0203c, 
- /* 0130 */    0xe2822502, 
- /* 0134 */    0xe780c002, 
- /* 0138 */    0xe3a03040, 
- /* 013c */    0xe2833502, 
- /* 0140 */    0xe780c003, 
- /* 0144 */    0xe3a02044, 
- /* 0148 */    0xe2822502, 
- /* 014c */    0xe780c002, 
- /* 0150 */    0xe3803048, 
- /* 0154 */    0xe783c00e, 
- /* 0158 */    0xe380204c, 
- /* 015c */    0xe782c00e, 
- /* 0160 */    0xe3803050, 
- /* 0164 */    0xe783c00e, 
- /* 0168 */    0xe3802054, 
- /* 016c */    0xe782c00e, 
- /* 0170 */    0xe3803058, 
- /* 0174 */    0xe783c00e, 
- /* 0178 */    0xe380205c, 
- /* 017c */    0xe782c00e, 
- /* 0180 */    0xe3803060, 
- /* 0184 */    0xe783c00e, 
- /* 0188 */    0xe3802064, 
- /* 018c */    0xe782c00e, 
- /* 0190 */    0xe3803068, 
- /* 0194 */    0xe783c00e, 
- /* 0198 */    0xe380206c, 
- /* 019c */    0xe782c00e, 
- /* 01a0 */    0xe3803070, 
- /* 01a4 */    0xe783c00e, 
- /* 01a8 */    0xe3802074, 
- /* 01ac */    0xe782c00e, 
- /* 01b0 */    0xe3803078, 
- /* 01b4 */    0xe783c00e, 
- /* 01b8 */    0xe380007c, 
- /* 01bc */    0xe780c00e, 
- /* 01c0 */    0xe2844001, 
- /* 01c4 */    0xe354003f, 
- /* 01c8 */    0xdaffffae, 
- /* 01cc */    0xe3a03502, 
- /* 01d0 */    0xe2833b0a, 
- /* 01d4 */    0xe3a0200f, 
- /* 01d8 */    0xe5832000, 
- /* 01dc */    0xe28dd004, 
- /* 01e0 */    0xe8bd80f0, 
- /* 01e4 */    0xe92d4010, 
- /* 01e8 */    0xe3a0c856, 
- /* 01ec */    0xe28ccc22, 
- /* 01f0 */    0xe3a04007, 
- /* 01f4 */    0xe150000c, 
- /* 01f8 */    0x2a000009, 
- /* 01fc */    0xe1a0c0ac, 
- /* 0200 */    0xe2444001, 
- /* 0204 */    0xe3740008, 
- /* 0208 */    0xb3a03000, 
- /* 020c */    0xa3a03001, 
- /* 0210 */    0xe150000c, 
- /* 0214 */    0x23a03000, 
- /* 0218 */    0x32033001, 
- /* 021c */    0xe3530000, 
- /* 0220 */    0x1afffff5, 
- /* 0224 */    0xe150000c, 
- /* 0228 */    0x31a00584, 
- /* 022c */    0x32000b3e, 
- /* 0230 */    0x38bd8010, 
- /* 0234 */    0xe06c0000, 
- /* 0238 */    0xe1a030ac, 
- /* 023c */    0xe0833500, 
- /* 0240 */    0xe3a0e000, 
- /* 0244 */    0xe153000c, 
- /* 0248 */    0x3a000003, 
- /* 024c */    0xe06c3003, 
- /* 0250 */    0xe28ee001, 
- /* 0254 */    0xe153000c, 
- /* 0258 */    0x2afffffb, 
- /* 025c */    0xe35e0b01, 
- /* 0260 */    0x02844001, 
- /* 0264 */    0x03a0e000, 
- /* 0268 */    0x0a00001b, 
- /* 026c */    0xe0010c9e, 
- /* 0270 */    0xe3a02fff, 
- /* 0274 */    0xe2822002, 
- /* 0278 */    0xe1500521, 
- /* 027c */    0x93a03000, 
- /* 0280 */    0x83a03001, 
- /* 0284 */    0xe15e0002, 
- /* 0288 */    0x83a03000, 
- /* 028c */    0x92033001, 
- /* 0290 */    0xe3530000, 
- /* 0294 */    0x0a000004, 
- /* 0298 */    0xe28e2001, 
- /* 029c */    0xe0030c92, 
- /* 02a0 */    0xe1500523, 
- /* 02a4 */    0x01a0e002, 
- /* 02a8 */    0x0a00000b, 
- /* 02ac */    0xe1500521, 
- /* 02b0 */    0x23a03000, 
- /* 02b4 */    0x33a03001, 
- /* 02b8 */    0xe35e0000, 
- /* 02bc */    0x03a03000, 
- /* 02c0 */    0x12033001, 
- /* 02c4 */    0xe3530000, 
- /* 02c8 */    0x0a000003, 
- /* 02cc */    0xe24e2001, 
- /* 02d0 */    0xe0030c92, 
- /* 02d4 */    0xe1500523, 
- /* 02d8 */    0x01a0e002, 
- /* 02dc */    0xe1a00584, 
- /* 02e0 */    0xe2000b3e, 
- /* 02e4 */    0xe080000e, 
- /* 02e8 */    0xe8bd8010, 
- /* 02ec */    0xe1a0c00d, 
- /* 02f0 */    0xe92ddff0, 
- /* 02f4 */    0xe24cb004, 
- /* 02f8 */    0xe24dd00c, 
- /* 02fc */    0xebffff53, 
- /* 0300 */    0xe3a03da2, 
- /* 0304 */    0xe2833034, 
- /* 0308 */    0xe2833502, 
- /* 030c */    0xe3a02020, 
- /* 0310 */    0xe5832000, 
- /* 0314 */    0xe3a0a000, 



Home | Main Index | Thread Index | Old Index