CVS commit: src/sys/arch/dreamcast/dev/g2

2021-02-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Feb  9 12:39:28 UTC 2021

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Update function name in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/dreamcast/dev/g2/aica.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.29 src/sys/arch/dreamcast/dev/g2/aica.c:1.30
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.29	Sat Feb  6 09:14:03 2021
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Tue Feb  9 12:39:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $	*/
+/*	$NetBSD: aica.c,v 1.30 2021/02/09 12:39:28 isaki Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.30 2021/02/09 12:39:28 isaki Exp $");
 
 #include 
 #include 
@@ -530,7 +530,7 @@ aica_intr(void *arg)
 
 	aica_fillbuffer(sc);
 
-	/* call audio interrupt handler (audio_pint()) */
+	/* call audio interrupt handler (audio_pintr()) */
 	if (sc->sc_intr != NULL) {
 		(*(sc->sc_intr))(sc->sc_intr_arg);
 	}



CVS commit: src/sys/arch/dreamcast/dev/g2

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 09:14:03 UTC 2021

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Remove sc_open flag.
Counting {open,close} is done by the MI audio layer.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/dreamcast/dev/g2/aica.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.28 src/sys/arch/dreamcast/dev/g2/aica.c:1.29
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.28	Sun Feb 23 04:02:45 2020
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sat Feb  6 09:14:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.28 2020/02/23 04:02:45 isaki Exp $	*/
+/*	$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.28 2020/02/23 04:02:45 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $");
 
 #include 
 #include 
@@ -63,7 +63,6 @@ struct aica_softc {
 	bus_space_handle_t	sc_aica_memh;
 
 	/* audio property */
-	int			sc_open;
 	int			sc_precision;
 	int			sc_channels;
 	int			sc_rate;
