Module Name:    src
Committed By:   isaki
Date:           Sun May  5 05:59:40 UTC 2019

Modified Files:
        src/sys/dev/pci [isaki-audio2]: cs4280.c cs4280reg.h cs428x.h

Log Message:
Remove encoding conversions on recording.
These are handled in the upper layer now.


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.2 -r1.71.2.3 src/sys/dev/pci/cs4280.c
cvs rdiff -u -r1.7 -r1.7.156.1 src/sys/dev/pci/cs4280reg.h
cvs rdiff -u -r1.16.42.1 -r1.16.42.2 src/sys/dev/pci/cs428x.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/dev/pci/cs4280.c
diff -u src/sys/dev/pci/cs4280.c:1.71.2.2 src/sys/dev/pci/cs4280.c:1.71.2.3
--- src/sys/dev/pci/cs4280.c:1.71.2.2	Sat May  4 07:20:10 2019
+++ src/sys/dev/pci/cs4280.c	Sun May  5 05:59:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4280.c,v 1.71.2.2 2019/05/04 07:20:10 isaki Exp $	*/
+/*	$NetBSD: cs4280.c,v 1.71.2.3 2019/05/05 05:59:40 isaki Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Tatoku Ogaito.  All rights reserved.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71.2.2 2019/05/04 07:20:10 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71.2.3 2019/05/05 05:59:40 isaki Exp $");
 
 #include "midi.h"
 
@@ -450,9 +450,6 @@ cs4280_intr(void *p)
 	}
 	/* Capture Interrupt */
 	if (intr & HISR_CINT) {
-		int  i;
-		int16_t rdata;
-
 		handled = 1;
 		mem = BA1READ4(sc, CS4280_CIE);
 		BA1WRITE4(sc, CS4280_CIE, (mem & ~CIE_CI_MASK) | CIE_CI_DISABLE);
@@ -463,53 +460,9 @@ cs4280_intr(void *p)
 			if ((sc->sc_ri&1) == 0)
 				empty_dma += sc->hw_blocksize;
 
-			/*
-			 * XXX
-			 * I think this audio data conversion should be
-			 * happend in upper layer, but I put this here
-			 * since there is no conversion function available.
-			 */
-			switch(sc->sc_rparam) {
-			case CF_16BIT_STEREO:
-				/* just copy it */
-				memcpy(sc->sc_rn, empty_dma, sc->hw_blocksize);
-				sc->sc_rn += sc->hw_blocksize;
-				break;
-			case CF_16BIT_MONO:
-				for (i = 0; i < 512; i++) {
-					rdata  = *((int16_t *)empty_dma)>>1;
-					empty_dma += 2;
-					rdata += *((int16_t *)empty_dma)>>1;
-					empty_dma += 2;
-					*((int16_t *)sc->sc_rn) = rdata;
-					sc->sc_rn += 2;
-				}
-				break;
-			case CF_8BIT_STEREO:
-				for (i = 0; i < 512; i++) {
-					rdata = *((int16_t*)empty_dma);
-					empty_dma += 2;
-					*sc->sc_rn++ = rdata >> 8;
-					rdata = *((int16_t*)empty_dma);
-					empty_dma += 2;
-					*sc->sc_rn++ = rdata >> 8;
-				}
-				break;
-			case CF_8BIT_MONO:
-				for (i = 0; i < 512; i++) {
-					rdata =	 *((int16_t*)empty_dma) >>1;
-					empty_dma += 2;
-					rdata += *((int16_t*)empty_dma) >>1;
-					empty_dma += 2;
-					*sc->sc_rn++ = rdata >>8;
-				}
-				break;
-			default:
-				/* Should not reach here */
-				aprint_error_dev(sc->sc_dev,
-				    "unknown sc->sc_rparam: %d\n",
-				    sc->sc_rparam);
-			}
+			/* just copy it */
+			memcpy(sc->sc_rn, empty_dma, sc->hw_blocksize);
+			sc->sc_rn += sc->hw_blocksize;
 			if (sc->sc_rn >= sc->sc_re)
 				sc->sc_rn = sc->sc_rs;
 		}
@@ -752,17 +705,6 @@ cs4280_trigger_input(void *addr, void *s
 	/* initiate capture DMA */
 	BA1WRITE4(sc, CS4280_CBA, DMAADDR(p));
 
-	/* setup format information for internal converter */
-	sc->sc_rparam = 0;
-	if (param->precision == 8) {
-		sc->sc_rparam += CF_8BIT;
-		sc->sc_rcount <<= 1;
-	}
-	if (param->channels  == 1) {
-		sc->sc_rparam += CF_MONO;
-		sc->sc_rcount <<= 1;
-	}
-
 	/* set CIE */
 	cie = BA1READ4(sc, CS4280_CIE) & ~CIE_CI_MASK;
 	BA1WRITE4(sc, CS4280_CIE, cie | CIE_CI_ENABLE);

Index: src/sys/dev/pci/cs4280reg.h
diff -u src/sys/dev/pci/cs4280reg.h:1.7 src/sys/dev/pci/cs4280reg.h:1.7.156.1
--- src/sys/dev/pci/cs4280reg.h:1.7	Sat Apr 15 21:20:47 2006
+++ src/sys/dev/pci/cs4280reg.h	Sun May  5 05:59:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4280reg.h,v 1.7 2006/04/15 21:20:47 jmcneill Exp $	*/
+/*	$NetBSD: cs4280reg.h,v 1.7.156.1 2019/05/05 05:59:40 isaki Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Tatoku Ogaito.  All rights reserved.
@@ -217,14 +217,6 @@
 #define	 FRMT_FTV	  0x00000adf
 
 
-#define CF_MONO		  0x01
-#define CF_8BIT		  0x02
-
-#define CF_16BIT_STEREO	  0x00
-#define CF_16BIT_MONO	  0x01
-#define CF_8BIT_STEREO	  0x02
-#define CF_8BIT_MONO	  0x03
-
 #define MIDI_BUSY_WAIT		100
 #define MIDI_BUSY_DELAY		100	/* Delay when UART is busy */
 

Index: src/sys/dev/pci/cs428x.h
diff -u src/sys/dev/pci/cs428x.h:1.16.42.1 src/sys/dev/pci/cs428x.h:1.16.42.2
--- src/sys/dev/pci/cs428x.h:1.16.42.1	Sun Apr 21 07:49:16 2019
+++ src/sys/dev/pci/cs428x.h	Sun May  5 05:59:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs428x.h,v 1.16.42.1 2019/04/21 07:49:16 isaki Exp $	*/
+/*	$NetBSD: cs428x.h,v 1.16.42.2 2019/05/05 05:59:40 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000 Tatoku Ogaito.  All rights reserved.
@@ -118,7 +118,6 @@ struct cs428x_softc {
 	int	sc_ri;
 	struct	cs428x_dma *sc_rdma;
 	char	*sc_rbuf;
-	int	sc_rparam;		/* record format */
 	int	(*halt_input)(void *);
 	char	sc_rrun;		/* recording status */
 	int	sc_rrate;		/* recording sample rate */

Reply via email to