1139749Simp/*-
2119853Scg * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
355639Scg * All rights reserved.
455639Scg *
555639Scg * Derived from the public domain Linux driver
655639Scg *
755639Scg * Redistribution and use in source and binary forms, with or without
855639Scg * modification, are permitted provided that the following conditions
955639Scg * are met:
1055639Scg * 1. Redistributions of source code must retain the above copyright
1155639Scg *    notice, this list of conditions and the following disclaimer.
1255639Scg * 2. Redistributions in binary form must reproduce the above copyright
1355639Scg *    notice, this list of conditions and the following disclaimer in the
1455639Scg *    documentation and/or other materials provided with the distribution.
1555639Scg *
1655639Scg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1755639Scg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1855639Scg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1955639Scg * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2055639Scg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2155639Scg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2255639Scg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2355639Scg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
2455639Scg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2555639Scg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
2655639Scg * SUCH DAMAGE.
2755639Scg *
2855639Scg * $FreeBSD$
2955639Scg */
3055639Scg
3155639Scg#ifndef _NM256_H_
3255639Scg#define _NM256_H_
3355639Scg
3455639Scg/* The BIOS signature. */
3555639Scg#define NM_SIGNATURE 0x4e4d0000
3655639Scg/* Signature mask. */
3755639Scg#define NM_SIG_MASK 0xffff0000
3855639Scg
3955639Scg/* Size of the second memory area. */
4055639Scg#define NM_PORT2_SIZE 4096
4155639Scg
4255639Scg/* The base offset of the mixer in the second memory area. */
4355639Scg#define NM_MIXER_OFFSET 0x600
4455639Scg
4575382Sgreid/* The base offset for the AC97 test */
4675382Sgreid#define NM_MIXER_PRESENCE 0xa06
4775382Sgreid#define NM_PRESENCE_MASK  0x050
4875382Sgreid#define NM_PRESENCE_VALUE 0x040
4975382Sgreid
5055639Scg/* The maximum size of a coefficient entry. */
5155639Scg#define NM_MAX_COEFFICIENT 0x5000
5255639Scg
5355639Scg/* The interrupt register. */
5455639Scg#define NM_INT_REG 0xa04
5555639Scg/* And its bits. */
5655639Scg#define NM_PLAYBACK_INT 0x40
5755639Scg#define NM_RECORD_INT 0x100
5855639Scg#define NM_MISC_INT_1 0x4000
5955639Scg#define NM_MISC_INT_2 0x1
6055639Scg
6155639Scg/* The AV's "mixer ready" status bit and location. */
6255639Scg#define NM_MIXER_STATUS_OFFSET 0xa04
6355639Scg#define NM_MIXER_READY_MASK 0x0800
6455639Scg
6555639Scg/*
6655639Scg * For the ZX.  It uses the same interrupt register, but it holds 32
6755639Scg * bits instead of 16.
6855639Scg */
6955639Scg#define NM2_PLAYBACK_INT 0x10000
7055639Scg#define NM2_RECORD_INT 0x80000
7155639Scg#define NM2_MISC_INT_1 0x8
7255639Scg#define NM2_MISC_INT_2 0x2
7355639Scg
7455639Scg/* The ZX's "mixer ready" status bit and location. */
7555639Scg#define NM2_MIXER_STATUS_OFFSET 0xa06
7655639Scg#define NM2_MIXER_READY_MASK 0x0800
7755639Scg
7855639Scg/* The playback registers start from here. */
7955639Scg#define NM_PLAYBACK_REG_OFFSET 0x0
8055639Scg/* The record registers start from here. */
8155639Scg#define NM_RECORD_REG_OFFSET 0x200
8255639Scg
8355639Scg/* The rate register is located 2 bytes from the start of the register area. */
8455639Scg#define NM_RATE_REG_OFFSET 2
8555639Scg
8655639Scg/* Mono/stereo flag, number of bits on playback, and rate mask. */
8755639Scg#define NM_RATE_STEREO 1
8855639Scg#define NM_RATE_BITS_16 2
8955639Scg#define NM_RATE_MASK 0xf0
9055639Scg
9155639Scg/* Playback enable register. */
9255639Scg#define NM_PLAYBACK_ENABLE_REG (NM_PLAYBACK_REG_OFFSET + 0x1)
9355639Scg#define NM_PLAYBACK_ENABLE_FLAG 1
9455639Scg#define NM_PLAYBACK_ONESHOT 2
9555639Scg#define NM_PLAYBACK_FREERUN 4
9655639Scg
9755639Scg/* Mutes the audio output. */
9855639Scg#define NM_AUDIO_MUTE_REG (NM_PLAYBACK_REG_OFFSET + 0x18)
9955639Scg#define NM_AUDIO_MUTE_LEFT 0x8000
10055639Scg#define NM_AUDIO_MUTE_RIGHT 0x0080
10155639Scg#define NM_AUDIO_MUTE_BOTH 0x8080
10255639Scg
10355639Scg/* Recording enable register. */
10455639Scg#define NM_RECORD_ENABLE_REG (NM_RECORD_REG_OFFSET + 0)
10555639Scg#define NM_RECORD_ENABLE_FLAG 1
10655639Scg#define NM_RECORD_FREERUN 2
10755639Scg
10855639Scg#define NM_RBUFFER_START (NM_RECORD_REG_OFFSET + 0x4)
10955639Scg#define NM_RBUFFER_END   (NM_RECORD_REG_OFFSET + 0x10)
11055639Scg#define NM_RBUFFER_WMARK (NM_RECORD_REG_OFFSET + 0xc)
11155639Scg#define NM_RBUFFER_CURRP (NM_RECORD_REG_OFFSET + 0x8)
11255639Scg
11355639Scg#define NM_PBUFFER_START (NM_PLAYBACK_REG_OFFSET + 0x4)
11455639Scg#define NM_PBUFFER_END   (NM_PLAYBACK_REG_OFFSET + 0x14)
11555639Scg#define NM_PBUFFER_WMARK (NM_PLAYBACK_REG_OFFSET + 0xc)
11655639Scg#define NM_PBUFFER_CURRP (NM_PLAYBACK_REG_OFFSET + 0x8)
11755639Scg
11855639Scg
11955639Scg#endif
120