Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga Driver for the ALiENDESiGN Repulse board.



details:   https://anonhg.NetBSD.org/src/rev/2fad62556ac2
branches:  trunk
changeset: 514209:2fad62556ac2
user:      is <is%NetBSD.org@localhost>
date:      Sat Aug 25 21:15:44 2001 +0000

description:
Driver for the ALiENDESiGN Repulse board.
- only 8/16 bit precision supported
- no support for the Repulse special S/P-DIF I/O yet
- I think ac97.c needs some work.

diffstat:

 sys/arch/amiga/conf/GENERIC           |     7 +-
 sys/arch/amiga/conf/files.amiga       |     6 +-
 sys/arch/amiga/dev/repulse.c          |   981 +++++++++++
 sys/arch/amiga/dev/repulse_firmware.h |  2926 +++++++++++++++++++++++++++++++++
 4 files changed, 3917 insertions(+), 3 deletions(-)

diffs (truncated from 3963 to 300 lines):

diff -r e544adb2e10b -r 2fad62556ac2 sys/arch/amiga/conf/GENERIC
--- a/sys/arch/amiga/conf/GENERIC       Sat Aug 25 21:14:44 2001 +0000
+++ b/sys/arch/amiga/conf/GENERIC       Sat Aug 25 21:15:44 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERIC,v 1.160 2001/07/08 16:32:13 abs Exp $
+#      $NetBSD: GENERIC,v 1.161 2001/08/25 21:15:46 is Exp $
 
 #
 #if 0
@@ -16,7 +16,7 @@
 
 include "arch/amiga/conf/std.amiga"
 
-#ident                 "GENERIC-$Revision: 1.160 $"
+#ident                 "GENERIC-$Revision: 1.161 $"
 
 #ifdef INSTALL_CONFIGURATION
 makeoptions    COPTS="-Os"
@@ -358,6 +358,9 @@
 audio*         at melody?
 #endif
 
+repulse*       at zbus0                # ALiENDESiGN Repulse
+audio*         at repulse?
+
 # Ethernet cards:
 le*            at zbus0                # A2065, Ameristar, Ariadne
 ne*            at zbus0                # AriadneII, X-surf
diff -r e544adb2e10b -r 2fad62556ac2 sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga   Sat Aug 25 21:14:44 2001 +0000
+++ b/sys/arch/amiga/conf/files.amiga   Sat Aug 25 21:15:44 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amiga,v 1.108 2001/06/18 02:00:48 christos Exp $
+#      $NetBSD: files.amiga,v 1.109 2001/08/25 21:15:45 is Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16                       # NOTE THAT AMIGA IS SPECIAL!
@@ -97,6 +97,10 @@
 attach melody at zbus
 file   arch/amiga/dev/melody.c         melody
 
+device repulse: audio, ac97, mulaw
+attach repulse at zbus
+file   arch/amiga/dev/repulse.c        repulse
+
 # mouse
 device ms: event
 attach ms at mainbus