@@ -125,8 +124,6 @@ void aica_fillbuffer(struct aica_softc *
 int aica_intr(void *);
 
 /* for audio */
-int aica_open(void *, int);
-void aica_close(void *);
 int aica_query_format(void *, audio_format_query_t *);
 int aica_set_format(void *, int,
 const audio_params_t *, const audio_params_t *,
@@ -145,8 +142,6 @@ int aica_get_props(void *);
 void aica_get_locks(void *, kmutex_t **, kmutex_t **);
 
 const struct audio_hw_if aica_hw_if = {
-	.open			= aica_open,
-	.close			= aica_close,
 	.query_format		= aica_query_format,
 	.set_format		= aica_set_format,
 	.round_blocksize	= aica_round_blocksize,
@@ -389,31 +384,6 @@ aica_ch2p8write(struct aica_softc *sc, b
 }
 
 int
-aica_open(void *addr, int flags)
-{
-	struct aica_softc *sc;
-
-	sc = addr;
-	if (sc->sc_open)
-		return EBUSY;
-
-	sc->sc_intr = NULL;
-	sc->sc_open = 1;
-
-	return 0;
-}
-
-void
-aica_close(void *addr)
-{
-	struct aica_softc *sc;
-
-	sc = addr;
-	sc->sc_open = 0;
-	sc->sc_intr = NULL;
-}
-
-int
 aica_query_format(void *addr, audio_format_query_t *afp)
 {
 
@@ -561,7 +531,7 @@ aica_intr(void *arg)
 	aica_fillbuffer(sc);
 
 	/* call audio interrupt handler (audio_pint()) */
-	if (sc->sc_open && sc->sc_intr != NULL) {
+	if (sc->sc_intr != NULL) {
 		(*(sc->sc_intr))(sc->sc_intr_arg);
 	}
 
@@ -610,6 +580,7 @@ aica_halt_output(void *addr)
 
 	sc = addr;
 	aica_command(sc, AICA_COMMAND_STOP);
+	sc->sc_intr = NULL;
 	return 0;
 }
 



CVS commit: src/sys/arch/dreamcast/dev/g2

2018-03-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  3 23:27:51 UTC 2018

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
this ain't python, thanks gcc6.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/dreamcast/dev/g2/aica.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.23 src/sys/arch/dreamcast/dev/g2/aica.c:1.24
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.23	Tue Jul 25 19:18:04 2017
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sat Mar  3 18:27:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $	*/
+/*	$NetBSD: aica.c,v 1.24 2018/03/03 23:27:51 christos Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.24 2018/03/03 23:27:51 christos Exp $");
 
 #include 
 #include 
@@ -414,8 +414,9 @@ aica_ch2p8write(struct aica_softc *sc, b
 
 	if (len) {
 		p = (uint8_t *)buf;
-		for (i = 0; i < len; i++)
+		for (i = 0; i < len; i++) {
 			*p++ = *src++; src++;
+		}
 
 		aica_g2fifo_wait();
 		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh,



CVS commit: src/sys/arch/dreamcast/dev/g2

2017-07-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jul 25 23:18:04 UTC 2017

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Dreamcast audio only supports playback so set it in the props.
This makes dreamcast audio work again.

Tested by Bjorn Johannesson.
cvs: --


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/dreamcast/dev/g2/aica.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.22 src/sys/arch/dreamcast/dev/g2/aica.c:1.23
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.22	Wed Nov 23 23:07:29 2011
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Tue Jul 25 23:18:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.22 2011/11/23 23:07:29 jmcneill Exp $	*/
+/*	$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.22 2011/11/23 23:07:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $");
 
 #include 
 #include 
@@ -774,7 +774,7 @@ int
 aica_get_props(void *addr)
 {
 
-	return 0;
+	return AUDIO_PROP_PLAYBACK;
 }
 
 void



CVS commit: src/sys/arch/dreamcast/dev/g2

2016-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  9 14:41:47 UTC 2016

Modified Files:
src/sys/arch/dreamcast/dev/g2: g2rtc.c

Log Message:
PR/51540: Henning Petersen: replace , with ;


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/dreamcast/dev/g2/g2rtc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/g2rtc.c
diff -u src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.7 src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.8
--- src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.7	Sun Nov 16 21:15:48 2014
+++ src/sys/arch/dreamcast/dev/g2/g2rtc.c	Sun Oct  9 10:41:47 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: g2rtc.c,v 1.7 2014/11/17 02:15:48 christos Exp $ */
+/* $NetBSD: g2rtc.c,v 1.8 2016/10/09 14:41:47 christos Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: g2rtc.c,v 1.7 2014/11/17 02:15:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: g2rtc.c,v 1.8 2016/10/09 14:41:47 christos Exp $");
 
 #include 
 #include 
@@ -99,8 +99,8 @@ g2rtc_attach(device_t parent, device_t s
 
 	tch = &sc->sc_tch;
 	tch->cookie = sc;
-	tch->todr_gettime = g2rtc_todr_gettime,
-	tch->todr_settime = g2rtc_todr_settime,
+	tch->todr_gettime = g2rtc_todr_gettime;
+	tch->todr_settime = g2rtc_todr_settime;
 	todr_attach(tch);
 }
 



CVS commit: src/sys/arch/dreamcast/dev/g2

2014-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 31 13:12:55 UTC 2014

Modified Files:
src/sys/arch/dreamcast/dev/g2: gapspci_pci.c

Log Message:
make a copy of the interrupt string in buf.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/gapspci_pci.c
diff -u src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.14 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.15
--- src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.14	Mon Mar 31 08:38:40 2014
+++ src/sys/arch/dreamcast/dev/g2/gapspci_pci.c	Mon Mar 31 09:12:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $	*/
+/*	$NetBSD: gapspci_pci.c,v 1.15 2014/03/31 13:12:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -38,7 +38,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.15 2014/03/31 13:12:55 christos Exp $");
 
 #include 
 #include 
@@ -201,7 +201,8 @@ gaps_intr_string(void *v, pci_intr_handl
 char *buf, size_t len)
 {
 
-	return sysasic_intr_string(SYSASIC_IRL11);
+	strlcpy(buf, sysasic_intr_string(SYSASIC_IRL11), len);
+	return buf;
 }
 
 void *



CVS commit: src/sys/arch/dreamcast/dev/g2

2014-03-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 31 12:38:41 UTC 2014

Modified Files:
src/sys/arch/dreamcast/dev/g2: gapspci_pci.c

Log Message:
Adapt intr_string signature


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/gapspci_pci.c
diff -u src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.13 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.14
--- src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.13	Tue Jul 19 15:52:30 2011
+++ src/sys/arch/dreamcast/dev/g2/gapspci_pci.c	Mon Mar 31 12:38:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gapspci_pci.c,v 1.13 2011/07/19 15:52:30 dyoung Exp $	*/
+/*	$NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -38,7 +38,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.13 2011/07/19 15:52:30 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $");
 
 #include 
 #include 
@@ -63,7 +63,8 @@ pcireg_t	gaps_conf_read(void *, pcitag_t
 void		gaps_conf_write(void *, pcitag_t, int, pcireg_t);
 
 int		gaps_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
-const char	*gaps_intr_string(void *, pci_intr_handle_t);
+const char	*gaps_intr_string(void *, pci_intr_handle_t,
+		char *buf, size_t len);
 void		*gaps_intr_establish(void *, pci_intr_handle_t,
 		int, int (*)(void *), void *);
 void		gaps_intr_disestablish(void *, void *);
@@ -196,7 +197,8 @@ gaps_intr_map(struct pci_attach_args *pa
 }
 
 const char *
-gaps_intr_string(void *v, pci_intr_handle_t ih)
+gaps_intr_string(void *v, pci_intr_handle_t ih,
+char *buf, size_t len)
 {
 
 	return sysasic_intr_string(SYSASIC_IRL11);



CVS commit: src/sys/arch/dreamcast/dev/g2

2010-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Nov 21 16:11:32 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c g2bus.c g2busvar.h gapspci.c
gapspci_pci.c gapspcivar.h

Log Message:
Split softc/device_t.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/dreamcast/dev/g2/aica.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/dreamcast/dev/g2/g2bus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/dreamcast/dev/g2/g2busvar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/dreamcast/dev/g2/gapspci.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/dreamcast/dev/g2/gapspcivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.19 src/sys/arch/dreamcast/dev/g2/aica.c:1.20
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.19	Sat Nov 20 16:12:23 2010
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sun Nov 21 16:11:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $	*/
+/*	$NetBSD: aica.c,v 1.20 2010/11/21 16:11:32 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.20 2010/11/21 16:11:32 tsutsui Exp $");
 
 #include 
 #include 
@@ -56,7 +56,7 @@
 #define	AICA_TIMEOUT	0x1800
 
 struct aica_softc {
-	struct device		sc_dev;		/* base device */
+	device_t		sc_dev;		/* base device */
 	bus_space_tag_t		sc_memt;
 	bus_space_handle_t	sc_aica_regh;
 	bus_space_handle_t	sc_aica_memh;
@@ -113,11 +113,11 @@
 	 2, AUFMT_STEREO, 0, {1, 65536}},
 };
 
-int aica_match(struct device *, struct cfdata *, void *);
-void aica_attach(struct device *, struct device *, void *);
+int aica_match(device_t, cfdata_t, void *);
+void aica_attach(device_t, device_t, void *);
 int aica_print(void *, const char *);
 
-CFATTACH_DECL(aica, sizeof(struct aica_softc), aica_match, aica_attach,
+CFATTACH_DECL_NEW(aica, sizeof(struct aica_softc), aica_match, aica_attach,
 NULL, NULL);
 
 const struct audio_device aica_device = {
@@ -194,7 +194,7 @@
 };
 
 int
-aica_match(struct device *parent, struct cfdata *cf, void *aux)
+aica_match(device_t parent, cfdata_t cf, void *aux)
 {
 	static int aica_matched = 0;
 
@@ -206,29 +206,30 @@
 }
 
 void
-aica_attach(struct device *parent, struct device *self, void *aux)
+aica_attach(device_t parent, device_t self, void *aux)
 {
 	struct aica_softc *sc;
 	struct g2bus_attach_args *ga;
 	int i;
 
-	sc = (struct aica_softc *)self;
+	sc = device_private(self);
 	ga = aux;
+	sc->sc_dev = self;
 	sc->sc_memt = ga->ga_memt;
 
 	if (bus_space_map(sc->sc_memt, AICA_REG_ADDR, 0x3000, 0,
 	&sc->sc_aica_regh) != 0) {
-		printf(": can't map AICA register space\n");
+		aprint_error(": can't map AICA register space\n");
 		return;
 	}
 
 	if (bus_space_map(sc->sc_memt, AICA_RAM_START, AICA_RAM_SIZE, 0,
 	&sc->sc_aica_memh) != 0) {
-		printf(": can't map AICA memory space\n");
+		aprint_error(": can't map AICA memory space\n");
 		return;
 	}
 
-	printf(": ARM7 Sound Processing Unit\n");
+	aprint_normal(": ARM7 Sound Processing Unit\n");
 
 	aica_disable(sc);
 
@@ -245,12 +246,12 @@
 
 	aica_enable(sc);
 
-	printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname,
+	aprint_normal_dev(self, "interrupting at %s\n",
 	sysasic_intr_string(SYSASIC_IRL9));
 	sysasic_intr_establish(SYSASIC_EVENT_AICA, IPL_BIO, SYSASIC_IRL9,
 	aica_intr, sc);
 
-	audio_attach_mi(&aica_hw_if, sc, &sc->sc_dev);
+	audio_attach_mi(&aica_hw_if, sc, self);
 
 	/* init parameters */
 	sc->sc_output_master = 255;

Index: src/sys/arch/dreamcast/dev/g2/g2bus.c
diff -u src/sys/arch/dreamcast/dev/g2/g2bus.c:1.13 src/sys/arch/dreamcast/dev/g2/g2bus.c:1.14
--- src/sys/arch/dreamcast/dev/g2/g2bus.c:1.13	Mon Aug  7 17:36:53 2006
+++ src/sys/arch/dreamcast/dev/g2/g2bus.c	Sun Nov 21 16:11:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: g2bus.c,v 1.13 2006/08/07 17:36:53 tsutsui Exp $	*/
+/*	$NetBSD: g2bus.c,v 1.14 2010/11/21 16:11:32 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -34,7 +34,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: g2bus.c,v 1.13 2006/08/07 17:36:53 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: g2bus.c,v 1.14 2010/11/21 16:11:32 tsutsui Exp $");
 
 #include 
 #include 
@@ -46,29 +46,29 @@
 
 #include 
 
-int	g2busmatch(struct device *, struct cfdata *, void *);
-void	g2busattach(struct device *, struct device *, void *);
+int	g2busmatch(device_t, cfdata_t, void *);
+void	g2busattach(device_t, device_t, void *);
 int	g2busprint(void *, const char *);
 
-CFATTACH_DECL(g2bus, sizeof(struct g2bus_softc),
+CFATTACH_DECL_NEW(g2bus, sizeof(struct g2bus_softc),
 g2busmatch, g2busattach, NULL, NULL);
 
-int	g2bussearch(struct device *, struct cfdata *,
-		const int *

CVS commit: src/sys/arch/dreamcast/dev/g2

2010-11-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov 20 16:12:24 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Make aica_round_blocksize() always return a fixed buffer size.

I'm not sure if this is correct, but audio playback doesn't work
on dreamcast without this workaround. (since kent-audio1 merge?)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/dreamcast/dev/g2/aica.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.18 src/sys/arch/dreamcast/dev/g2/aica.c:1.19
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.18	Fri Aug  1 20:19:49 2008
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sat Nov 20 16:12:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.18 2008/08/01 20:19:49 marcus Exp $	*/
+/*	$NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.18 2008/08/01 20:19:49 marcus Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $");
 
 #include 
 #include 
@@ -479,6 +479,7 @@
 int
 aica_round_blocksize(void *addr, int blk, int mode, const audio_params_t *param)
 {
+#if 0	/* XXX this has not worked since kent-audio1 merge? */
 	struct aica_softc *sc;
 
 	sc = addr;
@@ -505,6 +506,7 @@
 		break;
 	}
 
+#endif
 	return AICA_DMABUF_SIZE / 4;
 }
 



CVS commit: src/sys/arch/dreamcast/dev/g2

2010-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Sep  1 17:06:00 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/g2: g2rtc.c

Log Message:
- split device_t/softc
- allocate struct todr_chip_handle in per-device softc
- some cosmetics


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/dreamcast/dev/g2/g2rtc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/g2rtc.c
diff -u src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.4 src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.5
--- src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.4	Sat Dec 12 14:44:09 2009
+++ src/sys/arch/dreamcast/dev/g2/g2rtc.c	Wed Sep  1 17:06:00 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: g2rtc.c,v 1.4 2009/12/12 14:44:09 tsutsui Exp $ */
+/* $NetBSD: g2rtc.c,v 1.5 2010/09/01 17:06:00 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: g2rtc.c,v 1.4 2009/12/12 14:44:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: g2rtc.c,v 1.5 2010/09/01 17:06:00 tsutsui Exp $");
 
 #include 
 #include 
@@ -46,36 +46,30 @@
 #define G2RTC_OFFSET	(20 * SECYR + 5 * SECDAY)
 
 struct g2rtc_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 
 	bus_space_tag_t sc_bt;
 	bus_space_handle_t sc_bh;
+	struct todr_chip_handle sc_tch;
 };
 
 /* autoconf glue */
-static int g2rtc_match(struct device *, struct cfdata *, void *);
-static void g2rtc_attach(struct device *, struct device *, void *);
+static int g2rtc_match(device_t, cfdata_t, void *);
+static void g2rtc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(g2rtc, sizeof(struct g2rtc_softc),
-	  g2rtc_match, g2rtc_attach, NULL, NULL);
+CFATTACH_DECL_NEW(g2rtc, sizeof(struct g2rtc_softc),
+g2rtc_match, g2rtc_attach, NULL, NULL);
 
 
 /* todr(9) methods */
 static int g2rtc_todr_gettime(todr_chip_handle_t, struct timeval *);
 static int g2rtc_todr_settime(todr_chip_handle_t, struct timeval *);
 
-static struct todr_chip_handle g2rtc_todr_handle = {
-	.cookie   = NULL,	/* set on attach */
-	.todr_gettime = g2rtc_todr_gettime,
-	.todr_settime = g2rtc_todr_settime,
-};
-
-
 static inline uint32_t g2rtc_read(bus_space_tag_t, bus_space_handle_t);
 
 
 static int
-g2rtc_match(struct device *parent, struct cfdata *cf, void *aux)
+g2rtc_match(device_t parent, cfdata_t cf, void *aux)
 {
 	static int g2rtc_matched = 0;
 
@@ -88,22 +82,26 @@
 
 
 static void
-g2rtc_attach(struct device *parent, struct device *self, void *aux)
+g2rtc_attach(device_t parent, device_t self, void *aux)
 {
-	struct g2rtc_softc *sc = (void *)self;
+	struct g2rtc_softc *sc = device_private(self);
 	struct g2bus_attach_args *ga = aux;
+	todr_chip_handle_t tch;
 
+	sc->sc_dev = self;
 	sc->sc_bt = ga->ga_memt;
 	if (bus_space_map(sc->sc_bt, G2RTC_REG_BASE, G2RTC_REG_SIZE, 0,
-			  &sc->sc_bh) != 0)
-	{
+	&sc->sc_bh) != 0) {
 		printf(": unable to map registers\n");
 		return;
 	}
 	printf(": time-of-day clock\n");
 
-	g2rtc_todr_handle.cookie = sc;
-	todr_attach(&g2rtc_todr_handle);
+	tch = &sc->sc_tch;
+	tch->cookie = sc;
+	tch->todr_gettime = g2rtc_todr_gettime,
+	tch->todr_settime = g2rtc_todr_settime,
+	todr_attach(tch);
 }
 
 
@@ -112,7 +110,7 @@
 {
 	
 	return ((bus_space_read_4(bt, bh, 0) & 0x) << 16)
-		| (bus_space_read_4(bt, bh, 4) & 0x);
+	| (bus_space_read_4(bt, bh, 4) & 0x);
 }
 
 
@@ -173,5 +171,4 @@
 	}
 
 	return EIO;
-
 }