diff -r e544adb2e10b -r 2fad62556ac2 sys/arch/amiga/dev/repulse.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/dev/repulse.c      Sat Aug 25 21:15:44 2001 +0000
@@ -0,0 +1,981 @@
+/* $NetBSD: repulse.c,v 1.1 2001/08/25 21:15:44 is Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Ignatios Souvatzis.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *       This product includes software developed by the NetBSD
+ *       Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h> 
+#include <sys/fcntl.h>         /* FREAD */
+
+#include <machine/bus.h>
+
+#include <sys/audioio.h>
+#include <dev/audio_if.h>
+#include <dev/mulaw.h>
+ 
+#include <dev/ic/ac97reg.h>
+#include <dev/ic/ac97var.h>
+
+#include <amiga/dev/zbusvar.h>
+#include <amiga/amiga/isr.h>
+
+#include <amiga/dev/repulse_firmware.h>
+
+#ifndef vu_int8_t
+#define vu_int8_t volatile u_int8_t
+#endif
+#ifndef vu_int16_t
+#define vu_int16_t volatile u_int16_t
+#endif
+#ifndef vu_int32_t
+#define vu_int32_t volatile u_int32_t
+#endif
+
+/* ac97 attachment functions */
+
+int repac_attach(void *, struct ac97_codec_if *);
+int repac_read(void *, u_int8_t, u_int16_t *);
+int repac_write(void *, u_int8_t, u_int16_t);
+void repac_reset(void *);
+enum ac97_host_flag repac_flags(void *);
+
+/* audio attachment functions */
+
+int rep_open(void *, int);
+void rep_close(void *);
+int rep_getdev(void *, struct audio_device *);
+int rep_get_props(void *);
+int rep_halt_output(void *);
+int rep_halt_input(void *);
+int rep_query_encoding(void *, struct audio_encoding *);
+int rep_set_params(void *, int, int, struct audio_params *,
+    struct audio_params *);
+int rep_round_blocksize(void *, int);
+int rep_set_port(void *, mixer_ctrl_t *);
+int rep_get_port(void *, mixer_ctrl_t *);
+int rep_query_devinfo(void *, mixer_devinfo_t *);
+size_t rep_round_buffersize(void *, int, size_t);
+
+int rep_start_input(void *, void *, int, void (*)(void *), void *);
+int rep_start_output(void *, void *, int, void (*)(void *), void *);
+
+int rep_intr(void *tag);
+
+
+/* audio attachment */
+
+struct audio_hw_if rep_hw_if = {
+       rep_open,
+       rep_close,
+       /* drain */ 0,
+       rep_query_encoding,
+       rep_set_params,
+       rep_round_blocksize,
+       /* commit_setting */ 0,
+       /* init_output */ 0,
+       /* init_input */ 0,
+       rep_start_output,
+       rep_start_input,
+       rep_halt_output,
+       rep_halt_input,
+       /* speaker_ctl */ 0,
+       rep_getdev,
+       /* getfd */ 0,
+       rep_set_port,
+       rep_get_port,
+       rep_query_devinfo,
+       /* allocm */ 0,
+       /* freem */ 0,
+       rep_round_buffersize,
+       /* mappage */ 0,
+       rep_get_props,
+       /* trigger_output */ 0,
+       /* trigger_input */ 0,
+
+};
+
+/* hardware registers */
+
+struct repulse_hw {
+       vu_int16_t      rhw_status;
+       vu_int16_t      rhw_fifostatus;         /* 0xrrrrpppp0000flag */
+       vu_int16_t      rhw_reg_address;
+       vu_int16_t      rhw_reg_data;
+/* 0x08 */
+       vu_int16_t      rhw_fifo_lh;
+       vu_int16_t      rhw_fifo_ll;
+       vu_int16_t      rhw_fifo_rh;
+       vu_int16_t      rhw_fifo_rl;
+/* 0x10 */
+       vu_int16_t      rhw_fifo_pack;
+       vu_int16_t      rhw_play_fifosz;
+       vu_int32_t      rhw_spdifin_stat;
+#define        rhw_spdifout_stat rhw_spdifin_stat;
+
+/* 0x18 */
+       vu_int16_t      rhw_capt_fifosz;
+       vu_int16_t      rhw_version;
+       vu_int16_t      rhw_dummy1;
+       vu_int8_t       rhw_firmwareload;
+/* 0x1F */
+       vu_int8_t       rhw_dummy2[66 - 31];
+/* 0x42 */
+       vu_int16_t      rhw_reset;
+} /* __attribute__((packed)) */;
+
+#define REPSTATUS_PLAY         0x0001
+#define REPSTATUS_RECORD       0x0002
+#define REPSTATUS_PLAYFIFORST  0x0004
+#define REPSTATUS_RECFIFORST   0x0008
+
+#define REPSTATUS_REGSENDBUSY  0x0010
+#define REPSTATUS_LOOPBACK     0x0020
+#define REPSTATUS_ENSPDIFIN    0x0040
+#define REPSTATUS_ENSPDIFOUT   0x0080
+
+#define REPSTATUS_CODECRESET   0x0200
+#define REPSTATUS_SPDIFOUT24   0x0400
+#define REPSTATUS_SPDIFIN24    0x0800
+
+#define REPSTATUS_RECIRQENABLE 0x1000
+#define REPSTATUS_RECIRQACK    0x2000
+#define REPSTATUS_PLAYIRQENABLE        0x4000
+#define REPSTATUS_PLAYIRQACK   0x8000
+
+#define REPFIFO_PLAYFIFOFULL   0x0001
+#define REPFIFO_PLAYFIFOEMPTY  0x0002
+#define REPFIFO_RECFIFOFULL    0x0004
+#define REPFIFO_RECFIFOEMPTY   0x0008
+#define REPFIFO_PLAYFIFOGAUGE(x) ((x << 4) & 0xf000)
+#define REPFIFO_RECFIFOGAUGE(x)                (x & 0xf000)
+
+/* ac97 data stream transfer functions */
+void rep_read_16_stereo(struct repulse_hw *, u_int8_t *, int, unsigned);
+void rep_read_16_mono(struct repulse_hw *, u_int8_t *, int, unsigned);
+void rep_write_16_stereo(struct repulse_hw *, u_int8_t *, int, unsigned);
+void rep_write_16_mono(struct repulse_hw *, u_int8_t *, int, unsigned);
+void rep_read_8_stereo(struct repulse_hw *, u_int8_t *, int, unsigned);
+void rep_read_8_mono(struct repulse_hw *, u_int8_t *, int, unsigned);
+void rep_write_8_stereo(struct repulse_hw *, u_int8_t *, int, unsigned);
+void rep_write_8_mono(struct repulse_hw *, u_int8_t *, int, unsigned);
+
+/* AmigaDOS Delay() ticks */
+
+#define USECPERTICK    (1000000/50)
+
+/* NetBSD device attachment */
+
+struct repulse_softc {
+       struct device           sc_dev;
+       struct isr              sc_isr;
+       struct ac97_host_if     sc_achost;
+       struct ac97_codec_if    *sc_codec_if;
+
+       struct repulse_hw       *sc_boardp;
+
+       void    (*sc_captmore)(void *);
+       void     *sc_captarg;
+
+       void    (*sc_captfun)(struct repulse_hw *, u_int8_t *, int, unsigned);
+       void     *sc_captbuf;
+       int       sc_captscale;
+       int       sc_captbufsz;
+       unsigned  sc_captflags;
+
+
+       void    (*sc_playmore)(void *);
+       void     *sc_playarg;
+       void    (*sc_playfun)(struct repulse_hw *, u_int8_t *, int, unsigned);
+       int       sc_playscale;
+       unsigned  sc_playflags;
+
+};
+
+int repulse_match (struct device *, struct cfdata *, void *);
+void repulse_attach (struct device *, struct device *, void *);
+
+struct cfattach repulse_ca = {
+       sizeof(struct repulse_softc), repulse_match, repulse_attach
+};
+
+int
+repulse_match(struct device *parent, struct cfdata *cfp, void *aux) {
+       struct zbus_args *zap;
+
+       zap = aux;
+
+       if (zap->manid != 0x4144)
+               return (0);
+
+       if (zap->prodid != 0)
+               return (0);



Home | Main Index | Thread Index | Old Index